Interface
USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, PaxProgram PaxCompiler, StdCtrls PaxRunner;
Type
TForm1=class (TForm)
For: TButton;
PaxCompiler1: TPaxCompiler;
PaxPascalLanguage1: TPaxPascalLanguage;
PaxProgram1: TPaxProgram;
Button2: TButton;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
The end;
Type
TDynArraya=array of String;
Var
Form1: TForm1;
Implementation
{$R *. DFM}
Procedure TForm1. Button1Click (Sender: TObject);
Var
H_range H_S, I: Integer;
Tmeps, me: STRING;
TDynArray: TDynArraya;
The begin
SetLength (TDynArray, 2);
Me:=';
='TDynArray tmeps: [0] :=' + ' ' 'nihAAoa! "';
PaxCompiler1. Reset;
PaxCompiler1. RegisterLanguage (PaxPascalLanguage1);
H_range:=PaxCompiler1 RegisterVariable (0, 'TDynArray, 24);
H_S:=PaxCompiler1 RegisterDynamicArrayType (0, 'TDynArray, 24);
//H_range:=PaxCompiler1 RegisterVariable (0, 'TDynArray H_S, @ TDynArray);
//H_S:=PaxCompiler1 RegisterVariable (0, 'me', 5);
PaxCompiler1. AddModule (' 1 ', PaxPascalLanguage1 LanguageName);//add the PAX module
//PaxCompiler1. AddCode (' 1 ', 'var TDynArray: TDynArraya; ');//add code
PaxCompiler1. AddCode (' 1 ', 'begin');
PaxCompiler1. AddCode (' 1 ', tmeps);
PaxCompiler1. AddCode (' 1 ', 'end. ");
If PaxCompiler1.Com running (PaxProgram1) then
The begin
PaxProgram1. Run;
Showmessage (TDynArray [0]);
End
The else
For I:=0 to PaxCompiler1. ErrorCount do
ShowMessage (PaxCompiler1 ErrorMessage [I]);
The end;
End.
Tried N times, all don't understand how to register and call and dynamic array, the array have know friends comment,
CodePudding user response:
Never use paxCOMPILER, attention,CodePudding user response:
Procedure TForm1. Button1Click (Sender: TObject);Var
H_range H_S, I: Integer;
Tmeps, me: string;
TDynArray: TDynArraya;
The begin
SetLength (TDynArray, 2);
TDynArray [0] :='hello in Delphi;
Me:='SetLength (TDynArray, 2); ';
='TDynArray tmeps: [0] :=' 'Hello in script' '; ';
PaxCompiler1. Reset;
PaxCompiler1. RegisterLanguage (PaxPascalLanguage1);
H_S:=PaxCompiler1 RegisterDynamicArrayType (0, 'TDynArraya, __typeSTRING);
H_range:=PaxCompiler1 RegisterVariable (0, 'TDynArray, PaxCompiler1. LookupTypeId (' TDynArraya), @ TDynArray);
PaxCompiler1. AddModule (' 1 ', PaxPascalLanguage1 LanguageName);//add the PAX module
PaxCompiler1. AddCode (' 1 ', 'begin');
PaxCompiler1. AddCode (' 1 ', tmeps);
PaxCompiler1. AddCode (' 1 ', 'end. ");
If PaxCompiler1.Com running (PaxProgram1) then
The begin
Showmessage (' before '+ (TDynArray [0]));
PaxProgram1. Run;
Showmessage (' execution '+ (TDynArray [0]));
End
The else
For I:=0 to PaxCompiler1. Do ErrorCount - 1
ShowMessage (' error message '+ PaxCompiler1 ErrorMessage [I]);
The end;
CodePudding user response:
Thank you for your reply, I'm going to specify __typeSTRING D10, 24 and 7 is wrong, but I filled out what reason be?