Beispiel #1
0
 def from_memory(self, space, w_obj, offset):
     # read access, so no copy needed
     address_value = self._get_raw_address(space, w_obj, offset)
     address = rffi.cast(rffi.ULONGP, address_value)
     return lowlevelviews.W_LowLevelView(space,
                                         letter2tp(space, self.typecode),
                                         self.size, address[0])
Beispiel #2
0
 def from_memory(self, space, w_obj, offset):
     # returned as a long value for the address (INTPTR_T is not proper
     # per se, but rffi does not come with a PTRDIFF_T)
     address = self._get_raw_address(space, w_obj, offset)
     ptrval = rffi.cast(rffi.ULONGP, address)[0]
     if ptrval == rffi.cast(rffi.ULONG, 0):
         from pypy.module._cppyy import interp_cppyy
         return interp_cppyy.get_nullptr(space)
     shape = letter2tp(space, 'P')
     return lowlevelviews.W_LowLevelView(space, shape, sys.maxint/shape.size, ptrval)
Beispiel #3
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     if hasattr(space, "fake"):
         raise NotImplementedError
     lresult = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
     ptrval = rffi.cast(rffi.ULONG, lresult)
     if ptrval == rffi.cast(rffi.ULONG, 0):
         from pypy.module._cppyy import interp_cppyy
         return interp_cppyy.get_nullptr(space)
     shape = letter2tp(space, self.typecode)
     return lowlevelviews.W_LowLevelView(space, shape,
                                         sys.maxint / shape.size, ptrval)
Beispiel #4
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     if hasattr(space, "fake"):
         raise NotImplementedError
     address = capi.c_call_r(space, cppmethod, cppthis, num_args, args)
     ipv = rffi.cast(rffi.UINTPTR_T, address)
     if ipv == rffi.cast(rffi.UINTPTR_T, 0):
         from pypy.module._cppyy import interp_cppyy
         return interp_cppyy.get_nullptr(space)
     shape = letter2tp(space, self.typecode)
     return lowlevelviews.W_LowLevelView(space, shape,
                                         sys.maxint / shape.size, ipv)
Beispiel #5
0
 def from_memory(self, space, w_obj, offset):
     # read access, so no copy needed
     address = self._get_raw_address(space, w_obj, offset)
     ipv = rffi.cast(rffi.UINTPTR_T, rffi.cast(rffi.VOIDPP, address)[0])
     return lowlevelviews.W_LowLevelView(
         space, letter2tp(space, self.typecode), self.size, ipv)