示例#1
0
文件: executor.py 项目: lvyitian/pypy
 def execute(self, space, cppmethod, cppthis, num_args, args):
     vptr = capi.c_call_r(space, cppmethod, cppthis, num_args, args)
     ccp = rffi.cast(rffi.CCHARP, vptr)
     if ccp == rffi.cast(rffi.CCHARP, 0):
         return space.newbytes("")
     result = rffi.charp2str(ccp)  # TODO: make it a choice to free
     return space.newtext(result)
示例#2
0
文件: executor.py 项目: lvyitian/pypy
 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)
示例#3
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     from pypy.module._cppyy import interp_cppyy
     voidp_result = capi.c_call_r(space, cppmethod, cppthis, num_args, args)
     ref_address = rffi.cast(rffi.VOIDPP, voidp_result)
     ptr_result = rffi.cast(capi.C_OBJECT, ref_address[0])
     return interp_cppyy.wrap_cppobject(space, ptr_result, self.cppclass)
示例#4
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     result = capi.c_call_r(space, cppmethod, cppthis, num_args, args)
     return self._wrap_reference(space, rffi.cast(self.c_ptrtype, result))
示例#5
0
文件: executor.py 项目: zcxowwww/pypy
 def execute(self, space, cppmethod, cppthis, num_args, args):
     presult = capi.c_call_r(space, cppmethod, cppthis, num_args, args)
     ref = rffi.cast(rffi.VOIDPP, presult)
     return self._wrap_result(space, rffi.cast(capi.C_OBJECT, ref[0]))
示例#6
0
文件: executor.py 项目: lvyitian/pypy
 def execute(self, space, cppmethod, cppthis, num_args, args):
     if hasattr(space, "fake"):
         raise NotImplementedError
     vptr = capi.c_call_r(space, cppmethod, cppthis, num_args, args)
     return self.wrap_result(space, vptr)
示例#7
0
文件: executor.py 项目: lvyitian/pypy
 def execute(self, space, cppmethod, cppthis, num_args, args):
     cmplx = capi.c_call_r(space, cppmethod, cppthis, num_args, args)
     return self._convert2complex(space, rffi.cast(capi.C_OBJECT, cmplx))
示例#8
0
文件: executor.py 项目: lvyitian/pypy
 def execute(self, space, cppmethod, cppthis, num_args, args):
     vptr = capi.c_call_r(space, cppmethod, cppthis, num_args, args)
     return self._wrap_result(space, rffi.cast(capi.C_OBJECT, vptr))