mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-10 05:07:59 -05:00
.include now quite working..
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@144 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
dd3d202b44
commit
f3dae9ae78
7
Includes/test.mufa
Normal file
7
Includes/test.mufa
Normal file
@ -0,0 +1,7 @@
|
||||
const
|
||||
TestStr = 'Hai, seems like you got includes working!';
|
||||
|
||||
function Multiply(a,b : integer) : integer;
|
||||
begin;
|
||||
result := a*b;
|
||||
end;
|
@ -140,9 +140,9 @@ begin
|
||||
MMLPSThread.SetPSScript(Self.SynEdit1.Lines.Text);
|
||||
MMLPSThread.SetDebug(Self.Memo1);
|
||||
if ScriptFile <> '' then
|
||||
MMLPSThread.SetPaths( ExtractFileDir(ScriptFile) + DS,MainDir +DS)
|
||||
MMLPSThread.SetPaths( ExtractFileDir(ScriptFile) + DS,IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)))
|
||||
else
|
||||
MMLPSThread.SetPaths('',MainDir + DS);
|
||||
MMLPSThread.SetPaths('', IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)));
|
||||
|
||||
// This doesn't actually set the Client's MWindow to the passed window, it
|
||||
// only copies the current set window handle.
|
||||
|
@ -44,6 +44,9 @@ type
|
||||
PSyncInfo = ^TSyncInfo;
|
||||
|
||||
TMMLPSThread = class(TThread)
|
||||
procedure OnProcessDirective(Sender: TPSPreProcessor;
|
||||
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
||||
const DirectiveName, DirectiveParam: string; var Continue: Boolean);
|
||||
procedure PSScriptProcessUnknowDirective(Sender: TPSPreProcessor;
|
||||
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
||||
const DirectiveName, DirectiveParam: string; var Continue: Boolean);
|
||||
@ -150,6 +153,7 @@ begin
|
||||
PSScript := TPSScript.Create(nil);
|
||||
PSScript.UsePreProcessor:= True;
|
||||
PSScript.OnNeedFile := @RequireFile;
|
||||
PSScript.OnProcessDirective:=@OnProcessDirective;
|
||||
PSScript.OnProcessUnknowDirective:=@PSScriptProcessUnknowDirective;
|
||||
PSScript.OnCompile:= @OnCompile;
|
||||
PSScript.OnCompImport:= @OnCompImport;
|
||||
@ -187,6 +191,11 @@ end;
|
||||
{$I PSInc/Wrappers/mouse.inc}
|
||||
{$I PSInc/Wrappers/dtm.inc}
|
||||
|
||||
procedure TMMLPSThread.OnProcessDirective(Sender: TPSPreProcessor;
|
||||
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
||||
const DirectiveName, DirectiveParam: string; var Continue: Boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TMMLPSThread.PSScriptProcessUnknowDirective(Sender: TPSPreProcessor;
|
||||
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
||||
@ -233,9 +242,33 @@ end;
|
||||
|
||||
function TMMLPSThread.RequireFile(Sender: TObject;
|
||||
const OriginFileName: String; var FileName, OutPut: string): Boolean;
|
||||
var
|
||||
path: string;
|
||||
f: TFileStream;
|
||||
begin
|
||||
|
||||
Result := False;
|
||||
if FileExists(FileName) then
|
||||
Path := FileName
|
||||
else
|
||||
Path := AppPath+ 'Includes' + DS + Filename;
|
||||
if not FileExists(Path) then
|
||||
begin;
|
||||
Writeln(Path + ' doesn''t exist');
|
||||
Result := false;
|
||||
Exit;
|
||||
end;
|
||||
try
|
||||
F := TFileStream.Create(Path, fmOpenRead or fmShareDenyWrite);
|
||||
except
|
||||
Result := false;
|
||||
exit;
|
||||
end;
|
||||
try
|
||||
SetLength(Output, f.Size);
|
||||
f.Read(Output[1], Length(Output));
|
||||
finally
|
||||
f.Free;
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TMMLPSThread.OnCompImport(Sender: TObject; x: TPSPascalCompiler);
|
||||
|
Loading…
Reference in New Issue
Block a user