Переглянути джерело

ncd: move initialization of modules from NCDInterpreter into NCDModuleIndex

ambrop7 13 роки тому
батько
коміт
10a594c625
5 змінених файлів з 138 додано та 85 видалено
  1. 6 60
      ncd/NCDInterpreter.c
  2. 13 3
      ncd/NCDMethodIndex.c
  3. 9 2
      ncd/NCDMethodIndex.h
  4. 100 18
      ncd/NCDModuleIndex.c
  5. 10 2
      ncd/NCDModuleIndex.h

+ 6 - 60
ncd/NCDInterpreter.c

@@ -82,7 +82,6 @@ struct process {
 
 
 static void start_terminate (NCDInterpreter *interp, int exit_code);
 static void start_terminate (NCDInterpreter *interp, int exit_code);
 static char * implode_id_strings (NCDInterpreter *interp, const NCD_string_id_t *names, size_t num_names, char del);
 static char * implode_id_strings (NCDInterpreter *interp, const NCD_string_id_t *names, size_t num_names, char del);
-static int alloc_base_type_strings (NCDInterpreter *interp, const struct NCDModuleGroup *g);
 static void clear_process_cache (NCDInterpreter *interp);
 static void clear_process_cache (NCDInterpreter *interp);
 static struct process * process_allocate (NCDInterpreter *interp, NCDInterpProcess *iprocess);
 static struct process * process_allocate (NCDInterpreter *interp, NCDInterpProcess *iprocess);
 static void process_release (struct process *p, int no_push);
 static void process_release (struct process *p, int no_push);
@@ -161,17 +160,6 @@ int NCDInterpreter_Init (NCDInterpreter *o, NCDProgram program, struct NCDInterp
         goto fail2;
         goto fail2;
     }
     }
     
     
-    // add module groups to index and allocate string id's for base_type's
-    for (const struct NCDModuleGroup **g = ncd_modules; *g; g++) {
-        if (!NCDModuleIndex_AddGroup(&o->mindex, *g)) {
-            BLog(BLOG_ERROR, "NCDModuleIndex_AddGroup failed");
-            goto fail3;
-        }
-        if (!alloc_base_type_strings(o, *g)) {
-            goto fail3;
-        }
-    }
-    
     // init pointers to global resources in out struct NCDModuleInst_iparams.
     // init pointers to global resources in out struct NCDModuleInst_iparams.
     // Don't initialize any callback at this point as these must not be called
     // Don't initialize any callback at this point as these must not be called
     // from globalinit functions of modules.
     // from globalinit functions of modules.
