# Pyrex - Builtin Definitions
#
+from Binding import Binding
from Symtab import BuiltinScope, StructOrUnionScope
from Code import UtilityCode
from TypeSlots import Signature
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)
+ binding = Binding(name = self.py_name, cname = self.cname, extern = 1)
+ scope.declare_builtin_cfunction(
+ binding, type = func_type, python_equiv = self.py_equiv,
+ utility_code = self.utility_code)
class BuiltinMethod(_BuiltinOverride):
def declare_in_type(self, self_type):
self_arg = PyrexTypes.CFuncTypeArg("", self_type, None)
self_arg.not_none = True
method_type = sig.function_type(self_arg)
+ binding = Binding(name = self.py_name, cname = self.cname, extern = 1)
self_type.scope.declare_builtin_cfunction(
- self.py_name, method_type, self.cname, utility_code = self.utility_code)
+ binding, type = method_type, utility_code = self.utility_code)
builtin_function_table = [
error(pos, "undeclared name not builtin: %s" %
binding.name)
- def declare_builtin_cfunction(self, name, type, cname, python_equiv = None,
- utility_code = None):
- binding = self._WTK_setup(name, cname, 'extern')
- return self.WTK_declare_builtin_cfunction(binding, type, python_equiv, utility_code)
-
- def WTK_declare_builtin_cfunction(
- self, binding, type, python_equiv = None,
- utility_code = None):
+ def declare_builtin_cfunction(self, binding, type, python_equiv = None,
+ utility_code = None):
# If python_equiv == "*", the Python equivalent has the same name
# as the entry, otherwise it has the name specified by python_equiv.
binding.name = EncodedString(binding.name)
entry.prev_entry = prev_entry
return entry
- def declare_builtin_cfunction(self, name, type, cname, utility_code = None):
- binding = self._WTK_setup(name, cname, 'extern')
- return self.WTK_declare_builtin_cfunction(binding, type, utility_code=utility_code)
-
- def WTK_declare_builtin_cfunction(
- self, binding, type, python_equiv = None,
- utility_code = None):
+ def declare_builtin_cfunction(self, binding, type, python_equiv = None,
+ utility_code = None):
# overridden methods of builtin types still have their Python
# equivalent that must be accessible to support bound methods
binding.name = EncodedString(binding.name)