1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 18:52:15 -05:00

Implemeted threadsafecall in a cross-component way. Starting on the interface for CPascal now...

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@469 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
BenLand100 2010-01-25 21:37:33 +00:00
parent b1d07ff6d4
commit 331255a0be
4 changed files with 118 additions and 118 deletions

View File

@ -10,7 +10,7 @@
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="Simba"/> <Title Value="Simba"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="8"/> <ActiveEditorIndexAtStart Value="10"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -139,9 +139,10 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<CursorPos X="37" Y="1704"/> <ComponentState Value="1"/>
<TopLine Value="1687"/> <CursorPos X="10" Y="1718"/>
<EditorIndex Value="8"/> <TopLine Value="1702"/>
<EditorIndex Value="9"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit13> </Unit13>
@ -266,8 +267,8 @@
<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="26" Y="250"/> <CursorPos X="47" Y="337"/>
<TopLine Value="225"/> <TopLine Value="321"/>
<EditorIndex Value="6"/> <EditorIndex Value="6"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -350,7 +351,7 @@
<UnitName Value="bitmaps"/> <UnitName Value="bitmaps"/>
<CursorPos X="12" Y="93"/> <CursorPos X="12" Y="93"/>
<TopLine Value="83"/> <TopLine Value="83"/>
<EditorIndex Value="10"/> <EditorIndex Value="11"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit42> </Unit42>
@ -496,9 +497,9 @@
<Unit64> <Unit64>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/>
<CursorPos X="23" Y="107"/> <CursorPos X="23" Y="107"/>
<TopLine Value="95"/> <TopLine Value="7"/>
<EditorIndex Value="9"/> <EditorIndex Value="10"/>
<UsageCount Value="44"/> <UsageCount Value="45"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit64> </Unit64>
<Unit65> <Unit65>
@ -625,8 +626,10 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="windowselector"/> <UnitName Value="windowselector"/>
<CursorPos X="37" Y="34"/> <CursorPos X="37" Y="34"/>
<TopLine Value="12"/> <TopLine Value="176"/>
<EditorIndex Value="8"/>
<UsageCount Value="201"/> <UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit82> </Unit82>
<Unit83> <Unit83>
<Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/objpas/classes/classesh.inc"/> <Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/objpas/classes/classesh.inc"/>
@ -768,7 +771,7 @@
<CursorPos X="12" Y="63"/> <CursorPos X="12" Y="63"/>
<TopLine Value="29"/> <TopLine Value="29"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<UsageCount Value="19"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit103> </Unit103>
<Unit104> <Unit104>
@ -889,7 +892,7 @@
<ResourceBaseClass Value="Frame"/> <ResourceBaseClass Value="Frame"/>
<UnitName Value="framescript"/> <UnitName Value="framescript"/>
<CursorPos X="23" Y="72"/> <CursorPos X="23" Y="72"/>
<TopLine Value="55"/> <TopLine Value="223"/>
<EditorIndex Value="7"/> <EditorIndex Value="7"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -1591,7 +1594,7 @@
<UnitName Value="framefunctionlist"/> <UnitName Value="framefunctionlist"/>
<CursorPos X="26" Y="295"/> <CursorPos X="26" Y="295"/>
<TopLine Value="7"/> <TopLine Value="7"/>
<UsageCount Value="186"/> <UsageCount Value="188"/>
</Unit223> </Unit223>
<Unit224> <Unit224>
<Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/> <Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/>
@ -1646,7 +1649,7 @@
<UnitName Value="simpleanalyzer"/> <UnitName Value="simpleanalyzer"/>
<CursorPos X="52" Y="104"/> <CursorPos X="52" Y="104"/>
<TopLine Value="193"/> <TopLine Value="193"/>
<UsageCount Value="173"/> <UsageCount Value="175"/>
</Unit231> </Unit231>
<Unit232> <Unit232>
<Filename Value="../../Units/Misc/mPasLex.pas"/> <Filename Value="../../Units/Misc/mPasLex.pas"/>
@ -1704,10 +1707,10 @@
</Unit239> </Unit239>
<Unit240> <Unit240>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<CursorPos X="3" Y="100"/> <CursorPos X="89" Y="99"/>
<TopLine Value="72"/> <TopLine Value="78"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<UsageCount Value="30"/> <UsageCount Value="31"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit240> </Unit240>
<Unit241> <Unit241>
@ -1723,7 +1726,7 @@
<UnitName Value="updater"/> <UnitName Value="updater"/>
<CursorPos X="38" Y="211"/> <CursorPos X="38" Y="211"/>
<TopLine Value="65"/> <TopLine Value="65"/>
<UsageCount Value="146"/> <UsageCount Value="148"/>
</Unit242> </Unit242>
<Unit243> <Unit243>
<Filename Value="updateform.pas"/> <Filename Value="updateform.pas"/>
@ -1734,7 +1737,7 @@
<ComponentState Value="1"/> <ComponentState Value="1"/>
<CursorPos X="111" Y="102"/> <CursorPos X="111" Y="102"/>
<TopLine Value="207"/> <TopLine Value="207"/>
<UsageCount Value="141"/> <UsageCount Value="143"/>
</Unit243> </Unit243>
<Unit244> <Unit244>
<Filename Value="../../../Documents/lazarus/lcl/fileutil.pas"/> <Filename Value="../../../Documents/lazarus/lcl/fileutil.pas"/>
@ -1855,7 +1858,7 @@
<UnitName Value="simbasettings"/> <UnitName Value="simbasettings"/>
<CursorPos X="26" Y="9"/> <CursorPos X="26" Y="9"/>
<TopLine Value="11"/> <TopLine Value="11"/>
<UsageCount Value="104"/> <UsageCount Value="106"/>
</Unit261> </Unit261>
<Unit262> <Unit262>
<Filename Value="../../Units/MMLAddon/settings.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
@ -1893,7 +1896,7 @@
<UnitName Value="reportbug"/> <UnitName Value="reportbug"/>
<CursorPos X="53" Y="23"/> <CursorPos X="53" Y="23"/>
<TopLine Value="21"/> <TopLine Value="21"/>
<UsageCount Value="87"/> <UsageCount Value="89"/>
</Unit266> </Unit266>
<Unit267> <Unit267>
<Filename Value="../../Units/Synapse/synsock.pas"/> <Filename Value="../../Units/Synapse/synsock.pas"/>
@ -1950,7 +1953,7 @@
<UnitName Value="newinternets"/> <UnitName Value="newinternets"/>
<CursorPos X="37" Y="171"/> <CursorPos X="37" Y="171"/>
<TopLine Value="153"/> <TopLine Value="153"/>
<UsageCount Value="83"/> <UsageCount Value="85"/>
</Unit274> </Unit274>
<Unit275> <Unit275>
<Filename Value="reportbug.lrs"/> <Filename Value="reportbug.lrs"/>
@ -1996,19 +1999,19 @@
<Unit281> <Unit281>
<Filename Value="../../Units/MMLCore/iomanager.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<UnitName Value="IOManager"/> <UnitName Value="IOManager"/>
<CursorPos X="67" Y="53"/> <CursorPos X="15" Y="600"/>
<TopLine Value="34"/> <TopLine Value="379"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="33"/> <UsageCount Value="34"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit281> </Unit281>
<Unit282> <Unit282>
<Filename Value="../../Units/MMLCore/os_linux.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<UnitName Value="os_linux"/> <UnitName Value="os_linux"/>
<CursorPos X="36" Y="69"/> <CursorPos X="36" Y="69"/>
<TopLine Value="56"/> <TopLine Value="34"/>
<EditorIndex Value="5"/> <EditorIndex Value="5"/>
<UsageCount Value="32"/> <UsageCount Value="33"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit282> </Unit282>
<Unit283> <Unit283>
@ -2021,10 +2024,10 @@
<Unit284> <Unit284>
<Filename Value="../../Units/MMLCore/os_windows.pas"/> <Filename Value="../../Units/MMLCore/os_windows.pas"/>
<UnitName Value="os_windows"/> <UnitName Value="os_windows"/>
<CursorPos X="22" Y="164"/> <CursorPos X="9" Y="75"/>
<TopLine Value="155"/> <TopLine Value="67"/>
<EditorIndex Value="11"/> <EditorIndex Value="12"/>
<UsageCount Value="28"/> <UsageCount Value="29"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit284> </Unit284>
<Unit285> <Unit285>
@ -2047,7 +2050,7 @@
<UnitName Value="libloader"/> <UnitName Value="libloader"/>
<CursorPos X="1" Y="149"/> <CursorPos X="1" Y="149"/>
<TopLine Value="128"/> <TopLine Value="128"/>
<UsageCount Value="41"/> <UsageCount Value="43"/>
</Unit287> </Unit287>
<Unit288> <Unit288>
<Filename Value="../../Units/MMLAddon/tpa.pas"/> <Filename Value="../../Units/MMLAddon/tpa.pas"/>
@ -2061,7 +2064,7 @@
<CursorPos X="8" Y="157"/> <CursorPos X="8" Y="157"/>
<TopLine Value="140"/> <TopLine Value="140"/>
<EditorIndex Value="4"/> <EditorIndex Value="4"/>
<UsageCount Value="18"/> <UsageCount Value="19"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit289> </Unit289>
<Unit290> <Unit290>
@ -2088,123 +2091,123 @@
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="223" Column="14" TopLine="206"/> <Caret Line="118" Column="15" TopLine="101"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="239" Column="11" TopLine="229"/> <Caret Line="129" Column="63" TopLine="101"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="377" Column="34" TopLine="349"/> <Caret Line="369" Column="14" TopLine="352"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="118" Column="15" TopLine="101"/> <Caret Line="99" Column="70" TopLine="67"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="129" Column="63" TopLine="101"/> <Caret Line="261" Column="8" TopLine="246"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="369" Column="14" TopLine="352"/> <Caret Line="308" Column="4" TopLine="292"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="99" Column="70" TopLine="67"/> <Caret Line="310" Column="16" TopLine="297"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<Caret Line="261" Column="8" TopLine="246"/> <Caret Line="59" Column="40" TopLine="36"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="308" Column="4" TopLine="292"/> <Caret Line="127" Column="19" TopLine="101"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="310" Column="16" TopLine="297"/> <Caret Line="59" Column="22" TopLine="42"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<Caret Line="59" Column="40" TopLine="36"/> <Caret Line="24" Column="28" TopLine="7"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="127" Column="19" TopLine="101"/>
</Position12>
<Position13>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="59" Column="22" TopLine="42"/>
</Position13>
<Position14>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<Caret Line="24" Column="28" TopLine="7"/>
</Position14>
<Position15>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<Caret Line="30" Column="24" TopLine="13"/> <Caret Line="30" Column="24" TopLine="13"/>
</Position15> </Position12>
<Position16> <Position13>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<Caret Line="24" Column="3" TopLine="7"/> <Caret Line="24" Column="3" TopLine="7"/>
</Position16> </Position13>
<Position17> <Position14>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="134" Column="37" TopLine="243"/>
</Position17>
<Position18>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="387" Column="6" TopLine="374"/> <Caret Line="387" Column="6" TopLine="374"/>
</Position18> </Position14>
<Position19> <Position15>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="644" Column="12" TopLine="622"/> <Caret Line="644" Column="12" TopLine="622"/>
</Position19> </Position15>
<Position20> <Position16>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="133" Column="36" TopLine="113"/> <Caret Line="133" Column="36" TopLine="113"/>
</Position20> </Position16>
<Position21> <Position17>
<Filename Value="framescript.pas"/> <Filename Value="framescript.pas"/>
<Caret Line="101" Column="1" TopLine="98"/> <Caret Line="101" Column="1" TopLine="98"/>
</Position21> </Position17>
<Position22> <Position18>
<Filename Value="framescript.pas"/> <Filename Value="framescript.pas"/>
<Caret Line="73" Column="41" TopLine="54"/> <Caret Line="73" Column="41" TopLine="54"/>
</Position22> </Position18>
<Position23> <Position19>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="1550" Column="3" TopLine="1548"/> <Caret Line="1550" Column="3" TopLine="1548"/>
</Position19>
<Position20>
<Filename Value="testunit.pas"/>
<Caret Line="541" Column="21" TopLine="518"/>
</Position20>
<Position21>
<Filename Value="testunit.pas"/>
<Caret Line="536" Column="30" TopLine="519"/>
</Position21>
<Position22>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="97" Column="54" TopLine="73"/>
</Position22>
<Position23>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="240" Column="69" TopLine="223"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="541" Column="21" TopLine="518"/> <Caret Line="550" Column="46" TopLine="532"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="536" Column="30" TopLine="519"/> <Caret Line="636" Column="33" TopLine="613"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="97" Column="54" TopLine="73"/> <Caret Line="1439" Column="24" TopLine="1422"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="240" Column="69" TopLine="223"/> <Caret Line="46" Column="30" TopLine="32"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="550" Column="46" TopLine="532"/> <Caret Line="1704" Column="37" TopLine="1791"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="636" Column="33" TopLine="613"/> <Caret Line="1718" Column="79" TopLine="1699"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="1439" Column="24" TopLine="1422"/> <Caret Line="1711" Column="38" TopLine="1696"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@ -1699,20 +1699,32 @@ end;
procedure TForm1.SafeCallThread; procedure TForm1.SafeCallThread;
var
thread: TMThread;
begin begin
Writeln('Executing : ' + CurrentSyncInfo.MethodName); Writeln('Executing : ' + CurrentSyncInfo.MethodName);
mmlpsthread.CurrThread := TMThread(CurrentSyncInfo.OldThread); thread:= TMThread(CurrentSyncInfo.OldThread);
with CurrentSyncInfo.PSScript do mmlpsthread.CurrThread:= thread;
begin; try
if thread is TPSThread then
begin
with TPSThread(thread).PSScript do
begin
OnLine:=@OnLinePSScript; OnLine:=@OnLinePSScript;
CurrentSyncInfo.Res:= Exec.RunProcPVar(CurrentSyncInfo.V,Exec.GetProc(CurrentSyncInfo.MethodName)); CurrentSyncInfo.Res:= Exec.RunProcPVar(CurrentSyncInfo.V,Exec.GetProc(CurrentSyncInfo.MethodName));
Online := nil; Online := nil;
end; end;
end else
begin
raise Exception.Create('ThreadSafeCall not implemented on this client');
end;
finally
mmlpsthread.CurrThread:= nil; mmlpsthread.CurrThread:= nil;
end; end;
end;
function TForm1.OpenScript: boolean; function TForm1.OpenScript: boolean;
begin; begin
Result := False; Result := False;
if CanExitOrOpen = false then if CanExitOrOpen = false then
Exit; Exit;