@@ -187,34 +175,24 @@ int NCDInterpreter_Init (NCDInterpreter *o, NCDProgram program, struct NCDInterp
 #endif
 #endif
     o->module_iparams.string_index = &o->string_index;
     o->module_iparams.string_index = &o->string_index;
     
     
-    // init modules
-    o->num_inited_modules = 0;
+    // add module groups to index and allocate string id's for base_type's
     for (const struct NCDModuleGroup **g = ncd_modules; *g; g++) {
     for (const struct NCDModuleGroup **g = ncd_modules; *g; g++) {
-        // map strings
-        if ((*g)->strings && !NCDStringIndex_GetRequests(&o->string_index, (*g)->strings)) {
-            BLog(BLOG_ERROR, "NCDStringIndex_GetRequests failed for some module");
-            goto fail4;
-        }
-        
-        // call func_globalinit
-        if ((*g)->func_globalinit && !(*g)->func_globalinit(&o->module_iparams)) {
-            BLog(BLOG_ERROR, "globalinit failed for some module");
-            goto fail4;
+        if (!NCDModuleIndex_AddGroup(&o->mindex, *g, &o->module_iparams, &o->string_index)) {
+            BLog(BLOG_ERROR, "NCDModuleIndex_AddGroup failed");
+            goto fail3;
         }
         }
-        
-        o->num_inited_modules++;
     }
     }
     
     
     // desugar
     // desugar
     if (!NCDSugar_Desugar(&o->program)) {
     if (!NCDSugar_Desugar(&o->program)) {
         BLog(BLOG_ERROR, "NCDSugar_Desugar failed");
         BLog(BLOG_ERROR, "NCDSugar_Desugar failed");
-        goto fail4;
+        goto fail3;
     }
     }
     
     
     // init placeholder database
     // init placeholder database
     if (!NCDPlaceholderDb_Init(&o->placeholder_db, &o->string_index)) {
     if (!NCDPlaceholderDb_Init(&o->placeholder_db, &o->string_index)) {
         BLog(BLOG_ERROR, "NCDPlaceholderDb_Init failed");
         BLog(BLOG_ERROR, "NCDPlaceholderDb_Init failed");
-        goto fail4;
+        goto fail3;
     }
     }
     
     
     // init interp program
     // init interp program
@@ -280,14 +258,6 @@ fail7:;
 fail5:
 fail5:
     // free placeholder database
     // free placeholder database
     NCDPlaceholderDb_Free(&o->placeholder_db);
     NCDPlaceholderDb_Free(&o->placeholder_db);
-fail4:
-    // free modules
-    while (o->num_inited_modules-- > 0) {
-        const struct NCDModuleGroup **g = &ncd_modules[o->num_inited_modules];
-        if ((*g)->func_globalfree) {
-            (*g)->func_globalfree();
-        }
-    }
 fail3:
 fail3:
     // free module index
     // free module index
     NCDModuleIndex_Free(&o->mindex);
     NCDModuleIndex_Free(&o->mindex);
@@ -324,14 +294,6 @@ void NCDInterpreter_Free (NCDInterpreter *o)
     // free placeholder database
     // free placeholder database
     NCDPlaceholderDb_Free(&o->placeholder_db);
     NCDPlaceholderDb_Free(&o->placeholder_db);
     
     
-    // free modules
-    while (o->num_inited_modules-- > 0) {
-        const struct NCDModuleGroup **g = &ncd_modules[o->num_inited_modules];
-        if ((*g)->func_globalfree) {
-            (*g)->func_globalfree();
-        }
-    }
-    
     // free module index
     // free module index
     NCDModuleIndex_Free(&o->mindex);
     NCDModuleIndex_Free(&o->mindex);
     
     
@@ -408,22 +370,6 @@ fail0:
     return NULL;
     return NULL;
 }
 }
 
 
