mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-10 13:18:00 -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.SetPSScript(Self.SynEdit1.Lines.Text);
|
||||||
MMLPSThread.SetDebug(Self.Memo1);
|
MMLPSThread.SetDebug(Self.Memo1);
|
||||||
if ScriptFile <> '' then
|
if ScriptFile <> '' then
|
||||||
MMLPSThread.SetPaths( ExtractFileDir(ScriptFile) + DS,MainDir +DS)
|
MMLPSThread.SetPaths( ExtractFileDir(ScriptFile) + DS,IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)))
|
||||||
else
|
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
|
// This doesn't actually set the Client's MWindow to the passed window, it
|
||||||
// only copies the current set window handle.
|
// only copies the current set window handle.
|
||||||
|
@ -44,6 +44,9 @@ type
|
|||||||
PSyncInfo = ^TSyncInfo;
|
PSyncInfo = ^TSyncInfo;
|
||||||
|
|
||||||
TMMLPSThread = class(TThread)
|
TMMLPSThread = class(TThread)
|
||||||
|
procedure OnProcessDirective(Sender: TPSPreProcessor;
|
||||||
|
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
||||||
|
const DirectiveName, DirectiveParam: string; var Continue: Boolean);
|
||||||
procedure PSScriptProcessUnknowDirective(Sender: TPSPreProcessor;
|
procedure PSScriptProcessUnknowDirective(Sender: TPSPreProcessor;
|
||||||
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
||||||
const DirectiveName, DirectiveParam: string; var Continue: Boolean);
|
const DirectiveName, DirectiveParam: string; var Continue: Boolean);
|
||||||
@ -150,6 +153,7 @@ begin
|
|||||||
PSScript := TPSScript.Create(nil);
|
PSScript := TPSScript.Create(nil);
|
||||||
PSScript.UsePreProcessor:= True;
|
PSScript.UsePreProcessor:= True;
|
||||||
PSScript.OnNeedFile := @RequireFile;
|
PSScript.OnNeedFile := @RequireFile;
|
||||||
|
PSScript.OnProcessDirective:=@OnProcessDirective;
|
||||||
PSScript.OnProcessUnknowDirective:=@PSScriptProcessUnknowDirective;
|
PSScript.OnProcessUnknowDirective:=@PSScriptProcessUnknowDirective;
|
||||||
PSScript.OnCompile:= @OnCompile;
|
PSScript.OnCompile:= @OnCompile;
|
||||||
PSScript.OnCompImport:= @OnCompImport;
|
PSScript.OnCompImport:= @OnCompImport;
|
||||||
@ -187,6 +191,11 @@ end;
|
|||||||
{$I PSInc/Wrappers/mouse.inc}
|
{$I PSInc/Wrappers/mouse.inc}
|
||||||
{$I PSInc/Wrappers/dtm.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;
|
procedure TMMLPSThread.PSScriptProcessUnknowDirective(Sender: TPSPreProcessor;
|
||||||
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
||||||
@ -233,9 +242,33 @@ end;
|
|||||||
|
|
||||||
function TMMLPSThread.RequireFile(Sender: TObject;
|
function TMMLPSThread.RequireFile(Sender: TObject;
|
||||||
const OriginFileName: String; var FileName, OutPut: string): Boolean;
|
const OriginFileName: String; var FileName, OutPut: string): Boolean;
|
||||||
|
var
|
||||||
|
path: string;
|
||||||
|
f: TFileStream;
|
||||||
begin
|
begin
|
||||||
|
if FileExists(FileName) then
|
||||||
Result := False;
|
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;
|
end;
|
||||||
|
|
||||||
procedure TMMLPSThread.OnCompImport(Sender: TObject; x: TPSPascalCompiler);
|
procedure TMMLPSThread.OnCompImport(Sender: TObject; x: TPSPascalCompiler);
|
||||||
|
Loading…
Reference in New Issue
Block a user