用于C ++应用程序的脚本工具? (我不确定我应该用什么谷歌搜索) [英] Scripting tool for C++ application ? (I'm not certain what I should be googling for)

查看:48
本文介绍了用于C ++应用程序的脚本工具? (我不确定我应该用什么谷歌搜索)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我希望我能说清楚这一点)



我们有一个自制脚本/宏工具,让我们称之为高级功能在我们的申请中;这是为了帮助增加应用程序的自动化而开发的;让use使用自动运行相同的命令集而不是手动执行它们。



该工具开始显示其年龄和限制;对于需要添加到工具中的每个新功能,我们似乎花费更多时间来破解/修补工具而不是做真正的工作。



我们的应用程序加载,解析和解释脚本,调用内部应用程序函数(带参数)。一切都在我们的应用程序内部完成



例如,



假设我们的应用程序是3d图形应用程序,我可以创建一个脚本,如:



  //   script.txt  
LoadFile( potato.cad // 加载cad文件
ConstructSphere( sphere 0 0 0 10 ,#FF0000 ) // 在coord 0,0,0处构造一个红色球体,半径为10,名称为sphere
ReverseSurfaceNormal( sphere // 反转曲面球体的法线
ZoomAll( ) // zoom
删除( onion *,ALL_PLANE) // delete所有洋葱飞机
SaveFile( tomate.cad // 保存cad文件





要运行它,启动我们的应用程序并打开并播放脚本,它将调用相应的函数



----



我们可能正处于使用该工具可以完成的限制。



所以我在寻找某种替代和/或替代品。



VBScript / COM? Python? Perl? LUA?



我正朝着正确的方向前进吗?



我需要打电话给C来自正在运行的应用程序内的脚本的函数(包装器);一点点(很多)就像宏在Visual Studio 2008中如何工作一样。





谢谢。



Max。

解决方案

我认为你使用Python或Javascript走在正确的轨道上。根据应用程序的类型,您甚至可以从许多可用的Python应用程序包中受益,例如 numpy matplot



由于您的应用程序中已有脚本引擎,为什么不研究Python和Javascript实现的工作方式,并在您自己的引擎中实现他们的一些想法。这样您就可以保持现有用户的兼容性,并且这条路线的实现可能要少得多,因为您不必将完整的自适应层编写到新的脚本引擎。


有看看 http://www.swig.org/ [ ^ ]



这将使您能够支持Tcl,Python,Perl,Guile,Java ,Ruby,Mzscheme,PHP,Objective Caml,C#,javascript等等相对容易。



祝你好运

Espen Harlinn

(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:

// 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.

解决方案

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.


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


这篇关于用于C ++应用程序的脚本工具? (我不确定我应该用什么谷歌搜索)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