-->

是否有一个良好的脚本类Pascal语言德尔福?(Is there a good scripting

2019-07-31 11:27发布

我在寻找一个很好的免费脚本引擎德尔福。 我想脚本添加到应用程序,这样我可以写的小测试脚本。 具体来说,我需要:

  • 类似于Pascal的语法
  • 目前(我看的RemObjects帕斯卡尔脚本,但它根据一个帖子我看到是“过时”)。

我并不需要完整的语言支持,只是基础知识。 我看到这一点: https://stackoverflow.com/questions/226135/scripting-library-for-delphi但我假设自那时事情已经在一点点移动。

所有我希望能够做的就是添加一个备忘录组件我的程序,并在运行时源的片段添加到该备忘录,并点击一个Go按钮。 我希望脚本能够访问我的应用程序的变量和函数。

什么是完成这个最简单的途径? 实施例程序如下。

program Project31;

uses
  Forms,
  Unit36 in 'Unit36.pas' {Form36};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm36, Form36);
  Application.Run;
end.

unit Unit36;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm36 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form36: TForm36;

implementation

{$R *.dfm}

procedure RoutineInMyApplication ;

begin
ShowMessage ('Hello from my Application') ;
end ;

procedure TForm36.Button1Click(Sender: TObject);
begin
//ExecuteScript (Memo1.Lines) ;
end ;

end.

object Form36: TForm36
  Left = 0
  Top = 0
  Caption = 'Form36'
  ClientHeight = 174
  ClientWidth = 391
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Button1: TButton
    Left = 300
    Top = 72
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Memo1: TMemo
    Left = 8
    Top = 21
    Width = 241
    Height = 145
    Lines.Strings = (
      'begin'
      'ShowMessage  ('#39'Hello world'#39') ;'
      'CallSomehow (RoutineInMyApplication) ;'
      'end.'
      ' ')
    TabOrder = 1
  end
end

Answer 1:

尝试dwscript这是目前维护库埃里克田庄 。



Answer 2:

绝地JVCL还包括TJvInterpreter这是一个非常轻量级的(小)解释器,但具有许多功能比dwscript更有限。

对于非常小的(用户输入的公式,或简单的字符串和数字处理任务)JvInterpreter已经做得很不错了我。



Answer 3:

几年前,我曾经工作大同编译器结合这个表格编辑器 。



Answer 4:

FastScript从FastReport中(堆栈不允许给的链接)。 包括PascalScript,C ++脚本,JScript和BasicScript。 PascalScript似乎是你问什么了。



Answer 5:

尝试嵌入的Lua 。 见Lua的5.1德尔福的实例。



文章来源: Is there a good scripting Pascal-like language for Delphi?