Normalize WTK_declare_builtin_cfunction -> declare_builtin_cfunction.
authorW. Trevor King <wking@drexel.edu>
Fri, 4 Mar 2011 03:52:20 +0000 (22:52 -0500)
committerW. Trevor King <wking@drexel.edu>
Fri, 4 Mar 2011 03:52:20 +0000 (22:52 -0500)
Cython/Compiler/Builtin.py
Cython/Compiler/Symtab.py

index d9c4207e184ed63a1f7eea5528748e9ae8081f27..26ed45b5b7bf06a07b172c9a8a20380bc63c75c0 100644 (file)
@@ -2,6 +2,7 @@
 #   Pyrex - Builtin Definitions
 #
 
+from Binding import Binding
 from Symtab import BuiltinScope, StructOrUnionScope
 from Code import UtilityCode
 from TypeSlots import Signature
@@ -346,8 +347,10 @@ class BuiltinFunction(_BuiltinOverride):
             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):
@@ -359,8 +362,9 @@ class BuiltinMethod(_BuiltinOverride):
             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 = [
index 1e2947c6a172c65643c567519e854d5a70875978..e849d1b13027c24d3182614cde0210b5275a565b 100644 (file)
@@ -853,14 +853,8 @@ class BuiltinScope(Scope):
                 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)
@@ -1860,13 +1854,8 @@ class CClassScope(ClassScope):
         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)