mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-10 19:35:10 -05:00
Added a few include files, pscompile.inc should probably be split up in more include files.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@41 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
2abd1feb48
commit
b5e0bbf5ff
@ -41,7 +41,7 @@
|
||||
<CursorPos X="13" Y="17"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="70"/>
|
||||
<UsageCount Value="73"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -173,7 +173,7 @@
|
||||
<CursorPos X="19" Y="271"/>
|
||||
<TopLine Value="255"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="36"/>
|
||||
<UsageCount Value="39"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
@ -305,7 +305,7 @@
|
||||
<CursorPos X="25" Y="4"/>
|
||||
<TopLine Value="4"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="35"/>
|
||||
<UsageCount Value="38"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit37>
|
||||
<Unit38>
|
||||
@ -315,7 +315,7 @@
|
||||
<CursorPos X="4" Y="26"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="35"/>
|
||||
<UsageCount Value="38"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit38>
|
||||
<Unit39>
|
||||
@ -331,7 +331,7 @@
|
||||
<UnitName Value="files"/>
|
||||
<CursorPos X="62" Y="61"/>
|
||||
<TopLine Value="46"/>
|
||||
<UsageCount Value="36"/>
|
||||
<UsageCount Value="39"/>
|
||||
</Unit40>
|
||||
<Unit41>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
@ -340,7 +340,7 @@
|
||||
<CursorPos X="8" Y="262"/>
|
||||
<TopLine Value="255"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="35"/>
|
||||
<UsageCount Value="38"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit41>
|
||||
<Unit42>
|
||||
@ -378,7 +378,7 @@
|
||||
<CursorPos X="24" Y="130"/>
|
||||
<TopLine Value="111"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="28"/>
|
||||
<UsageCount Value="31"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit46>
|
||||
<Unit47>
|
||||
@ -394,7 +394,7 @@
|
||||
<UnitName Value="MMLThread"/>
|
||||
<CursorPos X="132" Y="5"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="26"/>
|
||||
<UsageCount Value="29"/>
|
||||
</Unit48>
|
||||
<Unit49>
|
||||
<Filename Value="../../../Documents/fpc/rtl/objpas/classes/classesh.inc"/>
|
||||
@ -406,10 +406,10 @@
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="mmlpsthread"/>
|
||||
<CursorPos X="11" Y="46"/>
|
||||
<TopLine Value="31"/>
|
||||
<CursorPos X="22" Y="136"/>
|
||||
<TopLine Value="121"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="24"/>
|
||||
<UsageCount Value="27"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit50>
|
||||
<Unit51>
|
||||
@ -418,7 +418,7 @@
|
||||
<CursorPos X="21" Y="193"/>
|
||||
<TopLine Value="183"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="13"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit51>
|
||||
<Unit52>
|
||||
@ -447,7 +447,7 @@
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="12"/>
|
||||
<UsageCount Value="14"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit55>
|
||||
<Unit56>
|
||||
@ -455,7 +455,7 @@
|
||||
<CursorPos X="20" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="12"/>
|
||||
<UsageCount Value="14"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit56>
|
||||
<Unit57>
|
||||
@ -522,7 +522,7 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit65>
|
||||
</Units>
|
||||
<JumpHistory Count="18" HistoryIndex="17">
|
||||
<JumpHistory Count="26" HistoryIndex="25">
|
||||
<Position1>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="274" Column="26" TopLine="258"/>
|
||||
@ -595,6 +595,38 @@
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="198" Column="19" TopLine="183"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="145" Column="68" TopLine="121"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="121" Column="13" TopLine="106"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="140" Column="13" TopLine="124"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="55" Column="13" TopLine="41"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="60" Column="16" TopLine="41"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="61" Column="15" TopLine="41"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="71" Column="64" TopLine="56"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="136" Column="25" TopLine="123"/>
|
||||
</Position26>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
9
Units/MMLAddon/PSInc/Wrappers/colour.inc
Normal file
9
Units/MMLAddon/PSInc/Wrappers/colour.inc
Normal file
@ -0,0 +1,9 @@
|
||||
function findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean;
|
||||
begin
|
||||
CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2);
|
||||
end;
|
||||
|
||||
procedure GetClientDimensions(var w, h: integer);
|
||||
begin
|
||||
CurrThread.Client.MWindow.GetDimensions(w, h);
|
||||
end;
|
4
Units/MMLAddon/PSInc/pscompile.inc
Normal file
4
Units/MMLAddon/PSInc/pscompile.inc
Normal file
@ -0,0 +1,4 @@
|
||||
Sender.AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
|
||||
Sender.AddFunction(@Writeln,'procedure writeln(s : string);');
|
||||
Sender.AddFunction(@FindColor, 'function findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean;');
|
||||
Sender.AddFunction(@GetClientDimensions, 'procedure GetClientDimensions(var w, h:integer);');
|
14
Units/MMLAddon/PSInc/psdefines.inc
Normal file
14
Units/MMLAddon/PSInc/psdefines.inc
Normal file
@ -0,0 +1,14 @@
|
||||
{$IFDEF CPU386 }
|
||||
PSScript.Defines.Add ('CPU386');
|
||||
{$ENDIF }
|
||||
PSScript.Defines.Add ('MUFASA');
|
||||
PSScript.Defines.Add ('COGAT');
|
||||
PSScript.Defines.Add ('RAYMONDPOWNS');
|
||||
{$IFDEF MSWINDOWS }
|
||||
PSScript.Defines.Add ('MSWINDOWS');
|
||||
PSScript.Defines.Add ('WIN32');
|
||||
PSScript.Defines.Add ('WINDOWS');
|
||||
{$ENDIF }
|
||||
{$IFDEF LINUX }
|
||||
PSScript.Defines.Add ('LINUX');
|
||||
{$ENDIF }
|
@ -40,10 +40,15 @@ type
|
||||
|
||||
implementation
|
||||
uses
|
||||
MufasaTypes,{$ifdef mswindows}windows,{$endif}
|
||||
uPSC_std, uPSC_controls,uPSC_classes,uPSC_graphics,uPSC_stdctrls,uPSC_forms,uPSC_extctrls, //Compile-libs
|
||||
uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms,uPSR_extctrls, //Runtime-libs
|
||||
lclintf;
|
||||
MufasaTypes,
|
||||
{$ifdef mswindows}windows,{$endif}
|
||||
uPSC_std, uPSC_controls,uPSC_classes,uPSC_graphics,uPSC_stdctrls,uPSC_forms,
|
||||
uPSC_extctrls, //Compile-libs
|
||||
|
||||
uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms,
|
||||
uPSR_extctrls, //Runtime-libs
|
||||
|
||||
lclintf; // for GetTickCount and others.
|
||||
|
||||
|
||||
threadvar
|
||||
@ -89,37 +94,32 @@ end;
|
||||
|
||||
constructor TMMLPSThread.Create(CreateSuspended : boolean);
|
||||
begin
|
||||
if Client <> nil then
|
||||
{if Client <> nil then
|
||||
Writeln('ThreadClient seems to be set, so not recreating it.') //reset client to defaults?
|
||||
//ThreadClient.ResetToDefaults
|
||||
else
|
||||
Client := TClient.Create;
|
||||
if PSScript <> nil then
|
||||
PSScript.Free;
|
||||
else }
|
||||
|
||||
// ^ Every time a script is compiled, a new thread is created. There will no
|
||||
// existing client left. I commented the above code out.
|
||||
Client := TClient.Create;
|
||||
|
||||
{ if PSScript <> nil then
|
||||
PSScript.Free; }
|
||||
// ^ Same, makes no sense. :-)
|
||||
|
||||
// Create Stuff here
|
||||
PSScript := TPSScript.Create(nil);
|
||||
PSScript.UsePreProcessor:= True;
|
||||
PSScript.OnNeedFile := @RequireFile;
|
||||
|
||||
|
||||
PSScript.OnCompile:= @OnCompile;
|
||||
PSScript.OnCompImport:= @OnCompImport;
|
||||
PSScript.OnExecImport:= @OnExecImport;
|
||||
PSScript.OnAfterExecute:= @AfterExecute;
|
||||
{$IFDEF CPU386 }
|
||||
PSScript.Defines.Add ('CPU386');
|
||||
{$ENDIF }
|
||||
PSScript.Defines.Add ('MUFASA');
|
||||
PSScript.Defines.Add ('COGAT');
|
||||
PSScript.Defines.Add ('RAYMONDPOWNS');
|
||||
{$IFDEF MSWINDOWS }
|
||||
PSScript.Defines.Add ('MSWINDOWS');
|
||||
PSScript.Defines.Add ('WIN32');
|
||||
PSScript.Defines.Add ('WINDOWS');
|
||||
{$ENDIF }
|
||||
{$IFDEF LINUX }
|
||||
PSScript.Defines.Add ('LINUX');
|
||||
{$ENDIF }
|
||||
|
||||
// Set some defines
|
||||
{$I PSInc/psdefines.inc}
|
||||
|
||||
FreeOnTerminate := True;
|
||||
inherited Create(CreateSuspended);
|
||||
end;
|
||||
@ -131,12 +131,16 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
// include PS wrappers
|
||||
|
||||
{$I PSInc/Wrappers/colour.inc}
|
||||
|
||||
procedure TMMLPSThread.OnCompile(Sender: TPSScript);
|
||||
begin
|
||||
//Here we add all the initalizing, of BMPArray etc
|
||||
Sender.AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
|
||||
Sender.AddFunction(@Writeln,'procedure writeln(s : string);');
|
||||
//Also the functions get added into the engine, right here.
|
||||
|
||||
// Here we add all the functions to the engine.
|
||||
{$I PSInc/pscompile.inc}
|
||||
end;
|
||||
|
||||
procedure TMMLPSThread.AfterExecute(Sender: TPSScript);
|
||||
|
Loading…
Reference in New Issue
Block a user