1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-25 08:48:51 -05:00
Simba/Projects/MMLLib/test.py

66 lines
1.2 KiB
Python
Raw Normal View History

#!/usr/bin/env python
from ctypes import *
2010-03-27 07:44:19 -04:00
import platform
2010-03-27 07:44:19 -04:00
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
dll.init.restype = None
dll.init()
class POINT(Structure):
2010-03-27 07:44:19 -04:00
_fields_ = [('x', c_int),
('y', c_int)]
dll.getmousepos.restype = POINT
2010-03-27 07:44:19 -04:00
dll.getmousepos.argtypes = None
b = dll.getmousepos()
print b.x, b.y
2010-03-26 07:22:08 -04:00
PPOINT = POINTER(POINT)
dll.returnpoints.restype = PPOINT
c = dll.returnpoints()
print c[0].x
dll.printpoints.restype = c_int
dll.printpoints.argtypes = [PPOINT, c_int]
d = dll.printpoints(c, 2)
2010-03-27 07:44:19 -04:00
#dll.hoi.restype = None
#dll.hoi.argtypes = [POINTER(c_int)]
2010-03-26 07:22:08 -04:00
e = c_int(5)
dll.hoi(byref(e))
print e
2010-03-26 10:20:50 -04:00
class DTM(Structure):
_fields_ = [('l' , c_int),
('p' , PPOINT),
('c' , POINTER(c_int)),
('t' , POINTER(c_int)),
('asz' , POINTER(c_int)),
('ash' , POINTER(c_int)),
('bp' , POINTER(c_int)),
('n' , c_char_p)]
PDTM = POINTER(DTM)
dll.givedtm.restype = PDTM
dll.givedtm.argtypes = None
f = dll.givedtm()
print f
print f.contents.l