コード例 #1
0
 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'
コード例 #2
0
ファイル: converter.py プロジェクト: xen0n/pypy
 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
コード例 #3
0
 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'
コード例 #4
0
 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
コード例 #5
0
ファイル: converter.py プロジェクト: xen0n/pypy
 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
コード例 #6
0
 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'
コード例 #7
0
ファイル: converter.py プロジェクト: xen0n/pypy
    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)
コード例 #8
0
 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'
コード例 #9
0
 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'
コード例 #10
0
ファイル: converter.py プロジェクト: xen0n/pypy
 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
コード例 #11
0
ファイル: converter.py プロジェクト: xen0n/pypy
 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