コード例 #1
0
ファイル: executor.py プロジェクト: zcxowwww/pypy
 def _wrap_result(self, space, obj):
     from pypy.module._cppyy import interp_cppyy
     return interp_cppyy.wrap_cppinstance(space,
                                          obj,
                                          self.clsdecl,
                                          do_cast=False,
                                          python_owns=True,
                                          fresh=True)
コード例 #2
0
 def from_memory(self, space, w_obj, w_pycppclass, offset):
     address = rffi.cast(capi.C_OBJECT,
                         self._get_raw_address(space, w_obj, offset))
     from pypy.module._cppyy import interp_cppyy
     return interp_cppyy.wrap_cppinstance(space,
                                          address,
                                          self.clsdecl,
                                          do_cast=False)
コード例 #3
0
ファイル: executor.py プロジェクト: zcxowwww/pypy
 def _wrap_result(self, space, obj):
     from pypy.module._cppyy import interp_cppyy
     # TODO: this is a pointer to a smart pointer, take ownership on the smart one?
     return interp_cppyy.wrap_cppinstance(space,
                                          obj,
                                          self.clsdecl,
                                          self.smartdecl,
                                          self.deref,
                                          do_cast=False)
コード例 #4
0
ファイル: converter.py プロジェクト: zcxowwww/pypy
 def from_memory(self, space, w_obj, offset):
     address = rffi.cast(capi.C_OBJECT,
                         self._get_raw_address(space, w_obj, offset))
     from pypy.module._cppyy import interp_cppyy
     return interp_cppyy.wrap_cppinstance(space,
                                          address,
                                          self.rawdecl,
                                          smartdecl=self.smartdecl,
                                          deref=self.deref,
                                          do_cast=False)
コード例 #5
0
 def to_memory(self, space, w_obj, w_value, offset):
     try:
         address = rffi.cast(capi.C_OBJECT,
                             self._get_raw_address(space, w_obj, offset))
         assign = self.clsdecl.get_overload("__assign__")
         from pypy.module._cppyy import interp_cppyy
         assign.call(
             interp_cppyy.wrap_cppinstance(space,
                                           address,
                                           self.clsdecl,
                                           do_cast=False), [w_value])
     except Exception:
         InstanceConverter.to_memory(self, space, w_obj, w_value, offset)
コード例 #6
0
 def execute(self, space, cppmethod, cppthis, num_args, args):
     from pypy.module._cppyy import interp_cppyy
     long_result = capi.c_call_o(space, cppmethod, cppthis, num_args, args, self.cppclass)
     ptr_result = rffi.cast(capi.C_OBJECT, long_result)
     return interp_cppyy.wrap_cppinstance(space, ptr_result, self.cppclass,
                                          do_cast=False, python_owns=True, fresh=True)
コード例 #7
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_cppinstance(space, ptr_result, self.cppclass)
コード例 #8
0
 def execute_libffi(self, space, cif_descr, funcaddr, buffer):
     jit_libffi.jit_ffi_call(cif_descr, funcaddr, buffer)
     result = rffi.ptradd(buffer, cif_descr.exchange_result)
     from pypy.module._cppyy import interp_cppyy
     ptr_result = rffi.cast(capi.C_OBJECT, rffi.cast(rffi.VOIDPP, result)[0])
     return interp_cppyy.wrap_cppinstance(space, ptr_result, self.cppclass)
コード例 #9
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_cppinstance(space, ptr_result, self.cppclass)
     return pyres
コード例 #10
0
ファイル: executor.py プロジェクト: zcxowwww/pypy
 def _wrap_result(self, space, obj):
     from pypy.module._cppyy import interp_cppyy
     return interp_cppyy.wrap_cppinstance(space, obj, self.clsdecl)