Hi,
I'm a C++ programmer working on a GPL'd wxWindows-
based math project (http://mathstudio.sourceforge.net).
I want to implement a very useful feature in my
program: scripts or plugins, call them how you want,
loadable at runtime to allow all the user to write their
own functions with a simple notepad and then let my
program recognize them.
I started wondering in the net for a script interpreter.
My first choice was CINT, but it looked to old & messy;
then I looked at UnderC, Pike, Ruby, ElastiC..... I was
going mad: they are very difficult to use and they are
not designed at all (except for CINT) to be used as I
wanted to use them; I report you some short pseudo-
code to give you an idea of what I need:
........ start of pseudo-code I need to insert in my C++
program
ScriptFile script
("user_defined_trigonometric_functions.wxb");
FunctionArray functions =
script.GetArrayOfDefinedFunctions();
double alfa = script.RunFunction(functions[0].GetName
()); // alfa now contains the return value of the
first function defined
in "user_defined_trigonometric_functions.wxb"
...... end of pseudo-code
Finally, I found your great wxBasic and I couldn't believe
to my eyes when I saw the ordered design &
implementation of your sources.
I had no problems to compile it under Windows with
Borland BCC and run all the samples....
Then, I tried to modify the behaviour of the main() of
main.c and I found that it's not too difficult to
understand how wxBasic internals work.
Now I'm creating a function that I will use to implement
something like the ScriptFile::GetArrayOfDefinedFunctions
() function used in the pseudo-code above, that lists in
the console output all the functions defined in the
loaded script.
However, before going on with this work, I must know
one important thing and so I would like to ask it to you
because you can save me a lot of time I would
otherwise use trying to implement such a feature:
can I interface in some way the scripts written in
wxBasic that I load at runtime (from an application such
as the one defined by main() in main.c) with the
functions I've defined in my program ? that is; I would
like to be able to run such a pseudo-script:
--------------------------
Function myZetaFunction(n)
return myInterfacedLibrary.RunZetaFunction
(n) // RunZetaFunction is a function I've
defined in C++ in my program...
End Function
----------------------------
so; can I interface the functions of a C++ module with a
wxBasic program ?
Thank you very much indeed,
Francesco Montorsi