Browse code

- find_mod_export added (The function can find an export in a specified module).

Jan Janak authored on 24/10/2003 21:03:14
Showing 2 changed files
... ...
@@ -223,9 +223,9 @@ skip:
223 223
 
224 224
 
225 225
 
226
-/* searches the module list and returns a pointer to the "name" function or
226
+/* searches the module list and returns pointer to the "name" function or
227 227
  * 0 if not found 
228
- * flags parameter os OR value of all flags that must match
228
+ * flags parameter is OR value of all flags that must match
229 229
  */
230 230
 cmd_function find_export(char* name, int param_no, int flags)
231 231
 {
... ...
@@ -249,6 +249,39 @@ cmd_function find_export(char* name, int param_no, int flags)
249 249
 }
250 250
 
251 251
 
252
+
253
+/*
254
+ * searches the module list and returns pointer to "name" function in module "mod"
255
+ * 0 if not found
256
+ * flags parameter is OR value of all flags that must match
257
+ */
258
+cmd_function find_mod_export(char* mod, char* name, int param_no, int flags)
259
+{
260
+	struct sr_module* t;
261
+	cmd_export_t* cmd;
262
+
263
+	for (t = modules; t; t = t->next) {
264
+		if (strcmp(t->exports->name, mod) == 0) {
265
+			for (cmd = t->exports->cmds;  cmd && cmd->name; cmd++) {
266
+				if ((strcmp(name, cmd->name) == 0) &&
267
+				    (cmd->param_no == param_no) &&
268
+				    ((cmd->flags & flags) == flags)
269
+				   ){
270
+					DBG("find_mod_export: found <%s> in module %s [%s]\n",
271
+					    name, t->exports->name, t->path);
272
+					return cmd->function;
273
+				}
274
+			}
275
+		}
276
+	}
277
+
278
+	DBG("find_mod_export: <%s> in module %s not found\n", name, mod);
279
+	return 0;
280
+}
281
+
282
+
283
+
284
+
252 285
 void* find_param_export(char* mod, char* name, modparam_t type)
253 286
 {
254 287
 	struct sr_module* t;
... ...
@@ -125,6 +125,7 @@ int register_builtin_modules();
125 125
 int register_module(struct module_exports*, char*,  void*);
126 126
 int load_module(char* path);
127 127
 cmd_function find_export(char* name, int param_no, int flags);
128
+cmd_function find_mod_export(char* mod, char* name, int param_no, int flags);
128 129
 struct sr_module* find_module(void *f, cmd_export_t** cmd);
129 130
 void destroy_modules();
130 131
 int init_child(int rank);