Beispiel #1
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     lresult = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
     ccpresult = rffi.cast(rffi.CCHARP, lresult)
     if ccpresult == rffi.cast(rffi.CCHARP, 0):
         return space.newbytes("")
     result = rffi.charp2str(ccpresult)  # TODO: make it a choice to free
     return space.newbytes(result)
Beispiel #2
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)
     arr = space.interp_w(W_Array, unpack_simple_shape(space, space.newtext(self.typecode)))
     if ptrval == 0:
         from pypy.module._cppyy import interp_cppyy
         return interp_cppyy.get_nullptr(space)
     return arr.fromaddress(space, ptrval, sys.maxint)
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):
     lresult = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
     ccpresult = rffi.cast(rffi.CCHARP, lresult)
     if ccpresult == rffi.cast(rffi.CCHARP, 0):
         return space.newbytes("")
     result = rffi.charp2str(ccpresult)  # TODO: make it a choice to free
     # debatable whether this should be newtext or newbytes; they are bytes
     # but will be more likely used as text after binding ... probably need
     # to make this configurable on a per-function bases (same as the old
     # char* v.s. byte* problem)
     return space.newtext(result)
Beispiel #5
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)
     return self.wrap_result(space, lresult)
Beispiel #6
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     from pypy.module._cppyy import interp_cppyy
     long_result = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
     ptr_result = rffi.cast(capi.C_OBJECT, long_result)
     pyres = interp_cppyy.wrap_cppobject(space, ptr_result, self.cppclass)
     return pyres
Beispiel #7
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     lresult = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
     return self._wrap_result(space, rffi.cast(capi.C_OBJECT, lresult))
Beispiel #8
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     lres = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
     return self._wrap_object(space, lres)