It's been a real long time since my last post. I don't know if even some of you still remember me
I got a question for you, experienced coder in scripting. When you want to allow a program to be controlled from the outside by diverse scripts, how do you approach the problem? I guess you have to parse the script from the inside and then work with it? Anyway, could you point me to some useful articles on the subject?
There are different ways to do that. One way is the one you described - embedding the script-language in your project. I've done that two times, once with an own language and once using cint (http://root.cern.ch/root/Cint.html). You have to write an Interface for the parts of your Application which should be scriptable. For many scripting-languaes this interface is just a set of functions. The way the interface has to look really depends on the language used, so you have to browse the language documentation for that. Cint for example also allows complexer interfaces using c++ classes.
Another way to do it is to use an external Scriptlanguage which isn't a part of your project. This makes it slightly harder to get the data to the script and back to your application. You can do so for example by exchanging the necessary data by files (easiest). Or you can write a library for the scriptable parts (which needs to have a c-like interface to be useable by most scriptlanguages) which you use in the script and in your application and which does use some shared memory. Or you can use more complex transport mechanism like ole for communication. I don't have much experience with that stuff,so i'm not much of help there :(.
eXodus wrote:Thanks guys, I'll put some time in your first clue CuteAlien!
Uhm, i hope with my first clue you mean embedding a script language in your project in general and not using cint. Cint is fine - for some stuff - mainly if you want to script in c++. But very often easier script languages are better suited.