Commits

Brian Kearns committed c296ea9 Merge

merge reflex-support

  • Participants
  • Parent commits b72c31d, 8282572

Comments (0)

Files changed (7)

pypy/module/cppyy/capi/capi_types.py

 from rpython.rtyper.lltypesystem import rffi, lltype
 
 # shared ll definitions
-_C_OPAQUE_PTR = rffi.LONG
-_C_OPAQUE_NULL = lltype.nullptr(rffi.LONGP.TO)# ALT: _C_OPAQUE_PTR.TO
+_C_OPAQUE_PTR = rffi.ULONG
+_C_OPAQUE_NULL = lltype.nullptr(rffi.ULONGP.TO)# ALT: _C_OPAQUE_PTR.TO
 
 C_SCOPE = _C_OPAQUE_PTR
 C_NULL_SCOPE = rffi.cast(C_SCOPE, _C_OPAQUE_NULL)

pypy/module/cppyy/capi/cint_capi.py

 
 def activate_branch(space, w_branch):
     w_branches = space.call_method(w_branch, "GetListOfBranches")
-    for i in range(space.int_w(space.call_method(w_branches, "GetEntriesFast"))):
+    for i in range(space.r_longlong_w(space.call_method(w_branches, "GetEntriesFast"))):
         w_b = space.call_method(w_branches, "At", space.wrap(i))
         activate_branch(space, w_b)
     space.call_method(w_branch, "SetStatus", space.wrap(1))
     activate_branch(space, w_branch)
 
     # figure out from where we're reading
-    entry = space.int_w(space.call_method(w_self, "GetReadEntry"))
+    entry = space.r_longlong_w(space.call_method(w_self, "GetReadEntry"))
     if entry == -1:
         entry = 0
 
         self.w_tree = w_tree
 
         self.current  = 0
-        self.maxentry = space.int_w(space.call_method(w_tree, "GetEntriesFast"))
+        self.maxentry = space.r_longlong_w(space.call_method(w_tree, "GetEntriesFast"))
 
         space = self.space = tree.space          # holds the class cache in State
         space.call_method(w_tree, "SetBranchStatus", space.wrap("*"), space.wrap(0))

pypy/module/cppyy/capi/loadable_capi.py

 
         # TODO: the following need to match up with the globally defined C_XYZ low-level
         # types (see capi/__init__.py), but by using strings here, that isn't guaranteed
-        c_opaque_ptr = nt.new_primitive_type(space, 'long')
+        c_opaque_ptr = nt.new_primitive_type(space, 'unsigned long')
  
         c_scope  = c_opaque_ptr
         c_type   = c_scope
     return c_call.ctype.rcall(c_call._cdata, args)
 
 def _cdata_to_cobject(space, w_cdata):
-    return rffi.cast(C_OBJECT, space.int_w(w_cdata))
+    return rffi.cast(C_OBJECT, space.uint_w(w_cdata))
 
 def _cdata_to_size_t(space, w_cdata):
