def declare_in_scope(self, scope): func_type, sig = self.func_type, self.sig if func_type is None: if sig is None: sig = Signature(self.args, self.ret_type) func_type = sig.function_type() scope.declare_builtin_cfunction(self.py_name, func_type, self.cname, self.py_equiv, self.utility_code)
def init_builtin_types(): for name, cname, funcs in builtin_types_table: utility = builtin_utility_code.get(name) the_type = builtin_scope.declare_builtin_type(name, cname, utility) for name, args, ret, cname in funcs: sig = Signature(args, ret) the_type.scope.declare_cfunction(name, sig.function_type(), None, cname)
def declare_in_type(self, self_type): method_type, sig = self.func_type, self.sig if method_type is None: if sig is None: sig = Signature(self.args, self.ret_type) # override 'self' type (first argument) self_arg = PyrexTypes.CFuncTypeArg("", self_type, None) self_arg.not_none = True method_type = sig.function_type(self_arg) self_type.scope.declare_builtin_cfunction(self.py_name, method_type, self.cname, utility_code=self.utility_code)
def build_func_type(self, sig=None, self_arg=None): if sig is None: sig = Signature(self.args, self.ret_type) sig.exception_check = False # not needed for the current builtins func_type = sig.function_type(self_arg) if self.is_strict_signature: func_type.is_strict_signature = True if self.builtin_return_type: func_type.return_type = builtin_types[self.builtin_return_type] return func_type
def declare_in_type(self, self_type): method_type, sig = self.func_type, self.sig if method_type is None: if sig is None: sig = Signature(self.args, self.ret_type) # override 'self' type (first argument) self_arg = PyrexTypes.CFuncTypeArg("", self_type, None) self_arg.not_none = True method_type = sig.function_type(self_arg) self_type.scope.declare_builtin_cfunction( self.py_name, method_type, self.cname, utility_code = self.utility_code)
def declare_builtin_method(self_type, name, args, ret, cname): sig = Signature(args, ret) meth_type = sig.function_type(self_type) self_type.scope.declare_builtin_method(name, meth_type, cname)
def declare_builtin_func(name, args, ret, cname, py_equiv="*"): sig = Signature(args, ret) type = sig.function_type() utility = builtin_utility_code.get(name) builtin_scope.declare_builtin_cfunction(name, type, cname, py_equiv, utility)
def declare_builtin_func(name, args, ret, cname, py_equiv = "*"): sig = Signature(args, ret) type = sig.function_type() utility = builtin_utility_code.get(name) builtin_scope.declare_builtin_cfunction(name, type, cname, py_equiv, utility)