1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-01 13:22:16 -05:00

CPascal is broked, still. See line 536-538 in TestUnit.pas

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@486 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
BenLand100 2010-01-27 01:50:17 +00:00
parent cc74811fe7
commit 30f9ae6e1c
6 changed files with 23 additions and 36 deletions

Binary file not shown.

Binary file not shown.

View File

@ -27,7 +27,7 @@
<RunParams> <RunParams>
<local> <local>
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/bin/gnome-terminal -t 'Lazarus Run Output' -e '$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)'"/> <LaunchingApplication Use="True" PathPlusParams="/usr/bin/gnome-terminal -t 'Lazarus Run Output' -e '$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)'"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
@ -256,17 +256,4 @@
<CreateMakefileOnBuild Value="True"/> <CreateMakefileOnBuild Value="True"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG> </CONFIG>

View File

@ -533,6 +533,8 @@ begin
PluginsPath := LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir + DS + '..' + DS + '..'+ DS + 'Plugins'+ DS)); PluginsPath := LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir + DS + '..' + DS + '..'+ DS + 'Plugins'+ DS));
ScriptErrorLine:= -1; ScriptErrorLine:= -1;
CurrentSyncInfo.SyncMethod:= @Self.SafeCallThread; CurrentSyncInfo.SyncMethod:= @Self.SafeCallThread;
//This SHOULD load CPascal, but it fails ***WIZZUP***
//ScriptThread := TInterpreterThread.Create('libcpascal',True,@CurrentSyncInfo,PluginsPath);
ScriptThread := TPSThread.Create(True,@CurrentSyncInfo,PluginsPath); ScriptThread := TPSThread.Create(True,@CurrentSyncInfo,PluginsPath);
{$IFNDEF TERMINALWRITELN} {$IFNDEF TERMINALWRITELN}
ScriptThread.SetDebug(@formWriteln); ScriptThread.SetDebug(@formWriteln);

View File