-int alloc_base_type_strings (NCDInterpreter *interp, const struct NCDModuleGroup *g)
-{
-    for (struct NCDModule *m = g->modules; m->type; m++) {
-        const char *type = (m->base_type ? m->base_type : m->type);
-        ASSERT(type)
-        
-        m->base_type_id = NCDStringIndex_Get(&interp->string_index, type);
-        if (m->base_type_id < 0) {
-            BLog(BLOG_ERROR, "NCDStringIndex_Get failed");
-            return 0;
-        }
-    }
-    
-    return 1;
-}
-
 void clear_process_cache (NCDInterpreter *interp)
 void clear_process_cache (NCDInterpreter *interp)
 {
 {
     for (NCDProgramElem *elem = NCDProgram_FirstElem(&interp->program); elem; elem = NCDProgram_NextElem(&interp->program, elem)) {
     for (NCDProgramElem *elem = NCDProgram_FirstElem(&interp->program); elem; elem = NCDProgram_NextElem(&interp->program, elem)) {

+ 13 - 3
ncd/NCDMethodIndex.c

@@ -180,10 +180,10 @@ int NCDMethodIndex_AddMethod (NCDMethodIndex *o, const char *obj_type, const cha
         goto fail0;
         goto fail0;
     }
     }
     
     
+    int entry_idx;
     int first_entry_idx;
     int first_entry_idx;
     
     
     if (!find_method_name(o, method_name, &first_entry_idx)) {
     if (!find_method_name(o, method_name, &first_entry_idx)) {
-        int entry_idx;
         if (!add_method_name(o, method_name, &entry_idx)) {
         if (!add_method_name(o, method_name, &entry_idx)) {
             goto fail0;
             goto fail0;
         }
         }
@@ -204,6 +204,7 @@ int NCDMethodIndex_AddMethod (NCDMethodIndex *o, const char *obj_type, const cha
             goto fail0;
             goto fail0;
         }
         }
         
         
+        entry_idx = o->num_entries;
         struct NCDMethodIndex__entry *entry = &o->entries[o->num_entries];
         struct NCDMethodIndex__entry *entry = &o->entries[o->num_entries];
         
         
         entry->obj_type = obj_type_id;
         entry->obj_type = obj_type_id;
@@ -215,10 +216,19 @@ int NCDMethodIndex_AddMethod (NCDMethodIndex *o, const char *obj_type, const cha
         o->num_entries++;
         o->num_entries++;
     }
     }
     
     
-    return 1;
+    return entry_idx;
     
     
 fail0:
 fail0:
-    return 0;
+    return -1;
+}
+
+void NCDMethodIndex_RemoveMethod (NCDMethodIndex *o, int method_name_id)
+{
+    ASSERT(method_name_id >= 0)
+    ASSERT(method_name_id < o->num_entries)
+    ASSERT(o->entries[method_name_id].obj_type >= 0)
+    
+    o->entries[method_name_id].obj_type = -1;
 }
 }
 
 
 int NCDMethodIndex_GetMethodNameId (NCDMethodIndex *o, const char *method_name)
 int NCDMethodIndex_GetMethodNameId (NCDMethodIndex *o, const char *method_name)

+ 9 - 2
ncd/NCDMethodIndex.h

@@ -97,9 +97,16 @@ void NCDMethodIndex_Free (NCDMethodIndex *o);
  * @param method_name name of method, e.g. "meow" in "cat::meow".
  * @param method_name name of method, e.g. "meow" in "cat::meow".
  *                    Must not be NULL.
  *                    Must not be NULL.
  * @param module pointer to module structure. Must not be NULL.
  * @param module pointer to module structure. Must not be NULL.
- * @return 1 on success, 0 on failure
+ * @return on success, a non-negative identifier; on failure, -1
+ */
+int NCDMethodIndex_AddMethod (NCDMethodIndex *o, const char *obj_type, const char *method_name, const struct NCDModule *module);
+
+/**
+ * Removes a method from the index.
+ * 
+ * @param method_name_id method name identifier
  */
  */
-int NCDMethodIndex_AddMethod (NCDMethodIndex *o, const char *obj_type, const char *method_name, const struct NCDModule *module) WARN_UNUSED;
+void NCDMethodIndex_RemoveMethod (NCDMethodIndex *o, int method_name_id);
 
 
 /**
 /**
  * Obtains an internal integer identifier for a method name. The intention is that
  * Obtains an internal integer identifier for a method name. The intention is that

+ 100 - 18
ncd/NCDModuleIndex.c

@@ -75,11 +75,12 @@ static struct NCDModuleIndex_base_type * find_base_type (NCDModuleIndex *o, cons
     return bt;
     return bt;
 }
 }
 
 
-static int add_method (char *type, const struct NCDModule *module, NCDMethodIndex *method_index)
+static int add_method (char *type, const struct NCDModule *module, NCDMethodIndex *method_index, int *out_method_id)
 {
 {
     ASSERT(type)
     ASSERT(type)
     ASSERT(module)
     ASSERT(module)
     ASSERT(method_index)
     ASSERT(method_index)
+    ASSERT(out_method_id)
     
     
     const char search[] = "::";
     const char search[] = "::";
     size_t search_len = sizeof(search) - 1;
     size_t search_len = sizeof(search) - 1;
@@ -89,6 +90,7 @@ static int add_method (char *type, const struct NCDModule *module, NCDMethodInde
     
     
     size_t pos;
     size_t pos;
     if (!find_substring_reverse(type, strlen(type), search, search_len, table, &pos)) {
     if (!find_substring_reverse(type, strlen(type), search, search_len, table, &pos)) {
+        *out_method_id = -1;
         return 1;
         return 1;
     }
     }
     
     
@@ -98,14 +100,15 @@ static int add_method (char *type, const struct NCDModule *module, NCDMethodInde
     
     
     char save = type[pos];
     char save = type[pos];
     type[pos] = '\0';
     type[pos] = '\0';
-    int res = NCDMethodIndex_AddMethod(method_index, type, type + pos + search_len, module);
+    int method_id = NCDMethodIndex_AddMethod(method_index, type, type + pos + search_len, module);
     type[pos] = save;
     type[pos] = save;
     
     
-    if (!res) {
+    if (method_id < 0) {
         BLog(BLOG_ERROR, "NCDMethodIndex_AddMethod failed");
         BLog(BLOG_ERROR, "NCDMethodIndex_AddMethod failed");
         return 0;
         return 0;
     }
     }
     
     
+    *out_method_id = method_id;
     return 1;
     return 1;
 }
 }
 
 
@@ -131,6 +134,9 @@ int NCDModuleIndex_Init (NCDModuleIndex *o, NCDStringIndex *string_index)
     // init base types tree
     // init base types tree
     BAVL_Init(&o->base_types_tree, OFFSET_DIFF(struct NCDModuleIndex_base_type, base_type, base_types_tree_node), (BAVL_comparator)string_pointer_comparator, NULL);
     BAVL_Init(&o->base_types_tree, OFFSET_DIFF(struct NCDModuleIndex_base_type, base_type, base_types_tree_node), (BAVL_comparator)string_pointer_comparator, NULL);
     
     
+    // init groups list
+    LinkedList0_Init(&o->groups_list);
+    
     // init method index
     // init method index
     if (!NCDMethodIndex_Init(&o->method_index, string_index)) {
     if (!NCDMethodIndex_Init(&o->method_index, string_index)) {
         BLog(BLOG_ERROR, "NCDMethodIndex_Init failed");
         BLog(BLOG_ERROR, "NCDMethodIndex_Init failed");
@@ -152,6 +158,17 @@ void NCDModuleIndex_Free (NCDModuleIndex *o)
 {
 {
     DebugObject_Free(&o->d_obj);
     DebugObject_Free(&o->d_obj);
     
     
+    // free groups
+    LinkedList0Node *ln;
+    while (ln = LinkedList0_GetFirst(&o->groups_list)) {
+        struct NCDModuleIndex_group *ig = UPPER_OBJECT(ln, struct NCDModuleIndex_group, groups_list_node);
+        if (ig->group->func_globalfree) {
+            ig->group->func_globalfree();
+        }
+        LinkedList0_Remove(&o->groups_list, &ig->groups_list_node);
+        BFree(ig);
+    }
+    
     // free base types
     // free base types
     while (!BAVL_IsEmpty(&o->base_types_tree)) {
     while (!BAVL_IsEmpty(&o->base_types_tree)) {
         struct NCDModuleIndex_base_type *bt = UPPER_OBJECT(BAVL_GetFirst(&o->base_types_tree), struct NCDModuleIndex_base_type, base_types_tree_node);
         struct NCDModuleIndex_base_type *bt = UPPER_OBJECT(BAVL_GetFirst(&o->base_types_tree), struct NCDModuleIndex_base_type, base_types_tree_node);
@@ -169,12 +186,39 @@ void NCDModuleIndex_Free (NCDModuleIndex *o)
     BFree(o->modules);
     BFree(o->modules);
 }
 }
 
 
-int NCDModuleIndex_AddGroup (NCDModuleIndex *o, const struct NCDModuleGroup *group)
+int NCDModuleIndex_AddGroup (NCDModuleIndex *o, const struct NCDModuleGroup *group, const struct NCDModuleInst_iparams *iparams, NCDStringIndex *string_index)
 {
 {
     DebugObject_Access(&o->d_obj);
     DebugObject_Access(&o->d_obj);
     ASSERT(group)
     ASSERT(group)
+    ASSERT(iparams)
+    ASSERT(string_index)
+    
+    struct NCDModuleIndex_group *ig = BAlloc(sizeof(*ig));
+    if (!ig) {
+        BLog(BLOG_ERROR, "BAlloc failed");
+        goto fail0;
+    }
+    
+    ig->group = group;
+    LinkedList0_Prepend(&o->groups_list, &ig->groups_list_node);
+    
+    if (group->strings) {
+        if (!NCDStringIndex_GetRequests(string_index, group->strings)) {
+            BLog(BLOG_ERROR, "NCDStringIndex_GetRequests failed");
+            goto fail1;
+        }
+    }
+    
+    if (group->func_globalinit) {
+        if (!group->func_globalinit(iparams)) {
+            BLog(BLOG_ERROR, "func_globalinit failed");
+            goto fail1;
+        }
+    }
     
     
-    for (const struct NCDModule *nm = group->modules; nm->type; nm++) {
+    int num_inited_modules = 0;
+    
+    for (struct NCDModule *nm = group->modules; nm->type; nm++) {
         if (find_module(o, nm->type)) {
         if (find_module(o, nm->type)) {
             BLog(BLOG_ERROR, "module type '%s' already exists", nm->type);
             BLog(BLOG_ERROR, "module type '%s' already exists", nm->type);
             goto loop_fail0;
             goto loop_fail0;
@@ -190,16 +234,24 @@ int NCDModuleIndex_AddGroup (NCDModuleIndex *o, const struct NCDModuleGroup *gro
             goto loop_fail0;
             goto loop_fail0;
         }
         }
         
         
+        const char *base_type = (nm->base_type ? nm->base_type : nm->type);
+        ASSERT(base_type)
+        
+        nm->base_type_id = NCDStringIndex_Get(string_index, base_type);
+        if (nm->base_type_id < 0) {
+            BLog(BLOG_ERROR, "NCDStringIndex_Get failed");
+            goto loop_fail0;
+        }
+        
         struct NCDModuleIndex_module *m = &o->modules[o->num_modules];
         struct NCDModuleIndex_module *m = &o->modules[o->num_modules];
         
         
         strcpy(m->type, nm->type);
         strcpy(m->type, nm->type);
         m->module = nm;
         m->module = nm;
         
         
-        NCDModuleIndex__MHashRef ref = {m, o->num_modules};
-        int res = NCDModuleIndex__MHash_Insert(&o->modules_hash, o->modules, ref, NULL);
-        ASSERT_EXECUTE(res)
-        
-        const char *base_type = (nm->base_type ? nm->base_type : nm->type);
+        if (!add_method(m->type, nm, &o->method_index, &m->method_id)) {
+            BLog(BLOG_ERROR, "failed to add method to method index");
+            goto loop_fail0;
+        }
         
         
         struct NCDModuleIndex_base_type *bt = find_base_type(o, base_type);
         struct NCDModuleIndex_base_type *bt = find_base_type(o, base_type);
         if (bt) {
         if (bt) {
@@ -218,22 +270,52 @@ int NCDModuleIndex_AddGroup (NCDModuleIndex *o, const struct NCDModuleGroup *gro
             ASSERT_EXECUTE(BAVL_Insert(&o->base_types_tree, &bt->base_types_tree_node, NULL))
             ASSERT_EXECUTE(BAVL_Insert(&o->base_types_tree, &bt->base_types_tree_node, NULL))
         }
         }
         
         
-        o->num_modules++;
-        
-        if (!add_method(m->type, nm, &o->method_index)) {
-            BLog(BLOG_ERROR, "failed to add method to method index");
-            return 0;
-        }
+        NCDModuleIndex__MHashRef ref = {m, o->num_modules};
+        int res = NCDModuleIndex__MHash_Insert(&o->modules_hash, o->modules, ref, NULL);
+        ASSERT_EXECUTE(res)
         
         
+        o->num_modules++;
+        num_inited_modules++;
         continue;
         continue;
         
         
     loop_fail1:
     loop_fail1:
-        NCDModuleIndex__MHash_Remove(&o->modules_hash, o->modules, ref);
+        if (m->method_id >= 0) {
+            NCDMethodIndex_RemoveMethod(&o->method_index, m->method_id);
+        }
     loop_fail0:
     loop_fail0:
-        return 0;
+        goto fail2;
     }
     }
     
     
     return 1;
     return 1;
+    
+fail2:
+    while (num_inited_modules-- > 0) {
+        o->num_modules--;
+        struct NCDModule *nm = group->modules + num_inited_modules;
+        struct NCDModuleIndex_module *m = &o->modules[o->num_modules];
+        
+        NCDModuleIndex__MHashRef ref = {m, o->num_modules};
+        NCDModuleIndex__MHash_Remove(&o->modules_hash, o->modules, ref);
+        
+        struct NCDModuleIndex_base_type *bt = find_base_type(o, (nm->base_type ? nm->base_type : nm->type));
+        if (bt) {
+            ASSERT(bt->group == group)
+            BAVL_Remove(&o->base_types_tree, &bt->base_types_tree_node);
+            free(bt);
+        }
+        
+        if (m->method_id >= 0) {
+            NCDMethodIndex_RemoveMethod(&o->method_index, m->method_id);
+        }
+    }
+    if (group->func_globalfree) {
+        group->func_globalfree();
+    }
+fail1:
+    LinkedList0_Remove(&o->groups_list, &ig->groups_list_node);
+    BFree(ig);
+fail0:
+    return 0;
 }
 }
 
 
 const struct NCDModule * NCDModuleIndex_FindModule (NCDModuleIndex *o, const char *type)
 const struct NCDModule * NCDModuleIndex_FindModule (NCDModuleIndex *o, const char *type)

+ 10 - 2
ncd/NCDModuleIndex.h

@@ -33,17 +33,19 @@
 #include <misc/debug.h>
 #include <misc/debug.h>
 #include <structure/BAVL.h>
 #include <structure/BAVL.h>
 #include <structure/CHash.h>
 #include <structure/CHash.h>
+#include <structure/LinkedList0.h>
 #include <base/DebugObject.h>
 #include <base/DebugObject.h>
 #include <ncd/NCDModule.h>
 #include <ncd/NCDModule.h>
 #include <ncd/NCDMethodIndex.h>
 #include <ncd/NCDMethodIndex.h>
 
 
-#define NCDMODULEINDEX_MAX_TYPE_LEN 43
+#define NCDMODULEINDEX_MAX_TYPE_LEN 39
 #define NCDMODULEINDEX_MAX_MODULES 256
 #define NCDMODULEINDEX_MAX_MODULES 256
 #define NCDMODULEINDEX_MODULES_HASH_SIZE 512
 #define NCDMODULEINDEX_MODULES_HASH_SIZE 512
 
 
 struct NCDModuleIndex_module {
 struct NCDModuleIndex_module {
     const struct NCDModule *module;
     const struct NCDModule *module;
     int hash_next;
     int hash_next;
+    int method_id;
     char type[NCDMODULEINDEX_MAX_TYPE_LEN + 1];
     char type[NCDMODULEINDEX_MAX_TYPE_LEN + 1];
 };
 };
 
 
@@ -53,6 +55,11 @@ struct NCDModuleIndex_base_type {
     BAVLNode base_types_tree_node;
     BAVLNode base_types_tree_node;
 };
 };
 
 
+struct NCDModuleIndex_group {
+    const struct NCDModuleGroup *group;
+    LinkedList0Node groups_list_node;
+};
+
 typedef struct NCDModuleIndex_module NCDModuleIndex__mhash_entry;
 typedef struct NCDModuleIndex_module NCDModuleIndex__mhash_entry;
 typedef const char *NCDModuleIndex__mhash_key;
 typedef const char *NCDModuleIndex__mhash_key;
 typedef struct NCDModuleIndex_module *NCDModuleIndex__mhash_arg;
 typedef struct NCDModuleIndex_module *NCDModuleIndex__mhash_arg;
@@ -65,13 +72,14 @@ typedef struct {
     int num_modules;
     int num_modules;
     NCDModuleIndex__MHash modules_hash;
     NCDModuleIndex__MHash modules_hash;
     BAVL base_types_tree;
     BAVL base_types_tree;
+    LinkedList0 groups_list;
     NCDMethodIndex method_index;
     NCDMethodIndex method_index;
     DebugObject d_obj;
     DebugObject d_obj;
 } NCDModuleIndex;
 } NCDModuleIndex;
 
 
 int NCDModuleIndex_Init (NCDModuleIndex *o, NCDStringIndex *string_index) WARN_UNUSED;
 int NCDModuleIndex_Init (NCDModuleIndex *o, NCDStringIndex *string_index) WARN_UNUSED;
 void NCDModuleIndex_Free (NCDModuleIndex *o);
 void NCDModuleIndex_Free (NCDModuleIndex *o);
-int NCDModuleIndex_AddGroup (NCDModuleIndex *o, const struct NCDModuleGroup *group) WARN_UNUSED;
+int NCDModuleIndex_AddGroup (NCDModuleIndex *o, const struct NCDModuleGroup *group, const struct NCDModuleInst_iparams *iparams, NCDStringIndex *string_index) WARN_UNUSED;
 const struct NCDModule * NCDModuleIndex_FindModule (NCDModuleIndex *o, const char *type);
 const struct NCDModule * NCDModuleIndex_FindModule (NCDModuleIndex *o, const char *type);
 int NCDModuleIndex_GetMethodNameId (NCDModuleIndex *o, const char *method_name);
 int NCDModuleIndex_GetMethodNameId (NCDModuleIndex *o, const char *method_name);
 const struct NCDModule * NCDModuleIndex_GetMethodModule (NCDModuleIndex *o, NCD_string_id_t obj_type, int method_name_id);
 const struct NCDModule * NCDModuleIndex_GetMethodModule (NCDModuleIndex *o, NCD_string_id_t obj_type, int method_name_id);