def convert_argument(self, space, w_obj, address, call_local): r = rffi.cast(rffi.VOIDPP, call_local) r[0] = rffi.cast(rffi.VOIDP, self._unwrap_object(space, w_obj)) x = rffi.cast(rffi.VOIDPP, address) x[0] = rffi.cast(rffi.VOIDP, call_local) address = rffi.cast(capi.C_OBJECT, address) ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = 'o'
def convert_argument(self, space, w_obj, address): x = rffi.cast(rffi.VOIDPP, address) ptr = rffi.cast(rffi.VOIDP, self._unwrap_object(space, w_obj)) self.ref_buffer = lltype.malloc(rffi.VOIDPP.TO, 1, flavor='raw') self.ref_buffer[0] = ptr x[0] = self.ref_buffer ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = self.typecode
def convert_argument(self, space, w_obj, address, call_local): if hasattr(space, "fake"): raise NotImplementedError space.getbuiltinmodule("cpyext") from pypy.module.cpyext.pyobject import make_ref ref = make_ref(space, w_obj) x = rffi.cast(rffi.VOIDPP, address) x[0] = rffi.cast(rffi.VOIDP, ref) ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = 'a'
def convert_argument(self, space, w_obj, address, call_local): x = rffi.cast(rffi.VOIDPP, address) ba = rffi.cast(rffi.CCHARP, address) try: x[0] = get_rawbuffer(space, w_obj) except TypeError: r = rffi.cast(rffi.VOIDPP, call_local) r[0] = rffi.cast(rffi.VOIDP, get_rawobject(space, w_obj)) x[0] = rffi.cast(rffi.VOIDP, call_local) ba[capi.c_function_arg_typeoffset(space)] = self.typecode
def convert_argument(self, space, w_obj, address): x = rffi.cast(rffi.VOIDPP, address) try: x[0] = get_rawbuffer(space, w_obj) except TypeError: ptr = rffi.cast(rffi.VOIDP, get_rawobject(space, w_obj)) self.ref_buffer = lltype.malloc(rffi.VOIDPP.TO, 1, flavor='raw') self.ref_buffer[0] = ptr x[0] = self.ref_buffer ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = self.typecode
def convert_argument(self, space, w_obj, address, call_local): w_tc = space.findattr(w_obj, space.newtext('typecode')) if w_tc is not None and space.text_w(w_tc) != self.typecode: raise oefmt(space.w_TypeError, "expected %s pointer type, but received %s", self.typecode, space.text_w(w_tc)) x = rffi.cast(rffi.VOIDPP, address) try: x[0] = rffi.cast(rffi.VOIDP, get_rawbuffer(space, w_obj)) except TypeError: raise oefmt(space.w_TypeError, "raw buffer interface not supported") ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = 'o'
def convert_argument(self, space, w_obj, address): # TODO: atm, does not actually get an overload, but a staticmethod from pypy.module._cppyy.interp_cppyy import W_CPPOverload cppol = space.interp_w(W_CPPOverload, w_obj) # find the function with matching signature for i in range(len(cppol.functions)): m = cppol.functions[i] if m.signature(False) == self.signature: x = rffi.cast(rffi.VOIDPP, address) x[0] = rffi.cast(rffi.VOIDP, capi.c_function_address(space, m.cppmethod)) address = rffi.cast(capi.C_OBJECT, address) ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = 'p' return # lookup failed raise oefmt(space.w_TypeError, "no overload found matching %s", self.signature)
def convert_argument(self, space, w_obj, address, call_local): x = rffi.cast(rffi.LONGP, address) arg = space.text_w(w_obj) x[0] = rffi.cast(rffi.LONG, rffi.str2charp(arg)) ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = 'o'
def convert_argument(self, space, w_obj, address, call_local): x = rffi.cast(rffi.CCHARP, address) x[0] = self._unwrap_object(space, w_obj) ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = 'b'
def convert_argument(self, space, w_obj, address): x = rffi.cast(rffi.VOIDPP, address) x[0] = rffi.cast(rffi.VOIDP, self._unwrap_object(space, w_obj)) address = rffi.cast(capi.C_OBJECT, address) ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = self.typecode
def convert_argument(self, space, w_obj, address): x = rffi.cast(rffi.VOIDP, address) capi.c_double2longdouble(space, space.float_w(w_obj), x) ba = rffi.cast(rffi.CCHARP, address) ba[capi.c_function_arg_typeoffset(space)] = self.typecode