@ -151,9 +151,8 @@ type
protected protected
interps: array of TInterpreter; interps: array of TInterpreter;
function InitPlugin(plugin: TLibHandle): boolean; override; function InitPlugin(plugin: TLibHandle): boolean; override;
function GetInterpreter(idx: integer): TInterpreter;
public public
property Get[idx: integer]: TInterpreter read GetInterpreter; default; function GetInterpreter(idx: integer): TInterpreter;
end; end;
TInterpreterThread = class(TMThread) TInterpreterThread = class(TMThread)
@ -269,6 +268,7 @@ begin
SetLength(PluginsToLoad,0); SetLength(PluginsToLoad,0);
FreeOnTerminate := True; FreeOnTerminate := True;
OnTerminate := @OnThreadTerminate; OnTerminate := @OnThreadTerminate;
OnError:= nil;
inherited Create(CreateSuspended); inherited Create(CreateSuspended);
end; end;
@ -463,7 +463,6 @@ begin
PSScript.OnCompImport:= @OnCompImport; PSScript.OnCompImport:= @OnCompImport;
PSScript.OnExecImport:= @OnExecImport; PSScript.OnExecImport:= @OnExecImport;
PSScript.OnFindUnknownFile:=@PSScriptFindUnknownFile; PSScript.OnFindUnknownFile:=@PSScriptFindUnknownFile;
OnError:= nil;
// Set some defines // Set some defines
{$I PSInc/psdefines.inc} {$I PSInc/psdefines.inc}
inherited Create(CreateSuspended, TheSyncInfo, plugin_dir); inherited Create(CreateSuspended, TheSyncInfo, plugin_dir);
@ -689,7 +688,7 @@ begin
plugin_idx:= interp_loader.LoadPlugin(libname); plugin_idx:= interp_loader.LoadPlugin(libname);
if plugin_idx < 0 then if plugin_idx < 0 then
raise Exception.Create(Format('Could not locate the interpreter library: %s',[libname])); raise Exception.Create(Format('Could not locate the interpreter library: %s',[libname]));
interpreter:= interp_loader[plugin_idx]; interpreter:= interp_loader.GetInterpreter(plugin_idx);
instance:= nil; instance:= nil;
inherited Create(CreateSuspended, TheSyncInfo, plugin_dir); inherited Create(CreateSuspended, TheSyncInfo, plugin_dir);
end; end;
@ -720,14 +719,14 @@ begin
instance:= interpreter.Create(PChar(@script[1]), @Interpreter_Precompiler, @Interpreter_ErrorHandler); instance:= interpreter.Create(PChar(@script[1]), @Interpreter_Precompiler, @Interpreter_ErrorHandler);
for i := 0 to high(ExportedMethods) do for i := 0 to high(ExportedMethods) do
if ExportedMethods[i].FuncPtr <> nil then if ExportedMethods[i].FuncPtr <> nil then
interpreter.AddMethod(instance,ExportedMethods[i].FuncPtr,PChar(@ExportedMethods[i].FuncDecl[1])); interpreter.AddMethod(instance,ExportedMethods[i].FuncPtr,PChar(ExportedMethods[i].FuncDecl));
end; end;
procedure TInterpreterThread.AddMethod(meth: TExpMethod); procedure TInterpreterThread.AddMethod(meth: TExpMethod);
begin begin
if instance = nil then if instance = nil then
raise Exception.Create('Script not set, cannot add method'); raise Exception.Create('Script not set, cannot add method');
interpreter.AddMethod(instance,meth.FuncPtr,PChar(@meth.FuncDecl[1])); interpreter.AddMethod(instance,meth.FuncPtr,PChar(meth.FuncDecl));
end; end;
procedure TInterpreterThread.Execute; procedure TInterpreterThread.Execute;
@ -748,22 +747,23 @@ end;
function TInterpreterLoader.InitPlugin(plugin: TLibHandle): boolean; function TInterpreterLoader.InitPlugin(plugin: TLibHandle): boolean;
var var
interp: TInterpreter; i: integer;
begin begin
Pointer(interp.Create) := GetProcAddress(plugin, PChar('interp_init'));
if @interp.Create = nil then begin result:= false; exit; end;
Pointer(interp.Destroy) := GetProcAddress(plugin, PChar('interp_free'));
if @interp.Destroy = nil then begin result:= false; exit; end;
Pointer(interp.Run) := GetProcAddress(plugin, PChar('interp_run'));
if @interp.Run = nil then begin result:= false; exit; end;
Pointer(interp.AddMethod) := GetProcAddress(plugin, PChar('interp_meth'));
if @interp.AddMethod = nil then begin result:= false; exit; end;
//Optional methods...
Pointer(interp.Stop) := GetProcAddress(plugin, PChar('interp_stop'));
SetLength(interps,length(interps)+1);
interps[high(interps)]:= interp;
result:= true; result:= true;
i:= length(interps);
SetLength(interps,i+1);
Pointer(interps[i].Create) := GetProcAddress(plugin, PChar('interp_init'));
Pointer(interps[i].Destroy) := GetProcAddress(plugin, PChar('interp_free'));
Pointer(interps[i].Run) := GetProcAddress(plugin, PChar('interp_run'));
Pointer(interps[i].AddMethod) := GetProcAddress(plugin, PChar('interp_meth'));
//Optional methods...
Pointer(interps[i].Stop) := GetProcAddress(plugin, PChar('interp_stop'));
if (Pointer(interps[i].Create) = nil) or (Pointer(interps[i].Destroy) = nil) or
(Pointer(interps[i].Run) = nil) or (Pointer(interps[i].AddMethod) = nil) then
begin
SetLength(interps,i);
result:= false;
end;
end; end;
function TInterpreterLoader.GetInterpreter(idx: integer): TInterpreter; function TInterpreterLoader.GetInterpreter(idx: integer): TInterpreter;

View File

@ -718,8 +718,6 @@ begin
end; end;
destructor TEIOS_Controller.Destroy; destructor TEIOS_Controller.Destroy;
var
i: integer;
begin begin
SetLength(plugs,0); SetLength(plugs,0);
inherited Destroy; inherited Destroy;