1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-08-13 16:53:59 -04:00

Merge branch 'master' of ssh://villavu.com:54367/simba

This commit is contained in:
Raymond 2010-03-27 13:12:43 +01:00
commit a0ba655c1d
2 changed files with 16 additions and 10 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
@ -10,10 +15,11 @@ dll.init.restype = None
dll.init() dll.init()
class POINT(Structure): class POINT(Structure):
_fields_ = [('x', c_int), _fields_ = [('x', c_int),
('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
@ -30,8 +36,8 @@ dll.printpoints.argtypes = [PPOINT, c_int]
d = dll.printpoints(c, 2) d = dll.printpoints(c, 2)
dll.hoi.restype = None #dll.hoi.restype = None
dll.hoi.argtypes = [POINTER(c_int)] #dll.hoi.argtypes = [POINTER(c_int)]
e = c_int(5) e = c_int(5)
dll.hoi(byref(e)) dll.hoi(byref(e))