1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 18:52:15 -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>
<local>
<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>
</RunParams>
<RequiredPackages Count="2">
@ -256,17 +256,4 @@
<CreateMakefileOnBuild Value="True"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -533,6 +533,8 @@ begin
PluginsPath := LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir + DS + '..' + DS + '..'+ DS + 'Plugins'+ DS));
ScriptErrorLine:= -1;
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);
{$IFNDEF TERMINALWRITELN}
ScriptThread.SetDebug(@formWriteln);

View File

@ -151,9 +151,8 @@ type
protected
interps: array of TInterpreter;
function InitPlugin(plugin: TLibHandle): boolean; override;
function GetInterpreter(idx: integer): TInterpreter;
public
property Get[idx: integer]: TInterpreter read GetInterpreter; default;
function GetInterpreter(idx: integer): TInterpreter;
end;
TInterpreterThread = class(TMThread)
@ -269,6 +268,7 @@ begin
SetLength(PluginsToLoad,0);
FreeOnTerminate := True;
OnTerminate := @OnThreadTerminate;
OnError:= nil;
inherited Create(CreateSuspended);
end;
@ -463,7 +463,6 @@ begin
PSScript.OnCompImport:= @OnCompImport;
PSScript.OnExecImport:= @OnExecImport;
PSScript.OnFindUnknownFile:=@PSScriptFindUnknownFile;
OnError:= nil;
// Set some defines
{$I PSInc/psdefines.inc}
inherited Create(CreateSuspended, TheSyncInfo, plugin_dir);
@ -689,7 +688,7 @@ begin
plugin_idx:= interp_loader.LoadPlugin(libname);
if plugin_idx < 0 then
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;
inherited Create(CreateSuspended, TheSyncInfo, plugin_dir);
end;
@ -720,14 +719,14 @@ begin
instance:= interpreter.Create(PChar(@script[1]), @Interpreter_Precompiler, @Interpreter_ErrorHandler);
for i := 0 to high(ExportedMethods) do
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;
procedure TInterpreterThread.AddMethod(meth: TExpMethod);
begin
if instance = nil then
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;
procedure TInterpreterThread.Execute;
@ -748,22 +747,23 @@ end;
function TInterpreterLoader.InitPlugin(plugin: TLibHandle): boolean;
var
interp: TInterpreter;
i: integer;
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;
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;
function TInterpreterLoader.GetInterpreter(idx: integer): TInterpreter;

View File

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