@@ -365,6 +365,16 @@ bool MCScriptLookupModule(MCNameRef p_name, MCScriptModuleRef& r_module)
365365 return false ;
366366}
367367
368+ bool MCScriptIsModuleALibrary (MCScriptModuleRef self)
369+ {
370+ return self -> module_kind == kMCScriptModuleKindLibrary ;
371+ }
372+
373+ bool MCScriptIsModuleAWidget (MCScriptModuleRef self)
374+ {
375+ return self -> module_kind == kMCScriptModuleKindWidget ;
376+ }
377+
368378bool MCScriptEnsureModuleIsUsable (MCScriptModuleRef self)
369379{
370380 // If the module has already been ensured as usable, we are done.
@@ -382,8 +392,8 @@ bool MCScriptEnsureModuleIsUsable(MCScriptModuleRef self)
382392 if (!MCScriptLookupModule (self -> dependencies[i] . name, t_module))
383393 return false ;
384394
385- // A used module must be a library .
386- if (t_module -> module_kind != kMCScriptModuleKindLibrary )
395+ // A used module must not be a widget .
396+ if (t_module -> module_kind == kMCScriptModuleKindWidget )
387397 return false ;
388398
389399 // Check all the imported definitions from the module, and compute indicies.
@@ -718,6 +728,39 @@ bool MCScriptQueryEventOfModule(MCScriptModuleRef self, MCNameRef p_event, /* ge
718728 return true ;
719729}
720730
731+ bool MCScriptCopyHandlersOfModule (MCScriptModuleRef self, /* copy */ MCProperListRef& r_handler_names)
732+ {
733+ MCAutoProperListRef t_handlers;
734+ if (!MCProperListCreateMutable (&t_handlers))
735+ return false ;
736+
737+ for (uindex_t i = 0 ; i < self -> exported_definition_count; i++)
738+ if (self -> definitions[self -> exported_definitions[i] . index] -> kind == kMCScriptDefinitionKindHandler ||
739+ self -> definitions[self -> exported_definitions[i] . index] -> kind == kMCScriptDefinitionKindForeignHandler )
740+ if (!MCProperListPushElementOntoBack (*t_handlers, self -> exported_definitions[i] . name))
741+ return false ;
742+
743+ if (!MCProperListCopy (*t_handlers, r_handler_names))
744+ return false ;
745+
746+ return true ;
747+ }
748+
749+ bool MCScriptQueryHandlerOfModule (MCScriptModuleRef self, MCNameRef p_handler, /* get */ MCTypeInfoRef& r_signature)
750+ {
751+ MCScriptHandlerDefinition *t_def;
752+
753+ if (!self -> is_usable)
754+ return false ; // TODO - throw error
755+
756+ if (!MCScriptLookupHandlerDefinitionInModule (self, p_handler, t_def))
757+ return false ; // TODO - throw error
758+
759+ r_signature = self -> types[t_def -> type] -> typeinfo;
760+
761+ return true ;
762+ }
763+
721764// //////////////////////////////////////////////////////////////////////////////
722765
723766bool MCScriptWriteRawModule (MCStreamRef stream, MCScriptModule *p_module)
0 commit comments