1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-22 15:28: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('');
end;
function getmousepos: tpoint;
function getmousepos: tpoint; cdecl;
begin
C.IOManager.GetMousePos(result.x,result.y);
end;
function returnpoints: PTPoint;
function returnpoints: PTPoint; cdecl;
begin
result := AllocMem(sizeof(TPoint) * 2);
@ -38,19 +38,19 @@ begin
result[1].y := 30;
end;
function printpoints(b: PTPoint; len: integer): boolean;
function printpoints(b: PTPoint; len: integer): boolean; cdecl;
var i:integer;
begin
for i := 0 to len - 1 do
writeln('X, Y: (' + inttostr(b[i].x) + ', ' + inttostr(b[i].y) + ')');
end;
procedure hoi(var i: integer);
procedure hoi(var i: integer); cdecl;
begin
i := i + 1;
end;
function givedtm:PPDTM;
function givedtm:PPDTM; cdecl;
var
dtm: PPDTM;
begin

View File

@ -1,7 +1,12 @@
#!/usr/bin/env python
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
a = dll.test()
print a
@ -10,10 +15,11 @@ dll.init.restype = None
dll.init()
class POINT(Structure):
_fields_ = [('x', c_int),
('y', c_int)]
_fields_ = [('x', c_int),
('y', c_int)]
dll.getmousepos.restype = POINT
dll.getmousepos.argtypes = None
b = dll.getmousepos()
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)
SearchStart : TPoint;
LastTab : integer;
function GetIncludePath: String;
function GetScriptState: TScriptState;
procedure SetIncludePath(const AValue: String);
procedure SetScriptState(const State: TScriptState);
function LoadSettingDef(Key : string; Def : string) : string;
function CreateSetting(Key : string; Value : string) : string;
@ -374,6 +376,7 @@ type
procedure InitalizeTMThread(var Thread : TMThread);
procedure HandleParameters;
procedure OnSaveScript(const Filename : string);
property IncludePath : String read GetIncludePath write SetIncludePath;
end;
procedure ClearDebug;
@ -406,6 +409,7 @@ uses
lclintf,
syncobjs, // for the critical sections
debugimage,
files,
extensionmanagergui,
colourhistory,
math;
@ -464,8 +468,16 @@ begin
end;
function TForm1.OnCCFindInclude(Sender: TObject; var FileName: string): Boolean;
var
Temp : string;
begin
Result := False;
Temp := FindFile(filename,[MainDir+DS,IncludePath]);
if temp <> '' then
begin;
filename := temp;
result := true;
end else
result := false;
end;
procedure TForm1.ProcessDebugStream(Sender: TObject);
@ -945,7 +957,7 @@ end;
procedure TForm1.CreateDefaultEnvironment;
var
IncludePath,FontPath,PluginsPath,extensionsPath : string;
FontPath,PluginsPath,extensionsPath : string;
begin
CreateSetting('Settings/Updater/CheckForUpdates','True');
CreateSetting('Settings/Updater/CheckEveryXMinutes','30');
@ -989,7 +1001,6 @@ begin
{$ENDIF}
);
{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));
PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS));
extensionsPath := CreateSetting('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS));
@ -1147,7 +1158,6 @@ procedure TForm1.InitalizeTMThread(var Thread: TMThread);
var
DbgImgInfo : TDbgImgInfo;
fontPath: String;
includePath : string;
AppPath : string;
pluginspath: string;
ScriptPath : string;
@ -1156,7 +1166,6 @@ var
loadFontsOnScriptStart: boolean;
begin
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)));
PluginsPath := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS)));
CurrScript.ScriptErrorLine:= -1;
@ -2237,6 +2246,16 @@ begin
result := CurrScript.FScriptState;
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);
begin
CurrScript.FScriptState:= State;

View File

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

View File

@ -192,6 +192,7 @@ uses
stringutil, //String st00f
uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms,
uPSR_menus,
files,
uPSR_extctrls, //Runtime-libs
Graphics, //For Graphics types
math, //Maths!
@ -325,24 +326,6 @@ procedure TMThread.AddMethod(meth: TExpMethod);
begin
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;
var
path: string;
@ -591,22 +574,22 @@ begin
{$I PSInc/pscompile.inc}
Fonts := Client.MOCR.GetFonts;
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 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,
Muf_Conv_to_PS_Conv(PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncConv));
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.
//Export all the methods
for i := 0 to high(ExportedMethods) do
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});
end;

View File

@ -66,6 +66,7 @@ type
// We don't need one per object. :-)
function GetFiles(Path, Ext: string): TStringArray;
function GetDirectories(Path: string): TstringArray;
function FindFile(filename : string; Dirs : array of string) : string; //Results '' if not found
implementation
uses
@ -109,6 +110,24 @@ 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;
constructor TMFiles.Create(Owner : TObject);
begin
inherited Create;

View File

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