1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-22 23:38:50 -05:00

Merge ssh://villavu.com:54367/simba

This commit is contained in:
Niels 2010-03-27 19:50:13 +01:00
commit cf1dbaccc7
7 changed files with 68 additions and 41 deletions

View File

@ -23,12 +23,12 @@ begin
C:=TCLient.Create(''); C:=TCLient.Create('');
end; end;
function getmousepos: tpoint; function getmousepos: tpoint; cdecl;
begin begin
C.IOManager.GetMousePos(result.x,result.y); C.IOManager.GetMousePos(result.x,result.y);
end; end;
function returnpoints: PTPoint; function returnpoints: PTPoint; cdecl;
begin begin
result := AllocMem(sizeof(TPoint) * 2); result := AllocMem(sizeof(TPoint) * 2);
@ -38,19 +38,19 @@ begin
result[1].y := 30; result[1].y := 30;
end; end;
function printpoints(b: PTPoint; len: integer): boolean; function printpoints(b: PTPoint; len: integer): boolean; cdecl;
var i:integer; var i:integer;
begin begin
for i := 0 to len - 1 do for i := 0 to len - 1 do
writeln('X, Y: (' + inttostr(b[i].x) + ', ' + inttostr(b[i].y) + ')'); writeln('X, Y: (' + inttostr(b[i].x) + ', ' + inttostr(b[i].y) + ')');
end; end;
procedure hoi(var i: integer); procedure hoi(var i: integer); cdecl;
begin begin
i := i + 1; i := i + 1;
end; end;
function givedtm:PPDTM; function givedtm:PPDTM; cdecl;
var var
dtm: PPDTM; dtm: PPDTM;
begin begin

View File

@ -1,7 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
from ctypes import * from ctypes import *
import platform
dll = CDLL('./libmml.so') if platform.system() == 'Windows':
dll = CDLL('./libmml.dll')
print 'On Windows'
else:
dll = CDLL('./libmml.so')
dll.test.restype = c_char_p dll.test.restype = c_char_p
a = dll.test() a = dll.test()
print a print a
@ -14,6 +19,7 @@ class POINT(Structure):
('y', c_int)] ('y', c_int)]
dll.getmousepos.restype = POINT dll.getmousepos.restype = POINT
dll.getmousepos.argtypes = None
b = dll.getmousepos() b = dll.getmousepos()
print b.x, b.y print b.x, b.y

View File

