使用PaxScript为Delphi应用增加对脚本的支持

转自 https://aztack.wang/post/using-paxscript-in-delphi.html

 

通过使用PaxScript可以为Delphi应用增加对脚本的支持。

PaxScript支持paxC,paxBasic,paxPascle,paxJavaScript(对ECMA-262做了扩展) 四种脚本语言。它们分别是对应语言的子集。

在为程序增加脚本支持时要解决的主要问题是:本地代码与脚本之间的互相调用。

PaxScript为四种脚本语言都增加的名字空间和模块的概念。某段代码必须属于某个名字空间。执行代码时要指定代码所属的模块。默认的名字空间是全局名字空间。

执行代码的步骤是:

  1. 注册语言
  2. 注册本地变量、常量、函数、类型等
  3. 增加名字空间、模块
  4. 向模块增加代码,可以使硬编码、运行时输入的文本、从文件读入的字符流
  5. 运行指定模块的代码

图一

补充:16:31 2009-2-2

Delphi代码中调用脚本中的函数用PaxScripter.CallFunction

其他资料:

可以通过将SpiderMonkey嵌入你的C/C++代码,使你的应用Scriptable https://developer.mozilla.org/cn/JavaScript

23:26 2009-2-26 补充:

多谢 Firefly 兄弟的指点。

只要在工程中uses IMP_comctrls.pas就可以访问数组型的property了。 今天研究了一下,奥妙在于IMP_comctrls注册了常用的控件类型和属性、方法。 我们完全你可以手工注册。下面是一个小结。

图二

本文链接:http://aztack.wang/post/using-paxscript-in-delphi.html

转载于:https://www.cnblogs.com/xiefang2008/p/6141954.html

paxscriptnet2.7(价值187美金)C#代码解释执行器 About paxScript.NET 18 December 2013. Support of MS Visual Studio 2013. The Microsoft NET version of the paxScript scripting engine (paxScript.NET) includes interpreters of C# and VB.NET languages. The key features of paxScript.NET are: paxScript.NET is written in C#. Source code of paxScript.NET is CLS compilant. Support of Silverlight and Windows Phone platforms of Microsoft .NET Framework. Support of Mono. paxScript.NET compiles programs into byte-code. It does not use CodeDOM and it does not generate a dynamic assembly. Separate compilation of modules is allowed. You can combine source code modules and compiled (binary) modules in your paxScript.NET script project. Cross-language scripting is allowed. You can combine modules written in C# and VB.NET in your paxScript.NET script project. C# interpreter is based on the ECMA-334 standard. It supports all C# language features with exception for the unsafe code, attributes and generic types. The interpreter extends standard of C# language with extra features which simplify the use of C# for scripting needs (more...). paxScript.NET is implemented as a .NET component ( paxscript-net.dll) which can be used with Microsoft Visual Studio .NET and Mono. The component allows you to embed paxScript.NET interpreter into your WinForms, Mobile or ASP.NET application so you can customize and extend the application without having to recompile it. Any classes, structures, enumerations, arrays, delegates, events and interfaces of host application can be used in a script. (See demo...). You call script-defined methods from host application. (See demo...). Debug capabilities: breakpoints, call stack, watch/evaluate, trace into, step over etc. (See demo...).
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值