1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-01-10 21:28:00 -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:
Wizzup? 2009-09-12 08:15:52 +00:00
parent 2abd1feb48
commit b5e0bbf5ff
5 changed files with 105 additions and 42 deletions

View File

@ -41,7 +41,7 @@
<CursorPos X="13" Y="17"/> <CursorPos X="13" Y="17"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="70"/> <UsageCount Value="73"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@ -173,7 +173,7 @@
<CursorPos X="19" Y="271"/> <CursorPos X="19" Y="271"/>
<TopLine Value="255"/> <TopLine Value="255"/>
<EditorIndex Value="6"/> <EditorIndex Value="6"/>
<UsageCount Value="36"/> <UsageCount Value="39"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
@ -305,7 +305,7 @@
<CursorPos X="25" Y="4"/> <CursorPos X="25" Y="4"/>
<TopLine Value="4"/> <TopLine Value="4"/>
<EditorIndex Value="4"/> <EditorIndex Value="4"/>
<UsageCount Value="35"/> <UsageCount Value="38"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit37> </Unit37>
<Unit38> <Unit38>
@ -315,7 +315,7 @@
<CursorPos X="4" Y="26"/> <CursorPos X="4" Y="26"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="3"/> <EditorIndex Value="3"/>
<UsageCount Value="35"/> <UsageCount Value="38"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit38> </Unit38>
<Unit39> <Unit39>
@ -331,7 +331,7 @@
<UnitName Value="files"/> <UnitName Value="files"/>
<CursorPos X="62" Y="61"/> <CursorPos X="62" Y="61"/>
<TopLine Value="46"/> <TopLine Value="46"/>
<UsageCount Value="36"/> <UsageCount Value="39"/>
</Unit40> </Unit40>
<Unit41> <Unit41>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
@ -340,7 +340,7 @@
<CursorPos X="8" Y="262"/> <CursorPos X="8" Y="262"/>
<TopLine Value="255"/> <TopLine Value="255"/>
<EditorIndex Value="5"/> <EditorIndex Value="5"/>
<UsageCount Value="35"/> <UsageCount Value="38"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit41> </Unit41>
<Unit42> <Unit42>
@ -378,7 +378,7 @@
<CursorPos X="24" Y="130"/> <CursorPos X="24" Y="130"/>
<TopLine Value="111"/> <TopLine Value="111"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<UsageCount Value="28"/> <UsageCount Value="31"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit46> </Unit46>
<Unit47> <Unit47>
@ -394,7 +394,7 @@
<UnitName Value="MMLThread"/> <UnitName Value="MMLThread"/>
<CursorPos X="132" Y="5"/> <CursorPos X="132" Y="5"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="26"/> <UsageCount Value="29"/>
</Unit48> </Unit48>
<Unit49> <Unit49>
<Filename Value="../../../Documents/fpc/rtl/objpas/classes/classesh.inc"/> <Filename Value="../../../Documents/fpc/rtl/objpas/classes/classesh.inc"/>
@ -406,10 +406,10 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="mmlpsthread"/> <UnitName Value="mmlpsthread"/>
<CursorPos X="11" Y="46"/> <CursorPos X="22" Y="136"/>
<TopLine Value="31"/> <TopLine Value="121"/>
<EditorIndex Value="7"/> <EditorIndex Value="7"/>
<UsageCount Value="24"/> <UsageCount Value="27"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit50> </Unit50>
<Unit51> <Unit51>
@ -418,7 +418,7 @@
<CursorPos X="21" Y="193"/> <CursorPos X="21" Y="193"/>
<TopLine Value="183"/> <TopLine Value="183"/>
<EditorIndex Value="9"/> <EditorIndex Value="9"/>
<UsageCount Value="13"/> <UsageCount Value="15"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit51> </Unit51>
<Unit52> <Unit52>
@ -447,7 +447,7 @@
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="8"/> <EditorIndex Value="8"/>
<UsageCount Value="12"/> <UsageCount Value="14"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit55> </Unit55>
<Unit56> <Unit56>
@ -455,7 +455,7 @@
<CursorPos X="20" Y="1"/> <CursorPos X="20" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<UsageCount Value="12"/> <UsageCount Value="14"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit56> </Unit56>
<Unit57> <Unit57>
@ -522,7 +522,7 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit65> </Unit65>
</Units> </Units>
<JumpHistory Count="18" HistoryIndex="17"> <JumpHistory Count="26" HistoryIndex="25">
<Position1> <Position1>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="274" Column="26" TopLine="258"/> <Caret Line="274" Column="26" TopLine="258"/>
@ -595,6 +595,38 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="198" Column="19" TopLine="183"/> <Caret Line="198" Column="19" TopLine="183"/>
</Position18> </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> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View 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;