-    return rffi.cast(rffi.SIZE_T, space.int_w(w_cdata))
+    return rffi.cast(rffi.SIZE_T, space.uint_w(w_cdata))
 
 def _cdata_to_ptr(space, w_cdata): # TODO: this is both a hack and dreadfully slow
     return rffi.cast(rffi.VOIDP,
 def c_resolve_name(space, name):
     return charp2str_free(space, call_capi(space, 'resolve_name', [_Arg(s=name)]))
 def c_get_scope_opaque(space, name):
-    return rffi.cast(C_SCOPE, space.int_w(call_capi(space, 'get_scope', [_Arg(s=name)])))
+    return rffi.cast(C_SCOPE, space.uint_w(call_capi(space, 'get_scope', [_Arg(s=name)])))
 def c_get_template(space, name):
-    return rffi.cast(C_TYPE, space.int_w(call_capi(space, 'get_template', [_Arg(s=name)])))
+    return rffi.cast(C_TYPE, space.uint_w(call_capi(space, 'get_template', [_Arg(s=name)])))
 def c_actual_class(space, cppclass, cppobj):
     args = [_Arg(l=cppclass.handle), _Arg(l=cppobj)]
-    return rffi.cast(C_TYPE, space.int_w(call_capi(space, 'actual_class', args)))
+    return rffi.cast(C_TYPE, space.uint_w(call_capi(space, 'actual_class', args)))
 
 # memory management ----------------------------------------------------------
 def c_allocate(space, cppclass):
     call_capi(space, 'call_v', args)
 def c_call_b(space, cppmethod, cppobject, nargs, cargs):
     args = [_Arg(l=cppmethod), _Arg(l=cppobject), _Arg(l=nargs), _Arg(vp=cargs)]
-    return rffi.cast(rffi.UCHAR, space.c_int_w(call_capi(space, 'call_b', args)))
+    return rffi.cast(rffi.UCHAR, space.c_uint_w(call_capi(space, 'call_b', args)))
 def c_call_c(space, cppmethod, cppobject, nargs, cargs):
     args = [_Arg(l=cppmethod), _Arg(l=cppobject), _Arg(l=nargs), _Arg(vp=cargs)]
     return rffi.cast(rffi.CHAR, space.str_w(call_capi(space, 'call_c', args))[0])
 
 def c_get_method(space, cppscope, index):
     args = [_Arg(l=cppscope.handle), _Arg(l=index)]
-    return rffi.cast(C_METHOD, space.int_w(call_capi(space, 'get_method', args)))
+    return rffi.cast(C_METHOD, space.uint_w(call_capi(space, 'get_method', args)))
 def c_get_global_operator(space, nss, lc, rc, op):
     if nss is not None:
         args = [_Arg(l=nss.handle), _Arg(l=lc.handle), _Arg(l=rc.handle), _Arg(s=op)]

pypy/module/cppyy/converter.py

             try:
                 # TODO: accept a 'capsule' rather than naked int
                 # (do accept int(0), though)
-                obj = rffi.cast(rffi.VOIDP, space.int_w(w_obj))
+                obj = rffi.cast(rffi.VOIDP, space.uint_w(w_obj))
             except Exception:
                 obj = rffi.cast(rffi.VOIDP, get_rawobject(space, w_obj))
         return obj

pypy/module/cppyy/include/capi.h

 extern "C" {
 #endif // ifdef __cplusplus
 
-    typedef long cppyy_scope_t;
+    typedef unsigned long cppyy_scope_t;
     typedef cppyy_scope_t cppyy_type_t;
-    typedef long cppyy_object_t;
-    typedef long cppyy_method_t;
+    typedef unsigned long cppyy_object_t;
+    typedef unsigned long cppyy_method_t;
     typedef long cppyy_index_t;
     typedef void* (*cppyy_methptrgetter_t)(cppyy_object_t);
 

pypy/module/cppyy/interp_cppyy.py

     @unwrap_spec(args_w='args_w')
     def call(self, w_cppinstance, args_w):
         w_result = W_CPPOverload.call(self, w_cppinstance, args_w)
-        newthis = rffi.cast(capi.C_OBJECT, self.space.int_w(w_result))
+        newthis = rffi.cast(capi.C_OBJECT, self.space.uint_w(w_result))
         cppinstance = self.space.interp_w(W_CPPInstance, w_cppinstance, can_be_None=True)
         if cppinstance is not None:
             cppinstance._rawobject = newthis

pypy/module/cppyy/test/test_datatypes.py

 def setup_module(mod):
     if sys.platform == 'win32':
         py.test.skip("win32 not supported so far")
-    if sys.maxsize < 2 ** 31:
-        py.test.skip("32 bit not supported so far")
     err = os.system("cd '%s' && make datatypesDict.so" % currpath)
     if err:
         raise OSError("'make' failed (see stderr)")