mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-23 17:52:16 -05:00
Merge branch 'cts-rework' into cts-3
This commit is contained in:
commit
58c7676a4a
15
Extensions/extension.sex
Normal file
15
Extensions/extension.sex
Normal file
@ -0,0 +1,15 @@
|
||||
program ExtUpdater;
|
||||
{$I ..\Extensions\Updater.sei}
|
||||
|
||||
procedure Init;
|
||||
var
|
||||
EXT: integer;
|
||||
begin
|
||||
Settings.GetKeyValueDef('Extensions_Visible', 'false'); //Default Menu to be hidden =)
|
||||
AddUpdater('Extensions', 'http://wizzup.org/static/srl/exten.tar.bz2',
|
||||
'http://wizzup.org/static/srl/exten_version', ScriptPath + {$IFDEF WINDOWS}'\' {$ELSE}'/'{$ENDIF}, True, True, EXT);
|
||||
end;
|
||||
|
||||
function GetName: string; begin Result := 'Extensions Updater'; end;
|
||||
function GetVersion: string; begin Result := '0.1'; end;
|
||||
begin end.
|
@ -30,11 +30,12 @@ Name: "{app}\Extensions"
|
||||
Name: "{app}\Includes"
|
||||
Name: "{app}\Plugins"
|
||||
Name: "{app}\Scripts"
|
||||
Name: "{app}\Scripts\Tests"
|
||||
; Name: "{app}\Scripts\Tests"
|
||||
|
||||
[Files]
|
||||
Source: "C:\Simba\Simba.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "C:\Simba\Extensions\srl.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
|
||||
Source: "C:\Simba\Extensions\extension.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
|
||||
Source: "C:\Simba\Extensions\msi.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
|
||||
Source: "C:\Simba\Extensions\associate.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
|
||||
Source: "C:\Simba\Extensions\dtm_editor.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
|
||||
|
@ -184,7 +184,8 @@ type
|
||||
procedure OnCompile(Sender: TPSScript);
|
||||
function RequireFile(Sender: TObject; const OriginFileName: String;
|
||||
var FileName, OutPut: string): Boolean;
|
||||
function FileAlreadyIncluded(Sender: TObject; FileName: string): Boolean;
|
||||
function FileAlreadyIncluded(Sender: TObject; OrgFileName, FileName: string): Boolean;
|
||||
function OnIncludingFile(Sender: TObject; OrgFileName, FileName: string): Boolean;
|
||||
|
||||
procedure OnCompImport(Sender: TObject; x: TPSPascalCompiler);
|
||||
procedure OnExecImport(Sender: TObject; se: TPSExec; x: TPSRuntimeClassImporter);
|
||||
@ -425,7 +426,9 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
filename := path;//Yeah!
|
||||
Includes.Add(path);
|
||||
|
||||
if Includes.IndexOf(path) = -1 then
|
||||
Includes.Add(path);
|
||||
|
||||
try
|
||||
f:= TFileStream.Create(UTF8ToSys(Path), fmOpenRead);
|
||||
@ -615,6 +618,7 @@ begin
|
||||
PSScript.UsePreProcessor:= True;
|
||||
PSScript.CompilerOptions := PSScript.CompilerOptions + [icBooleanShortCircuit];
|
||||
PSScript.OnNeedFile := @RequireFile;
|
||||
PSScript.OnIncludingFile := @OnIncludingFile;
|
||||
PSScript.OnFileAlreadyIncluded := @FileAlreadyIncluded;
|
||||
PSScript.OnProcessDirective:=@OnProcessDirective;
|
||||
PSScript.OnProcessUnknowDirective:=@PSScriptProcessUnknownDirective;
|
||||
@ -737,26 +741,59 @@ begin
|
||||
'{$IFDEF __REMOVE_IS_INCLUDE}{$UNDEF IS_INCLUDE}{$ENDIF}';
|
||||
end;
|
||||
|
||||
function TPSThread.FileAlreadyIncluded(Sender: TObject; FileName: string): Boolean;
|
||||
function TPSThread.FileAlreadyIncluded(Sender: TObject; OrgFileName, FileName: string): Boolean;
|
||||
var
|
||||
path: string;
|
||||
i: integer;
|
||||
begin
|
||||
path := FindFile(Filename,[ScriptPath,IncludePath]);
|
||||
path := FindFile(filename,[includepath,ScriptPath,IncludeTrailingPathDelimiter(ExtractFileDir(OrgFileName))]);
|
||||
if path = '' then
|
||||
begin
|
||||
Result := True;
|
||||
Exit;
|
||||
end;
|
||||
path := ExpandFileNameUTF8(path);
|
||||
|
||||
if (path <> '') then
|
||||
if Includes.Find(path,i) then
|
||||
if Includes.IndexOf(path) <> -1 then
|
||||
begin
|
||||
{$IFDEF SIMBA_VERBOSE}
|
||||
psWriteln('Include_Once file already included:' + Path);
|
||||
writeln('Include_Once file already included:' + Path);
|
||||
{$ENDIF}
|
||||
Result := True;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
{$IFDEF SIMBA_VERBOSE}
|
||||
writeln('OnFileAlreadyIncluded, Adding: ' + path);
|
||||
{$ENDIF}
|
||||
Includes.Add(path);
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TPSThread.OnIncludingFile(Sender: TObject; OrgFileName, FileName: string): Boolean;
|
||||
var
|
||||
path: string;
|
||||
begin
|
||||
path := FindFile(filename,[includepath,ScriptPath,IncludeTrailingPathDelimiter(ExtractFileDir(OrgFileName))]);
|
||||
if path = '' then
|
||||
begin
|
||||
Result := True;
|
||||
Exit;
|
||||
end;
|
||||
path := ExpandFileNameUTF8(path);
|
||||
|
||||
if Includes.IndexOf(path) = -1 then
|
||||
begin
|
||||
{$IFDEF SIMBA_VERBOSE}
|
||||
writeln('OnIncludingFile, Adding: ' + path);
|
||||
{$ENDIF}
|
||||
Includes.Add(path);
|
||||
end;
|
||||
|
||||
Result := True; // Not used
|
||||
end;
|
||||
|
||||
procedure SIRegister_Mufasa(cl: TPSPascalCompiler);
|
||||
begin
|
||||
SIRegister_MML(cl);
|
||||
|
@ -128,6 +128,7 @@ begin;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
result := '';
|
||||
end;
|
||||
|
||||
constructor TMFiles.Create(Owner : TObject);
|
||||
|
@ -94,7 +94,8 @@ type
|
||||
TPSOnNeedFile = function (Sender: TObject; const OrginFileName: tbtstring; var FileName, Output: tbtstring): Boolean of object;
|
||||
|
||||
{ Added by Wizzup }
|
||||
TPSOnFileAlreadyIncluded = function (Sender: TObject; FileName: tbtstring): Boolean of object;
|
||||
TPSOnFileAlreadyIncluded = function (Sender: TObject; OrgFileName, FileName: tbtstring): Boolean of object;
|
||||
TPSOnIncludingFile = function (Sender: TObject; OrgFileName, FileName: tbtstring): Boolean of object;
|
||||
{ Wizzup out }
|
||||
|
||||
TPSOnProcessDirective = procedure (
|
||||
@ -127,6 +128,7 @@ type
|
||||
FOnNeedFile: TPSOnNeedFile;
|
||||
{ Added by Wizzup }
|
||||
FOnFileAlreadyIncluded: TPSOnFileAlreadyIncluded;
|
||||
FOnIncludingFile: TPSOnIncludingFile;
|
||||
{ Wizzup out }
|
||||
FUsePreProcessor: Boolean;
|
||||
FDefines: TStrings;
|
||||
@ -161,7 +163,8 @@ type
|
||||
//--jgv new
|
||||
function DoOnNeedFile (Sender: TObject; const OrginFileName: tbtstring; var FileName, Output: tbtstring): Boolean; virtual;
|
||||
{ Added by Wizzup }
|
||||
function DoOnFileAlreadyIncluded (Sender: TObject; FileName: tbtstring): Boolean; virtual;
|
||||
function DoOnFileAlreadyIncluded (Sender: TObject; OrgFileName, FileName: tbtstring): Boolean; virtual;
|
||||
function DoOnIncludingFile (Sender: TObject; OrgFileName, FileName: tbtstring): Boolean; virtual;
|
||||
{ Wizzup out }
|
||||
function DoOnUnknowUses (Sender: TPSPascalCompiler; const Name: tbtstring): Boolean; virtual; // return true if processed
|
||||
procedure DoOnCompImport; virtual;
|
||||
@ -300,6 +303,7 @@ type
|
||||
|
||||
{ Added by Wizzup }
|
||||
property OnFileAlreadyIncluded: TPSOnFileAlreadyIncluded read FOnFileAlreadyIncluded write FOnFileAlreadyIncluded;
|
||||
property OnIncludingFile: TPSOnIncludingFile read FOnIncludingFile write FOnIncludingFile;
|
||||
{ Wizzup out }
|
||||
|
||||
property Defines: TStrings read FDefines write SetDefines;
|
||||
@ -553,9 +557,14 @@ begin
|
||||
end;
|
||||
|
||||
{ Added by Wizzup }
|
||||
function CEOnFileAlreadyIncluded(Sender: TPSPreProcessor; FileName: tbtstring): Boolean;
|
||||
function CEOnFileAlreadyIncluded(Sender: TPSPreProcessor; OrgFileName, FileName: tbtstring): Boolean;
|
||||
begin
|
||||
Result := TPSScript (Sender.ID).DoOnFileAlreadyIncluded(Sender.ID, Filename);
|
||||
Result := TPSScript (Sender.ID).DoOnFileAlreadyIncluded(Sender.ID, OrgFileName, Filename);
|
||||
end;
|
||||
|
||||
function CEOnIncludingFile(Sender: TPSPreProcessor; OrgFileName, FileName: tbtstring): Boolean;
|
||||
begin
|
||||
Result := TPSScript (Sender.ID).DoOnIncludingFile(Sender.ID, OrgFileName, Filename);
|
||||
end;
|
||||
{ Wizzup out }
|
||||
|
||||
@ -675,6 +684,7 @@ begin
|
||||
|
||||
{ Added by Wizzup }
|
||||
FPP.OnFileAlreadyIncluded:= CEOnFileAlreadyIncluded;
|
||||
FPP.OnIncludingFile:= CEOnIncludingFile;
|
||||
{ Wizzup out }
|
||||
|
||||
FDefines := TStringList.Create;
|
||||
@ -1081,10 +1091,19 @@ end;
|
||||
|
||||
{ Added by Wizzup }
|
||||
function TPSScript.DoOnFileAlreadyIncluded(Sender: TObject;
|
||||
FileName: tbtstring): Boolean;
|
||||
OrgFileName, FileName: tbtstring): Boolean;
|
||||
begin
|
||||
If Assigned (OnFileAlreadyIncluded) then
|
||||
Result := OnFileAlreadyIncluded(Sender, FileName)
|
||||
Result := OnFileAlreadyIncluded(Sender, OrgFileName, FileName)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TPSScript.DoOnIncludingFile(Sender: TObject;
|
||||
OrgFileName, FileName: tbtstring): Boolean;
|
||||
begin
|
||||
If Assigned (OnIncludingFile) then
|
||||
Result := OnIncludingFile(Sender, OrgFileName, FileName)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
@ -16,7 +16,8 @@ type
|
||||
TPSOnNeedFile = function (Sender: TPSPreProcessor; const callingfilename: tbtstring; var FileName, Output: tbtstring): Boolean;
|
||||
|
||||
{ Added by Wizzup }
|
||||
TPSOnFileAlreadyIncluded = function (Sender: TPSPreProcessor; FileName: tbtstring): Boolean;
|
||||
TPSOnFileAlreadyIncluded = function (Sender: TPSPreProcessor; OrgFileName, FileName: tbtstring): Boolean;
|
||||
TPSOnIncludingFile = function (Sender: TPSPreProcessor; OrgFileName, FileName: tbtstring): Boolean;
|
||||
{ Wizzup out }
|
||||
|
||||
TPSOnProcessDirective = procedure (
|
||||
@ -99,6 +100,7 @@ type
|
||||
FOnNeedFile: TPSOnNeedFile;
|
||||
{ Added by Wizzup }
|
||||
FOnFileAlreadyIncluded: TPSOnFileAlreadyIncluded;
|
||||
FOnIncludingFile: TPSOnIncludingFile;
|
||||
{ Wizzup out }
|
||||
FAddedPosition: Cardinal;
|
||||
FDefineState: TPSDefineStates;
|
||||
@ -120,6 +122,7 @@ type
|
||||
|
||||
{ Added by Wizzup }
|
||||
property OnFileAlreadyIncluded: TPSOnFileAlreadyIncluded read FOnFileAlreadyIncluded write FOnFileAlreadyIncluded;
|
||||
property OnIncludingFile: TPSOnIncludingFile read FOnIncludingFile write FOnIncludingFile;
|
||||
{ Wizzup out }
|
||||
|
||||
property Defines: TStringList read FDefines write FDefines;
|
||||
@ -633,6 +636,8 @@ begin
|
||||
begin
|
||||
if FDefineState.DoWrite then
|
||||
begin
|
||||
if assigned(@OnIncludingFile) then
|
||||
OnIncludingFile(self , Filename, s);
|
||||
FAddedPosition := 0;
|
||||
IntPreProcess(Level +1, FileName, s, Dest);
|
||||
FCurrentLineInfo.Current := current;
|
||||
@ -646,7 +651,7 @@ begin
|
||||
raise EPSPreProcessor.CreateFmt(RPS_IncludeOnceNotFound, [FileName, OrgFileName])
|
||||
else
|
||||
begin
|
||||
if not OnFileAlreadyIncluded(Self, FileName) then
|
||||
if not OnFileAlreadyIncluded(Self, FileName, s) then
|
||||
begin
|
||||
FAddedPosition := 0;
|
||||
IntPreProcess(Level +1, FileName, s, Dest);
|
||||
|
Loading…
Reference in New Issue
Block a user