View 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);');

View 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 }

View File

@ -40,10 +40,15 @@ type
implementation implementation
uses uses
MufasaTypes,{$ifdef mswindows}windows,{$endif} MufasaTypes,
uPSC_std, uPSC_controls,uPSC_classes,uPSC_graphics,uPSC_stdctrls,uPSC_forms,uPSC_extctrls, //Compile-libs {$ifdef mswindows}windows,{$endif}
uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms,uPSR_extctrls, //Runtime-libs uPSC_std, uPSC_controls,uPSC_classes,uPSC_graphics,uPSC_stdctrls,uPSC_forms,
lclintf; 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 threadvar
@ -89,37 +94,32 @@ end;
constructor TMMLPSThread.Create(CreateSuspended : boolean); constructor TMMLPSThread.Create(CreateSuspended : boolean);
begin begin
if Client <> nil then {if Client <> nil then
Writeln('ThreadClient seems to be set, so not recreating it.') //reset client to defaults? Writeln('ThreadClient seems to be set, so not recreating it.') //reset client to defaults?
//ThreadClient.ResetToDefaults //ThreadClient.ResetToDefaults
else else }
Client := TClient.Create;
if PSScript <> nil then // ^ Every time a script is compiled, a new thread is created. There will no
PSScript.Free; // 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 // Create Stuff here
PSScript := TPSScript.Create(nil); PSScript := TPSScript.Create(nil);
PSScript.UsePreProcessor:= True; PSScript.UsePreProcessor:= True;
PSScript.OnNeedFile := @RequireFile; PSScript.OnNeedFile := @RequireFile;
PSScript.OnCompile:= @OnCompile; PSScript.OnCompile:= @OnCompile;
PSScript.OnCompImport:= @OnCompImport; PSScript.OnCompImport:= @OnCompImport;
PSScript.OnExecImport:= @OnExecImport; PSScript.OnExecImport:= @OnExecImport;
PSScript.OnAfterExecute:= @AfterExecute; PSScript.OnAfterExecute:= @AfterExecute;
{$IFDEF CPU386 }
PSScript.Defines.Add ('CPU386'); // Set some defines
{$ENDIF } {$I PSInc/psdefines.inc}
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 }
FreeOnTerminate := True; FreeOnTerminate := True;
inherited Create(CreateSuspended); inherited Create(CreateSuspended);
end; end;
@ -131,12 +131,16 @@ begin
inherited Destroy; inherited Destroy;
end; end;
// include PS wrappers
{$I PSInc/Wrappers/colour.inc}
procedure TMMLPSThread.OnCompile(Sender: TPSScript); procedure TMMLPSThread.OnCompile(Sender: TPSScript);
begin begin
//Here we add all the initalizing, of BMPArray etc //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);'); // Here we add all the functions to the engine.
//Also the functions get added into the engine, right here. {$I PSInc/pscompile.inc}
end; end;
procedure TMMLPSThread.AfterExecute(Sender: TPSScript); procedure TMMLPSThread.AfterExecute(Sender: TPSScript);