<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to support-requests</title><link href="https://sourceforge.net/p/wxbasic/support-requests/" rel="alternate"/><link href="https://sourceforge.net/p/wxbasic/support-requests/feed.atom" rel="self"/><id>https://sourceforge.net/p/wxbasic/support-requests/</id><updated>2004-04-23T20:34:10Z</updated><subtitle>Recent changes to support-requests</subtitle><entry><title>wxBasic as a script interpreter to embed in a C++ app</title><link href="https://sourceforge.net/p/wxbasic/support-requests/1/" rel="alternate"/><published>2004-04-23T20:34:10Z</published><updated>2004-04-23T20:34:10Z</updated><author><name>Francesco Montorsi</name><uri>https://sourceforge.net/u/frm/</uri></author><id>https://sourceforge.netfed07b89ef6fa15c16f51bd730fb4481fbdfb98e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br /&gt;
I'm a C++ programmer working on a GPL'd wxWindows-&lt;br /&gt;
based math project (http://mathstudio.sourceforge.net). &lt;br /&gt;
I want to implement a very useful feature in my &lt;br /&gt;
program: scripts or plugins, call them how you want, &lt;br /&gt;
loadable at runtime to allow all the user to write their &lt;br /&gt;
own functions with a simple notepad and then let my &lt;br /&gt;
program recognize them.&lt;br /&gt;
I started wondering in the net for a script interpreter. &lt;br /&gt;
My first choice was CINT, but it looked to old &amp;amp; messy; &lt;br /&gt;
then I looked at UnderC, Pike, Ruby, ElastiC..... I was &lt;br /&gt;
going mad: they are very difficult to use and they are &lt;br /&gt;
not designed at all (except for CINT) to be used as I &lt;br /&gt;
wanted to use them; I report you some short pseudo-&lt;br /&gt;
code to give you an idea of what I need:&lt;/p&gt;
&lt;p&gt;........ start of pseudo-code I need to insert in my C++ &lt;br /&gt;
program&lt;/p&gt;
&lt;p&gt;ScriptFile script&lt;br /&gt;
("user_defined_trigonometric_functions.wxb");&lt;br /&gt;
FunctionArray functions = &lt;br /&gt;
script.GetArrayOfDefinedFunctions();&lt;br /&gt;
double alfa = script.RunFunction(functions[0].GetName&lt;br /&gt;
());            // alfa now contains the return value of the &lt;br /&gt;
first function defined &lt;br /&gt;
in "user_defined_trigonometric_functions.wxb"&lt;/p&gt;
&lt;p&gt;...... end of pseudo-code&lt;/p&gt;
&lt;p&gt;Finally, I found your great wxBasic and I couldn't believe &lt;br /&gt;
to my eyes when I saw the ordered design &amp;amp; &lt;br /&gt;
implementation of your sources. &lt;br /&gt;
I had no problems to compile it under Windows with &lt;br /&gt;
Borland BCC and run all the samples....&lt;br /&gt;
Then, I tried to modify the behaviour of the main() of &lt;br /&gt;
main.c and I found that it's not too difficult to &lt;br /&gt;
understand how wxBasic internals work.&lt;br /&gt;
Now I'm creating a function that I will use to implement &lt;br /&gt;
something like the ScriptFile::GetArrayOfDefinedFunctions&lt;br /&gt;
() function used in the pseudo-code above, that lists in &lt;br /&gt;
the console output all the functions defined in the &lt;br /&gt;
loaded script.&lt;/p&gt;
&lt;p&gt;However, before going on with this work, I must know &lt;br /&gt;
one important thing and so I would like to ask it to you &lt;br /&gt;
because you can save me a lot of time I would &lt;br /&gt;
otherwise use trying to implement such a feature:&lt;br /&gt;
can I interface in some way the scripts written in &lt;br /&gt;
wxBasic that I load at runtime (from an application such &lt;br /&gt;
as the one defined by main() in main.c) with the &lt;br /&gt;
functions I've defined in my program ? that is; I would &lt;br /&gt;
like to be able to run such a pseudo-script:&lt;/p&gt;
&lt;p&gt;-------------------------- &lt;br /&gt;
Function myZetaFunction(n)&lt;br /&gt;
return myInterfacedLibrary.RunZetaFunction&lt;br /&gt;
(n)              // RunZetaFunction is a function I've &lt;br /&gt;
defined in C++ in my program...&lt;br /&gt;
End Function &lt;br /&gt;
----------------------------&lt;/p&gt;
&lt;p&gt;so; can I interface the functions of a C++ module with a &lt;br /&gt;
wxBasic program ?&lt;/p&gt;
&lt;p&gt;Thank you very much indeed,&lt;br /&gt;
Francesco Montorsi&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>