@ -326,7 +326,9 @@ type
FirstRun : boolean;//Only show the warnings the first run (path not existing one's) FirstRun : boolean;//Only show the warnings the first run (path not existing one's)
SearchStart : TPoint; SearchStart : TPoint;
LastTab : integer; LastTab : integer;
function GetIncludePath: String;
function GetScriptState: TScriptState; function GetScriptState: TScriptState;
procedure SetIncludePath(const AValue: String);
procedure SetScriptState(const State: TScriptState); procedure SetScriptState(const State: TScriptState);
function LoadSettingDef(Key : string; Def : string) : string; function LoadSettingDef(Key : string; Def : string) : string;
function CreateSetting(Key : string; Value : string) : string; function CreateSetting(Key : string; Value : string) : string;
@ -374,6 +376,7 @@ type
procedure InitalizeTMThread(var Thread : TMThread); procedure InitalizeTMThread(var Thread : TMThread);
procedure HandleParameters; procedure HandleParameters;
procedure OnSaveScript(const Filename : string); procedure OnSaveScript(const Filename : string);
property IncludePath : String read GetIncludePath write SetIncludePath;
end; end;
procedure ClearDebug; procedure ClearDebug;
@ -406,6 +409,7 @@ uses
lclintf, lclintf,
syncobjs, // for the critical sections syncobjs, // for the critical sections
debugimage, debugimage,
files,
extensionmanagergui, extensionmanagergui,
colourhistory, colourhistory,
math; math;
@ -464,8 +468,16 @@ begin
end; end;
function TForm1.OnCCFindInclude(Sender: TObject; var FileName: string): Boolean; function TForm1.OnCCFindInclude(Sender: TObject; var FileName: string): Boolean;
var
Temp : string;
begin begin
Result := False; Temp := FindFile(filename,[MainDir+DS,IncludePath]);
if temp <> '' then
begin;
filename := temp;
result := true;
end else
result := false;
end; end;
procedure TForm1.ProcessDebugStream(Sender: TObject); procedure TForm1.ProcessDebugStream(Sender: TObject);
@ -945,7 +957,7 @@ end;
procedure TForm1.CreateDefaultEnvironment; procedure TForm1.CreateDefaultEnvironment;
var var
IncludePath,FontPath,PluginsPath,extensionsPath : string; FontPath,PluginsPath,extensionsPath : string;
begin begin
CreateSetting('Settings/Updater/CheckForUpdates','True'); CreateSetting('Settings/Updater/CheckForUpdates','True');
CreateSetting('Settings/Updater/CheckEveryXMinutes','30'); CreateSetting('Settings/Updater/CheckEveryXMinutes','30');
@ -989,7 +1001,6 @@ begin
{$ENDIF} {$ENDIF}
); );
{Creates the paths and returns the path} {Creates the paths and returns the path}
includePath:= CreateSetting('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS));
fontPath := CreateSetting('Settings/Fonts/Path', ExpandFileName(MainDir+DS+ 'Fonts' + DS)); fontPath := CreateSetting('Settings/Fonts/Path', ExpandFileName(MainDir+DS+ 'Fonts' + DS));
PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS)); PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS));
extensionsPath := CreateSetting('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS)); extensionsPath := CreateSetting('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS));
@ -1147,7 +1158,6 @@ procedure TForm1.InitalizeTMThread(var Thread: TMThread);
var var
DbgImgInfo : TDbgImgInfo; DbgImgInfo : TDbgImgInfo;
fontPath: String; fontPath: String;
includePath : string;
AppPath : string; AppPath : string;
pluginspath: string; pluginspath: string;
ScriptPath : string; ScriptPath : string;
@ -1156,7 +1166,6 @@ var
loadFontsOnScriptStart: boolean; loadFontsOnScriptStart: boolean;
begin begin
AppPath:= MainDir + DS; AppPath:= MainDir + DS;
includePath:= IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS)));
fontPath := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Fonts/Path', ExpandFileName(MainDir+DS+ 'Fonts' + DS))); fontPath := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Fonts/Path', ExpandFileName(MainDir+DS+ 'Fonts' + DS)));
PluginsPath := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS))); PluginsPath := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS)));
CurrScript.ScriptErrorLine:= -1; CurrScript.ScriptErrorLine:= -1;
@ -2237,6 +2246,16 @@ begin
result := CurrScript.FScriptState; result := CurrScript.FScriptState;
end; end;
function TForm1.GetIncludePath: String;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS)));
end;
procedure TForm1.SetIncludePath(const AValue: String);
begin
CreateSetting('Settings/Includes/Path',AValue);
end;
procedure TForm1.SetScriptState(const State: TScriptState); procedure TForm1.SetScriptState(const State: TScriptState);
begin begin
CurrScript.FScriptState:= State; CurrScript.FScriptState:= State;

View File

@ -21,11 +21,11 @@
PSCompile.inc for the Mufasa Macro Library PSCompile.inc for the Mufasa Macro Library
} }
Sender.Comp.AddConstantN('AppPath','string').SetString(CurrThread.AppPath); Sender.Comp.AddConstantN('AppPath','string').SetString(Self.AppPath);
Sender.Comp.AddConstantN('ScriptPath','string').SetString(CurrThread.ScriptPath); Sender.Comp.AddConstantN('ScriptPath','string').SetString(Self.ScriptPath);
Sender.Comp.AddConstantN('IncludePath','string').SetString(CurrThread.IncludePath); Sender.Comp.AddConstantN('IncludePath','string').SetString(Self.IncludePath);
Sender.Comp.AddConstantN('PluginPath','string').SetString(CurrThread.PluginPath); Sender.Comp.AddConstantN('PluginPath','string').SetString(Self.PluginPath);
Sender.Comp.AddConstantN('FontPath','string').SetString(CurrThread.FontPath); Sender.Comp.AddConstantN('FontPath','string').SetString(Self.FontPath);
Sender.Comp.AddTypeS('TReplaceFlag', '(rfReplaceAll, rfIgnoreCase)'); Sender.Comp.AddTypeS('TReplaceFlag', '(rfReplaceAll, rfIgnoreCase)');
Sender.Comp.AddTypeS('TReplaceFlags','set of TReplaceFlag'); Sender.Comp.AddTypeS('TReplaceFlags','set of TReplaceFlag');
Sender.Comp.AddTypeS('StrExtr','(Numbers, Letters, Others);'); Sender.Comp.AddTypeS('StrExtr','(Numbers, Letters, Others);');

View File

