mirror of
https://github.com/moparisthebest/Simba
synced 2025-03-03 02:41:54 -05:00
Added RUTIS to Simba (You can now choose between RUTIS and PascalScript)
This commit is contained in:
parent
64e2bd4d5e
commit
1eba2fdb8f
@ -7,8 +7,8 @@
|
|||||||
<LRSInOutputDirectory Value="False"/>
|
<LRSInOutputDirectory Value="False"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<SessionStorage Value="InIDEConfig"/>
|
<SessionStorage Value="InIDEConfig"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
<Title Value="Simba"/>
|
<Title Value="Simba"/>
|
||||||
<ResourceType Value="res"/>
|
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
@ -302,7 +302,7 @@
|
|||||||
</Target>
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="$(ProjOutDir)/;$(ProjPath)../../Units/MMLAddon/PSInc/"/>
|
<IncludeFiles Value="$(ProjOutDir)/;$(ProjPath)../../Units/MMLAddon/PSInc/"/>
|
||||||
<OtherUnitFiles Value="$(ProjPath)/;$(ProjPath)../../Units/MMLCore/;$(ProjPath)../../Units/MMLAddon/;$(ProjPath)../../Units/PascalScript/;$(ProjPath)../../Units/Misc/;$(ProjPath)../../Units/MMLAddon/PSInc/;$(ProjPath)../../Units/Linux/;$(ProjPath)../../Units/Synapse/;$(LazarusDir)/components/mouseandkeyinput/"/>
|
<OtherUnitFiles Value="$(ProjPath)/;$(ProjPath)../../Units/MMLCore/;$(ProjPath)../../Units/MMLAddon/;$(ProjPath)../../Units/PascalScript/;$(ProjPath)../../Units/Misc/;$(ProjPath)../../Units/MMLAddon/PSInc/;$(ProjPath)../../Units/Linux/;$(ProjPath)../../Units/Synapse/;$(LazarusDir)/components/mouseandkeyinput/;$(ProjPath)../../Units/RUTIS/"/>
|
||||||
<UnitOutputDirectory Value="$(ProjPath)../../build/$(TargetOS)"/>
|
<UnitOutputDirectory Value="$(ProjPath)../../build/$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
@ -322,6 +322,9 @@
|
|||||||
</Debugging>
|
</Debugging>
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<UseMsgFile Value="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
<CustomOptions Value="-dUseCThreads
|
<CustomOptions Value="-dUseCThreads
|
||||||
-dM_MEMORY_DEBUG
|
-dM_MEMORY_DEBUG
|
||||||
-dFONTDEBUG"/>
|
-dFONTDEBUG"/>
|
||||||
|
@ -41,7 +41,6 @@ uses
|
|||||||
{$R Simba.res}
|
{$R Simba.res}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Application.Title:='Simba';
|
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
|
|
||||||
Application.CreateForm(TSimbaForm, SimbaForm);
|
Application.CreateForm(TSimbaForm, SimbaForm);
|
||||||
|
@ -606,8 +606,7 @@ begin
|
|||||||
OwnerSheet := TTabSheet(TheOwner);
|
OwnerSheet := TTabSheet(TheOwner);
|
||||||
OwnerPage := TPageControl(OwnerSheet.Owner);
|
OwnerPage := TPageControl(OwnerSheet.Owner);
|
||||||
|
|
||||||
if FileExistsUTF8(SimbaForm.DefScriptPath) then
|
SynEdit.Lines.text := SimbaForm.DefaultScript;
|
||||||
SynEdit.Lines.LoadFromFile(SimbaForm.DefScriptPath);
|
|
||||||
StartText:= SynEdit.Lines.text;
|
StartText:= SynEdit.Lines.text;
|
||||||
ScriptDefault:= StartText;
|
ScriptDefault:= StartText;
|
||||||
ScriptName:= 'Untitled';
|
ScriptName:= 'Untitled';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
object SimbaForm: TSimbaForm
|
object SimbaForm: TSimbaForm
|
||||||
Left = 674
|
Left = 531
|
||||||
Height = 623
|
Height = 623
|
||||||
Top = 308
|
Top = 290
|
||||||
Width = 660
|
Width = 660
|
||||||
AllowDropFiles = True
|
AllowDropFiles = True
|
||||||
Caption = 'THA FUKING Simba'
|
Caption = 'THA FUKING Simba'
|
||||||
@ -1243,6 +1243,24 @@ object SimbaForm: TSimbaForm
|
|||||||
ImageIndex = 7
|
ImageIndex = 7
|
||||||
OnClick = ActionStopExecute
|
OnClick = ActionStopExecute
|
||||||
end
|
end
|
||||||
|
object MenuDivider7: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MenuInterpreters: TMenuItem
|
||||||
|
Caption = 'Interpreter'
|
||||||
|
object MenuItemPascalScript: TMenuItem
|
||||||
|
Action = ActionPascalScript
|
||||||
|
RadioItem = True
|
||||||
|
end
|
||||||
|
object MenuItemRUTIS: TMenuItem
|
||||||
|
Action = ActionRUTIS
|
||||||
|
RadioItem = True
|
||||||
|
end
|
||||||
|
object MenuItemCPascal: TMenuItem
|
||||||
|
Action = ActionCPascal
|
||||||
|
RadioItem = True
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object MenuView: TMenuItem
|
object MenuView: TMenuItem
|
||||||
Caption = '&View'
|
Caption = '&View'
|
||||||
@ -2976,6 +2994,19 @@ object SimbaForm: TSimbaForm
|
|||||||
OnExecute = ActionExtensionsExecute
|
OnExecute = ActionExtensionsExecute
|
||||||
OnUpdate = ActionExtensionsUpdate
|
OnUpdate = ActionExtensionsUpdate
|
||||||
end
|
end
|
||||||
|
object ActionPascalScript: TAction
|
||||||
|
Caption = 'ActionPascalScript'
|
||||||
|
OnExecute = ActionPascalScriptExecute
|
||||||
|
end
|
||||||
|
object ActionRUTIS: TAction
|
||||||
|
Caption = 'ActionRUTIS'
|
||||||
|
OnExecute = ActionRUTISExecute
|
||||||
|
end
|
||||||
|
object ActionCPascal: TAction
|
||||||
|
Caption = 'ActionCPascal'
|
||||||
|
Enabled = False
|
||||||
|
OnExecute = ActionCPascalExecute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object DebugTimer: TTimer
|
object DebugTimer: TTimer
|
||||||
OnTimer = ProcessDebugStream
|
OnTimer = ProcessDebugStream
|
||||||
|
@ -47,6 +47,10 @@ uses
|
|||||||
const
|
const
|
||||||
SimbaVersion = 707;
|
SimbaVersion = 707;
|
||||||
|
|
||||||
|
interp_PS = 0; //PascalScript
|
||||||
|
interp_RT = 1; //RUTIS
|
||||||
|
interp_CP = 2; //CPascal
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TMufasaTab }
|
{ TMufasaTab }
|
||||||
@ -66,6 +70,9 @@ type
|
|||||||
{ TSimbaForm }
|
{ TSimbaForm }
|
||||||
|
|
||||||
TSimbaForm = class(TForm)
|
TSimbaForm = class(TForm)
|
||||||
|
ActionCPascal: TAction;
|
||||||
|
ActionRUTIS: TAction;
|
||||||
|
ActionPascalScript: TAction;
|
||||||
ActionExtensions: TAction;
|
ActionExtensions: TAction;
|
||||||
ActionSaveDef: TAction;
|
ActionSaveDef: TAction;
|
||||||
ActionConsole: TAction;
|
ActionConsole: TAction;
|
||||||
@ -105,6 +112,11 @@ type
|
|||||||
MenuFile: TMenuItem;
|
MenuFile: TMenuItem;
|
||||||
MenuEdit: TMenuItem;
|
MenuEdit: TMenuItem;
|
||||||
MenuHelp: TMenuItem;
|
MenuHelp: TMenuItem;
|
||||||
|
MenuDivider7: TMenuItem;
|
||||||
|
MenuInterpreters: TMenuItem;
|
||||||
|
MenuItemPascalScript: TMenuItem;
|
||||||
|
MenuItemCPascal: TMenuItem;
|
||||||
|
MenuItemRUTIS: TMenuItem;
|
||||||
MenuItemOpenPluginsFolder: TMenuItem;
|
MenuItemOpenPluginsFolder: TMenuItem;
|
||||||
MenuItemOpenIncludesFolder: TMenuItem;
|
MenuItemOpenIncludesFolder: TMenuItem;
|
||||||
MenuItemOpenScriptsFolder: TMenuItem;
|
MenuItemOpenScriptsFolder: TMenuItem;
|
||||||
@ -230,6 +242,7 @@ type
|
|||||||
procedure ActionCompileScriptExecute(Sender: TObject);
|
procedure ActionCompileScriptExecute(Sender: TObject);
|
||||||
procedure ActionConsoleExecute(Sender: TObject);
|
procedure ActionConsoleExecute(Sender: TObject);
|
||||||
procedure ActionCopyExecute(Sender: TObject);
|
procedure ActionCopyExecute(Sender: TObject);
|
||||||
|
procedure ActionCPascalExecute(Sender: TObject);
|
||||||
procedure ActionCutExecute(Sender: TObject);
|
procedure ActionCutExecute(Sender: TObject);
|
||||||
procedure ActionDeleteExecute(Sender: TObject);
|
procedure ActionDeleteExecute(Sender: TObject);
|
||||||
procedure ActionExitExecute(Sender: TObject);
|
procedure ActionExitExecute(Sender: TObject);
|
||||||
@ -241,11 +254,13 @@ type
|
|||||||
procedure ActionNewTabExecute(Sender: TObject);
|
procedure ActionNewTabExecute(Sender: TObject);
|
||||||
procedure ActionNormalSizeExecute(Sender: TObject);
|
procedure ActionNormalSizeExecute(Sender: TObject);
|
||||||
procedure ActionOpenExecute(Sender: TObject);
|
procedure ActionOpenExecute(Sender: TObject);
|
||||||
|
procedure ActionPascalScriptExecute(Sender: TObject);
|
||||||
procedure ActionPasteExecute(Sender: TObject);
|
procedure ActionPasteExecute(Sender: TObject);
|
||||||
procedure ActionPauseExecute(Sender: TObject);
|
procedure ActionPauseExecute(Sender: TObject);
|
||||||
procedure ActionRedoExecute(Sender: TObject);
|
procedure ActionRedoExecute(Sender: TObject);
|
||||||
procedure ActionReplaceExecute(Sender: TObject);
|
procedure ActionReplaceExecute(Sender: TObject);
|
||||||
procedure ActionRunExecute(Sender: TObject);
|
procedure ActionRunExecute(Sender: TObject);
|
||||||
|
procedure ActionRUTISExecute(Sender: TObject);
|
||||||
procedure ActionSaveAllExecute(Sender: TObject);
|
procedure ActionSaveAllExecute(Sender: TObject);
|
||||||
procedure ActionSaveAsExecute(Sender: TObject);
|
procedure ActionSaveAsExecute(Sender: TObject);
|
||||||
procedure ActionSaveDefExecute(Sender: TObject);
|
procedure ActionSaveDefExecute(Sender: TObject);
|
||||||
@ -359,10 +374,12 @@ type
|
|||||||
OpenFileData : TOpenFileData;
|
OpenFileData : TOpenFileData;
|
||||||
WriteFileData : TWriteFileData;
|
WriteFileData : TWriteFileData;
|
||||||
ScriptStartData : TScriptStartData;
|
ScriptStartData : TScriptStartData;
|
||||||
|
procedure UpdateInterpreter;
|
||||||
procedure HandleConnectionData;
|
procedure HandleConnectionData;
|
||||||
procedure HandleOpenFileData;
|
procedure HandleOpenFileData;
|
||||||
procedure HandleWriteFileData;
|
procedure HandleWriteFileData;
|
||||||
procedure HandleScriptStartData;
|
procedure HandleScriptStartData;
|
||||||
|
function GetInterpreter: Integer;
|
||||||
function GetDefScriptPath: string;
|
function GetDefScriptPath: string;
|
||||||
function GetScriptPath : string;
|
function GetScriptPath : string;
|
||||||
function GetExtPath: string;
|
function GetExtPath: string;
|
||||||
@ -378,6 +395,7 @@ type
|
|||||||
procedure SetExtPath(const AValue: string);
|
procedure SetExtPath(const AValue: string);
|
||||||
procedure SetFontPath(const AValue: String);
|
procedure SetFontPath(const AValue: String);
|
||||||
procedure SetIncludePath(const AValue: String);
|
procedure SetIncludePath(const AValue: String);
|
||||||
|
procedure SetInterpreter(const AValue: Integer);
|
||||||
procedure SetPluginPath(const AValue: string);
|
procedure SetPluginPath(const AValue: string);
|
||||||
procedure SetScriptPath(const AValue: string);
|
procedure SetScriptPath(const AValue: string);
|
||||||
procedure SetShowParamHintAuto(const AValue: boolean);
|
procedure SetShowParamHintAuto(const AValue: boolean);
|
||||||
@ -441,6 +459,7 @@ type
|
|||||||
procedure InitalizeTMThread(var Thread : TMThread);
|
procedure InitalizeTMThread(var Thread : TMThread);
|
||||||
procedure HandleParameters;
|
procedure HandleParameters;
|
||||||
procedure OnSaveScript(const Filename : string);
|
procedure OnSaveScript(const Filename : string);
|
||||||
|
property Interpreter : Integer read GetInterpreter write SetInterpreter;
|
||||||
property ShowParamHintAuto : boolean read GetShowParamHintAuto write SetShowParamHintAuto;
|
property ShowParamHintAuto : boolean read GetShowParamHintAuto write SetShowParamHintAuto;
|
||||||
property ShowCodeCompletionAuto: Boolean read GetShowCodeCompletionAuto write SetShowCodeCompletionAuto;
|
property ShowCodeCompletionAuto: Boolean read GetShowCodeCompletionAuto write SetShowCodeCompletionAuto;
|
||||||
property IncludePath : String read GetIncludePath write SetIncludePath;
|
property IncludePath : String read GetIncludePath write SetIncludePath;
|
||||||
@ -450,6 +469,7 @@ type
|
|||||||
property ScriptDir : string read GetScriptPath write SetScriptPath;
|
property ScriptDir : string read GetScriptPath write SetScriptPath;
|
||||||
property DefScriptPath : string read GetDefScriptPath write SetDefScriptPath;
|
property DefScriptPath : string read GetDefScriptPath write SetDefScriptPath;
|
||||||
property CurrHighlighter : TSynCustomHighlighter read GetHighlighter;
|
property CurrHighlighter : TSynCustomHighlighter read GetHighlighter;
|
||||||
|
function DefaultScript : string;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ClearDebug;
|
procedure ClearDebug;
|
||||||
@ -592,6 +612,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSimbaForm.UpdateInterpreter;
|
||||||
|
begin
|
||||||
|
ActionPascalScript.Checked:= false;
|
||||||
|
ActionRUTIS.Checked:= false;
|
||||||
|
ActionCPascal.Checked:= false;
|
||||||
|
case Interpreter of
|
||||||
|
interp_PS: ActionPascalScript.Checked:= True;
|
||||||
|
interp_CP: ActionCPascal.Checked:= True;
|
||||||
|
interp_RT: ActionRUTIS.Checked:= true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSimbaForm.HandleConnectionData;
|
procedure TSimbaForm.HandleConnectionData;
|
||||||
var
|
var
|
||||||
Args : TVariantArray;
|
Args : TVariantArray;
|
||||||
@ -609,6 +641,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSimbaForm.GetInterpreter: Integer;
|
||||||
|
begin
|
||||||
|
result := StrToIntDef(LoadSettingDef('Settings/Interpreter/Type','0'),0);
|
||||||
|
if (result < 0) or (result > 2) then
|
||||||
|
begin
|
||||||
|
SetInterpreter(0);
|
||||||
|
result := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TSimbaForm.GetDefScriptPath: string;
|
function TSimbaForm.GetDefScriptPath: string;
|
||||||
begin
|
begin
|
||||||
result :=LoadSettingDef('Settings/SourceEditor/DefScriptPath', ExpandFileName(MainDir+DS+'default.simba'));
|
result :=LoadSettingDef('Settings/SourceEditor/DefScriptPath', ExpandFileName(MainDir+DS+'default.simba'));
|
||||||
@ -1172,7 +1214,7 @@ var
|
|||||||
begin
|
begin
|
||||||
CreateSetting('Settings/Updater/CheckForUpdates','True');
|
CreateSetting('Settings/Updater/CheckForUpdates','True');
|
||||||
CreateSetting('Settings/Updater/CheckEveryXMinutes','30');
|
CreateSetting('Settings/Updater/CheckEveryXMinutes','30');
|
||||||
CreateSetting('Settings/Interpreter/UseCPascal', 'False');
|
CreateSetting('Settings/Interpreter/Type', '0');
|
||||||
CreateSetting('Settings/Fonts/LoadOnStartUp', 'True');
|
CreateSetting('Settings/Fonts/LoadOnStartUp', 'True');
|
||||||
CreateSetting('Settings/Fonts/Version','-1');
|
CreateSetting('Settings/Fonts/Version','-1');
|
||||||
CreateSetting('Settings/Tabs/OpenNextOnClose','False');
|
CreateSetting('Settings/Tabs/OpenNextOnClose','False');
|
||||||
@ -1275,6 +1317,7 @@ begin
|
|||||||
MTrayIcon.Hide;
|
MTrayIcon.Hide;
|
||||||
writeln('Hiding tray.');
|
writeln('Hiding tray.');
|
||||||
end;
|
end;
|
||||||
|
UpdateInterpreter;
|
||||||
self.EndFormUpdate;
|
self.EndFormUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1419,14 +1462,14 @@ begin
|
|||||||
AppPath:= MainDir + DS;
|
AppPath:= MainDir + DS;
|
||||||
CurrScript.ScriptErrorLine:= -1;
|
CurrScript.ScriptErrorLine:= -1;
|
||||||
CurrentSyncInfo.SyncMethod:= @Self.SafeCallThread;
|
CurrentSyncInfo.SyncMethod:= @Self.SafeCallThread;
|
||||||
UseCPascal := LoadSettingDef('Settings/Interpreter/UseCPascal', 'False');
|
|
||||||
try
|
try
|
||||||
if lowercase(UseCPascal) = 'true' then
|
case Interpreter of
|
||||||
Thread := TCPThread.Create(True,@CurrentSyncInfo,PluginPath)
|
interp_PS : Thread := TPSThread.Create(true,@CurrentSyncInfo,PluginPath);
|
||||||
else
|
interp_RT : Thread := TRTThread.Create(true,@CurrentSyncInfo,PluginPath);
|
||||||
Thread := TPSThread.Create(True,@CurrentSyncInfo,PluginPath);
|
interp_CP : Thread := TCPThread.Create(true,@CurrentSyncInfo,PluginPath);
|
||||||
|
end;
|
||||||
except
|
except
|
||||||
mDebugLn('Failed to initialise the library!');
|
mDebugLn('Failed to initialise the interpreter');
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
{$IFNDEF TERMINALWRITELN}
|
{$IFNDEF TERMINALWRITELN}
|
||||||
@ -1535,6 +1578,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSimbaForm.DefaultScript: string;
|
||||||
|
var
|
||||||
|
x : TStringList;
|
||||||
|
begin
|
||||||
|
result := '';
|
||||||
|
case Interpreter of
|
||||||
|
interp_PS : begin
|
||||||
|
if FileExistsUTF8(SimbaForm.DefScriptPath) then
|
||||||
|
begin
|
||||||
|
x := TStringList.Create;
|
||||||
|
x.LoadFromFile(SimbaForm.DefScriptPath);
|
||||||
|
result := x.Text;
|
||||||
|
end else
|
||||||
|
result := 'program new;'+LineEnding + 'begin'+LineEnding+'end.' + LineEnding;
|
||||||
|
end;
|
||||||
|
interp_RT : result := 'program untitled;' + LineEnding + lineEnding + 'interface' + LineEnding + LineEnding +
|
||||||
|
'implementation' + LineEnding + LineEnding + 'begin' + LineEnding + 'end.' + LineEnding;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TSimbaForm.ActionTabLastExecute(Sender: TObject);
|
procedure TSimbaForm.ActionTabLastExecute(Sender: TObject);
|
||||||
var
|
var
|
||||||
@ -1580,6 +1643,11 @@ begin
|
|||||||
Memo1.CopyToClipboard;
|
Memo1.CopyToClipboard;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSimbaForm.ActionCPascalExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Interpreter:= interp_CP;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSimbaForm.ActionCutExecute(Sender: TObject);
|
procedure TSimbaForm.ActionCutExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if CurrScript.SynEdit.Focused or ScriptPopup.HandleAllocated then
|
if CurrScript.SynEdit.Focused or ScriptPopup.HandleAllocated then
|
||||||
@ -1672,6 +1740,11 @@ begin
|
|||||||
Self.OpenScript;
|
Self.OpenScript;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSimbaForm.ActionPascalScriptExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Interpreter:= interp_PS;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSimbaForm.ActionPasteExecute(Sender: TObject);
|
procedure TSimbaForm.ActionPasteExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if CurrScript.SynEdit.Focused or ScriptPopup.HandleAllocated then
|
if CurrScript.SynEdit.Focused or ScriptPopup.HandleAllocated then
|
||||||
@ -1710,6 +1783,11 @@ begin
|
|||||||
Self.RunScript;
|
Self.RunScript;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSimbaForm.ActionRUTISExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Interpreter:= interp_RT;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSimbaForm.ActionSaveAllExecute(Sender: TObject);
|
procedure TSimbaForm.ActionSaveAllExecute(Sender: TObject);
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
@ -2689,6 +2767,21 @@ begin
|
|||||||
SetSetting('Settings/Includes/Path',AValue,true);
|
SetSetting('Settings/Includes/Path',AValue,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSimbaForm.SetInterpreter(const AValue: Integer);
|
||||||
|
var
|
||||||
|
UpdateCurrScript: Boolean;
|
||||||
|
begin
|
||||||
|
UpdateCurrScript := false;
|
||||||
|
if (CurrScript <> nil) then
|
||||||
|
with CurrScript.Synedit do
|
||||||
|
if (Lines.text = DefaultScript) and not(CanUndo or CanRedo) then
|
||||||
|
UpdateCurrScript := true;
|
||||||
|
SetSetting('Settings/Interpreter/Type',Inttostr(AValue),true);
|
||||||
|
UpdateInterpreter;
|
||||||
|
if UpdateCurrScript then
|
||||||
|
CurrScript.SynEdit.Lines.text := DefaultScript;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSimbaForm.SetPluginPath(const AValue: string);
|
procedure TSimbaForm.SetPluginPath(const AValue: string);
|
||||||
begin
|
begin
|
||||||
SetSetting('Settings/Plugins/Path',AValue,true);
|
SetSetting('Settings/Plugins/Path',AValue,true);
|
||||||
|
@ -33,7 +33,7 @@ uses
|
|||||||
Classes, SysUtils, client, uPSComponent,uPSCompiler,
|
Classes, SysUtils, client, uPSComponent,uPSCompiler,
|
||||||
uPSRuntime,stdCtrls, uPSPreProcessor,MufasaTypes,MufasaBase, web,
|
uPSRuntime,stdCtrls, uPSPreProcessor,MufasaTypes,MufasaBase, web,
|
||||||
bitmaps, plugins, libloader, dynlibs,internets,scriptproperties,
|
bitmaps, plugins, libloader, dynlibs,internets,scriptproperties,
|
||||||
settings,settingssandbox;
|
settings,settingssandbox, Rutis_Engine,Rutis_Defs;
|
||||||
|
|
||||||
const
|
const
|
||||||
m_Status = 0; //Data = PChar to new status
|
m_Status = 0; //Data = PChar to new status
|
||||||
@ -189,6 +189,22 @@ type
|
|||||||
procedure AddMethod(meth: TExpMethod); override;
|
procedure AddMethod(meth: TExpMethod); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TRTThread }
|
||||||
|
|
||||||
|
TRTThread = class(TMThread)
|
||||||
|
private
|
||||||
|
procedure RTOnWrite(s : String);
|
||||||
|
procedure RTOnError(s : String; ErrorType : TRutisErrorType);
|
||||||
|
public
|
||||||
|
RUTIS : TRutisEngine;
|
||||||
|
constructor Create(CreateSuspended: Boolean; TheSyncInfo : PSyncInfo; plugin_dir: string);
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure SetScript(script: string); override;
|
||||||
|
procedure Execute; override;
|
||||||
|
procedure Terminate; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
threadvar
|
threadvar
|
||||||
CurrThread : TMThread;
|
CurrThread : TMThread;
|
||||||
var
|
var
|
||||||
@ -963,6 +979,67 @@ begin
|
|||||||
raise Exception.Create('Stopping Interpreter not yet implemented');
|
raise Exception.Create('Stopping Interpreter not yet implemented');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TRTThread }
|
||||||
|
|
||||||
|
procedure TRTThread.RTOnWrite(s: String);
|
||||||
|
begin
|
||||||
|
psWriteln(s);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRTThread.RTOnError(s: String; ErrorType: TRutisErrorType);
|
||||||
|
begin
|
||||||
|
psWriteln(s);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TRTThread.Create(CreateSuspended: Boolean; TheSyncInfo: PSyncInfo;
|
||||||
|
plugin_dir: string);
|
||||||
|
begin
|
||||||
|
inherited Create(CreateSuspended, TheSyncInfo, plugin_dir);
|
||||||
|
RUTIS := TRutisEngine.Create;
|
||||||
|
RUTIS.OnWrite:= @RTOnWrite;
|
||||||
|
RUTIS.OnError:= @RTOnError;
|
||||||
|
RUTIS.OptProcessTimer:= false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TRTThread.Destroy;
|
||||||
|
begin
|
||||||
|
RUTIS.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRTThread.SetScript(script: string);
|
||||||
|
begin
|
||||||
|
RUTIS.ScriptCode.Text:= Script;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRTThread.Execute;
|
||||||
|
begin
|
||||||
|
CurrThread := self;
|
||||||
|
Starttime := lclintf.GetTickCount;
|
||||||
|
try
|
||||||
|
RUTIS.Compile;
|
||||||
|
if not RUTIS.CompilerError then
|
||||||
|
begin
|
||||||
|
psWriteln('Compiled succesfully in ' + IntToStr(GetTickCount - Starttime) + ' ms.');
|
||||||
|
if CompileOnly then
|
||||||
|
exit;
|
||||||
|
RUTIS.Run;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
CurrThread.HandleError(RUTIS.Error.ELine+1,RUTIS.Error.EChrPos,-1,RUTIS.Error.Message,errCompile,'');
|
||||||
|
psWriteln('Compiling failed.');
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on E : Exception do
|
||||||
|
psWriteln('Exception in Script: ' + e.message);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRTThread.Terminate;
|
||||||
|
begin
|
||||||
|
RUTIS.Stop;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
PluginsGlob := TMPlugins.Create;
|
PluginsGlob := TMPlugins.Create;
|
||||||
libcpascal:= 0;
|
libcpascal:= 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user