Ejemplo n.º 1
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_cppobject(space, ptr_result, self.cppclass)
Ejemplo n.º 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_cppobject(space,
                                        address,
                                        self.cppclass,
                                        do_cast=False)
Ejemplo n.º 3
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_cppobject(space,
                                        ptr_result,
                                        self.cppclass,
                                        do_cast=False,
                                        python_owns=True,
                                        fresh=True)
Ejemplo n.º 4
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.cppclass.get_overload("__assign__")
         from pypy.module._cppyy import interp_cppyy
         assign.call(
             interp_cppyy.wrap_cppobject(space,
                                         address,
                                         self.cppclass,
                                         do_cast=False), [w_value])
     except Exception:
         InstanceConverter.to_memory(self, space, w_obj, w_value, offset)
Ejemplo n.º 5
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)
Ejemplo n.º 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