1) In my code I include a module with its table
and initialization function.
2) when I start my application, I call init_all()
and then init_foo(), where foo is my module.
3) I run_command("import foo"). Henceforth the functions
of foo will be available to every program as foo.func1,
foo.func2. etc., because the import was at the level
of __main__.
4) Whenever I want to execute a script, I call run_command(),
etc.
5) When I'm finished I call goaway();
Could someone confirm that this is correct, and that it will
work?
Next step: all the function I consider receive a string or
an integer, and return (possibly) a string. Thus, I just
have to start each such function with
getargs(args, "s", &p) or getargs(args, "s", &i)
and exit with a
return mkvalue("s", r), where char *r holds the return value.
Of course if there is an error I have to call err_setstr().
Is this OK?
Finally: I really need to be able to call my functions
func1, func2,..., and not foo.func1, foo.func2 etc. Is
there a way to obtain this? For otherwise all existing scripts
will break!
seba