[pypy-svn] r76637 - in pypy/branch/fast-ctypes/pypy: module/_ctypes rlib
getxsick at codespeak.net
getxsick at codespeak.net
Mon Aug 16 18:18:34 CEST 2010
Author: getxsick
Date: Mon Aug 16 18:18:33 2010
New Revision: 76637
Added:
pypy/branch/fast-ctypes/pypy/module/_ctypes/constants.py (contents, props changed)
Modified:
pypy/branch/fast-ctypes/pypy/module/_ctypes/__init__.py
pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py
Log:
add some constants
Modified: pypy/branch/fast-ctypes/pypy/module/_ctypes/__init__.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/module/_ctypes/__init__.py (original)
+++ pypy/branch/fast-ctypes/pypy/module/_ctypes/__init__.py Mon Aug 16 18:18:33 2010
@@ -2,8 +2,24 @@
class Module(MixedModule):
interpleveldefs = {
- '__version__' : 'space.wrap("1.0.3")',
'dlopen' : 'interp_dll.W_CDLL',
'Test' : 'interp_test.W_Test',
}
appleveldefs = {}
+
+ def buildloaders(cls):
+ from pypy.module._ctypes.constants import constants
+ for constant, value in constants.iteritems():
+ Module.interpleveldefs[constant] = 'space.wrap(%r)' % value
+
+ from pypy.rlib import rjitffi
+ for name in ['FUNCFLAG_STDCALL',
+ 'FUNCFLAG_CDECL',
+ 'FUNCFLAG_PYTHONAPI',
+ ]:
+ if hasattr(rjitffi, name):
+ Module.interpleveldefs[name] = \
+ "space.wrap(%r)" % getattr(rjitffi, name)
+
+ super(Module, cls).buildloaders()
+ buildloaders = classmethod(buildloaders)
Added: pypy/branch/fast-ctypes/pypy/module/_ctypes/constants.py
==============================================================================
--- (empty file)
+++ pypy/branch/fast-ctypes/pypy/module/_ctypes/constants.py Mon Aug 16 18:18:33 2010
@@ -0,0 +1,5 @@
+constants = {
+ '__version__' : '1.0.3',
+ 'RTLD_LOCAL' : 0,
+ 'RTLD_GLOBAL' : 256,
+}
Modified: pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py (original)
+++ pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py Mon Aug 16 18:18:33 2010
@@ -12,6 +12,10 @@
GLOBAL_CPU._vtable_to_descr_dict = None
GLOBAL_CPU.setup()
+FUNCFLAG_STDCALL = 0
+FUNCFLAG_CDECL = 1 # for WINAPI calls
+FUNCFLAG_PYTHONAPI = 4
+
class CDLL(object):
def __init__(self, name, load=True):
if load:
More information about the Pypy-commit
mailing list