Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
(I hope I can make this clear enough)

We have a "home made" scripting/macro tool that let us call most "high level" functionalities in our application; this was developed to help add automation to the application; to let use run the same set of commands automatically instead of doing them manually.

The tool is starting to show its age and limitation; with each new feature that needs to be added to the tool, we seem to be spending more time hacking/patching the tool instead of doing real work.

Our application loads, parses and interprets the script, calling internal application functions (with parameters). All is done internally within our application

For example,

Let's say our application is a "3d graphic application", I could create a "script" like:

C++
// script.txt
LoadFile ( "potato.cad" ) // load a "cad" file
ConstructSphere( "sphere", 0, 0, 0, 10, #FF0000 ) // construct a red sphere at coord 0, 0,0 with radius of 10 with the name "sphere"
ReverseSurfaceNormal( "sphere") // reverse the normal of the surface "sphere" 
ZoomAll() // zoom 
Delete( "onion*", ALL_PLANE) // delete all the onion planes 
SaveFile ( "tomate.cad" ) // save a "cad" file


To run this, with launch our application and open and play the script and it will call the corresponding functions

----

We probably are at the limit of what can be done with the tool.

So I'm looking for some sort of alternative and/or replacement.

VBScript/COM ? Python ? Perl ? LUA ?

Am I going in the proper direction ?

The thing is that I would need to call C functions (wrappers) from a script from within the running application; a little bit (a lot) like how the macros were working in Visual Studio 2008.


Thanks.

Max.
Posted
Comments
Sergey Alexandrovich Kryukov 9-Jul-14 14:55pm    
Javascript could make a good choice; you could find available Javascript host which you could embed in your system. The choice really depends on your goals and even taste. I don't think VBScript or COM would have life, skeptical about Perl...
—SA

I think that you are on the right track with Python or Javascript. Depending on the type of application you could even benefit from the many Python application packages that are available, for example numpy or matplot.

As you already have a scripting engine in your application, why not study the way Python and Javascript implementations work and implement some of their ideas in your own engine. That way you would maintain compatibility for your existing users and this route could be much less effort to implement as you don't have to write the complete adaption layer to the new scripting engine.
 
Share this answer
 
Have a look at http://www.swig.org/[^]

This will emable you to support Tcl, Python, Perl, Guile, Java, Ruby, Mzscheme, PHP, Objective Caml, C#, javascript and more with relative ease.

Best regards
Espen Harlinn
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900