@ -192,6 +192,7 @@ uses
stringutil, //String st00f stringutil, //String st00f
uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms, uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms,
uPSR_menus, uPSR_menus,
files,
uPSR_extctrls, //Runtime-libs uPSR_extctrls, //Runtime-libs
Graphics, //For Graphics types Graphics, //For Graphics types
math, //Maths! math, //Maths!
@ -325,24 +326,6 @@ procedure TMThread.AddMethod(meth: TExpMethod);
begin begin
end; end;
function FindFile(filename : string; Dirs : array of string) : string; //Results '' if not found
var
i : integer;
begin;
if fileexists(filename) then
result := filename
else
begin
for i := 0 to high(Dirs) do
if DirectoryExists(dirs[i]) then
if fileexists(dirs[i] + filename) then
begin
result := dirs[i] + filename;
exit;
end;
end;
end;
function TMThread.LoadFile(ParentFile : string; var filename, contents: string): boolean; function TMThread.LoadFile(ParentFile : string; var filename, contents: string): boolean;
var var
path: string; path: string;
@ -591,22 +574,22 @@ begin
{$I PSInc/pscompile.inc} {$I PSInc/pscompile.inc}
Fonts := Client.MOCR.GetFonts; Fonts := Client.MOCR.GetFonts;
for i := fonts.count - 1 downto 0 do for i := fonts.count - 1 downto 0 do
PSScript.Comp.AddConstantN(Fonts[i].Name,'string').SetString(Fonts[i].Name); Sender.Comp.AddConstantN(Fonts[i].Name,'string').SetString(Fonts[i].Name);
for i := high(PluginsToLoad) downto 0 do for i := high(PluginsToLoad) downto 0 do
for ii := 0 to PluginsGlob.MPlugins[PluginsToLoad[i]].MethodLen - 1 do for ii := 0 to PluginsGlob.MPlugins[PluginsToLoad[i]].MethodLen - 1 do
PSScript.AddFunctionEx(PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncPtr, Sender.AddFunctionEx(PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncPtr,
PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncStr, PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncStr,
Muf_Conv_to_PS_Conv(PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncConv)); Muf_Conv_to_PS_Conv(PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncConv));
for i := 0 to high(VirtualKeys) do for i := 0 to high(VirtualKeys) do
PSScript.Comp.AddConstantN(Format('VK_%S',[VirtualKeys[i].Str]),'Byte').SetInt(VirtualKeys[i].Key); Sender.Comp.AddConstantN(Format('VK_%S',[VirtualKeys[i].Str]),'Byte').SetInt(VirtualKeys[i].Key);
// Here we add all the Consts/Types to the engine. // Here we add all the Consts/Types to the engine.
//Export all the methods //Export all the methods
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
PSScript.AddFunctionEx(ExportedMethods[i].FuncPtr,ExportedMethods[i].FuncDecl, Sender.AddFunctionEx(ExportedMethods[i].FuncPtr,ExportedMethods[i].FuncDecl,
{$ifdef PS_StdCall}cdStdCall{$else}cdRegister {$endif}); {$ifdef PS_StdCall}cdStdCall{$else}cdRegister {$endif});
end; end;

View File

@ -66,6 +66,7 @@ type
// We don't need one per object. :-) // We don't need one per object. :-)
function GetFiles(Path, Ext: string): TStringArray; function GetFiles(Path, Ext: string): TStringArray;
function GetDirectories(Path: string): TstringArray; function GetDirectories(Path: string): TstringArray;
function FindFile(filename : string; Dirs : array of string) : string; //Results '' if not found
implementation implementation
uses uses
@ -109,6 +110,24 @@ begin
end; end;
end; end;
function FindFile(filename : string; Dirs : array of string) : string; //Results '' if not found
var
i : integer;
begin;
if fileexists(filename) then
result := filename
else
begin
for i := 0 to high(Dirs) do
if DirectoryExists(dirs[i]) then
if fileexists(dirs[i] + filename) then
begin
result := dirs[i] + filename;
exit;
end;
end;
end;
constructor TMFiles.Create(Owner : TObject); constructor TMFiles.Create(Owner : TObject);
begin begin
inherited Create; inherited Create;

View File

@ -247,7 +247,7 @@ procedure TPSScriptExtension.GetCodeProps;
btSingle: Result := FloatToStr(v.tsingle); btSingle: Result := FloatToStr(v.tsingle);
btDouble: Result := FloatToStr(v.tdouble); btDouble: Result := FloatToStr(v.tdouble);
btExtended: Result := FloatToStr(v.textended); btExtended: Result := FloatToStr(v.textended);
btString: Result := tbtString(v.tstring); btString: Result := MakeString(tbtString(v.tstring));
{$IFNDEF PS_NOINT64} {$IFNDEF PS_NOINT64}
btS64: Result := IntToStr(v.ts64); btS64: Result := IntToStr(v.ts64);
{$ENDIF} {$ENDIF}