re-checkin

git-svn-id: http://code.remobjects.com/svn/pascalscript@1 5c9d2617-0215-0410-a2ee-e80e04d1c6d8
This commit is contained in:
carlokok 2006-05-30 14:23:25 +00:00
commit afe3fdfd77
237 changed files with 83622 additions and 0 deletions

BIN
Pascal Script.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,61 @@
program sample1;
uses
uPSCompiler, uPSRuntime;
function ScriptOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
{ the OnUses callback function is called for each "uses" in the script.
It's always called with the parameter 'SYSTEM' at the top of the script.
For example: uses ii1, ii2;
This will call this function 3 times. First with 'SYSTEM' then 'II1' and then 'II2'.
}
begin
if Name = 'SYSTEM' then
begin
Result := True;
end else
Result := False;
end;
procedure ExecuteScript(const Script: string);
var
Compiler: TPSPascalCompiler;
{ TPSPascalCompiler is the compiler part of the scriptengine. This will
translate a Pascal script into a compiled form the executer understands. }
Exec: TPSExec;
{ TPSExec is the executer part of the scriptengine. It uses the output of
the compiler to run a script. }
Data: string;
begin
Compiler := TPSPascalCompiler.Create; // create an instance of the compiler.
Compiler.OnUses := ScriptOnUses; // assign the OnUses event.
if not Compiler.Compile(Script) then // Compile the Pascal script into bytecode.
begin
Compiler.Free;
// You could raise an exception here.
Exit;
end;
Compiler.GetOutput(Data); // Save the output of the compiler in the string Data.
Compiler.Free; // After compiling the script, there is no need for the compiler anymore.
Exec := TPSExec.Create; // Create an instance of the executer.
if not Exec.LoadData(Data) then // Load the data from the Data string.
begin
{ For some reason the script could not be loaded. This is usually the case when a
library that has been used at compile time isn't registered at runtime. }
Exec.Free;
// You could raise an exception here.
Exit;
end;
Exec.RunScript; // Run the script.
Exec.Free; // Free the executer.
end;
const
Script = 'var s: string; begin s := ''Test''; S := s + ''ing;''; end.';
begin
ExecuteScript(Script);
end.

View File

@ -0,0 +1,83 @@
program sample2;
uses
uPSCompiler,
uPSRuntime,
Dialogs
;
procedure MyOwnFunction(const Data: string);
begin
// Do something with Data
ShowMessage(Data);
end;
function ScriptOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
{ the OnUses callback function is called for each "uses" in the script.
It's always called with the parameter 'SYSTEM' at the top of the script.
For example: uses ii1, ii2;
This will call this function 3 times. First with 'SYSTEM' then 'II1' and then 'II2'.
}
begin
if Name = 'SYSTEM' then
begin
Sender.AddDelphiFunction('procedure MyOwnFunction(Data: string)');
{ This will register the function to the script engine. Now it can be used from
within the script.}
Result := True;
end else
Result := False;
end;
procedure ExecuteScript(const Script: string);
var
Compiler: TPSPascalCompiler;
{ TPSPascalCompiler is the compiler part of the scriptengine. This will
translate a Pascal script into a compiled form the executer understands. }
Exec: TPSExec;
{ TPSExec is the executer part of the scriptengine. It uses the output of
the compiler to run a script. }
Data: string;
begin
Compiler := TPSPascalCompiler.Create; // create an instance of the compiler.
Compiler.OnUses := ScriptOnUses; // assign the OnUses event.
if not Compiler.Compile(Script) then // Compile the Pascal script into bytecode.
begin
Compiler.Free;
// You could raise an exception here.
Exit;
end;
Compiler.GetOutput(Data); // Save the output of the compiler in the string Data.
Compiler.Free; // After compiling the script, there is no need for the compiler anymore.
Exec := TPSExec.Create; // Create an instance of the executer.
Exec.RegisterDelphiFunction(@MyOwnFunction, 'MYOWNFUNCTION', cdRegister);
{ This will register the function to the executer. The first parameter is a
pointer to the function. The second parameter is the name of the function (in uppercase).
And the last parameter is the calling convention (usually Register). }
if not Exec.LoadData(Data) then // Load the data from the Data string.
begin
{ For some reason the script could not be loaded. This is usually the case when a
library that has been used at compile time isn't registered at runtime. }
Exec.Free;
// You could raise an exception here.
Exit;
end;
Exec.RunScript; // Run the script.
Exec.Free; // Free the executer.
end;
const
Script = 'var s: string; begin s := ''Test''; S := s + ''ing;''; MyOwnFunction(s); end.';
begin
ExecuteScript(Script);
end.

View File

@ -0,0 +1,80 @@
program sample3;
uses
uPSC_dll,
uPSR_dll,
uPSCompiler,
uPSRuntime;
function ScriptOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
{ the OnUses callback function is called for each "uses" in the script.
It's always called with the parameter 'SYSTEM' at the top of the script.
For example: uses ii1, ii2;
This will call this function 3 times. First with 'SYSTEM' then 'II1' and then 'II2'.
}
begin
if Name = 'SYSTEM' then
begin
Sender.OnExternalProc := @DllExternalProc;
{ Assign the dll library to the script engine. This function can be found in the uPSC_dll.pas file.
When you have assigned this, it's possible to do this in the script:
Function FindWindow(c1, c2: PChar): Cardinal; external 'FindWindow@user32.dll stdcall';
The syntax for the external string is 'functionname@dllname callingconvention'.
}
Result := True;
end else
Result := False;
end;
procedure ExecuteScript(const Script: string);
var
Compiler: TPSPascalCompiler;
{ TPSPascalCompiler is the compiler part of the scriptengine. This will
translate a Pascal script into a compiled form the executer understands. }
Exec: TPSExec;
{ TPSExec is the executer part of the scriptengine. It uses the output of
the compiler to run a script. }
Data: string;
begin
Compiler := TPSPascalCompiler.Create; // create an instance of the compiler.
Compiler.OnUses := ScriptOnUses; // assign the OnUses event.
if not Compiler.Compile(Script) then // Compile the Pascal script into bytecode.
begin
Compiler.Free;
// You could raise an exception here.
Exit;
end;
Compiler.GetOutput(Data); // Save the output of the compiler in the string Data.
Compiler.Free; // After compiling the script, there is no need for the compiler anymore.
Exec := TPSExec.Create; // Create an instance of the executer.
RegisterDLLRuntime(Exec);
{ Register the DLL runtime library. This can be found in the uPSR_dll.pas file.}
if not Exec.LoadData(Data) then // Load the data from the Data string.
begin
{ For some reason the script could not be loaded. This is usually the case when a
library that has been used at compile time isn't registered at runtime. }
Exec.Free;
// You could raise an exception here.
Exit;
end;
Exec.RunScript; // Run the script.
Exec.Free; // Free the executer.
end;
const
Script =
'function MessageBox(hWnd: Longint; lpText, lpCaption: PChar; uType: Longint): Longint; external ''MessageBoxA@user32.dll stdcall'';'#13#10 +
'var s: string; begin s := ''Test''; MessageBox(0, s, ''Caption Here!'', 0);end.';
begin
ExecuteScript(Script);
end.

107
Samples/Console/sample4.dpr Normal file
View File

@ -0,0 +1,107 @@
program sample4;
uses
uPSCompiler,
uPSRuntime,
uPSC_std,
uPSC_controls,
uPSC_stdctrls,
uPSC_forms,
uPSR_std,
uPSR_controls,
uPSR_stdctrls,
uPSR_forms,
forms
;
function ScriptOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
{ the OnUses callback function is called for each "uses" in the script.
It's always called with the parameter 'SYSTEM' at the top of the script.
For example: uses ii1, ii2;
This will call this function 3 times. First with 'SYSTEM' then 'II1' and then 'II2'.
}
begin
if Name = 'SYSTEM' then
begin
SIRegister_Std(Sender);
{ This will register the declarations of these classes:
TObject, TPersistent, TComponent. This can be found
in the uPSC_std.pas unit. }
SIRegister_Controls(Sender);
{ This will register the declarations of these classes:
TControl, TWinControl, TFont, TStrings, TStringList, TCanvas, TGraphicControl. This can be found
in the uPSC_controls.pas unit. }
SIRegister_Forms(Sender);
{ This will register: TScrollingWinControl, TCustomForm, TForm and TApplication. uPSC_forms.pas unit. }
SIRegister_stdctrls(Sender);
{ This will register: TButtonContol, TButton, TCustomCheckbox, TCheckBox, TCustomEdit, TEdit, TCustomMemo, TMemo,
TCustomLabel and TLabel. Can be found in the uPSC_stdctrls.pas unit. }
Result := True;
end else
Result := False;
end;
procedure ExecuteScript(const Script: string);
var
Compiler: TPSPascalCompiler;
{ TPSPascalCompiler is the compiler part of the scriptengine. This will
translate a Pascal script into a compiled form the executer understands. }
Exec: TPSExec;
{ TPSExec is the executer part of the scriptengine. It uses the output of
the compiler to run a script. }
Data: string;
CI: TPSRuntimeClassImporter;
begin
Compiler := TPSPascalCompiler.Create; // create an instance of the compiler.
Compiler.OnUses := ScriptOnUses; // assign the OnUses event.
if not Compiler.Compile(Script) then // Compile the Pascal script into bytecode.
begin
Compiler.Free;
// You could raise an exception here.
Exit;
end;
Compiler.GetOutput(Data); // Save the output of the compiler in the string Data.
Compiler.Free; // After compiling the script, there is no need for the compiler anymore.
CI := TPSRuntimeClassImporter.Create;
{ Create an instance of the runtime class importer.}
RIRegister_Std(CI); // uPSR_std.pas unit.
RIRegister_stdctrls(CI); // uPSR_stdctrls.pas unit.
RIRegister_Controls(CI); // uPSR_controls.pas unit.
RIRegister_Forms(CI); // uPSR_forms.pas unit.
Exec := TPSExec.Create; // Create an instance of the executer.
RegisterClassLibraryRuntime(Exec, CI);
// Assign the runtime class importer to the executer.
if not Exec.LoadData(Data) then // Load the data from the Data string.
begin
{ For some reason the script could not be loaded. This is usually the case when a
library that has been used at compile time isn't registered at runtime. }
Exec.Free;
// You could raise an exception here.
Exit;
end;
Exec.RunScript; // Run the script.
Exec.Free; // Free the executer.
CI.Free; // Free the runtime class importer.
end;
const
Script =
'var f: TForm; i: Longint; begin f := TForm.CreateNew(nil,0); f.Show; for i := 0 to 1000000 do; f.Hide; f.free; end.';
begin
ExecuteScript(Script);
end.

113
Samples/Console/sample5.dpr Normal file
View File

@ -0,0 +1,113 @@
program sample5;
uses
uPSCompiler,
uPSRuntime,
uPSC_std,
uPSC_controls,
uPSC_stdctrls,
uPSC_forms,
uPSR_std,
uPSR_controls,
uPSR_stdctrls,
uPSR_forms,
forms
;
function ScriptOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
{ the OnUses callback function is called for each "uses" in the script.
It's always called with the parameter 'SYSTEM' at the top of the script.
For example: uses ii1, ii2;
This will call this function 3 times. First with 'SYSTEM' then 'II1' and then 'II2'.
}
begin
if Name = 'SYSTEM' then
begin
SIRegister_Std(Sender);
{ This will register the declarations of these classes:
TObject, TPersisent. This can be found
in the uPSC_std.pas unit. }
SIRegister_Controls(Sender);
{ This will register the declarations of these classes:
TControl, TWinControl, TFont, TStrings, TStringList, TGraphicControl. This can be found
in the uPSC_controls.pas unit. }
SIRegister_Forms(Sender);
{ This will register: TScrollingWinControl, TCustomForm, TForm and TApplication. uPSC_forms.pas unit. }
SIRegister_stdctrls(Sender);
{ This will register: TButtonContol, TButton, TCustomCheckbox, TCheckBox, TCustomEdit, TEdit, TCustomMemo, TMemo,
TCustomLabel and TLabel. Can be found in the uPSC_stdctrls.pas unit. }
AddImportedClassVariable(Sender, 'Application', 'TApplication');
// Registers the application variable to the script engine.
Result := True;
end else
Result := False;
end;
procedure ExecuteScript(const Script: string);
var
Compiler: TPSPascalCompiler;
{ TPSPascalCompiler is the compiler part of the scriptengine. This will
translate a Pascal script into a compiled form the executer understands. }
Exec: TPSExec;
{ TPSExec is the executer part of the scriptengine. It uses the output of
the compiler to run a script. }
Data: string;
CI: TPSRuntimeClassImporter;
begin
Compiler := TPSPascalCompiler.Create; // create an instance of the compiler.
Compiler.OnUses := ScriptOnUses; // assign the OnUses event.
if not Compiler.Compile(Script) then // Compile the Pascal script into bytecode.
begin
Compiler.Free;
// You could raise an exception here.
Exit;
end;
Compiler.GetOutput(Data); // Save the output of the compiler in the string Data.
Compiler.Free; // After compiling the script, there is no need for the compiler anymore.
CI := TPSRuntimeClassImporter.Create;
{ Create an instance of the runtime class importer.}
RIRegister_Std(CI); // uPSR_std.pas unit.
RIRegister_Controls(CI); // uPSR_controls.pas unti.
RIRegister_stdctrls(CI); // uPSR_stdctrls.pas unit.
RIRegister_Forms(CI); // uPSR_forms.pas unit.
Exec := TPSExec.Create; // Create an instance of the executer.
RegisterClassLibraryRuntime(Exec, CI);
// Assign the runtime class importer to the executer.
if not Exec.LoadData(Data) then // Load the data from the Data string.
begin
{ For some reason the script could not be loaded. This is usually the case when a
library that has been used at compile time isn't registered at runtime. }
Exec.Free;
// You could raise an exception here.
Exit;
end;
SetVariantToClass(Exec.GetVarNo(Exec.GetVar('APPLICATION')), Application);
// This will set the script's Application variable to the real Application variable.
Exec.RunScript; // Run the script.
Exec.Free; // Free the executer.
CI.Free; // Free the runtime class importer.
end;
const
Script =
'var f: TForm; i: Longint; begin f := TForm.CreateNew(f, 0); f.Show; while f.Visible do Application.ProcessMessages; F.free; end.';
begin
ExecuteScript(Script);
end.

136
Samples/Console/sample6.dpr Normal file
View File

@ -0,0 +1,136 @@
program sample6;
uses
uPSCompiler,
uPSUtils,
uPSRuntime,
Dialogs
;
procedure MyOwnFunction(const Data: string);
begin
// Do something with Data
ShowMessage(Data);
end;
function ScriptOnExportCheck(Sender: TPSPascalCompiler; Proc: TPSInternalProcedure; const ProcDecl: string): Boolean;
{
The OnExportCheck callback function is called for each function in the script
(Also for the main proc, with '!MAIN' as a Proc^.Name). ProcDecl contains the
result type and parameter types of a function using this format:
ProcDecl: ResultType + ' ' + Parameter1 + ' ' + Parameter2 + ' '+Parameter3 + .....
Parameter: ParameterType+TypeName
ParameterType is @ for a normal parameter and ! for a var parameter.
A result type of 0 means no result.
}
begin
if Proc.Name = 'TEST' then // Check if the proc is the Test proc we want.
begin
if not ExportCheck(Sender, Proc, [0, btString], [pmIn]) then // Check if the proc has the correct params.
begin
{ Something is wrong, so cause an error at the declaration position of the proc. }
Sender.MakeError('', ecTypeMismatch, '');
Result := False;
Exit;
end;
Result := True;
end else Result := True;
end;
function ScriptOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
{ the OnUses callback function is called for each "uses" in the script.
It's always called with the parameter 'SYSTEM' at the top of the script.
For example: uses ii1, ii2;
This will call this function 3 times. First with 'SYSTEM' then 'II1' and then 'II2'.
}
begin
if Name = 'SYSTEM' then
begin
Sender.AddDelphiFunction('procedure MyOwnFunction(Data: string)');
{ This will register the function to the script engine. Now it can be used from within the script. }
Result := True;
end else
Result := False;
end;
procedure ExecuteScript(const Script: string);
var
Compiler: TPSPascalCompiler;
{ TPSPascalCompiler is the compiler part of the scriptengine. This will
translate a Pascal script into a compiled form the executer understands. }
Exec: TPSExec;
{ TPSExec is the executer part of the scriptengine. It uses the output of
the compiler to run a script. }
Data: string;
N: PIfVariant;
{ The variant in which we are going to store the parameter }
ParamList: TIfList;
{ The parameter list}
begin
Compiler := TPSPascalCompiler.Create; // create an instance of the compiler.
Compiler.OnUses := ScriptOnUses; // assign the OnUses event.
Compiler.OnExportCheck := ScriptOnExportCheck; // Assign the onExportCheck event.
if not Compiler.Compile(Script) then // Compile the Pascal script into bytecode.
begin
Compiler.Free;
// You could raise an exception here.
Exit;
end;
Compiler.GetOutput(Data); // Save the output of the compiler in the string Data.
Compiler.Free; // After compiling the script, there is no need for the compiler anymore.
Exec := TPSExec.Create; // Create an instance of the executer.
Exec.RegisterDelphiFunction(@MyOwnFunction, 'MYOWNFUNCTION', cdRegister);
{ This will register the function to the executer. The first parameter is the executer. The second parameter is a
pointer to the function. The third parameter is the name of the function (in uppercase). And the last parameter is the
calling convention (usually Register). }
if not Exec.LoadData(Data) then // Load the data from the Data string.
begin
{ For some reason the script could not be loaded. This is usually the case when a
library that has been used at compile time isn't registered at runtime. }
Exec.Free;
// You could raise an exception here.
Exit;
end;
ParamList := TIfList.Create; // Create the parameter list
N := CreateHeapVariant(Exec.FindType2(btString));
{ Create a variant for the string parameter }
if n = nil then
begin
{ Something is wrong. Exit here }
ParamList.Free;
Exec.Free;
Exit;
end;
VSetString(n, 'Test Parameter!');
// Put something in the string parameter.
ParamList.Add(n); // Add it to the parameter list.
Exec.RunProc(ParamList, Exec.GetProc('TEST'));
{ This will call the test proc that was exported before }
FreePIFVariantList(ParamList); // Cleanup the parameters (This will also free N)
Exec.Free; // Free the executer.
end;
const
Script = 'procedure test(s: string); begin MyOwnFunction(''Test is called: ''+s);end; begin end.';
begin
ExecuteScript(Script);
end.

145
Samples/Console/sample7.dpr Normal file
View File

@ -0,0 +1,145 @@
program sample7;
uses
uPSCompiler,
uPSRuntime,
uPSUtils,
Dialogs
;
procedure MyOwnFunction(const Data: string);
begin
// Do something with Data
ShowMessage(Data);
end;
function ScriptOnExportCheck(Sender: TPSPascalCompiler; Proc: TPSInternalProcedure; const ProcDecl: string): Boolean;
{
The OnExportCheck callback function is called for each function in the script
(Also for the main proc, with '!MAIN' as a Proc^.Name). ProcDecl contains the
result type and parameter types of a function using this format:
ProcDecl: ResultType + ' ' + Parameter1 + ' ' + Parameter2 + ' '+Parameter3 + .....
Parameter: ParameterType+TypeName
ParameterType is @ for a normal parameter and ! for a var parameter.
A result type of 0 means no result.
}
begin
if Proc.Name = 'TEST' then // Check if the proc is the Test proc we want.
begin
if ProcDecl <> '0 @TSTRINGARRAY' then // Check if the proc has the correct params.
begin
{ Something is wrong, so cause an error. }
Sender.MakeError('', ecTypeMismatch, '');
Result := False;
Exit;
end;
{ Export the proc; This is needed because PS doesn't store the name of a
function by default }
Result := True;
end else Result := True;
end;
function ScriptOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
{ the OnUses callback function is called for each "uses" in the script.
It's always called with the parameter 'SYSTEM' at the top of the script.
For example: uses ii1, ii2;
This will call this function 3 times. First with 'SYSTEM' then 'II1' and then 'II2'.
}
begin
if Name = 'SYSTEM' then
begin
Sender.AddDelphiFunction('procedure MyOwnFunction(Data: string)');
{ This will register the function to the script engine. Now it can be used from within the script. }
Sender.AddTypeS('TSTRINGARRAY', 'array of string').ExportName := True;
{ Add the type to the script engine (and export it) }
Result := True;
end else
Result := False;
end;
type
TStringArr = array[0..1] of string;
procedure ExecuteScript(const Script: string);
var
Compiler: TPSPascalCompiler;
{ TPSPascalCompiler is the compiler part of the scriptengine. This will
translate a Pascal script into a compiled form the executer understands. }
Exec: TPSExec;
{ TPSExec is the executer part of the scriptengine. It uses the output of
the compiler to run a script. }
Data: string;
N: PIfVariant;
{ The variant in which we are going to store the parameter }
ParamList: TIfList;
{ The parameter list}
begin
Compiler := TPSPascalCompiler.Create; // create an instance of the compiler.
Compiler.OnUses := ScriptOnUses; // assign the OnUses event.
Compiler.OnExportCheck := ScriptOnExportCheck; // Assign the onExportCheck event.
if not Compiler.Compile(Script) then // Compile the Pascal script into bytecode.
begin
Compiler.Free;
// You could raise an exception here.
Exit;
end;
Compiler.GetOutput(Data); // Save the output of the compiler in the string Data.
Compiler.Free; // After compiling the script, there is no need for the compiler anymore.
Exec := TPSExec.Create; // Create an instance of the executer.
Exec.RegisterDelphiFunction(@MyOwnFunction, 'MYOWNFUNCTION', cdRegister);
if not Exec.LoadData(Data) then // Load the data from the Data string.
begin
{ For some reason the script could not be loaded. This is usually the case when a
library that has been used at compile time isn't registered at runtime. }
Exec.Free;
// You could raise an exception here.
Exit;
end;
ParamList := TIfList.Create; // Create the parameter list
n := CreateHeapVariant(Exec.GetTypeNo(Exec.GetType('TSTRINGARRAY')));
{ Create a variant for the array parameter }
if n = nil then
begin
{ Something is wrong. Exit here }
ParamList.Free;
Exec.Free;
Exit;
end;
PSDynArraySetLength(PPSVariantDynamicArray(n).Data, PPSVariantDynamicArray(n).VI.FType, 2); // Put two items in the array
TStringArr(PPSVariantDynamicArray(n).Data^)[0] := 'First item';
TStringArr(PPSVariantDynamicArray(n).Data^)[1] := 'Second item';
// Put something in the string parameter.
ParamList.Add(n); // Add it to the parameter list.
Exec.RunProc(ParamList, Exec.GetProc('TEST'));
{ This will call the test proc that was exported before }
FreePIFVariantList(ParamList); // Cleanup the parameters (This will also free N)
Exec.Free; // Free the executer.
end;
const
Script = 'procedure test(s: tstringarray); var i: Longint; begin for i := 0 to GetArrayLength(S) -1 do MyOwnFunction(''Test is called: ''+s[i]);end; begin end.';
begin
ExecuteScript(Script);
end.

122
Samples/Console/sample8.dpr Normal file
View File

@ -0,0 +1,122 @@
program sample8;
uses
uPSCompiler,
uPSRuntime,
uPSUtils,
Dialogs
;
procedure MyOwnFunction(const Data: string);
begin
// Do something with Data
ShowMessage(Data);
end;
function ScriptOnExportCheck(Sender: TPSPascalCompiler; Proc: TPSInternalProcedure; const ProcDecl: string): Boolean;
{
The OnExportCheck callback function is called for each function in the script
(Also for the main proc, with '!MAIN' as a Proc^.Name). ProcDecl contains the
result type and parameter types of a function using this format:
ProcDecl: ResultType + ' ' + Parameter1 + ' ' + Parameter2 + ' '+Parameter3 + .....
Parameter: ParameterType+TypeName
ParameterType is @ for a normal parameter and ! for a var parameter.
A result type of 0 means no result.
}
begin
if Proc.Name = 'TEST' then // Check if the proc is the Test proc we want.
begin
if not ExportCheck(Sender, Proc, [btString, btString], [pmIn]) then // Check if the proc has the correct params.
begin
{ Something is wrong, so cause an error. }
Sender.MakeError('', ecTypeMismatch, '');
Result := False;
Exit;
end;
Result := True;
end else Result := True;
end;
function ScriptOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
{ the OnUses callback function is called for each "uses" in the script.
It's always called with the parameter 'SYSTEM' at the top of the script.
For example: uses ii1, ii2;
This will call this function 3 times. First with 'SYSTEM' then 'II1' and then 'II2'.
}
begin
if Name = 'SYSTEM' then
begin
Sender.AddDelphiFunction('procedure MyOwnFunction(Data: string)');
{ This will register the function to the script engine. Now it can be used from within the script. }
Result := True;
end else
Result := False;
end;
type
TTestFunction = function (const s: string): string of object;
// Header of the test function, added of object.
procedure ExecuteScript(const Script: string);
var
Compiler: TPSPascalCompiler;
{ TPSPascalCompiler is the compiler part of the scriptengine. This will
translate a Pascal script into a compiled form the executer understands. }
Exec: TPSExec;
{ TPSExec is the executer part of the scriptengine. It uses the output of
the compiler to run a script. }
Data: string;
TestFunc: TTestFunction;
begin
Compiler := TPSPascalCompiler.Create; // create an instance of the compiler.
Compiler.OnUses := ScriptOnUses; // assign the OnUses event.
Compiler.OnExportCheck := ScriptOnExportCheck; // Assign the onExportCheck event.
Compiler.AllowNoBegin := True;
Compiler.AllowNoEnd := True; // AllowNoBegin and AllowNoEnd allows it that begin and end are not required in a script.
if not Compiler.Compile(Script) then // Compile the Pascal script into bytecode.
begin
Compiler.Free;
// You could raise an exception here.
Exit;
end;
Compiler.GetOutput(Data); // Save the output of the compiler in the string Data.
Compiler.Free; // After compiling the script, there is no need for the compiler anymore.
Exec := TPSExec.Create; // Create an instance of the executer.
Exec.RegisterDelphiFunction(@MyOwnFunction, 'MYOWNFUNCTION', cdRegister);
if not Exec.LoadData(Data) then // Load the data from the Data string.
begin
{ For some reason the script could not be loaded. This is usually the case when a
library that has been used at compile time isn't registered at runtime. }
Exec.Free;
// You could raise an exception here.
Exit;
end;
TestFunc := TTestFunction(Exec.GetProcAsMethodN('Test'));
if @TestFunc <> nil then
ShowMessage('Result from TestFunc(''test indata''): '+TestFunc('test indata'));
Exec.Free; // Free the executer.
end;
const
Script = 'function test(s: string): string; begin MyOwnFunction(''Test Called with param: ''+s); Result := ''Test Result: ''+s; end;';
begin
ExecuteScript(Script);
end.

Binary file not shown.

View File

@ -0,0 +1,107 @@
{-------------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: dlgConfirmReplace.dpr, released 2000-06-23.
The Original Code is part of the SearchReplaceDemo project, written by
Michael Hieke for the SynEdit component suite.
All Rights Reserved.
Contributors to the SynEdit project are listed in the Contributors.txt file.
Alternatively, the contents of this file may be used under the terms of the
GNU General Public License Version 2 or later (the "GPL"), in which case
the provisions of the GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the GPL and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your version
of this file under either the MPL or the GPL.
$Id: dlgConfirmReplace.pas,v 1.2 2000/11/22 08:37:05 mghie Exp $
You may retrieve the latest version of this file at the SynEdit home page,
located at http://SynEdit.SourceForge.net
Known Issues:
-------------------------------------------------------------------------------}
unit dlgConfirmReplace;
{$I SynEdit.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TConfirmReplaceDialog = class(TForm)
btnReplace: TButton;
lblConfirmation: TLabel;
btnSkip: TButton;
btnCancel: TButton;
btnReplaceAll: TButton;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
public
procedure PrepareShow(AEditorRect: TRect; X, Y1, Y2: integer;
AReplaceText: string);
end;
var
ConfirmReplaceDialog: TConfirmReplaceDialog;
implementation
{$R *.DFM}
resourcestring
SAskReplaceText = 'Replace this occurence of "%s"?';
{ TConfirmReplaceDialog }
procedure TConfirmReplaceDialog.FormCreate(Sender: TObject);
begin
Image1.Picture.Icon.Handle := LoadIcon(0, IDI_QUESTION);
end;
procedure TConfirmReplaceDialog.FormDestroy(Sender: TObject);
begin
ConfirmReplaceDialog := nil;
end;
procedure TConfirmReplaceDialog.PrepareShow(AEditorRect: TRect;
X, Y1, Y2: integer; AReplaceText: string);
var
nW, nH: integer;
begin
lblConfirmation.Caption := Format(SAskReplaceText, [AReplaceText]);
nW := AEditorRect.Right - AEditorRect.Left;
nH := AEditorRect.Bottom - AEditorRect.Top;
if nW <= Width then
X := AEditorRect.Left - (Width - nW) div 2
else begin
if X + Width > AEditorRect.Right then
X := AEditorRect.Right - Width;
end;
if Y2 > AEditorRect.Top + MulDiv(nH, 2, 3) then
Y2 := Y1 - Height - 4
else
Inc(Y2, 4);
SetBounds(X, Y2, Width, Height);
end;
end.

Binary file not shown.

View File

@ -0,0 +1,121 @@
{-------------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: dlgReplaceText.pas, released 2000-06-23.
The Original Code is part of the SearchReplaceDemo project, written by
Michael Hieke for the SynEdit component suite.
All Rights Reserved.
Contributors to the SynEdit project are listed in the Contributors.txt file.
Alternatively, the contents of this file may be used under the terms of the
GNU General Public License Version 2 or later (the "GPL"), in which case
the provisions of the GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the GPL and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your version
of this file under either the MPL or the GPL.
$Id: dlgReplaceText.pas,v 1.2 2000/11/22 08:37:05 mghie Exp $
You may retrieve the latest version of this file at the SynEdit home page,
located at http://SynEdit.SourceForge.net
Known Issues:
-------------------------------------------------------------------------------}
unit dlgReplaceText;
{$I SynEdit.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
dlgSearchText, StdCtrls, ExtCtrls;
type
TTextReplaceDialog = class(TTextSearchDialog)
Label2: TLabel;
cbReplaceText: TComboBox;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
function GetReplaceText: string;
function GetReplaceTextHistory: string;
procedure SetReplaceText(Value: string);
procedure SetReplaceTextHistory(Value: string);
public
property ReplaceText: string read GetReplaceText write SetReplaceText;
property ReplaceTextHistory: string read GetReplaceTextHistory
write SetReplaceTextHistory;
end;
implementation
{$R *.DFM}
{ TTextReplaceDialog }
function TTextReplaceDialog.GetReplaceText: string;
begin
Result := cbReplaceText.Text;
end;
function TTextReplaceDialog.GetReplaceTextHistory: string;
var
i: integer;
begin
Result := '';
for i := 0 to cbReplaceText.Items.Count - 1 do begin
if i >= 10 then
break;
if i > 0 then
Result := Result + #13#10;
Result := Result + cbReplaceText.Items[i];
end;
end;
procedure TTextReplaceDialog.SetReplaceText(Value: string);
begin
cbReplaceText.Text := Value;
end;
procedure TTextReplaceDialog.SetReplaceTextHistory(Value: string);
begin
cbReplaceText.Items.Text := Value;
end;
procedure TTextReplaceDialog.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
var
s: string;
i: integer;
begin
inherited;
if ModalResult = mrOK then begin
s := cbReplaceText.Text;
if s <> '' then begin
i := cbReplaceText.Items.IndexOf(s);
if i > -1 then begin
cbReplaceText.Items.Delete(i);
cbReplaceText.Items.Insert(0, s);
cbReplaceText.Text := s;
end else
cbReplaceText.Items.Insert(0, s);
end;
end;
end;
end.

Binary file not shown.

View File

@ -0,0 +1,216 @@
{-------------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: dlgSearchText.pas, released 2000-06-23.
The Original Code is part of the SearchReplaceDemo project, written by
Michael Hieke for the SynEdit component suite.
All Rights Reserved.
Contributors to the SynEdit project are listed in the Contributors.txt file.
Alternatively, the contents of this file may be used under the terms of the
GNU General Public License Version 2 or later (the "GPL"), in which case
the provisions of the GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the GPL and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your version
of this file under either the MPL or the GPL.
$Id: dlgSearchText.pas,v 1.3 2002/08/01 05:44:05 etrusco Exp $
You may retrieve the latest version of this file at the SynEdit home page,
located at http://SynEdit.SourceForge.net
Known Issues:
-------------------------------------------------------------------------------}
unit dlgSearchText;
{$I SynEdit.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TTextSearchDialog = class(TForm)
Label1: TLabel;
cbSearchText: TComboBox;
rgSearchDirection: TRadioGroup;
gbSearchOptions: TGroupBox;
cbSearchCaseSensitive: TCheckBox;
cbSearchWholeWords: TCheckBox;
cbSearchFromCursor: TCheckBox;
cbSearchSelectedOnly: TCheckBox;
btnOK: TButton;
btnCancel: TButton;
cbRegularExpression: TCheckBox;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
function GetSearchBackwards: boolean;
function GetSearchCaseSensitive: boolean;
function GetSearchFromCursor: boolean;
function GetSearchInSelection: boolean;
function GetSearchText: string;
function GetSearchTextHistory: string;
function GetSearchWholeWords: boolean;
procedure SetSearchBackwards(Value: boolean);
procedure SetSearchCaseSensitive(Value: boolean);
procedure SetSearchFromCursor(Value: boolean);
procedure SetSearchInSelection(Value: boolean);
procedure SetSearchText(Value: string);
procedure SetSearchTextHistory(Value: string);
procedure SetSearchWholeWords(Value: boolean);
procedure SetSearchRegularExpression(const Value: boolean);
function GetSearchRegularExpression: boolean;
public
property SearchBackwards: boolean read GetSearchBackwards
write SetSearchBackwards;
property SearchCaseSensitive: boolean read GetSearchCaseSensitive
write SetSearchCaseSensitive;
property SearchFromCursor: boolean read GetSearchFromCursor
write SetSearchFromCursor;
property SearchInSelectionOnly: boolean read GetSearchInSelection
write SetSearchInSelection;
property SearchText: string read GetSearchText write SetSearchText;
property SearchTextHistory: string read GetSearchTextHistory
write SetSearchTextHistory;
property SearchWholeWords: boolean read GetSearchWholeWords
write SetSearchWholeWords;
property SearchRegularExpression: boolean read GetSearchRegularExpression
write SetSearchRegularExpression;
end;
implementation
{$R *.DFM}
{ TTextSearchDialog }
function TTextSearchDialog.GetSearchBackwards: boolean;
begin
Result := rgSearchDirection.ItemIndex = 1;
end;
function TTextSearchDialog.GetSearchCaseSensitive: boolean;
begin
Result := cbSearchCaseSensitive.Checked;
end;
function TTextSearchDialog.GetSearchFromCursor: boolean;
begin
Result := cbSearchFromCursor.Checked;
end;
function TTextSearchDialog.GetSearchInSelection: boolean;
begin
Result := cbSearchSelectedOnly.Checked;
end;
function TTextSearchDialog.GetSearchRegularExpression: boolean;
begin
Result := cbRegularExpression.Checked;
end;
function TTextSearchDialog.GetSearchText: string;
begin
Result := cbSearchText.Text;
end;
function TTextSearchDialog.GetSearchTextHistory: string;
var
i: integer;
begin
Result := '';
for i := 0 to cbSearchText.Items.Count - 1 do begin
if i >= 10 then
break;
if i > 0 then
Result := Result + #13#10;
Result := Result + cbSearchText.Items[i];
end;
end;
function TTextSearchDialog.GetSearchWholeWords: boolean;
begin
Result := cbSearchWholeWords.Checked;
end;
procedure TTextSearchDialog.SetSearchBackwards(Value: boolean);
begin
rgSearchDirection.ItemIndex := Ord(Value);
end;
procedure TTextSearchDialog.SetSearchCaseSensitive(Value: boolean);
begin
cbSearchCaseSensitive.Checked := Value;
end;
procedure TTextSearchDialog.SetSearchFromCursor(Value: boolean);
begin
cbSearchFromCursor.Checked := Value;
end;
procedure TTextSearchDialog.SetSearchInSelection(Value: boolean);
begin
cbSearchSelectedOnly.Checked := Value;
end;
procedure TTextSearchDialog.SetSearchText(Value: string);
begin
cbSearchText.Text := Value;
end;
procedure TTextSearchDialog.SetSearchTextHistory(Value: string);
begin
cbSearchText.Items.Text := Value;
end;
procedure TTextSearchDialog.SetSearchWholeWords(Value: boolean);
begin
cbSearchWholeWords.Checked := Value;
end;
procedure TTextSearchDialog.SetSearchRegularExpression(
const Value: boolean);
begin
cbRegularExpression.Checked := Value;
end;
{ event handlers }
procedure TTextSearchDialog.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
var
s: string;
i: integer;
begin
if ModalResult = mrOK then begin
s := cbSearchText.Text;
if s <> '' then begin
i := cbSearchText.Items.IndexOf(s);
if i > -1 then begin
cbSearchText.Items.Delete(i);
cbSearchText.Items.Insert(0, s);
cbSearchText.Text := s;
end else
cbSearchText.Items.Insert(0, s);
end;
end;
end;
end.

21
Samples/Debug/ide.dpr Normal file
View File

@ -0,0 +1,21 @@
program ide;
uses
Forms,
ide_editor in 'ide_editor.pas' {editor},
ide_debugoutput in 'ide_debugoutput.pas' {debugoutput},
uFrmGotoLine in 'uFrmGotoLine.pas' {frmGotoLine},
dlgSearchText in 'dlgSearchText.pas' {TextSearchDialog},
dlgConfirmReplace in 'dlgConfirmReplace.pas' {ConfirmReplaceDialog},
dlgReplaceText in 'dlgReplaceText.pas' {TextReplaceDialog};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(Teditor, editor);
Application.CreateForm(Tdebugoutput, debugoutput);
Application.CreateForm(TfrmGotoLine, frmGotoLine);
Application.CreateForm(TConfirmReplaceDialog, ConfirmReplaceDialog);
Application.Run;
end.

BIN
Samples/Debug/ide.res Normal file

Binary file not shown.

View File

@ -0,0 +1,27 @@
object debugoutput: Tdebugoutput
Left = 192
Top = 107
Width = 530
Height = 366
Caption = 'Debug Output'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object output: TMemo
Left = 0
Top = 0
Width = 522
Height = 339
Align = alClient
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WordWrap = False
end
end

View File

@ -0,0 +1,33 @@
unit ide_debugoutput;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tdebugoutput = class(TForm)
output: TMemo;
private
public
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
var
debugoutput: Tdebugoutput;
implementation
{$R *.dfm}
{ Tdebugoutput }
procedure Tdebugoutput.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
end;
end.

View File

@ -0,0 +1,296 @@
object editor: Teditor
Left = 350
Top = 222
Width = 696
Height = 480
Caption = 'Editor'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -14
Font.Name = 'MS Sans Serif'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
Position = poDesktopCenter
PixelsPerInch = 120
TextHeight = 16
object Splitter1: TSplitter
Left = 0
Top = 311
Width = 688
Height = 4
Cursor = crVSplit
Align = alBottom
end
object ed: TSynEdit
Left = 0
Top = 0
Width = 688
Height = 311
Align = alClient
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -17
Font.Name = 'Courier New'
Font.Style = []
PopupMenu = PopupMenu1
TabOrder = 0
Gutter.AutoSize = True
Gutter.Font.Charset = DEFAULT_CHARSET
Gutter.Font.Color = clWindowText
Gutter.Font.Height = -11
Gutter.Font.Name = 'Terminal'
Gutter.Font.Style = []
Gutter.ShowLineNumbers = True
Highlighter = pashighlighter
Lines.Strings = (
'Program test;'
'begin'
'end.')
Options = [eoAutoIndent, eoDragDropEditing, eoDropFiles, eoGroupUndo, eoScrollPastEol, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces]
OnDropFiles = edDropFiles
OnSpecialLineColors = edSpecialLineColors
OnStatusChange = edStatusChange
RemovedKeystrokes = <
item
Command = ecContextHelp
ShortCut = 112
end>
AddedKeystrokes = <
item
Command = ecContextHelp
ShortCut = 16496
end>
end
object messages: TListBox
Left = 0
Top = 315
Width = 688
Height = 81
Align = alBottom
ItemHeight = 16
TabOrder = 1
OnDblClick = messagesDblClick
end
object StatusBar: TStatusBar
Left = 0
Top = 396
Width = 688
Height = 19
Panels = <
item
Width = 50
end>
end
object ce: TPSScriptDebugger
CompilerOptions = []
OnCompile = ceCompile
OnExecute = ceExecute
OnAfterExecute = ceAfterExecute
Plugins = <
item
Plugin = IFPS3CE_DateUtils1
end
item
Plugin = IFPS3CE_Std1
end
item
Plugin = IFPS3CE_Controls1
end
item
Plugin = IFPS3CE_StdCtrls1
end
item
Plugin = IFPS3CE_Forms1
end
item
Plugin = IFPS3DllPlugin1
end
item
Plugin = IFPS3CE_ComObj1
end>
MainFileName = 'Unnamed'
UsePreProcessor = True
OnNeedFile = ceNeedFile
OnIdle = ceIdle
OnLineInfo = ceLineInfo
OnBreakpoint = ceBreakpoint
Left = 592
Top = 112
end
object IFPS3DllPlugin1: TPSDllPlugin
Left = 560
Top = 112
end
object pashighlighter: TSynPasSyn
Left = 592
Top = 64
end
object PopupMenu1: TPopupMenu
Left = 592
Top = 16
object BreakPointMenu: TMenuItem
Caption = '&Set/Clear Breakpoint'
ShortCut = 116
OnClick = BreakPointMenuClick
end
end
object MainMenu1: TMainMenu
Left = 592
Top = 160
object File1: TMenuItem
Caption = '&File'
object New1: TMenuItem
Caption = '&New'
ShortCut = 16462
OnClick = New1Click
end
object N3: TMenuItem
Caption = '-'
end
object Open1: TMenuItem
Caption = '&Open...'
ShortCut = 16463
OnClick = Open1Click
end
object Save1: TMenuItem
Caption = '&Save'
ShortCut = 16467
OnClick = Save1Click
end
object Saveas1: TMenuItem
Caption = 'Save &as...'
OnClick = Saveas1Click
end
object N4: TMenuItem
Caption = '-'
end
object Exit1: TMenuItem
Caption = '&Exit'
OnClick = Exit1Click
end
end
object Search1: TMenuItem
Caption = '&Search'
object Find1: TMenuItem
Caption = '&Find...'
OnClick = Find1Click
end
object Replace1: TMenuItem
Caption = '&Replace...'
OnClick = Replace1Click
end
object Searchagain1: TMenuItem
Caption = '&Search again'
OnClick = Searchagain1Click
end
object N6: TMenuItem
Caption = '-'
end
object Gotolinenumber1: TMenuItem
Caption = '&Go to...'
OnClick = Gotolinenumber1Click
end
end
object Run1: TMenuItem
Caption = '&Run'
object Syntaxcheck1: TMenuItem
Caption = 'Syntax &check'
OnClick = Syntaxcheck1Click
end
object Decompile1: TMenuItem
Caption = '&Decompile...'
OnClick = Decompile1Click
end
object N5: TMenuItem
Caption = '-'
end
object StepOver1: TMenuItem
Caption = '&Step Over'
ShortCut = 119
OnClick = StepOver1Click
end
object StepInto1: TMenuItem
Caption = 'Step &Into'
ShortCut = 118
OnClick = StepInto1Click
end
object N1: TMenuItem
Caption = '-'
end
object Pause1: TMenuItem
Caption = '&Pause'
OnClick = Pause1Click
end
object Reset1: TMenuItem
Caption = 'R&eset'
ShortCut = 16497
OnClick = Reset1Click
end
object N2: TMenuItem
Caption = '-'
end
object Run2: TMenuItem
Caption = '&Run'
ShortCut = 120
OnClick = Run2Click
end
end
end
object SaveDialog1: TSaveDialog
DefaultExt = 'ROPS'
Filter = 'ROPS Files|*.ROPS'
Options = [ofHideReadOnly, ofPathMustExist, ofEnableSizing]
Left = 200
Top = 104
end
object OpenDialog1: TOpenDialog
DefaultExt = 'ROPS'
Filter = 'ROPS Files|*.ROPS'
Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing]
Left = 168
Top = 104
end
object IFPS3CE_Controls1: TPSImport_Controls
EnableStreams = True
EnableGraphics = True
EnableControls = True
Left = 328
Top = 40
end
object IFPS3CE_DateUtils1: TPSImport_DateUtils
Left = 328
Top = 72
end
object IFPS3CE_Std1: TPSImport_Classes
EnableStreams = True
EnableClasses = True
Left = 328
Top = 104
end
object IFPS3CE_Forms1: TPSImport_Forms
EnableForms = True
EnableMenus = True
Left = 328
Top = 136
end
object IFPS3CE_StdCtrls1: TPSImport_StdCtrls
EnableExtCtrls = True
EnableButtons = True
Left = 328
Top = 168
end
object IFPS3CE_ComObj1: TPSImport_ComObj
Left = 328
Top = 200
end
object SynEditSearch: TSynEditSearch
Left = 136
Top = 216
end
object SynEditRegexSearch: TSynEditRegexSearch
Left = 168
Top = 216
end
end

View File

@ -0,0 +1,649 @@
//Version: 31Jan2005
unit ide_editor;
interface
uses
Windows, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ExtCtrls, StdCtrls, ComCtrls,
SynEdit, SynEditTypes, SynHighlighterPas,
uPSComponent_COM, uPSComponent_StdCtrls, uPSComponent_Forms,
uPSComponent_Default, uPSComponent_Controls,
uPSRuntime, uPSDisassembly, uPSUtils,
uPSComponent, uPSDebugger, SynEditRegexSearch,
SynEditSearch, SynEditMiscClasses, SynEditHighlighter;
type
Teditor = class(TForm)
ce: TPSScriptDebugger;
IFPS3DllPlugin1: TPSDllPlugin;
pashighlighter: TSynPasSyn;
ed: TSynEdit;
PopupMenu1: TPopupMenu;
BreakPointMenu: TMenuItem;
MainMenu1: TMainMenu;
File1: TMenuItem;
Run1: TMenuItem;
StepOver1: TMenuItem;
StepInto1: TMenuItem;
N1: TMenuItem;
Reset1: TMenuItem;
N2: TMenuItem;
Run2: TMenuItem;
Exit1: TMenuItem;
messages: TListBox;
Splitter1: TSplitter;
SaveDialog1: TSaveDialog;
OpenDialog1: TOpenDialog;
N3: TMenuItem;
N4: TMenuItem;
New1: TMenuItem;
Open1: TMenuItem;
Save1: TMenuItem;
Saveas1: TMenuItem;
StatusBar: TStatusBar;
Decompile1: TMenuItem;
N5: TMenuItem;
IFPS3CE_Controls1: TPSImport_Controls;
IFPS3CE_DateUtils1: TPSImport_DateUtils;
IFPS3CE_Std1: TPSImport_Classes;
IFPS3CE_Forms1: TPSImport_Forms;
IFPS3CE_StdCtrls1: TPSImport_StdCtrls;
IFPS3CE_ComObj1: TPSImport_ComObj;
Pause1: TMenuItem;
SynEditSearch: TSynEditSearch;
SynEditRegexSearch: TSynEditRegexSearch;
Search1: TMenuItem;
Find1: TMenuItem;
Replace1: TMenuItem;
Searchagain1: TMenuItem;
N6: TMenuItem;
Gotolinenumber1: TMenuItem;
Syntaxcheck1: TMenuItem;
procedure edSpecialLineColors(Sender: TObject; Line: Integer; var Special: Boolean; var FG, BG: TColor);
procedure BreakPointMenuClick(Sender: TObject);
procedure ceLineInfo(Sender: TObject; const FileName: String; Position, Row, Col: Cardinal);
procedure Exit1Click(Sender: TObject);
procedure StepOver1Click(Sender: TObject);
procedure StepInto1Click(Sender: TObject);
procedure Reset1Click(Sender: TObject);
procedure ceIdle(Sender: TObject);
procedure Run2Click(Sender: TObject);
procedure ceExecute(Sender: TPSScript);
procedure ceAfterExecute(Sender: TPSScript);
procedure ceCompile(Sender: TPSScript);
procedure New1Click(Sender: TObject);
procedure Open1Click(Sender: TObject);
procedure Save1Click(Sender: TObject);
procedure Saveas1Click(Sender: TObject);
procedure edStatusChange(Sender: TObject; Changes: TSynStatusChanges);
procedure Decompile1Click(Sender: TObject);
function ceNeedFile(Sender: TObject; const OrginFileName: String; var FileName, Output: String): Boolean;
procedure ceBreakpoint(Sender: TObject; const FileName: String; Position, Row, Col: Cardinal);
procedure Pause1Click(Sender: TObject);
procedure messagesDblClick(Sender: TObject);
procedure Gotolinenumber1Click(Sender: TObject);
procedure Find1Click(Sender: TObject);
procedure Searchagain1Click(Sender: TObject);
procedure Replace1Click(Sender: TObject);
procedure Syntaxcheck1Click(Sender: TObject);
procedure edDropFiles(Sender: TObject; X, Y: Integer;
AFiles: TStrings);
private
FSearchFromCaret: boolean;
FActiveLine: Longint;
FResume: Boolean;
FActiveFile: string;
function Compile: Boolean;
function Execute: Boolean;
procedure Writeln(const s: string);
procedure Readln(var s: string);
procedure SetActiveFile(const Value: string);
procedure DoSearchReplaceText(AReplace: boolean; ABackwards: boolean);
procedure ShowSearchReplaceDialog(AReplace: boolean);
property aFile: string read FActiveFile write SetActiveFile;
public
function SaveCheck: Boolean;
end;
var
editor: Teditor;
implementation
uses
ide_debugoutput,
uFrmGotoLine,
dlgSearchText, dlgReplaceText, dlgConfirmReplace;
{$R *.dfm}
const
isRunningOrPaused = [isRunning, isPaused];
// options - to be saved to the registry
var
gbSearchBackwards: boolean;
gbSearchCaseSensitive: boolean;
gbSearchFromCaret: boolean;
gbSearchSelectionOnly: boolean;
gbSearchTextAtCaret: boolean;
gbSearchWholeWords: boolean;
gbSearchRegex: boolean;
gsSearchText: string;
gsSearchTextHistory: string;
gsReplaceText: string;
gsReplaceTextHistory: string;
resourcestring
STR_TEXT_NOTFOUND = 'Text not found';
STR_UNNAMED = 'Unnamed';
STR_SUCCESSFULLY_COMPILED = 'Succesfully compiled';
STR_SUCCESSFULLY_EXECUTED = 'Succesfully executed';
STR_RUNTIME_ERROR='[Runtime error] %s(%d:%d), bytecode(%d:%d): %s'; //Birb
STR_FORM_TITLE = 'Editor';
STR_FORM_TITLE_RUNNING = 'Editor - Running';
STR_INPUTBOX_TITLE = 'Script';
STR_DEFAULT_PROGRAM = 'Program test;'#13#10'begin'#13#10'end.';
STR_NOTSAVED = 'File has not been saved, save now?';
procedure Teditor.DoSearchReplaceText(AReplace: boolean; ABackwards: boolean);
var
Options: TSynSearchOptions;
begin
Statusbar.SimpleText := '';
if AReplace then
Options := [ssoPrompt, ssoReplace, ssoReplaceAll]
else
Options := [];
if ABackwards then
Include(Options, ssoBackwards);
if gbSearchCaseSensitive then
Include(Options, ssoMatchCase);
if not fSearchFromCaret then
Include(Options, ssoEntireScope);
if gbSearchSelectionOnly then
Include(Options, ssoSelectedOnly);
if gbSearchWholeWords then
Include(Options, ssoWholeWord);
if gbSearchRegex then
ed.SearchEngine := SynEditRegexSearch
else
ed.SearchEngine := SynEditSearch;
if ed.SearchReplace(gsSearchText, gsReplaceText, Options) = 0 then
begin
MessageBeep(MB_ICONASTERISK);
Statusbar.SimpleText := STR_TEXT_NOTFOUND;
if ssoBackwards in Options then
ed.BlockEnd := ed.BlockBegin
else
ed.BlockBegin := ed.BlockEnd;
ed.CaretXY := ed.BlockBegin;
end;
if ConfirmReplaceDialog <> nil then
ConfirmReplaceDialog.Free;
end;
procedure Teditor.ShowSearchReplaceDialog(AReplace: boolean);
var
dlg: TTextSearchDialog;
begin
Statusbar.SimpleText := '';
if AReplace then
dlg := TTextReplaceDialog.Create(Self)
else
dlg := TTextSearchDialog.Create(Self);
with dlg do try
// assign search options
SearchBackwards := gbSearchBackwards;
SearchCaseSensitive := gbSearchCaseSensitive;
SearchFromCursor := gbSearchFromCaret;
SearchInSelectionOnly := gbSearchSelectionOnly;
// start with last search text
SearchText := gsSearchText;
if gbSearchTextAtCaret then begin
// if something is selected search for that text
if ed.SelAvail and (ed.BlockBegin.Line = ed.BlockEnd.Line) //Birb (fix at SynEdit's SearchReplaceDemo)
then
SearchText := ed.SelText
else
SearchText := ed.GetWordAtRowCol(ed.CaretXY);
end;
SearchTextHistory := gsSearchTextHistory;
if AReplace then with dlg as TTextReplaceDialog do begin
ReplaceText := gsReplaceText;
ReplaceTextHistory := gsReplaceTextHistory;
end;
SearchWholeWords := gbSearchWholeWords;
if ShowModal = mrOK then begin
gbSearchBackwards := SearchBackwards;
gbSearchCaseSensitive := SearchCaseSensitive;
gbSearchFromCaret := SearchFromCursor;
gbSearchSelectionOnly := SearchInSelectionOnly;
gbSearchWholeWords := SearchWholeWords;
gbSearchRegex := SearchRegularExpression;
gsSearchText := SearchText;
gsSearchTextHistory := SearchTextHistory;
if AReplace then with dlg as TTextReplaceDialog do begin
gsReplaceText := ReplaceText;
gsReplaceTextHistory := ReplaceTextHistory;
end;
fSearchFromCaret := gbSearchFromCaret;
if gsSearchText <> '' then begin
DoSearchReplaceText(AReplace, gbSearchBackwards);
fSearchFromCaret := TRUE;
end;
end;
finally
dlg.Free;
end;
end;
procedure Teditor.edSpecialLineColors(Sender: TObject; Line: Integer;
var Special: Boolean; var FG, BG: TColor);
begin
if ce.HasBreakPoint(ce.MainFileName, Line) then
begin
Special := True;
if Line = FActiveLine then
begin
BG := clWhite;
FG := clRed;
end else
begin
FG := clWhite;
BG := clRed;
end;
end else
if Line = FActiveLine then
begin
Special := True;
FG := clWhite;
bg := clBlue;
end else Special := False;
end;
procedure Teditor.BreakPointMenuClick(Sender: TObject);
var
Line: Longint;
begin
Line := Ed.CaretY;
if ce.HasBreakPoint(ce.MainFileName, Line) then
ce.ClearBreakPoint(ce.MainFileName, Line)
else
ce.SetBreakPoint(ce.MainFileName, Line);
ed.Refresh;
end;
procedure Teditor.ceLineInfo(Sender: TObject; const FileName: String; Position, Row,
Col: Cardinal);
begin
if (ce.Exec.DebugMode <> dmRun) and (ce.Exec.DebugMode <> dmStepOver) then
begin
FActiveLine := Row;
if (FActiveLine < ed.TopLine +2) or (FActiveLine > Ed.TopLine + Ed.LinesInWindow -2) then
begin
Ed.TopLine := FActiveLine - (Ed.LinesInWindow div 2);
end;
ed.CaretY := FActiveLine;
ed.CaretX := 1;
ed.Refresh;
end
else
Application.ProcessMessages;
end;
procedure Teditor.Exit1Click(Sender: TObject);
begin
Reset1Click(nil); //terminate any running script
if SaveCheck then //check if script changed and not yet saved
Close;
end;
procedure Teditor.StepOver1Click(Sender: TObject);
begin
if ce.Exec.Status in isRunningOrPaused then
ce.StepOver
else
begin
if Compile then
begin
ce.StepInto;
Execute;
end;
end;
end;
procedure Teditor.StepInto1Click(Sender: TObject);
begin
if ce.Exec.Status in isRunningOrPaused then
ce.StepInto
else
begin
if Compile then
begin
ce.StepInto;
Execute;
end;
end;
end;
procedure Teditor.Pause1Click(Sender: TObject);
begin
if ce.Exec.Status = isRunning then
begin
ce.Pause;
ce.StepInto;
end;
end;
procedure Teditor.Reset1Click(Sender: TObject);
begin
if ce.Exec.Status in isRunningOrPaused then
ce.Stop;
end;
function Teditor.Compile: Boolean;
var
i: Longint;
begin
ce.Script.Assign(ed.Lines);
Result := ce.Compile;
messages.Clear;
for i := 0 to ce.CompilerMessageCount -1 do
begin
Messages.Items.Add(ce.CompilerMessages[i].MessageToString);
end;
if Result then
Messages.Items.Add(STR_SUCCESSFULLY_COMPILED);
end;
procedure Teditor.ceIdle(Sender: TObject);
begin
Application.ProcessMessages; //Birb: don't use Application.HandleMessage here, else GUI will be unrensponsive if you have a tight loop and won't be able to use Run/Reset menu action
if FResume then
begin
FResume := False;
ce.Resume;
FActiveLine := 0;
ed.Refresh;
end;
end;
procedure Teditor.Run2Click(Sender: TObject);
begin
if CE.Running then
begin
FResume := True
end else
begin
if Compile then
Execute;
end;
end;
procedure Teditor.ceExecute(Sender: TPSScript);
begin
ce.SetVarToInstance('SELF', Self);
ce.SetVarToInstance('APPLICATION', Application);
Caption := STR_FORM_TITLE_RUNNING;
end;
procedure Teditor.ceAfterExecute(Sender: TPSScript);
begin
Caption := STR_FORM_TITLE;
FActiveLine := 0;
ed.Refresh;
end;
function Teditor.Execute: Boolean;
begin
debugoutput.Output.Clear;
if CE.Execute then
begin
Messages.Items.Add(STR_SUCCESSFULLY_EXECUTED);
Result := True;
end else
begin
messages.Items.Add(Format(STR_RUNTIME_ERROR, [extractFileName(aFile), ce.ExecErrorRow,ce.ExecErrorCol,ce.ExecErrorProcNo,ce.ExecErrorByteCodePosition,ce.ExecErrorToString])); //Birb
Result := False;
end;
end;
procedure Teditor.Writeln(const s: string);
begin
debugoutput.output.Lines.Add(S);
debugoutput.Visible := True;
end;
procedure Teditor.ceCompile(Sender: TPSScript);
begin
Sender.AddMethod(Self, @TEditor.Writeln, 'procedure writeln(s: string)');
Sender.AddMethod(Self, @TEditor.Readln, 'procedure readln(var s: string)');
Sender.AddRegisteredVariable('Self', 'TForm');
Sender.AddRegisteredVariable('Application', 'TApplication');
end;
procedure Teditor.Readln(var s: string);
begin
s := InputBox(STR_INPUTBOX_TITLE, '', '');
end;
procedure Teditor.New1Click(Sender: TObject);
begin
if SaveCheck then //check if script changed and not yet saved
begin
ed.ClearAll;
ed.Lines.Text := STR_DEFAULT_PROGRAM;
ed.Modified := False;
aFile := '';
end;
end;
procedure Teditor.Open1Click(Sender: TObject);
begin
if SaveCheck then //check if script changed and not yet saved
begin
if OpenDialog1.Execute then
begin
ed.ClearAll;
ed.Lines.LoadFromFile(OpenDialog1.FileName);
ed.Modified := False;
aFile := OpenDialog1.FileName;
end;
end;
end;
procedure Teditor.Save1Click(Sender: TObject);
begin
if aFile <> '' then
begin
ed.Lines.SaveToFile(aFile);
ed.Modified := False;
end else
SaveAs1Click(nil);
end;
procedure Teditor.Saveas1Click(Sender: TObject);
begin
if SaveDialog1.Execute then
begin
aFile := SaveDialog1.FileName;
ed.Lines.SaveToFile(aFile);
ed.Modified := False;
end;
end;
//check if script changed and not yet saved//
function Teditor.SaveCheck: Boolean;
begin
if ed.Modified then
begin
case MessageDlg(STR_NOTSAVED, mtConfirmation, mbYesNoCancel, 0) of
idYes:
begin
Save1Click(nil);
Result := aFile <> '';
end;
IDNO: Result := True;
else
Result := False;
end;
end else Result := True;
end;
procedure Teditor.edStatusChange(Sender: TObject;
Changes: TSynStatusChanges);
begin
StatusBar.Panels[0].Text := IntToStr(ed.CaretY)+':'+IntToStr(ed.CaretX)
end;
procedure Teditor.Decompile1Click(Sender: TObject);
var
s: string;
begin
if Compile then
begin
ce.GetCompiled(s);
IFPS3DataToText(s, s);
debugoutput.output.Lines.Text := s;
debugoutput.visible := true;
end;
end;
function Teditor.ceNeedFile(Sender: TObject; const OrginFileName: String;
var FileName, Output: String): Boolean;
var
path: string;
f: TFileStream;
begin
if aFile <> '' then
Path := ExtractFilePath(aFile)
else
Path := ExtractFilePath(ParamStr(0));
Path := Path + FileName;
try
F := TFileStream.Create(Path, fmOpenRead or fmShareDenyWrite);
except
Result := false;
exit;
end;
try
SetLength(Output, f.Size);
f.Read(Output[1], Length(Output));
finally
f.Free;
end;
Result := True;
end;
procedure Teditor.ceBreakpoint(Sender: TObject; const FileName: String; Position, Row,
Col: Cardinal);
begin
FActiveLine := Row;
if (FActiveLine < ed.TopLine +2) or (FActiveLine > Ed.TopLine + Ed.LinesInWindow -2) then
begin
Ed.TopLine := FActiveLine - (Ed.LinesInWindow div 2);
end;
ed.CaretY := FActiveLine;
ed.CaretX := 1;
ed.Refresh;
end;
procedure Teditor.SetActiveFile(const Value: string);
begin
FActiveFile := Value;
ce.MainFileName := ExtractFileName(FActiveFile);
if Ce.MainFileName = '' then
Ce.MainFileName := STR_UNNAMED;
end;
function GetErrorRowCol(const inStr: string): TBufferCoord;
var
Row:string;
Col:string;
p1,p2,p3:integer;
begin
p1:=Pos('(',inStr);
p2:=Pos(':',inStr);
p3:=Pos(')',inStr);
if (p1>0) and (p2>p1) and (p3>p2) then
begin
Row := Copy(inStr, p1+1,p2-p1-1);
Col := Copy(inStr, p2+1,p3-p2-1);
Result.Char := StrToInt(Trim(Col));
Result.Line := StrToInt(Trim(Row));
end
else
begin
Result.Char := 1;
Result.Line := 1;
end
end;
procedure Teditor.messagesDblClick(Sender: TObject);
begin
//if Copy(messages.Items[messages.ItemIndex],1,7)= '[Error]' then
//begin
ed.CaretXY := GetErrorRowCol(messages.Items[messages.ItemIndex]);
ed.SetFocus;
//end;
end;
procedure Teditor.Gotolinenumber1Click(Sender: TObject);
begin
with TfrmGotoLine.Create(self) do
try
Char := ed.CaretX;
Line := ed.CaretY;
ShowModal;
if ModalResult = mrOK then
ed.CaretXY := CaretXY;
finally
Free;
ed.SetFocus;
end;
end;
procedure Teditor.Find1Click(Sender: TObject);
begin
ShowSearchReplaceDialog(FALSE);
end;
procedure Teditor.Searchagain1Click(Sender: TObject);
begin
DoSearchReplaceText(FALSE, FALSE);
end;
procedure Teditor.Replace1Click(Sender: TObject);
begin
ShowSearchReplaceDialog(TRUE);
end;
procedure Teditor.Syntaxcheck1Click(Sender: TObject);
begin
Compile;
end;
procedure Teditor.edDropFiles(Sender: TObject; X, Y: Integer;
AFiles: TStrings);
begin
if AFiles.Count>=1 then
if SaveCheck then //check if script changed and not yet saved
begin
ed.ClearAll;
ed.Lines.LoadFromFile(AFiles[0]);
ed.Modified := False;
aFile := AFiles[0];
end;
end;
end.

1
Samples/Debug/readme.txt Normal file
View File

@ -0,0 +1 @@
This demo requires SynEdit (http://synedit.sf.net) to compile.

Binary file not shown.

View File

@ -0,0 +1,79 @@
unit uFrmGotoLine;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, SynEditTypes;
type
TfrmGotoLine = class(TForm)
edtCharNumber: TEdit;
edtLineNumber: TEdit;
Button1: TButton;
btnGoto: TButton;
lblLineNumber: TLabel;
lblCharNumber: TLabel;
procedure FormShow(Sender: TObject);
private
function GetCaret: TBufferCoord;
procedure SetCaret(const Value: TBufferCoord);
procedure SetChar(const Value: Integer);
procedure SetLine(const Value: Integer);
function GetChar: Integer;
function GetLine: Integer;
{ Private declarations }
public
{ Public declarations }
property Char : Integer read GetChar write SetChar;
property Line : Integer read GetLine write setLine;
property CaretXY:TBufferCoord read GetCaret write SetCaret;
end;
var
frmGotoLine: TfrmGotoLine;
implementation
{$R *.dfm}
{ TfrmGotoLine }
function TfrmGotoLine.GetCaret: TBufferCoord;
begin
Result.Char := StrToInt(edtCharNumber.Text);
Result.Line := StrToInt(edtLineNumber.Text);
end;
function TfrmGotoLine.GetChar: Integer;
begin
Result := StrToInt(edtCharNumber.Text)
end;
function TfrmGotoLine.GetLine: Integer;
begin
Result := StrToInt(edtLineNumber.Text)
end;
procedure TfrmGotoLine.SetCaret(const Value: TBufferCoord);
begin
edtCharNumber.Text := IntToStr(Value.Char);
edtLineNumber.Text := IntToStr(Value.Line);
end;
procedure TfrmGotoLine.SetChar(const Value: Integer);
begin
edtCharNumber.Text := IntToStr(Value);
end;
procedure TfrmGotoLine.SetLine(const Value: Integer);
begin
edtLineNumber.Text := IntToStr(Value);
end;
procedure TfrmGotoLine.FormShow(Sender: TObject);
begin
edtLineNumber.SetFocus;
end;
end.

17
Samples/Import/Import.dpr Normal file
View File

@ -0,0 +1,17 @@
program Import;
uses
Forms,
fMain in 'fMain.pas' {MainForm},
fDwin in 'fDwin.pas' {dwin};
{$R *.RES}
begin
Application.Initialize;
Application.Title := 'Import Sample';
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(Tdwin, dwin);
Application.Run;
end.

BIN
Samples/Import/Import.res Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
Program IFSTest;
type
TArrayOfByte = array of byte;
procedure Test(x: TARrayOfByte);
var
i: Integer;
begin
for i := 0 to Getarraylength(X) -1 do
begin
writeln(inttostr(x[i]));
end;
end;
var
temp: TArrayOfByte;
Begin
setarraylength(temp, 2);
temp[0] := 1;
temp[1] :=23;
test(temp);
End.

View File

@ -0,0 +1,15 @@
Program IFSTest;
var
x1, x2: integer;
b: boolean;
Begin
x1 := 2;
x2 := 2;
b := x1 = x2;
if b then begin writeln('true'); end else begin writeln('false');end;
x1 := 2;
x2 := 4;
b := x1 = x2;
if b then begin writeln('true'); end else begin writeln('false');end;
writeln('done');
End.

View File

@ -0,0 +1,14 @@
Program IFSTest;
type
TByteArray = array of byte;
var
x: TByteARray;
Begin
try
x[0] := 1;
// will cause an runtime error (Out Of Record Fields Range)
writeln('Not supposed to be here');
except
Writeln('Error, which is ok since we accessed a field outside it''s bounds');
end;
End.

View File

@ -0,0 +1,12 @@
Program IFSTest;
var
b: Byte;
Begin
for b := 0 to 2 do begin
case b of
0: writeln('0');
1: writeln('1');
else writeln('>1');
end;
end;
End.

View File

@ -0,0 +1,19 @@
Program IFSTest;
// compile the demo application, minimize delphi and run this.
function FindWindow(C1, C2: PChar): Longint; external 'FindWindowA@user32.dll stdcall';
function ShowWindow(hWnd, nCmdShow: Longint): Integer; external 'ShowWindow@user32.dll stdcall';
function SetWindowText(hWnd: Longint; Text: PChar): Longint; external 'SetWindowTextA@user32.dll stdcall';
var
i: Longint;
wnd: Longint;
Begin
wnd := Findwindow('', 'Innerfuse Pascal Script III');
SetWindowText(Wnd, 'This is DLL demo, it calls some windows user32 routines. This will hide this window for a few seconds');
for i := 0 to 200000 do begin end;
ShowWindow(Wnd, 0); // hide it
for i := 0 to 200000 do begin end;
SetWindowText(Wnd, 'Wasn''t that nice?');
ShowWindow(Wnd, 5); // show it
for i := 0 to 200000 do begin end;
SetWindowText(Wnd, 'Innerfuse Pascal Script III');
End.

13
Samples/Import/exc.ROPS Normal file
View File

@ -0,0 +1,13 @@
Program test;
var
I: Integer;
begin
try
I := I div 0;
except
try
except
end;
Writeln('SHOULD GET HERE');
end;
end.

View File

@ -0,0 +1,14 @@
Program IFSTest;
procedure test;
begin
writeln('1');
exit;
writeln('2');
end;
Begin
test;
writeln('3');
exit;
writeln('4');
End.

BIN
Samples/Import/fDwin.dfm Normal file

Binary file not shown.

27
Samples/Import/fDwin.pas Normal file
View File

@ -0,0 +1,27 @@
unit fDwin;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
Tdwin = class(TForm)
Memo1: TMemo;
Panel1: TPanel;
Button1: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
dwin: Tdwin;
implementation
{$R *.dfm}
end.

BIN
Samples/Import/fMain.dfm Normal file

Binary file not shown.

471
Samples/Import/fMain.pas Normal file
View File

@ -0,0 +1,471 @@
unit fMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, uPSCompiler, uPSRuntime, uPSPreprocessor, uPSUtils,
Menus, uPSC_comobj, uPSR_comobj;
type
TMainForm = class(TForm)
Memo1: TMemo;
Memo2: TMemo;
Splitter1: TSplitter;
MainMenu1: TMainMenu;
Toosl1: TMenuItem;
Compile1: TMenuItem;
CompilewithTimer1: TMenuItem;
File1: TMenuItem;
Exit1: TMenuItem;
N1: TMenuItem;
SaveAs1: TMenuItem;
Save1: TMenuItem;
Open1: TMenuItem;
New1: TMenuItem;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
N2: TMenuItem;
Stop1: TMenuItem;
N3: TMenuItem;
CompileandDisassemble1: TMenuItem;
procedure Compile1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure New1Click(Sender: TObject);
procedure Open1Click(Sender: TObject);
procedure Save1Click(Sender: TObject);
procedure SaveAs1Click(Sender: TObject);
procedure Memo1Change(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure Stop1Click(Sender: TObject);
procedure CompileandDisassemble1Click(Sender: TObject);
procedure CompilewithTimer1Click(Sender: TObject);
private
fn: string;
changed: Boolean;
function SaveTest: Boolean;
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
uses
uPSDisassembly, uPSC_dll, uPSR_dll, uPSDebugger,
uPSR_std, uPSC_std, uPSR_stdctrls, uPSC_stdctrls,
uPSR_forms, uPSC_forms,
uPSC_graphics,
uPSC_controls,
uPSC_classes,
uPSR_graphics,
uPSR_controls,
uPSR_classes,
fDwin;
{$R *.DFM}
var
Imp: TPSRuntimeClassImporter;
function StringLoadFile(const Filename: string): string;
var
Stream: TStream;
begin
Stream := TFileStream.Create(Filename, fmOpenread or fmSharedenywrite);
try
SetLength(Result, Stream.Size);
Stream.Read(Result[1], Length(Result));
finally
Stream.Free;
end;
end;
function OnNeedFile(Sender: TPSPreProcessor; const callingfilename: string; var FileName, Output: string): Boolean;
var
s: string;
begin
s := ExtractFilePath(callingfilename);
if s = '' then s := ExtractFilePath(Paramstr(0));
Filename := s + Filename;
if FileExists(Filename) then
begin
Output := StringLoadFile(Filename);
Result := True;
end else
Result := False;
end;
function MyOnUses(Sender: TPSPascalCompiler; const Name: string): Boolean;
begin
if Name = 'SYSTEM' then
begin
TPSPascalCompiler(Sender).AddFunction('procedure Writeln(s: string);');
TPSPascalCompiler(Sender).AddFunction('function Readln(question: string): string;');
Sender.AddDelphiFunction('function ImportTest(S1: string; s2: Longint; s3: Byte; s4: word; var s5: string): string;');
Sender.AddConstantN('NaN', 'extended').Value.textended := 0.0 / 0.0;
Sender.AddConstantN('Infinity', 'extended').Value.textended := 1.0 / 0.0;
Sender.AddConstantN('NegInfinity', 'extended').Value.textended := - 1.0 / 0.0;
SIRegister_Std(Sender);
SIRegister_Classes(Sender, True);
SIRegister_Graphics(Sender, True);
SIRegister_Controls(Sender);
SIRegister_stdctrls(Sender);
SIRegister_Forms(Sender);
SIRegister_ComObj(Sender);
AddImportedClassVariable(Sender, 'Memo1', 'TMemo');
AddImportedClassVariable(Sender, 'Memo2', 'TMemo');
AddImportedClassVariable(Sender, 'Self', 'TForm');
AddImportedClassVariable(Sender, 'Application', 'TApplication');
Result := True;
end
else
begin
TPSPascalCompiler(Sender).MakeError('', ecUnknownIdentifier, '');
Result := False;
end;
end;
function MyWriteln(Caller: TPSExec; p: TIFExternalProcRec; Global, Stack: TPSStack): Boolean;
var
PStart: Cardinal;
begin
if Global = nil then begin result := false; exit; end;
PStart := Stack.Count - 1;
MainForm.Memo2.Lines.Add(Stack.GetString(PStart));
Result := True;
end;
function MyReadln(Caller: TPSExec; p: TIFExternalProcRec; Global, Stack: TPSStack): Boolean;
var
PStart: Cardinal;
begin
if Global = nil then begin result := false; exit; end;
PStart := Stack.Count - 2;
Stack.SetString(PStart + 1, InputBox(MainForm.Caption, Stack.GetString(PStart), ''));
Result := True;
end;
function ImportTest(S1: string; s2: Longint; s3: Byte; s4: word; var s5: string): string;
begin
Result := s1 + ' ' + IntToStr(s2) + ' ' + IntToStr(s3) + ' ' + IntToStr(s4) + ' - OK!';
S5 := s5 + ' '+ result + ' - OK2!';
end;
var
IgnoreRunline: Boolean = False;
I: Integer;
procedure RunLine(Sender: TPSExec);
begin
if IgnoreRunline then Exit;
i := (i + 1) mod 15;
Sender.GetVar('');
if i = 0 then Application.ProcessMessages;
end;
function MyExportCheck(Sender: TPSPascalCompiler; Proc: TPSInternalProcedure; const ProcDecl: string): Boolean;
begin
Result := True;
end;
procedure TMainForm.Compile1Click(Sender: TObject);
var
x1: TPSPascalCompiler;
x2: TPSDebugExec;
xpre: TPSPreProcessor;
s, d: string;
procedure Outputtxt(const s: string);
begin
Memo2.Lines.Add(s);
end;
procedure OutputMsgs;
var
l: Longint;
b: Boolean;
begin
b := False;
for l := 0 to x1.MsgCount - 1 do
begin
Outputtxt(x1.Msg[l].MessageToString);
if (not b) and (x1.Msg[l] is TPSPascalCompilerError) then
begin
b := True;
Memo1.SelStart := X1.Msg[l].Pos;
end;
end;
end;
begin
if tag <> 0 then exit;
Memo2.Clear;
xpre := TPSPreProcessor.Create;
try
xpre.OnNeedFile := OnNeedFile;
xpre.MainFileName := fn;
xpre.MainFile := Memo1.Text;
xpre.PreProcess(xpre.MainFileName, s);
x1 := TPSPascalCompiler.Create;
x1.OnExportCheck := MyExportCheck;
x1.OnUses := MyOnUses;
x1.OnExternalProc := DllExternalProc;
if x1.Compile(s) then
begin
Outputtxt('Succesfully compiled');
xpre.AdjustMessages(x1);
OutputMsgs;
if not x1.GetOutput(s) then
begin
x1.Free;
Outputtxt('[Error] : Could not get data');
exit;
end;
x1.GetDebugOutput(d);
x1.Free;
x2 := TPSDebugExec.Create;
try
RegisterDLLRuntime(x2);
RegisterClassLibraryRuntime(x2, Imp);
RIRegister_ComObj(x2);
tag := longint(x2);
if sender <> nil then
x2.OnRunLine := RunLine;
x2.RegisterFunctionName('WRITELN', MyWriteln, nil, nil);
x2.RegisterFunctionName('READLN', MyReadln, nil, nil);
x2.RegisterDelphiFunction(@ImportTest, 'IMPORTTEST', cdRegister);
if not x2.LoadData(s) then
begin
Outputtxt('[Error] : Could not load data: '+TIFErrorToString(x2.ExceptionCode, x2.ExceptionString));
tag := 0;
exit;
end;
x2.LoadDebugData(d);
SetVariantToClass(x2.GetVarNo(x2.GetVar('MEMO1')), Memo1);
SetVariantToClass(x2.GetVarNo(x2.GetVar('MEMO2')), Memo2);
SetVariantToClass(x2.GetVarNo(x2.GetVar('SELF')), Self);
SetVariantToClass(x2.GetVarNo(x2.GetVar('APPLICATION')), Application);
x2.RunScript;
if x2.ExceptionCode <> erNoError then
Outputtxt('[Runtime Error] : ' + TIFErrorToString(x2.ExceptionCode, x2.ExceptionString) +
' in ' + IntToStr(x2.ExceptionProcNo) + ' at ' + IntToSTr(x2.ExceptionPos))
else
OutputTxt('Successfully executed');
finally
tag := 0;
x2.Free;
end;
end
else
begin
Outputtxt('Failed when compiling');
xpre.AdjustMessages(x1);
OutputMsgs;
x1.Free;
end;
finally
Xpre.Free;
end;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
Caption := 'RemObjects Pascal Script';
fn := '';
changed := False;
Memo1.Lines.Text := 'Program Test;'#13#10'Begin'#13#10'End.';
end;
procedure TMainForm.Exit1Click(Sender: TObject);
begin
Close;
end;
procedure TMainForm.New1Click(Sender: TObject);
begin
if not SaveTest then
exit;
Memo1.Lines.Text := 'Program Test;'#13#10'Begin'#13#10'End.';
Memo2.Lines.Clear;
fn := '';
end;
function TMainForm.SaveTest: Boolean;
begin
if changed then
begin
case MessageDlg('File is not saved, save now?', mtWarning, mbYesNoCancel, 0) of
mrYes:
begin
Save1Click(nil);
Result := not changed;
end;
mrNo: Result := True;
else
Result := False;
end;
end
else
Result := True;
end;
procedure TMainForm.Open1Click(Sender: TObject);
begin
if not SaveTest then
exit;
if OpenDialog1.Execute then
begin
Memo1.Lines.LoadFromFile(OpenDialog1.FileName);
changed := False;
Memo2.Lines.Clear;
fn := OpenDialog1.FileName;
end;
end;
procedure TMainForm.Save1Click(Sender: TObject);
begin
if fn = '' then
begin
Saveas1Click(nil);
end
else
begin
Memo1.Lines.SaveToFile(fn);
changed := False;
end;
end;
procedure TMainForm.SaveAs1Click(Sender: TObject);
begin
SaveDialog1.FileName := '';
if SaveDialog1.Execute then
begin
fn := SaveDialog1.FileName;
Memo1.Lines.SaveToFile(fn);
changed := False;
end;
end;
procedure TMainForm.Memo1Change(Sender: TObject);
begin
changed := True;
end;
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := SaveTest;
end;
procedure TMainForm.Stop1Click(Sender: TObject);
begin
if tag <> 0 then
TPSExec(tag).Stop;
end;
procedure TMainForm.CompileandDisassemble1Click(Sender: TObject);
var
x1: TPSPascalCompiler;
xpre: TPSPreProcessor;
s, s2: string;
procedure OutputMsgs;
var
l: Integer;
b: Boolean;
begin
b := False;
for l := 0 to x1.MsgCount - 1 do
begin
Memo2.Lines.Add(x1.Msg[l].MessageToString);
if (not b) and (x1.Msg[l] is TPSPascalCompilerError) then
begin
b := True;
Memo1.SelStart := X1.Msg[l].Pos;
end;
end;
end;
begin
if tag <> 0 then exit;
Memo2.Clear;
xpre := TPSPreProcessor.Create;
try
xpre.OnNeedFile := OnNeedFile;
xpre.MainFileName := fn;
xpre.MainFile := Memo1.Text;
xpre.PreProcess(xpre.MainFileName, s);
x1 := TPSPascalCompiler.Create;
x1.OnExternalProc := DllExternalProc;
x1.OnUses := MyOnUses;
if x1.Compile(s) then
begin
Memo2.Lines.Add('Succesfully compiled');
xpre.AdjustMessages(x1);
OutputMsgs;
if not x1.GetOutput(s) then
begin
x1.Free;
Memo2.Lines.Add('[Error] : Could not get data');
exit;
end;
x1.Free;
IFPS3DataToText(s, s2);
dwin.Memo1.Text := s2;
dwin.showmodal;
end
else
begin
Memo2.Lines.Add('Failed when compiling');
xpre.AdjustMessages(x1);
OutputMsgs;
x1.Free;
end;
finally
xPre.Free;
end;
end;
procedure TMainForm.CompilewithTimer1Click(Sender: TObject);
var
Freq, Time1, Time2: Comp;
begin
if not QueryPerformanceFrequency(TLargeInteger((@Freq)^)) then
begin
ShowMessage('Your computer does not support Performance Timers!');
exit;
end;
QueryPerformanceCounter(TLargeInteger((@Time1)^));
IgnoreRunline := True;
try
Compile1Click(nil);
except
end;
IgnoreRunline := False;
QueryPerformanceCounter(TLargeInteger((@Time2)^));
Memo2.Lines.Add('Time: ' + Sysutils.FloatToStr((Time2 - Time1) / Freq) +
' sec');
end;
initialization
Imp := TPSRuntimeClassImporter.Create;
RIRegister_Std(Imp);
RIRegister_Classes(Imp, True);
RIRegister_Graphics(Imp, True);
RIRegister_Controls(Imp);
RIRegister_stdctrls(imp);
RIRegister_Forms(Imp);
finalization
Imp.Free;
end.

View File

@ -0,0 +1,9 @@
Program IFSTest;
var
i: Longint;
Begin
for i := 0 to 9 do
begin
writeln('hello'+inttostr(i));
end;
End.

9
Samples/Import/if.rops Normal file
View File

@ -0,0 +1,9 @@
Program IFSTest;
var
a: boolean;
Begin
a := true;
if a then begin ;end else
if a then begin ;end else;
writeln('5');
End.

View File

@ -0,0 +1,104 @@
Program IFSTest;
var
F, Form: TForm;
Labl: TLabel;
Button: TButton;
Edit: TEdit;
Memo: TMemo;
Stop: Boolean;
procedure MyOnCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := Stop;
end;
procedure c2(sender: TObject);
begin
f.Close;
end;
procedure buttonclick(sender: TObject);
var
l: TLabel;
b: TButton;
begin
if Length(Edit.Text) < 5 then
begin
f := TForm.Create(self);
f.Width := 100;
f.Height := 100;
f.Position := poScreenCenter;
f.BorderStyle := bsDialog;
f.Caption := 'Error';
l := TLabel.Create(F);
l.parent := f;
l.Left := 10;
l.Top := 10;
l.Width := 100;
l.Height := 50;
l.Caption := 'Invalid name';
b := TButton.Create(f);
b.parent := f;
b.Left:=10;
b.Top := 40;
b.Caption := 'OK';
b.Default := True;
b.Cancel := True;
b.OnClick := @C2;
f.Visible := True;
form.Visible := False;
while f.Visible do
begin
Application.HandleMessage;
end;
Form.Visible := True;
end else begin
writeln('debug:'+Edit.Text);
Stop := True;
Form.Close;
end;
end;
Begin
Form := TForm.Create(self);
Form.Width := 400;
Form.Height := 300;
Form.BorderStyle := bsDialog;
Form.BorderIcons := [];
Form.OnCloseQuery := @MyOnCloseQuery;
Form.Caption := 'Name';
Form.Position := poScreenCenter;
Labl := TLabel.Create(Form);
Labl.Top := 120;
Labl.Left := 160;
Labl.Caption := 'Please type in your name:';
Labl.Parent := Form;
Edit := TEdit.Create(Form);
Edit.Font.Name := 'Tahoma';
Edit.SetBounds(160,160,80,24);
Edit.Parent := Form;
Button := TButton.Create(Form);
Button.Left := 160;
Button.Top := 200;
Button.Width := 80;
Button.Height := 24;
Button.Caption := '&OK';
Button.OnClick := @buttonclick;
Button.Parent := Form;
Button.Default := True;
Memo := TMemo.Create(Form);
Memo.Left := 10;
Memo.Width := 380;
Memo.Top := 10;
Memo.Height := 100;
Memo.Text := 'Welcome to Form Test.'#13#10#13#10'Type here your name (min 5 letters). You can''t exit this demo without it.';
Memo.Color := 0;
Memo.Font.Color := $FFFFFF;
Memo.Parent := Form;
Memo.Readonly := True;
Form.Visible := true;
stop := false;
while Form.Visible do
begin
Application.HandleMessage;
end;
Button.Free;
Form.Free;
End.

View File

@ -0,0 +1,16 @@
Program IFSTest;
var
a,b :string;
Begin
a := 'test: ';
b := ImportTest('1', 2, 3, 4, a);
writeln(b);
writeln(a);
{
Output should be:
1 2 3 4 - OK!
1 2 3 4 - OK! - OK2!
}
End.

View File

@ -0,0 +1,10 @@
Program IFSTest;
var
i, i2: Longint;
Begin
for i := 0 to 1000000 do
begin
i2 := i -1;
end;
writeln(inttostr(i2));
End.

View File

@ -0,0 +1,11 @@
Program IFSTest;
type
TMyRec = record a: Integer; b: string; end;
var
s: TMyRec;
Begin
s.a := 1234;
s.b := 'abc';
writeln(s.b);
writeln(inttostr(s.a));
End.

View File

@ -0,0 +1,8 @@
Program test;
var s: string;
begin
s:='123456789';
s[1]:=s[2];
writeln(s);
end.

6
Samples/Import/t1.rops Normal file
View File

@ -0,0 +1,6 @@
Program test;
var
i: Longint;
begin
writeln('Really simple test');
end.

12
Samples/Import/t10.rops Normal file
View File

@ -0,0 +1,12 @@
Program test;
begin
writeln('1');
try
writeln('2');
raiseexception(erCustomError, 'TEST EXCEPTION');
writeln('3');
finally
writeln('4');
end;
writeln('5');
end.

57
Samples/Import/t11.rops Normal file
View File

@ -0,0 +1,57 @@
Program IFSTest;
var
F, Form: TForm;
i: Longint;
Labl: TLabel;
Button: TButton;
Edit: TEdit;
Memo: TMemo;
Stop: Boolean;
Begin
Form := TForm.Create(self);
Form.Width := 400;
Form.Height := 300;
Form.BorderStyle := bsDialog;
Form.BorderIcons := [];
Form.Caption := 'Name';
Form.Position := poScreenCenter;
Labl := TLabel.Create(Form);
Labl.Top := 120;
Labl.Left := 160;
Labl.Caption := 'Please type in your name:';
Labl.Parent := Form;
Edit := TEdit.Create(Form);
Edit.Font.Name := 'Tahoma';
Edit.SetBounds(160,160,80,24);
Edit.Parent := Form;
Button := TButton.Create(Form);
Button.Left := 160;
Button.Top := 200;
Button.Width := 80;
Button.Height := 24;
Button.Caption := '&OK';
Button.Parent := Form;
Button.Default := True;
Memo := TMemo.Create(Form);
Memo.Left := 10;
Memo.Width := 380;
Memo.Top := 10;
Memo.Height := 100;
Memo.Text := 'Welcome to Form Test.'#13#10#13#10'Plase wait till the loop is over.';
Memo.Color := 0;
Memo.Font.Color := $FFFFFF;
Memo.Parent := Form;
Memo.Readonly := True;
Form.Visible := true;
Form.Refresh;
stop := false;
while Form.Visible do
begin
Application.ProcessMessages;
i := i + 1;
if i > 100000 then Break;
end;
Button.Free;
Form.Free;
End.

6
Samples/Import/t2.rops Normal file
View File

@ -0,0 +1,6 @@
Program test;
var
i: Longint;
begin
for i := 0 to 100000 do ;
end.

4
Samples/Import/t3.rops Normal file
View File

@ -0,0 +1,4 @@
Program test;
begin
writeln('test');
end.

8
Samples/Import/t4.rops Normal file
View File

@ -0,0 +1,8 @@
Program test;
var
s: string;
begin
s := 'test';
s := s + 'TESTED';
writeln(s);
end.

9
Samples/Import/t5.rops Normal file
View File

@ -0,0 +1,9 @@
Program test;
var
s: string;
begin
Writeln('Your name?');
s := readln(s);
s := s + 'TESTED';
writeln(s);
end.

22
Samples/Import/t6.rops Normal file
View File

@ -0,0 +1,22 @@
Program IFSTest;
type
TArrayOfByte = array of byte;
procedure Test(x: TARrayOfByte);
var
i: Integer;
begin
for i := 0 to Getarraylength(X) -1 do
begin
writeln(inttostr(x[i]));
end;
end;
var
temp: TArrayOfByte;
Begin
setarraylength(temp, 2);
temp[0] := 1;
temp[1] :=23;
test(temp);
End.

7
Samples/Import/t7.rops Normal file
View File

@ -0,0 +1,7 @@
Program test;
var
r: TObject;
begin
r := TObject.Create;
r.Free;
end.

16
Samples/Import/t8.rops Normal file
View File

@ -0,0 +1,16 @@
Program test;
var
r: TObject;
begin
if r = nil then Writeln('(r = nil) = true') else Writeln('(r = nil) = false');
if r <> nil then Writeln('(r <> nil) = true') else Writeln('(r <> nil) = false');
r := TObject.Create;
if r = nil then Writeln('(r = nil) = true') else Writeln('(r = nil) = false');
if r <> nil then Writeln('(r <> nil) = true') else Writeln('(r <> nil) = false');
r.Free;
if r = nil then Writeln('(r = nil) = true') else Writeln('(r = nil) = false');
if r <> nil then Writeln('(r <> nil) = true') else Writeln('(r <> nil) = false');
r := nil;
if r = nil then Writeln('(r = nil) = true') else Writeln('(r = nil) = false');
if r <> nil then Writeln('(r <> nil) = true') else Writeln('(r <> nil) = false');
end.

16
Samples/Import/t9.rops Normal file
View File

@ -0,0 +1,16 @@
Program test;
var
t: TObject;
i: IUnknown;
begin
t := TObject.Create;
try
try
i := t;
except
writeln('Expected Exception: Interface not supported');
end;
finally
t.Free;
end;
end.

View File

@ -0,0 +1,10 @@
{.$DEFINE ERROR}
// Remove the . before the define to
// cause an error in textinclude.rops
{$I testinclude.rops}
begin
testproc();
writeln('test');
end.

View File

@ -0,0 +1,12 @@
{
This file is part of a DEFINE / INCLUDE test. Use
testdefine.rops file to execute this file.
}
procedure TestProc;
begin
Writeln('Test Proc Called');
{$IFDEF ERROR}
Error!
{$ENDIF}
end;

View File

@ -0,0 +1,14 @@
Program IFSTest;
var
e: variant;
Begin
e := null;
case VarType(e) of
varempty :writeln('unassigned');
varNull: Writeln('null');
varstring: Writeln('String');
varInteger : writeln('VarInteger');
varSingle: Writeln('Single');
varDouble: Writeln('Double');
end;
End.

View File

@ -0,0 +1,7 @@
Program test;
var
WordDoc: Variant;
begin
WordDoc := CreateOleObject('Word.Application');
WordDoc.Visible := True;
end.

16
Samples/Kylix/Import.dpr Normal file
View File

@ -0,0 +1,16 @@
program Import;
uses
QForms,
fMain in 'fMain.pas' {MainForm},
fDwin in 'fDwin.pas' {dwin};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(Tdwin, dwin);
Application.Run;
end.

View File

@ -0,0 +1,22 @@
Program IFSTest;
type
TArrayOfByte = array of byte;
procedure Test(x: TARrayOfByte);
var
i: Integer;
begin
for i := 0 to Getarraylength(X) -1 do
begin
writeln(inttostr(x[i]));
end;
end;
var
temp: TArrayOfByte;
Begin
setarraylength(temp, 2);
temp[0] := 1;
temp[1] :=23;
test(temp);
End.

View File

@ -0,0 +1,15 @@
Program IFSTest;
var
x1, x2: integer;
b: boolean;
Begin
x1 := 2;
x2 := 2;
b := x1 = x2;
if b then begin writeln('true'); end else begin writeln('false');end;
x1 := 2;
x2 := 4;
b := x1 = x2;
if b then begin writeln('true'); end else begin writeln('false');end;
writeln('done');
End.

View File

@ -0,0 +1,9 @@
Program IFSTest;
type
TByteArray = array of byte;
var
x: TByteARray;
Begin
x[0] := 1;
// will cause an runtime error (Out Of Record Fields Range)
End.

View File

@ -0,0 +1,12 @@
Program IFSTest;
var
b: Byte;
Begin
for b := 0 to 2 do begin
case b of
0: writeln('0');
1: writeln('1');
else writeln('>1');
end;
end;
End.

View File

@ -0,0 +1,14 @@
Program IFSTest;
procedure test;
begin
writeln('1');
exit;
writeln('2');
end;
Begin
test;
writeln('3');
exit;
writeln('4');
End.

BIN
Samples/Kylix/fDwin.dfm Normal file

Binary file not shown.

27
Samples/Kylix/fDwin.pas Normal file
View File

@ -0,0 +1,27 @@
unit fDwin;
interface
uses
SysUtils, Classes, QGraphics, QControls, QForms, QDialogs, QStdCtrls,
QExtCtrls;
type
Tdwin = class(TForm)
Memo1: TMemo;
Panel1: TPanel;
Button1: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
dwin: Tdwin;
implementation
{$R *.dfm}
end.

BIN
Samples/Kylix/fMain.dfm Normal file

Binary file not shown.

330
Samples/Kylix/fMain.pas Normal file
View File

@ -0,0 +1,330 @@
unit fMain;
interface
uses
Classes, QGraphics, QControls, QForms, QDialogs,
uPSCompiler, uPSRuntime, uPSUtils, QMenus, QTypes, QStdCtrls, QExtCtrls;
type
TMainForm = class(TForm)
Memo1: TMemo;
Memo2: TMemo;
Splitter1: TSplitter;
MainMenu1: TMainMenu;
Toosl1: TMenuItem;
Compile1: TMenuItem;
File1: TMenuItem;
Exit1: TMenuItem;
N1: TMenuItem;
SaveAs1: TMenuItem;
Save1: TMenuItem;
Open1: TMenuItem;
New1: TMenuItem;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
N2: TMenuItem;
Stop1: TMenuItem;
N3: TMenuItem;
CompileandDisassemble1: TMenuItem;
procedure Compile1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure New1Click(Sender: TObject);
procedure Open1Click(Sender: TObject);
procedure Save1Click(Sender: TObject);
procedure SaveAs1Click(Sender: TObject);
procedure Memo1Change(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure Stop1Click(Sender: TObject);
procedure CompileandDisassemble1Click(Sender: TObject);
private
fn: string;
changed: Boolean;
function SaveTest: Boolean;
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
uses
fDwin, uPSDisassembly, uPSC_dll, uPSR_dll;
{$R *.dfm}
function MyOnUses(Sender: TIFPSPascalCompiler; const Name: string): Boolean;
begin
if Name = 'SYSTEM' then
begin
TIFPSPascalCompiler(Sender).AddFunction('procedure Writeln(s: string);');
TIFPSPascalCompiler(Sender).AddFunction('function Readln(question: string): string;');
Sender.AddConstantN('NaN', 'extended').SetExtended(0.0 / 0.0);
Sender.AddConstantN('Infinity', 'extended').SetExtended(1.0 / 0.0);
Sender.AddConstantN('NegInfinity', 'extended').SetExtended(1.0 / 0.0);
Sender.AddDelphiFunction('function ImportTest(S1: string; s2: Longint; s3: Byte; s4: word; var s5: string): string;');
Result := True;
end
else
begin
TIFPSPascalCompiler(Sender).MakeError('', ecUnknownIdentifier, '');
Result := False;
end;
end;
function MyWriteln(Caller: TIFPSExec; p: TPSExternalProcRec; Global, Stack: TIFPSStack): Boolean;
begin
MainForm.Memo2.Lines.Add(Stack.GetString(-1));
Result := True;
end;
function MyReadln(Caller: TIFPSExec; p: TPSExternalProcRec; Global, Stack: TIFPSStack): Boolean;
begin
Stack.SetString(-1,InputBox(MainForm.Caption, Stack.GetString(-2), ''));
Result := True;
end;
function ImportTest(S1: string; s2: Longint; s3: Byte; s4: word; var s5: string): string;
begin
Result := s1 + ' ' + IntToStr(s2) + ' ' + IntToStr(s3) + ' ' + IntToStr(s4) + ' - OK!';
S5 := s5 + ' '+ result + ' - OK2!';
end;
var
I: Integer;
procedure RunLine(Sender: TIFPSExec);
begin
i := (i + 1) mod 15;
if i = 0 then Application.ProcessMessages;
end;
function MyExportCheck(Sender: TIFPSPascalCompiler; Proc: TIFPSInternalProcedure; const ProcDecl: string): Boolean;
begin
Result := TRue;
end;
procedure TMainForm.Compile1Click(Sender: TObject);
var
x1: TIFPSPascalCompiler;
x2: TIFPSExec;
s: string;
procedure Outputtxt(const s: string);
begin
Memo2.Lines.Add(s);
end;
procedure OutputMsgs;
var
l: Longint;
b: Boolean;
begin
b := False;
for l := 0 to x1.MsgCount - 1 do
begin
Outputtxt(x1.Msg[l].MessageToString);
if (not b) and (x1.Msg[l] is TPSPascalCompilerError) then
begin
b := True;
Memo1.SelStart := X1.Msg[l].Pos;
end;
end;
end;
begin
if tag <> 0 then exit;
Memo2.Clear;
x1 := TIFPSPascalCompiler.Create;
x1.OnExportCheck := MyExportCheck;
x1.OnUses := MyOnUses;
x1.OnExternalProc := DllExternalProc;
if x1.Compile(Memo1.Text) then
begin
Outputtxt('Succesfully compiled');
OutputMsgs;
if not x1.GetOutput(s) then
begin
x1.Free;
Outputtxt('[Error] : Could not get data');
exit;
end;
x1.Free;
x2 := TIFPSExec.Create;
RegisterDLLRuntime(x2);
tag := longint(x2);
if sender <> nil then
x2.OnRunLine := RunLine;
x2.RegisterFunctionName('WRITELN', MyWriteln, nil, nil);
x2.RegisterFunctionName('READLN', MyReadln, nil, nil);
x2.RegisterDelphiFunction(@importtest, 'IMPORTTEST', cdRegister);
if not x2.LoadData(s) then begin
Outputtxt('[Error] : Could not load data');
x2.Free;
exit;
end;
x2.RunScript;
if x2.ExceptionCode <> ENoError then
Outputtxt('[Runtime Error] : ' + TIFErrorToString(x2.ExceptionCode, x2.ExceptionString) +
' in ' + IntToStr(x2.ExceptionProcNo) + ' at ' + IntToSTr(x2.ExceptionPos))
else
OutputTxt('Successfully executed');
tag := 0;
x2.Free;
end
else
begin
Outputtxt('Failed when compiling');
OutputMsgs;
x1.Free;
end;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
Caption := 'RemObjects Pascal Script';
fn := '';
changed := False;
Memo1.Lines.Text := 'Program ROTEST;'#13#10'Begin'#13#10'End.';
end;
procedure TMainForm.Exit1Click(Sender: TObject);
begin
Close;
end;
procedure TMainForm.New1Click(Sender: TObject);
begin
if not SaveTest then
exit;
Memo1.Lines.Text := 'Program ROTEST;'#13#10'Begin'#13#10'End.';
Memo2.Lines.Clear;
fn := '';
end;
function TMainForm.SaveTest: Boolean;
begin
if changed then
begin
case MessageDlg('File is not saved, save now?', mtWarning, mbYesNoCancel, 0) of
mrYes:
begin
Save1Click(nil);
Result := not changed;
end;
mrNo: Result := True;
else
Result := False;
end;
end
else
Result := True;
end;
procedure TMainForm.Open1Click(Sender: TObject);
begin
if not SaveTest then
exit;
if OpenDialog1.Execute then
begin
Memo1.Lines.LoadFromFile(OpenDialog1.FileName);
changed := False;
Memo2.Lines.Clear;
fn := OpenDialog1.FileName;
end;
end;
procedure TMainForm.Save1Click(Sender: TObject);
begin
if fn = '' then
begin
Saveas1Click(nil);
end
else
begin
Memo1.Lines.SaveToFile(fn);
changed := False;
end;
end;
procedure TMainForm.SaveAs1Click(Sender: TObject);
begin
SaveDialog1.FileName := '';
if SaveDialog1.Execute then
begin
fn := SaveDialog1.FileName;
Memo1.Lines.SaveToFile(fn);
changed := False;
end;
end;
procedure TMainForm.Memo1Change(Sender: TObject);
begin
changed := True;
end;
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := SaveTest;
end;
procedure TMainForm.Stop1Click(Sender: TObject);
begin
if tag <> 0 then
TIFPSExec(tag).Stop;
end;
procedure TMainForm.CompileandDisassemble1Click(Sender: TObject);
var
x1: TIFPSPascalCompiler;
s, s2: string;
procedure OutputMsgs;
var
l: Longint;
b: Boolean;
begin
b := False;
for l := 0 to x1.MsgCount - 1 do
begin
Memo2.Lines.Add(x1.Msg[l].MessageToString);
if (not b) and (x1.Msg[l] is TPSPascalCompilerError) then
begin
b := True;
Memo1.SelStart := X1.Msg[l].Pos;
end;
end;
end;
begin
if tag <> 0 then exit;
Memo2.Clear;
x1 := TIFPSPascalCompiler.Create;
x1.OnExternalProc := DllExternalProc;
x1.OnUses := MyOnUses;
if x1.Compile(Memo1.Text) then
begin
Memo2.Lines.Add('Succesfully compiled');
OutputMsgs;
if not x1.GetOutput(s) then
begin
x1.Free;
Memo2.Lines.Add('[Error] : Could not get data');
exit;
end;
x1.Free;
IFPS3DataToText(s, s2);
dwin.Memo1.Text := s2;
dwin.showmodal;
end
else
begin
Memo2.Lines.Add('Failed when compiling');
OutputMsgs;
x1.Free;
end;
end;
end.

View File

@ -0,0 +1,9 @@
Program IFSTest;
var
i: Longint;
Begin
for i := 0 to 9 do
begin
writeln('hello'+inttostr(i));
end;
End.

9
Samples/Kylix/if.rops Normal file
View File

@ -0,0 +1,9 @@
Program IFSTest;
var
a: boolean;
Begin
a := true;
if a then begin ;end else
if a then begin ;end else;
writeln('5');
End.

View File

@ -0,0 +1,16 @@
Program IFSTest;
var
a,b :string;
Begin
a := 'test: ';
b := ImportTest('1', 2, 3, 4, a);
writeln(b);
writeln(a);
{
Output should be:
1 2 3 4 - OK!
1 2 3 4 - OK! - OK2!
}
End.

View File

@ -0,0 +1,10 @@
Program IFSTest;
var
i, i2: Longint;
Begin
for i := 0 to 1000000 do
begin
i2 := i -1;
end;
writeln(inttostr(i2));
End.

View File

@ -0,0 +1,11 @@
Program IFSTest;
type
TMyRec = record a: Integer; b: string; end;
var
s: TMyRec;
Begin
s.a := 1234;
s.b := 'abc';
writeln(s.b);
writeln(inttostr(s.a));
End.

View File

@ -0,0 +1,14 @@
Program IFSTest;
var
e: variant;
Begin
e := null;
case VarType(e) of
varempty :writeln('unassigned');
varNull: Writeln('null');
varstring: Writeln('String');
varInteger : writeln('VarInteger');
varSingle: Writeln('Single');
varDouble: Writeln('Double');
end;
End.

View File

@ -0,0 +1,109 @@
<Library Name="NewLibrary" UID="{D9821C1A-A084-4120-93F3-BCE6CF2AE0F4}" Documentation="">
<Services>
<Service Name="NewService">
<Interfaces>
<Interface Name="Default" UID="{D9821C1A-A084-4120-93F3-BCE6CF2AE0F4}" Documentation="Service_NewService__This_service_has_been_automatically_generated_using_the_RODL_template_you_can_find_in_the_Templates_directory_">
<Operations>
<Operation Name="Sum" UID="{D9821C1A-A084-4120-93F3-BCE6CF2AE0F4}" Documentation="">
<Parameters>
<Parameter Name="A" DataType="Integer" Flag="In" />
<Parameter Name="B" DataType="Integer" Flag="In" />
<Parameter Name="Result" DataType="Integer" Flag="Result" />
</Parameters>
</Operation>
<Operation Name="GetServerTime" UID="{D9821C1A-A084-4120-93F3-BCE6CF2AE0F4}" Documentation="">
<Parameters>
<Parameter Name="Result" DataType="DateTime" Flag="Result" />
</Parameters>
</Operation>
<Operation Name="EchoPerson" UID="{B8717BF0-B874-4C94-8756-A734840FE445}" Documentation="">
<Parameters>
<Parameter Name="aPerson" DataType="TPerson" Flag="In" />
<Parameter Name="anotherPerson" DataType="TPerson" Flag="Out" />
</Parameters>
</Operation>
<Operation Name="TestIntegerArray" UID="{2A0CA87E-11DC-45FE-8288-30EEDDE8EC4E}" Documentation="">
<Parameters>
<Parameter Name="anArray" DataType="TIntegerArray" Flag="In" />
<Parameter Name="Result" DataType="TIntegerArray" Flag="Result" />
</Parameters>
</Operation>
<Operation Name="TestStringArray" UID="{C54A4879-EBA7-4AA3-B4CC-05A66580DB8C}" Documentation="">
<Parameters>
<Parameter Name="anArray" DataType="TStringArray" Flag="In" />
<Parameter Name="Result" DataType="TStringArray" Flag="Result" />
</Parameters>
</Operation>
<Operation Name="TestPersonArray" UID="{50565130-EA3B-408A-A230-B55AB11F7743}" Documentation="">
<Parameters>
<Parameter Name="anArray" DataType="TPersonArray" Flag="In" />
<Parameter Name="Result" DataType="TPersonArray" Flag="Result" />
</Parameters>
</Operation>
<Operation Name="EchoBinary" UID="{6007A623-9D43-4AB2-8CE5-E337316FE8DD}" Documentation="">
<Parameters>
<Parameter Name="BinIN" DataType="binary" Flag="In" />
<Parameter Name="BinOUT" DataType="Binary" Flag="Out" />
</Parameters>
</Operation>
<Operation Name="SomeTypes" UID="{86B5581B-EDB0-4039-9EF4-2F4155BF28F0}" Documentation="">
<Parameters>
<Parameter Name="aString" DataType="String" Flag="InOut" />
<Parameter Name="aWidestring" DataType="Widestring" Flag="InOut" />
<Parameter Name="anInteger" DataType="Integer" Flag="InOut" />
<Parameter Name="aCurrency" DataType="Currency" Flag="InOut" />
<Parameter Name="aDatetime" DataType="DateTime" Flag="InOut" />
</Parameters>
</Operation>
<Operation Name="CustomObjectAsString" UID="{D26D93E6-8FA8-447F-B927-604A542DCC43}" Documentation="">
<Parameters>
<Parameter Name="Result" DataType="String" Flag="Result" />
</Parameters>
</Operation>
<Operation Name="CustomObjectAsStream" UID="{F5048214-9949-41D2-B6FC-76E707E9E645}" Documentation="">
<Parameters>
<Parameter Name="Result" DataType="Binary" Flag="Result" />
</Parameters>
</Operation>
<Operation Name="RaiseError" UID="{6FF781AC-4A73-40FE-9760-216C2F460FF2}" Documentation="">
<Parameters>
</Parameters>
</Operation>
</Operations>
</Interface>
</Interfaces>
</Service>
</Services>
<Structs>
<Struct Name="TPerson" UID="{94B3E0BD-4AB9-4C93-8507-C1762CDA32C7}" Documentation="">
<Elements>
<Element Name="FirstName" DataType="String" />
<Element Name="LastName" DataType="String" />
<Element Name="Age" DataType="Integer" />
<Element Name="Sex" DataType="TSex" />
</Elements>
</Struct>
</Structs>
<Enums>
<Enum Name="TSex" UID="{9B0938FA-35F8-49DE-91E1-DB9E0DD5E1A3}" Documentation="">
<EnumValues>
<EnumValue Name="sxMale" />
<EnumValue Name="sxFemale" />
</EnumValues>
</Enum>
</Enums>
<Arrays>
<Array Name="TPersonArray" UID="{3DDF0AF8-EA63-4DD1-A23F-4AA0427A1DCA}" Documentation="">
<ElementType DataType="TPerson" />
</Array>
<Array Name="TIntegerArray" UID="{54E4F9ED-83DD-42E3-9611-D2617163B733}" Documentation="">
<ElementType DataType="Integer" />
</Array>
<Array Name="TStringArray" UID="{A4EE5636-DAD1-45B4-A46C-993664EB279F}" Documentation="">
<ElementType DataType="String" />
</Array>
</Arrays>
<Exceptions>
<Exception Name="TestException" UID="{DFB108B7-C8D8-4E25-AAFC-8546094E1623}" Documentation="" />
</Exceptions>
</Library>

View File

@ -0,0 +1,92 @@
var
Message: TROBINMessage;
Channel: TRoIndyHttpChannel;
Service: NewService;
s: string;
i1, i2, i3: Integer;
procedure TestPerson;
var
inp, outp: TPerson;
begin
inp.FirstName := 'First_Name';
inp.FirstName := 'Last_Name';
inp.Age := 100;
inp.Sex := sxFemale;
Writeln('Calling TestPerson:');
Service.EchoPerson(inp, outp);
Writeln('Test Result: FirstName: '+outp.FirstName+
' LastName: '+outp.LastName + ' Age: '+inttostr(outp.Age));
if inp.Sex = sxMale then
Writeln('Male')
else
Writeln('Female');
end;
procedure TestStringArray;
var
Str, Str2: TStringArray;
i: Longint;
s: string;
begin
Str := ['first', 'second', 'third', 'fourth', 'fifth'];
Writeln('Passing [''first'', ''second'', ''third'', ''fourth'', ''fifth''] to TestStringArray:');
str2 := Service.TestStringArray(str);
for i := 0 to GetArrayLength(str2) -1 do
S := s + str2[i]+' ';
Writeln('Result: '+s);
end;
procedure TestIntegerArray;
var
Str, Str2: TIntegerArray;
i: Longint;
s: string;
begin
Str := [12, 34, 45, 67, 89];
Writeln('Passing [12, 34, 45, 67, 89] to TestIntegerArray:');
str2 := Service.TestIntegerArray(str);
for i := 0 to GetArrayLength(str2) -1 do
S := s + inttostr(str2[i])+' ';
Writeln('Result: '+s);
end;
begin
Message := TROBINMessage.Create(nil);
Message.UseCompression := False;
Channel := TRoIndyHTTPChannel.Create(nil);
Channel.TargetURL := 'http://localhost:8099/BIN';
Service := NewService.Create(Message, Channel);
try
TestPerson;
Writeln('MegaDemo Test');
Writeln('First number:');
s := readln('First Number');
i1 := StrToInt(s);
Writeln('Second number:');
s := readln('Second Number');
i2 := StrToInt(s);
i3 := Service.Sum(i1,i2);
writeln(inttostr(i1)+'+'+inttostr(i2)+' -> Server, Result:'+inttostr(i3));
Writeln('Server Time:'+DateToStr(Service.GetServerTime));
TestStringArray;
TestIntegerArray;
Writeln('Custom Object As String: '+Service.CustomObjectAsString);
try
Writeln('Trying to raise an exception:');
Service.RaiseError;
Writeln('Exception Failed');
except
Writeln('Exception: '+ExceptionToString(ExceptionType, ExceptionParam));
end;
finally
Service := nil;
channel.Free;
message.Free;
end;
end.

View File

@ -0,0 +1,14 @@
program TestApplication;
uses
Forms,
fMain in 'fMain.pas' {Form1};
{$R *.RES}
begin
Application.Initialize;
Application.Title := 'Test Application';
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,174 @@
unit fMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, uPSComponent, uPSCompiler, Menus, uPSRuntime,
uROPSServerLink, uPSComponent_Default;
type
TForm1 = class(TForm)
Memo1: TMemo;
Memo2: TMemo;
Splitter1: TSplitter;
PSScript: TPSScript;
PS3DllPlugin: TPSDllPlugin;
MainMenu1: TMainMenu;
Program1: TMenuItem;
Compile1: TMenuItem;
PS3RemObjectsPlugin1: TPSRemObjectsSdkPlugin;
OpenDialog1: TOpenDialog;
OpenDialog2: TOpenDialog;
N1: TMenuItem;
OpenScript1: TMenuItem;
OpenRODL1: TMenuItem;
PSImport_Classes1: TPSImport_Classes;
PSImport_DateUtils1: TPSImport_DateUtils;
procedure IFPS3ClassesPlugin1CompImport(Sender: TObject;
x: TPSPascalCompiler);
procedure IFPS3ClassesPlugin1ExecImport(Sender: TObject; Exec: TPSExec;
x: TPSRuntimeClassImporter);
procedure PSScriptCompile(Sender: TPSScript);
procedure Compile1Click(Sender: TObject);
procedure PSScriptExecute(Sender: TPSScript);
procedure OpenRODL1Click(Sender: TObject);
procedure OpenScript1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
uPSR_std,
uPSC_std,
uPSR_stdctrls,
uPSC_stdctrls,
uPSR_forms,
uPSC_forms,
uPSC_graphics,
uPSC_controls,
uPSC_classes,
uPSR_graphics,
uPSR_controls,
uPSR_classes;
{$R *.DFM}
procedure TForm1.IFPS3ClassesPlugin1CompImport(Sender: TObject;
x: TIFPSPascalcompiler);
begin
SIRegister_Std(x);
SIRegister_Classes(x, true);
SIRegister_Graphics(x, true);
SIRegister_Controls(x);
SIRegister_stdctrls(x);
SIRegister_Forms(x);
end;
procedure TForm1.IFPS3ClassesPlugin1ExecImport(Sender: TObject; Exec: TIFPSExec;
x: TIFPSRuntimeClassImporter);
begin
RIRegister_Std(x);
RIRegister_Classes(x, True);
RIRegister_Graphics(x, True);
RIRegister_Controls(x);
RIRegister_stdctrls(x);
RIRegister_Forms(x);
end;
function ImportTest(S1: string; s2: Longint; s3: Byte; s4: word; var s5: string): string;
begin
Result := s1 + ' ' + IntToStr(s2) + ' ' + IntToStr(s3) + ' ' + IntToStr(s4) + ' - OK!';
S5 := s5 + ' '+ result + ' - OK2!';
end;
procedure MyWriteln(const s: string);
begin
Form1.Memo2.Lines.Add(s);
end;
function MyReadln(const question: string): string;
begin
Result := InputBox(question, '', '');
end;
procedure TForm1.PSScriptCompile(Sender: TPSScript);
begin
Sender.AddFunction(@MyWriteln, 'procedure Writeln(s: string);');
Sender.AddFunction(@MyReadln, 'function Readln(question: string): string;');
Sender.AddFunction(@ImportTest, 'function ImportTest(S1: string; s2: Longint; s3: Byte; s4: word; var s5: string): string;');
Sender.AddRegisteredVariable('Application', 'TApplication');
Sender.AddRegisteredVariable('Self', 'TForm');
Sender.AddRegisteredVariable('Memo1', 'TMemo');
Sender.AddRegisteredVariable('Memo2', 'TMemo');
end;
procedure TForm1.Compile1Click(Sender: TObject);
procedure OutputMessages;
var
l: Longint;
b: Boolean;
begin
b := False;
for l := 0 to PSScript.CompilerMessageCount - 1 do
begin
Memo2.Lines.Add('Compiler: '+ PSScript.CompilerErrorToStr(l));
if (not b) and (PSScript.CompilerMessages[l] is TIFPSPascalCompilerError) then
begin
b := True;
Memo1.SelStart := PSScript.CompilerMessages[l].Pos;
end;
end;
end;
begin
Memo2.Lines.Clear;
PSScript.Script.Assign(Memo1.Lines);
Memo2.Lines.Add('Compiling');
if PSScript.Compile then
begin
OutputMessages;
Memo2.Lines.Add('Compiled succesfully');
if not PSScript.Execute then
begin
Memo1.SelStart := PSScript.ExecErrorPosition;
Memo2.Lines.Add(PSScript.ExecErrorToString +' at '+Inttostr(PSScript.ExecErrorProcNo)+'.'+Inttostr(PSScript.ExecErrorByteCodePosition));
end else Memo2.Lines.Add('Succesfully executed');
end else
begin
OutputMessages;
Memo2.Lines.Add('Compiling failed');
end;
end;
procedure TForm1.PSScriptExecute(Sender: TPSScript);
begin
PSScript.SetVarToInstance('APPLICATION', Application);
PSScript.SetVarToInstance('SELF', Self);
PSScript.SetVarToInstance('MEMO1', Memo1);
PSScript.SetVarToInstance('MEMO2', Memo2);
end;
procedure TForm1.OpenRODL1Click(Sender: TObject);
begin
if OpenDialog2.Execute then
begin
PS3RemObjectsPlugin1.RODLLoadFromFile(OpenDialog2.FileName);
end;
end;
procedure TForm1.OpenScript1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
Memo1.Lines.LoadFromFile(OpenDialog1.FileName);
end;
end;
end.

View File

@ -0,0 +1,14 @@
program TestApplication;
uses
Forms,
fMain in 'fMain.pas' {Form1};
{$R *.RES}
begin
Application.Initialize;
Application.Title := 'Test Application';
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

Binary file not shown.

BIN
Samples/TestApp/fMain.dfm Normal file

Binary file not shown.

152
Samples/TestApp/fMain.pas Normal file
View File

@ -0,0 +1,152 @@
unit fMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, uPSComponent, uPSCompiler, uPSUtils,
Menus, uPSRuntime;
type
TForm1 = class(TForm)
Memo1: TMemo;
Memo2: TMemo;
Splitter1: TSplitter;
PSScript: TPSScript;
PS3DllPlugin: TPSDllPlugin;
MainMenu1: TMainMenu;
Program1: TMenuItem;
Compile1: TMenuItem;
procedure IFPS3ClassesPlugin1CompImport(Sender: TObject;
x: TPSPascalCompiler);
procedure IFPS3ClassesPlugin1ExecImport(Sender: TObject; Exec: TPSExec;
x: TPSRuntimeClassImporter);
procedure PSScriptCompile(Sender: TPSScript);
procedure Compile1Click(Sender: TObject);
procedure PSScriptExecute(Sender: TPSScript);
private
MyVar: Longint;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
uPSR_std,
uPSC_std,
uPSR_stdctrls,
uPSC_stdctrls,
uPSR_forms,
uPSC_forms,
uPSC_graphics,
uPSC_controls,
uPSC_classes,
uPSR_graphics,
uPSR_controls,
uPSR_classes;
{$R *.DFM}
procedure TForm1.IFPS3ClassesPlugin1CompImport(Sender: TObject;
x: TIFPSPascalcompiler);
begin
SIRegister_Std(x);
SIRegister_Classes(x, true);
SIRegister_Graphics(x, true);
SIRegister_Controls(x);
SIRegister_stdctrls(x);
SIRegister_Forms(x);
end;
procedure TForm1.IFPS3ClassesPlugin1ExecImport(Sender: TObject; Exec: TIFPSExec;
x: TIFPSRuntimeClassImporter);
begin
RIRegister_Std(x);
RIRegister_Classes(x, True);
RIRegister_Graphics(x, True);
RIRegister_Controls(x);
RIRegister_stdctrls(x);
RIRegister_Forms(x);
end;
function ImportTest(S1: string; s2: Longint; s3: Byte; s4: word; var s5: string): string;
begin
Result := s1 + ' ' + IntToStr(s2) + ' ' + IntToStr(s3) + ' ' + IntToStr(s4) + ' - OK!';
S5 := s5 + ' '+ result + ' - OK2!';
end;
procedure MyWriteln(const s: string);
begin
Form1.Memo2.Lines.Add(s);
end;
function MyReadln(const question: string): string;
begin
Result := InputBox(question, '', '');
end;
procedure TForm1.PSScriptCompile(Sender: TPSScript);
begin
Sender.AddFunction(@MyWriteln, 'procedure Writeln(s: string);');
Sender.AddFunction(@MyReadln, 'function Readln(question: string): string;');
Sender.AddFunction(@ImportTest, 'function ImportTest(S1: string; s2: Longint; s3: Byte; s4: word; var s5: string): string;');
Sender.AddRegisteredVariable('Application', 'TApplication');
Sender.AddRegisteredVariable('Self', 'TForm');
Sender.AddRegisteredVariable('Memo2', 'TMemo');
Sender.AddRegisteredPTRVariable('Memo1', 'TMemo');
Sender.AddRegisteredPTRVariable('MyVar', 'Longint');
end;
procedure TForm1.Compile1Click(Sender: TObject);
procedure OutputMessages;
var
l: Longint;
b: Boolean;
begin
b := False;
for l := 0 to PSScript.CompilerMessageCount - 1 do
begin
Memo2.Lines.Add('Compiler: '+ PSScript.CompilerErrorToStr(l));
if (not b) and (PSScript.CompilerMessages[l] is TIFPSPascalCompilerError) then
begin
b := True;
Memo1.SelStart := PSScript.CompilerMessages[l].Pos;
end;
end;
end;
begin
Memo2.Lines.Clear;
PSScript.Script.Assign(Memo1.Lines);
Memo2.Lines.Add('Compiling');
if PSScript.Compile then
begin
OutputMessages;
Memo2.Lines.Add('Compiled succesfully');
if not PSScript.Execute then
begin
Memo1.SelStart := PSScript.ExecErrorPosition;
Memo2.Lines.Add(PSScript.ExecErrorToString +' at '+Inttostr(PSScript.ExecErrorProcNo)+'.'+Inttostr(PSScript.ExecErrorByteCodePosition));
end else Memo2.Lines.Add('Succesfully executed');
end else
begin
OutputMessages;
Memo2.Lines.Add('Compiling failed');
end;
end;
procedure TForm1.PSScriptExecute(Sender: TPSScript);
begin
PSScript.SetVarToInstance('APPLICATION', Application);
PSScript.SetVarToInstance('SELF', Self);
PSScript.SetVarToInstance('MEMO1', Memo1);
PSScript.SetVarToInstance('MEMO2', Memo2);
PSScript.SetPointerToData('MyVar', @MyVar, PSScript.FindBaseType(bts32));
PSScript.SetPointerToData('Memo1', @Memo1, PSScript.FindNamedType('TMemo'));
end;
end.

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
<Option Name="Personality">Default.Personality</Option>
<Option Name="ProjectType"></Option>
<Option Name="Version">1.0</Option>
<Option Name="GUID">{1AAFA68F-D7AE-44BA-927F-310105A7A640}</Option>
</Option>
</PersonalityInfo>
<Default.Personality>
<Projects>
<Projects Name="PascalScript_Core_D10.bpl">PascalScript_Core_D10.bdsproj</Projects>
<Projects Name="PascalScript_RO_D10.bpl">PascalScript_RO_D10.bdsproj</Projects>
<Projects Name="Targets">PascalScript_Core_D10.bpl PascalScript_RO_D10.bpl</Projects>
</Projects>
<Dependencies/>
</Default.Personality> <StarTeamAssociation></StarTeamAssociation>
<StarTeamNonRelativeFiles></StarTeamNonRelativeFiles>
</BorlandProject>

View File

@ -0,0 +1,23 @@
#------------------------------------------------------------------------------
VERSION = BWS.01
#------------------------------------------------------------------------------
!ifndef ROOT
ROOT = $(MAKEDIR)\..
!endif
#------------------------------------------------------------------------------
MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
DCC = $(ROOT)\bin\dcc32.exe $**
BRCC = $(ROOT)\bin\brcc32.exe $**
#------------------------------------------------------------------------------
PROJECTS = PascalScript_Core_D6.bpl PascalScript_RO_D6.bpl
#------------------------------------------------------------------------------
default: $(PROJECTS)
#------------------------------------------------------------------------------
PascalScript_Core_D6.bpl: PascalScript_Core_D6.dpk
$(DCC)
PascalScript_RO_D6.bpl: PascalScript_RO_D6.dpk
$(DCC)

View File

@ -0,0 +1,23 @@
#------------------------------------------------------------------------------
VERSION = BWS.01
#------------------------------------------------------------------------------
!ifndef ROOT
ROOT = $(MAKEDIR)\..
!endif
#------------------------------------------------------------------------------
MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
DCC = $(ROOT)\bin\dcc32.exe $**
BRCC = $(ROOT)\bin\brcc32.exe $**
#------------------------------------------------------------------------------
PROJECTS = PascalScript_Core_D7.bpl PascalScript_RO_D7.bpl
#------------------------------------------------------------------------------
default: $(PROJECTS)
#------------------------------------------------------------------------------
PascalScript_Core_D7.bpl: PascalScript_Core_D7.dpk
$(DCC)
PascalScript_RO_D7.bpl: PascalScript_RO_D7.dpk
$(DCC)

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
<Option Name="Personality">Default.Personality</Option>
<Option Name="ProjectType"></Option>
<Option Name="Version">1.0</Option>
<Option Name="GUID">{1AAFA68F-D7AE-44BA-927F-310105A7A640}</Option>
</Option>
</PersonalityInfo>
<Default.Personality>
<Projects>
<Projects Name="PascalScript_Core_D9.bpl">PascalScript_Core_D9.bdsproj</Projects>
<Projects Name="PascalScript_RO_D9.bpl">PascalScript_RO_D9.bdsproj</Projects>
<Projects Name="Targets">PascalScript_Core_D9.bpl PascalScript_RO_D9.bpl</Projects>
</Projects>
<Dependencies/>
</Default.Personality>
</BorlandProject>

66
Source/PascalScript.inc Normal file
View File

@ -0,0 +1,66 @@
{----------------------------------------------------------------------------}
{ RemObjects Pascal Script }
{ }
{ compiler: Delphi 2 and up, Kylix 3 and up }
{ platform: Win32, Linux }
{ }
{ (c)opyright RemObjects Software. all rights reserved. }
{ }
{----------------------------------------------------------------------------}
{$INCLUDE eDefines.inc}
{$IFDEF FPC}{$H+}{$MODE DELPHI}{$ENDIF}
{$IFDEF VER125}{C4}{$B-}{$X+}{$T-}{$H+}{$ENDIF}
{$IFDEF VER110}{C3}{$B-}{$X+}{$T-}{$H+}{$ENDIF}
{$IFDEF VER93}{C1}{$B-}{$X+}{$T-}{$H+}{$ENDIF}
{$IFDEF DELPHI4UP}
{$DEFINE PS_HAVEVARIANT}
{$DEFINE PS_DYNARRAY}
{$ENDIF}
{$IFNDEF FPC}
{$B-}{$X+}{$T-}{$H+}
{$ELSE}
{$R-}{$Q-}
{$ENDIF}
{$IFNDEF FPC}
{$IFNDEF DELPHI4UP}
{$IFNDEF LINUX}
{$DEFINE PS_NOINT64}
{$ENDIF}
{$ENDIF}
{$IFDEF DELPHI2}
{$DEFINE PS_NOINT64}
{$DEFINE PS_NOWIDESTRING}
{$B-}{$X+}{$T-}{$H+}
{$ENDIF}
{$IFDEF LINUX}{KYLIX}{$DEFINE CLX}{$DEFINE DELPHI3UP}{$DEFINE DELPHI6UP}{$ENDIF}
{$ENDIF}
{$R-}{$Q-}
{
Defines:
IFPS3_NOSMARTLIST - Don't use the smart list option
}
{$UNDEF DEBUG}
{$IFDEF CLX}
{$DEFINE PS_NOIDISPATCH} // not implemented
{$ENDIF}
{$IFDEF FPC}
{$DEFINE PS_HAVEVARIANT}
{$DEFINE PS_DYNARRAY}
{$DEFINE PS_NOIDISPATCH}
{$DEFINE DELPHI3UP}
{$DEFINE DELPHI6UP}
{$ENDIF}

View File

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
<Option Name="Personality">Delphi.Personality</Option>
<Option Name="ProjectType"></Option>
<Option Name="Version">1.0</Option>
<Option Name="GUID">{7803B416-C1B3-4801-BCDB-CB1C64840119}</Option>
</Option>
</PersonalityInfo>
<Delphi.Personality>
<Source>
<Source Name="MainSource">PascalScript_Core_D10.dpk</Source>
</Source>
<FileVersion>
<FileVersion Name="Version">7.0</FileVersion>
</FileVersion>
<Compiler>
<Compiler Name="A">8</Compiler>
<Compiler Name="B">0</Compiler>
<Compiler Name="C">1</Compiler>
<Compiler Name="D">1</Compiler>
<Compiler Name="E">0</Compiler>
<Compiler Name="F">0</Compiler>
<Compiler Name="G">1</Compiler>
<Compiler Name="H">1</Compiler>
<Compiler Name="I">1</Compiler>
<Compiler Name="J">0</Compiler>
<Compiler Name="K">0</Compiler>
<Compiler Name="L">1</Compiler>
<Compiler Name="M">0</Compiler>
<Compiler Name="N">1</Compiler>
<Compiler Name="O">1</Compiler>
<Compiler Name="P">1</Compiler>
<Compiler Name="Q">0</Compiler>
<Compiler Name="R">0</Compiler>
<Compiler Name="S">0</Compiler>
<Compiler Name="T">0</Compiler>
<Compiler Name="U">0</Compiler>
<Compiler Name="V">1</Compiler>
<Compiler Name="W">1</Compiler>
<Compiler Name="X">1</Compiler>
<Compiler Name="Y">1</Compiler>
<Compiler Name="Z">1</Compiler>
<Compiler Name="ShowHints">True</Compiler>
<Compiler Name="ShowWarnings">True</Compiler>
<Compiler Name="UnitAliases"></Compiler>
<Compiler Name="NamespacePrefix"></Compiler>
<Compiler Name="GenerateDocumentation">False</Compiler>
<Compiler Name="DefaultNamespace"></Compiler>
<Compiler Name="SymbolDeprecated">False</Compiler>
<Compiler Name="SymbolLibrary">False</Compiler>
<Compiler Name="SymbolPlatform">False</Compiler>
<Compiler Name="SymbolExperimental">False</Compiler>
<Compiler Name="UnitLibrary">False</Compiler>
<Compiler Name="UnitPlatform">False</Compiler>
<Compiler Name="UnitDeprecated">False</Compiler>
<Compiler Name="UnitExperimental">False</Compiler>
<Compiler Name="HResultCompat">True</Compiler>
<Compiler Name="HidingMember">True</Compiler>
<Compiler Name="HiddenVirtual">True</Compiler>
<Compiler Name="Garbage">True</Compiler>
<Compiler Name="BoundsError">True</Compiler>
<Compiler Name="ZeroNilCompat">True</Compiler>
<Compiler Name="StringConstTruncated">True</Compiler>
<Compiler Name="ForLoopVarVarPar">True</Compiler>
<Compiler Name="TypedConstVarPar">True</Compiler>
<Compiler Name="AsgToTypedConst">True</Compiler>
<Compiler Name="CaseLabelRange">True</Compiler>
<Compiler Name="ForVariable">True</Compiler>
<Compiler Name="ConstructingAbstract">True</Compiler>
<Compiler Name="ComparisonFalse">True</Compiler>
<Compiler Name="ComparisonTrue">True</Compiler>
<Compiler Name="ComparingSignedUnsigned">True</Compiler>
<Compiler Name="CombiningSignedUnsigned">True</Compiler>
<Compiler Name="UnsupportedConstruct">True</Compiler>
<Compiler Name="FileOpen">True</Compiler>
<Compiler Name="FileOpenUnitSrc">True</Compiler>
<Compiler Name="BadGlobalSymbol">True</Compiler>
<Compiler Name="DuplicateConstructorDestructor">True</Compiler>
<Compiler Name="InvalidDirective">True</Compiler>
<Compiler Name="PackageNoLink">True</Compiler>
<Compiler Name="PackageThreadVar">True</Compiler>
<Compiler Name="ImplicitImport">True</Compiler>
<Compiler Name="HPPEMITIgnored">True</Compiler>
<Compiler Name="NoRetVal">True</Compiler>
<Compiler Name="UseBeforeDef">True</Compiler>
<Compiler Name="ForLoopVarUndef">True</Compiler>
<Compiler Name="UnitNameMismatch">True</Compiler>
<Compiler Name="NoCFGFileFound">True</Compiler>
<Compiler Name="MessageDirective">True</Compiler>
<Compiler Name="ImplicitVariants">True</Compiler>
<Compiler Name="UnicodeToLocale">True</Compiler>
<Compiler Name="LocaleToUnicode">True</Compiler>
<Compiler Name="ImagebaseMultiple">True</Compiler>
<Compiler Name="SuspiciousTypecast">True</Compiler>
<Compiler Name="PrivatePropAccessor">True</Compiler>
<Compiler Name="UnsafeType">False</Compiler>
<Compiler Name="UnsafeCode">False</Compiler>
<Compiler Name="UnsafeCast">False</Compiler>
<Compiler Name="OptionTruncated">True</Compiler>
<Compiler Name="WideCharReduced">True</Compiler>
<Compiler Name="DuplicatesIgnored">True</Compiler> <Compiler Name="UnitInitSeq">True</Compiler>
<Compiler Name="LocalPInvoke">True</Compiler>
<Compiler Name="CodePage"></Compiler>
</Compiler>
<Linker>
<Linker Name="MapFile">0</Linker>
<Linker Name="OutputObjs">0</Linker>
<Linker Name="ConsoleApp">1</Linker>
<Linker Name="DebugInfo">False</Linker>
<Linker Name="RemoteSymbols">False</Linker>
<Linker Name="GenerateDRC">False</Linker>
<Linker Name="MinStackSize">16384</Linker>
<Linker Name="MaxStackSize">1048576</Linker>
<Linker Name="ImageBase">4194304</Linker>
<Linker Name="ExeDescription">RemObjects Pascal Script - Core Package</Linker> <Linker Name="GenerateHpps">False</Linker>
</Linker>
<Directories>
<Directories Name="OutputDir"></Directories>
<Directories Name="UnitOutputDir">..\Dcu\D10</Directories>
<Directories Name="PackageDLLOutputDir">..\Dcu\D10</Directories>
<Directories Name="PackageDCPOutputDir">..\Dcu\D10</Directories>
<Directories Name="SearchPath">..\Dcu\D10</Directories>
<Directories Name="Packages"></Directories>
<Directories Name="Conditionals"></Directories>
<Directories Name="DebugSourceDirs"></Directories>
<Directories Name="UsePackages">False</Directories>
</Directories>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="RemoteHost"></Parameters>
<Parameters Name="RemotePath"></Parameters>
<Parameters Name="RemoteLauncher"></Parameters>
<Parameters Name="RemoteCWD"></Parameters>
<Parameters Name="RemoteDebug">False</Parameters> <Parameters Name="Debug Symbols Search Path"></Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<Language>
<Language Name="ActiveLang"></Language>
<Language Name="ProjectLang">$00000000</Language>
<Language Name="RootDir"></Language>
</Language>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
<VersionInfo Name="AutoIncBuild">0</VersionInfo>
<VersionInfo Name="MajorVer">0</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">0</VersionInfo>
<VersionInfo Name="PreRelease">0</VersionInfo>
<VersionInfo Name="Special">0</VersionInfo>
<VersionInfo Name="Private">0</VersionInfo>
<VersionInfo Name="DLL">0</VersionInfo>
<VersionInfo Name="Locale">1033</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName">RemObjects Software</VersionInfoKeys>
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">0.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
<VersionInfoKeys Name="ProductName">Pascal Script</VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">3.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="CompileDate">Monday, December 19, 2005 4:43 PM</VersionInfoKeys> <VersionInfoKeys Name="Compile Date">Monday, February 28, 2005 3:33 PM</VersionInfoKeys>
</VersionInfoKeys>
</Delphi.Personality>
</BorlandProject>

View File

@ -0,0 +1,51 @@
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J-
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q-
-$R-
-$S-
-$T-
-$U-
-$V+
-$W+
-$X+
-$YD
-$Z1
-cg
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-N0"..\Dcu\D10"
-LE"..\Dcu\D10"
-LN"..\Dcu\D10"
-U"..\Dcu\D10"
-O"..\Dcu\D10"
-I"..\Dcu\D10"
-R"..\Dcu\D10"
-Z
-w-SYMBOL_DEPRECATED
-w-SYMBOL_LIBRARY
-w-SYMBOL_PLATFORM
-w-SYMBOL_EXPERIMENTAL
-w-UNIT_LIBRARY
-w-UNIT_PLATFORM
-w-UNIT_DEPRECATED
-w-UNIT_EXPERIMENTAL
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@ -0,0 +1,77 @@
package PascalScript_Core_D10;
{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DESCRIPTION 'RemObjects Pascal Script - Core Package'}
{$DESIGNONLY}
{$IMPLICITBUILD OFF}
requires
rtl,
vcl,
dbrtl;
contains
uPSC_extctrls in 'uPSC_extctrls.pas',
uPSC_forms in 'uPSC_forms.pas',
uPSC_graphics in 'uPSC_graphics.pas',
uPSC_menus in 'uPSC_menus.pas',
uPSC_std in 'uPSC_std.pas',
uPSC_stdctrls in 'uPSC_stdctrls.pas',
uPSCompiler in 'uPSCompiler.pas',
uPSComponent in 'uPSComponent.pas',
uPSComponent_COM in 'uPSComponent_COM.pas',
uPSComponent_Controls in 'uPSComponent_Controls.pas',
uPSComponent_DB in 'uPSComponent_DB.pas',
uPSComponent_Default in 'uPSComponent_Default.pas',
uPSComponent_Forms in 'uPSComponent_Forms.pas',
uPSComponent_StdCtrls in 'uPSComponent_StdCtrls.pas',
uPSDebugger in 'uPSDebugger.pas',
uPSDisassembly in 'uPSDisassembly.pas',
uPSPreProcessor in 'uPSPreProcessor.pas',
uPSR_buttons in 'uPSR_buttons.pas',
uPSR_classes in 'uPSR_classes.pas',
uPSR_comobj in 'uPSR_comobj.pas',
uPSR_controls in 'uPSR_controls.pas',
uPSR_dateutils in 'uPSR_dateutils.pas',
uPSR_DB in 'uPSR_DB.pas',
uPSR_dll in 'uPSR_dll.pas',
uPSR_extctrls in 'uPSR_extctrls.pas',
uPSR_forms in 'uPSR_forms.pas',
uPSR_graphics in 'uPSR_graphics.pas',
uPSR_menus in 'uPSR_menus.pas',
uPSR_std in 'uPSR_std.pas',
uPSR_stdctrls in 'uPSR_stdctrls.pas',
uPSRuntime in 'uPSRuntime.pas',
uPSUtils in 'uPSUtils.pas',
uPSC_buttons in 'uPSC_buttons.pas',
uPSC_classes in 'uPSC_classes.pas',
uPSC_comobj in 'uPSC_comobj.pas',
uPSC_controls in 'uPSC_controls.pas',
uPSC_dateutils in 'uPSC_dateutils.pas',
uPSC_DB in 'uPSC_DB.pas',
uPSC_dll in 'uPSC_dll.pas',
PascalScript_Core_Reg in 'PascalScript_Core_Reg.pas',
uPSComponentExt in 'uPSComponentExt.pas';
end.

Binary file not shown.

View File

@ -0,0 +1,115 @@
[FileVersion]
Version=3.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=1
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=0
SymbolLibrary=0
SymbolPlatform=0
UnitLibrary=0
UnitPlatform=0
UnitDeprecated=0
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=RemObjects Pascal Script - Core Package
[Directories]
OutputDir=s:\exe
UnitOutputDir=..\Dcu\D3
PackageDLLOutputDir=..\Dcu\D3
PackageDCPOutputDir=..\Dcu\D3
SearchPath=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Version Info Keys]
CompanyName=RemObjects Software
InternalName=
LegalCopyright=
LegalTrademarks=
ProductName=Pascal Script
ProductVersion=3.0.0.0
FileDescription=
FileVersion=3.0.2.34
OriginalFilename=

View File

@ -0,0 +1,76 @@
package PascalScript_Core_D3;
{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DESCRIPTION 'RemObjects Pascal Script - Core Package'}
{$DESIGNONLY}
{$IMPLICITBUILD OFF}
requires
rtl,
vcl,
dbrtl;
contains
uPSC_extctrls in 'uPSC_extctrls.pas',
uPSC_forms in 'uPSC_forms.pas',
uPSC_graphics in 'uPSC_graphics.pas',
uPSC_menus in 'uPSC_menus.pas',
uPSC_std in 'uPSC_std.pas',
uPSC_stdctrls in 'uPSC_stdctrls.pas',
uPSCompiler in 'uPSCompiler.pas',
uPSComponent in 'uPSComponent.pas',
uPSComponent_COM in 'uPSComponent_COM.pas',
uPSComponent_Controls in 'uPSComponent_Controls.pas',
uPSComponent_DB in 'uPSComponent_DB.pas',
uPSComponent_Default in 'uPSComponent_Default.pas',
uPSComponent_Forms in 'uPSComponent_Forms.pas',
uPSComponent_StdCtrls in 'uPSComponent_StdCtrls.pas',
uPSDebugger in 'uPSDebugger.pas',
uPSDisassembly in 'uPSDisassembly.pas',
uPSPreProcessor in 'uPSPreProcessor.pas',
uPSR_buttons in 'uPSR_buttons.pas',
uPSR_classes in 'uPSR_classes.pas',
uPSR_comobj in 'uPSR_comobj.pas',
uPSR_controls in 'uPSR_controls.pas',
uPSR_dateutils in 'uPSR_dateutils.pas',
uPSR_DB in 'uPSR_DB.pas',
uPSR_dll in 'uPSR_dll.pas',
uPSR_extctrls in 'uPSR_extctrls.pas',
UPSR_forms in 'uPSR_forms.pas',
UPSR_graphics in 'uPSR_graphics.pas',
uPSR_menus in 'uPSR_menus.pas',
uPSR_std in 'uPSR_std.pas',
uPSR_stdctrls in 'uPSR_stdctrls.pas',
uPSRuntime in 'uPSRuntime.pas',
uPSUtils in 'uPSUtils.pas',
uPSC_buttons in 'uPSC_buttons.pas',
uPSC_classes in 'uPSC_classes.pas',
uPSC_comobj in 'uPSC_comobj.pas',
uPSC_controls in 'uPSC_controls.pas',
uPSC_dateutils in 'uPSC_dateutils.pas',
uPSC_DB in 'uPSC_DB.pas',
uPSC_dll in 'uPSC_dll.pas',
PascalScript_Core_Reg in 'PascalScript_Core_Reg.pas';
end.

View File

@ -0,0 +1,114 @@
[FileVersion]
Version=4.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=1
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=0
SymbolLibrary=0
SymbolPlatform=0
UnitLibrary=0
UnitPlatform=0
UnitDeprecated=0
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=RemObjects Pascal Script - Core Package
[Directories]
UnitOutputDir=..\Dcu\D4
PackageDLLOutputDir=..\Dcu\D4
PackageDCPOutputDir=..\Dcu\D4
SearchPath=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Version Info Keys]
CompanyName=RemObjects Software
InternalName=
LegalCopyright=
LegalTrademarks=
ProductName=Pascal Script
ProductVersion=3.0.0.0
FileDescription=
FileVersion=3.0.2.34
OriginalFilename=

View File

@ -0,0 +1,76 @@
package PascalScript_Core_D4
{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DESCRIPTION 'RemObjects Pascal Script - Core Package'}
{$DESIGNONLY}
{$IMPLICITBUILD OFF}
requires
rtl,
vcl,
dbrtl;
contains
uPSC_extctrls in 'uPSC_extctrls.pas',
uPSC_forms in 'uPSC_forms.pas',
uPSC_graphics in 'uPSC_graphics.pas',
uPSC_menus in 'uPSC_menus.pas',
uPSC_std in 'uPSC_std.pas',
uPSC_stdctrls in 'uPSC_stdctrls.pas',
uPSCompiler in 'uPSCompiler.pas',
uPSComponent in 'uPSComponent.pas',
uPSComponent_COM in 'uPSComponent_COM.pas',
uPSComponent_Controls in 'uPSComponent_Controls.pas',
uPSComponent_DB in 'uPSComponent_DB.pas',
uPSComponent_Default in 'uPSComponent_Default.pas',
uPSComponent_Forms in 'uPSComponent_Forms.pas',
uPSComponent_StdCtrls in 'uPSComponent_StdCtrls.pas',
uPSDebugger in 'uPSDebugger.pas',
uPSDisassembly in 'uPSDisassembly.pas',
uPSPreProcessor in 'uPSPreProcessor.pas',
uPSR_buttons in 'uPSR_buttons.pas',
uPSR_classes in 'uPSR_classes.pas',
uPSR_comobj in 'uPSR_comobj.pas',
uPSR_controls in 'uPSR_controls.pas',
uPSR_dateutils in 'uPSR_dateutils.pas',
uPSR_DB in 'uPSR_DB.pas',
uPSR_dll in 'uPSR_dll.pas',
uPSR_extctrls in 'uPSR_extctrls.pas',
UPSR_forms in 'uPSR_forms.pas',
UPSR_graphics in 'uPSR_graphics.pas',
uPSR_menus in 'uPSR_menus.pas',
uPSR_std in 'uPSR_std.pas',
uPSR_stdctrls in 'uPSR_stdctrls.pas',
uPSRuntime in 'uPSRuntime.pas',
uPSUtils in 'uPSUtils.pas',
uPSC_buttons in 'uPSC_buttons.pas',
uPSC_classes in 'uPSC_classes.pas',
uPSC_comobj in 'uPSC_comobj.pas',
uPSC_controls in 'uPSC_controls.pas',
uPSC_dateutils in 'uPSC_dateutils.pas',
uPSC_DB in 'uPSC_DB.pas',
uPSC_dll in 'uPSC_dll.pas',
PascalScript_Core_Reg in 'PascalScript_Core_Reg.pas';
end.

View File

@ -0,0 +1,114 @@
[FileVersion]
Version=5.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=1
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=0
SymbolLibrary=0
SymbolPlatform=0
UnitLibrary=0
UnitPlatform=0
UnitDeprecated=0
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=RemObjects Pascal Script - Core Package
[Directories]
UnitOutputDir=..\Dcu\D5
PackageDLLOutputDir=..\Dcu\D5
PackageDCPOutputDir=..\Dcu\D5
SearchPath=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Version Info Keys]
CompanyName=RemObjects Software
InternalName=
LegalCopyright=
LegalTrademarks=
ProductName=Pascal Script
ProductVersion=3.0.0.0
FileDescription=
FileVersion=3.0.2.34
OriginalFilename=

View File

@ -0,0 +1,76 @@
package PascalScript_Core_D5;
{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DESCRIPTION 'RemObjects Pascal Script - Core Package'}
{$DESIGNONLY}
{$IMPLICITBUILD OFF}
requires
rtl,
vcl,
dbrtl;
contains
uPSC_extctrls in 'uPSC_extctrls.pas',
uPSC_forms in 'uPSC_forms.pas',
uPSC_graphics in 'uPSC_graphics.pas',
uPSC_menus in 'uPSC_menus.pas',
uPSC_std in 'uPSC_std.pas',
uPSC_stdctrls in 'uPSC_stdctrls.pas',
uPSCompiler in 'uPSCompiler.pas',
uPSComponent in 'uPSComponent.pas',
uPSComponent_COM in 'uPSComponent_COM.pas',
uPSComponent_Controls in 'uPSComponent_Controls.pas',
uPSComponent_DB in 'uPSComponent_DB.pas',
uPSComponent_Default in 'uPSComponent_Default.pas',
uPSComponent_Forms in 'uPSComponent_Forms.pas',
uPSComponent_StdCtrls in 'uPSComponent_StdCtrls.pas',
uPSDebugger in 'uPSDebugger.pas',
uPSDisassembly in 'uPSDisassembly.pas',
uPSPreProcessor in 'uPSPreProcessor.pas',
uPSR_buttons in 'uPSR_buttons.pas',
uPSR_classes in 'uPSR_classes.pas',
uPSR_comobj in 'uPSR_comobj.pas',
uPSR_controls in 'uPSR_controls.pas',
uPSR_dateutils in 'uPSR_dateutils.pas',
uPSR_DB in 'uPSR_DB.pas',
uPSR_dll in 'uPSR_dll.pas',
uPSR_extctrls in 'uPSR_extctrls.pas',
UPSR_forms in 'uPSR_forms.pas',
UPSR_graphics in 'uPSR_graphics.pas',
uPSR_menus in 'uPSR_menus.pas',
uPSR_std in 'uPSR_std.pas',
uPSR_stdctrls in 'uPSR_stdctrls.pas',
uPSRuntime in 'uPSRuntime.pas',
uPSUtils in 'uPSUtils.pas',
uPSC_buttons in 'uPSC_buttons.pas',
uPSC_classes in 'uPSC_classes.pas',
uPSC_comobj in 'uPSC_comobj.pas',
uPSC_controls in 'uPSC_controls.pas',
uPSC_dateutils in 'uPSC_dateutils.pas',
uPSC_DB in 'uPSC_DB.pas',
uPSC_dll in 'uPSC_dll.pas',
PascalScript_Core_Reg in 'PascalScript_Core_Reg.pas';
end.

Some files were not shown because too many files have changed in this diff Show More