View File

@ -21,7 +21,7 @@
psexportedmethods.inc for the Mufasa Macro Library psexportedmethods.inc for the Mufasa Macro Library
} }
//AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;'); AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
AddFunction(nil,'procedure Writeln(x);'); //We use special function for this AddFunction(nil,'procedure Writeln(x);'); //We use special function for this
{ DTM } { DTM }
@ -97,7 +97,6 @@ AddFunction(@DisplayDebugImgWindow,'procedure DisplayDebugImgWindow(w, h: intege
AddFunction(@DrawBitmapDebugImg,'procedure DrawBitmapDebugImg(bmp: integer);'); AddFunction(@DrawBitmapDebugImg,'procedure DrawBitmapDebugImg(bmp: integer);');
AddFunction(@GetDebugBitmap,'function GetDebugBitmap: integer;'); AddFunction(@GetDebugBitmap,'function GetDebugBitmap: integer;');
AddFunction(@Random,'function Random(Int: integer): integer;'); AddFunction(@Random,'function Random(Int: integer): integer;');
//AddFunction(@NewThreadCall,'function NewThreadCall(procname : string) : cardinal');
AddFunction(@ClearDebug,'procedure ClearDebug;'); AddFunction(@ClearDebug,'procedure ClearDebug;');

View File

@ -44,7 +44,6 @@ type
Res : Variant; Res : Variant;
SyncMethod : procedure of object; SyncMethod : procedure of object;
OldThread : TThread; OldThread : TThread;
PSScript : TPSScript;
end; end;
TWritelnProc = procedure(s: string); TWritelnProc = procedure(s: string);
@ -247,7 +246,7 @@ begin
ErrorData^.ErrType:= ErrorType; ErrorData^.ErrType:= ErrorType;
ErrorData^.Module:= ErrorModule; ErrorData^.Module:= ErrorModule;
ErrorData^.IncludePath:= IncludePath; ErrorData^.IncludePath:= IncludePath;
CurrThread.Synchronize(OnError); //what does this do??? CurrThread.Synchronize(OnError);
end; end;
procedure TMThread.OnThreadTerminate(Sender: TObject); procedure TMThread.OnThreadTerminate(Sender: TObject);
@ -332,6 +331,15 @@ begin
FontPath:= FontP; FontPath:= FontP;
end; end;
function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;
begin
CurrThread.SyncInfo^.MethodName:= ProcName;
CurrThread.SyncInfo^.V:= V;
CurrThread.SyncInfo^.OldThread := CurrThread;
CurrThread.Synchronize(CurrThread.SyncInfo^.SyncMethod);
Result := CurrThread.SyncInfo^.Res;
end;
{$I PSInc/Wrappers/other.inc} {$I PSInc/Wrappers/other.inc}
{$I PSInc/Wrappers/bitmap.inc} {$I PSInc/Wrappers/bitmap.inc}
{$I PSInc/Wrappers/window.inc} {$I PSInc/Wrappers/window.inc}
@ -397,28 +405,6 @@ end;
well, it will really make the unit more straightforward to use and read. well, it will really make the unit more straightforward to use and read.
} }
{function NewThreadCall(Procname : string) : Cardinal;
begin;
result := CurrThread.PSScript.Exec.GetVar(Procname);
end;}
{function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;
begin;
CurrThread.SyncInfo^.MethodName:= ProcName;
CurrThread.SyncInfo^.V:= V;
CurrThread.SyncInfo^.PSScript := CurrThread.PSScript;
CurrThread.SyncInfo^.OldThread := CurrThread;
CurrThread.Synchronize(CurrThread.SyncInfo^.SyncMethod);
Result := CurrThread.SyncInfo^.Res;
// Writeln('We have a length of: ' + inttostr(length(v)));
// Try
// Result := CurrThread.PSScript.Exec.RunProcPVar(v,CurrThread.PSScript.Exec.GetProc(Procname));
// Except
// Writeln('We has some errors :-(');
// end;
end;}
constructor TPSThread.Create(CreateSuspended : boolean; TheSyncInfo : PSyncInfo; plugin_dir: string); constructor TPSThread.Create(CreateSuspended : boolean; TheSyncInfo : PSyncInfo; plugin_dir: string);
begin begin
SyncInfo:= TheSyncInfo; SyncInfo:= TheSyncInfo;