Пример #1
0
 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)
Пример #2
0
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)
Пример #3
0
 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)
Пример #4
0
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)
Пример #5
0
 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)
Пример #6
0
 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
Пример #7
0
 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
Пример #8
0
 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)
Пример #9
0
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)
Пример #10
0
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)
Пример #11
0
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)
Пример #12
0
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)