[pypy-svn] r49046 - in pypy/branch/remove-extcompiler-rctypes/pypy/translator/c: . src

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Nov 24 18:07:25 CET 2007


Author: cfbolz
Date: Sat Nov 24 18:07:25 2007
New Revision: 49046

Removed:
   pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/pyobj.py
   pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/src/module.h
Modified:
   pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/database.py
   pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/genc.py
   pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/src/pyobj.h
Log:
kill pyobj.py and module.h. deal with the (few) consequences


Modified: pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/database.py
==============================================================================
--- pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/database.py	(original)
+++ pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/database.py	Sat Nov 24 18:07:25 2007
@@ -54,9 +54,6 @@
         # constant
         self.late_initializations = []
         self.namespace = CNameManager()
-        if not standalone:
-            from pypy.translator.c.pyobj import PyObjMaker
-            self.pyobjmaker = PyObjMaker(self.namespace, self, translator)
 
         if translator is None or translator.rtyper is None:
             self.exctransformer = None
@@ -303,8 +300,6 @@
         
         while True:
             while True:
-                if hasattr(self, 'pyobjmaker'):
-                    self.pyobjmaker.collect_initcode()
                 while self.pendingsetupnodes:
                     lst = self.pendingsetupnodes
                     self.pendingsetupnodes = []

Modified: pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/genc.py
==============================================================================
--- pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/genc.py	(original)
+++ pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/genc.py	Sat Nov 24 18:07:25 2007
@@ -40,7 +40,7 @@
         self.libraries = libraries
         self.exports = {}
 
-    def build_database(self, pyobj_options=None):
+    def build_database(self):
         translator = self.translator
 
         gcpolicyclass = self.get_gcpolicyclass()
@@ -63,10 +63,6 @@
                               thread_enabled=self.config.translation.thread,
                               sandbox=self.config.translation.sandbox)
         self.db = db
-        # pass extra options into pyobjmaker
-        if pyobj_options:
-            for key, value in pyobj_options.items():
-                setattr(db.pyobjmaker, key, value)
 
         # we need a concrete gcpolicy to do this
         self.libraries += db.gcpolicy.gc_libraries()
@@ -765,77 +761,6 @@
     sg.set_strategy(targetdir)
     sg.gen_readable_parts_of_source(f)
 
-##     #
-##     # PyObject support (strange) code
-##     #
-##     pyobjmaker = database.pyobjmaker
-##     print >> f
-##     print >> f, '/***********************************************************/'
-##     print >> f, '/***  Table of global PyObjects                          ***/'
-##     print >> f
-##     print >> f, 'static globalobjectdef_t globalobjectdefs[] = {'
-##     for node in database.containerlist:
-##         if isinstance(node, PyObjectNode):
-##             for target in node.where_to_copy_me:
-##                 print >> f, '\t{%s, "%s"},' % (target, node.exported_name)
-##     print >> f, '\t{ NULL, NULL }\t/* Sentinel */'
-##     print >> f, '};'
-##     print >> f
-##     print >> f, '/***********************************************************/'
-##     print >> f, '/***  Table of functions                                 ***/'
-##     print >> f
-##     print >> f, 'static globalfunctiondef_t globalfunctiondefs[] = {'
-##     wrappers = pyobjmaker.wrappers.items()
-##     wrappers.sort()
-##     for globalobject_name, (base_name, wrapper_name, func_doc) in wrappers:
-##         print >> f, ('\t{&%s, "%s", {"%s", (PyCFunction)%s, '
-##                      'METH_VARARGS|METH_KEYWORDS, %s}},' % (
-##             globalobject_name,
-##             globalobject_name,
-##             base_name,
-##             wrapper_name,
-##             func_doc and c_string_constant(func_doc) or 'NULL'))
-##     print >> f, '\t{ NULL }\t/* Sentinel */'
-##     print >> f, '};'
-##     print >> f, 'static globalfunctiondef_t *globalfunctiondefsptr = &globalfunctiondefs[0];'
-##     print >> f
-##     print >> f, '/***********************************************************/'
-##     print >> f, '/***  Frozen Python bytecode: the initialization code    ***/'
-##     print >> f
-##     print >> f, 'static char *frozen_initcode[] = {"\\'
-##     bytecode, originalsource = database.pyobjmaker.getfrozenbytecode()
-##     g = targetdir.join('frozen.py').open('w')
-##     g.write(originalsource)
-##     g.close()
-##     def char_repr(c):
-##         if c in '\\"': return '\\' + c
-##         if ' ' <= c < '\x7F': return c
-##         return '\\%03o' % ord(c)
-##     for i in range(0, len(bytecode), 32):
-##         print >> f, ''.join([char_repr(c) for c in bytecode[i:i+32]])+'\\'
-##         if (i+32) % 1024 == 0:
-##             print >> f, '", "\\'
-##     print >> f, '"};'
-##     print >> f, "#define FROZEN_INITCODE_SIZE %d" % len(bytecode)
-##     print >> f
-
-##     #
-##     # Module initialization function
-##     #
-##     print >> f, '/***********************************************************/'
-##     print >> f, '/***  Module initialization function                     ***/'
-##     print >> f
-##     print >> f
-##     print >> f, 'MODULE_INITFUNC(%s)' % modulename
-##     print >> f, '{'
-##     print >> f, '\tSETUP_MODULE(%s);' % modulename
-##     for publicname, pyobjptr in exports.items():
-##         # some fishing needed to find the name of the obj
-##         pyobjnode = database.containernodes[pyobjptr._obj]
-##         print >> f, '\tPyModule_AddObject(m, "%s", %s);' % (publicname,
-##                                                             pyobjnode.name)
-##     print >> f, '\tcall_postsetup(m);'
-##    print >> f, '}'
     gen_startupcode(f, database)
     f.close()
 

Modified: pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/src/pyobj.h
==============================================================================
--- pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/src/pyobj.h	(original)
+++ pypy/branch/remove-extcompiler-rctypes/pypy/translator/c/src/pyobj.h	Sat Nov 24 18:07:25 2007
@@ -218,17 +218,6 @@
 #define OP_NEWDICT(args,r)     if (!(r=PyDict_Pack args)) CFAIL()
 #define OP_NEWTUPLE(args,r)    if (!(r=PyTuple_Pack args)) CFAIL()
 
-/*** argument parsing ***/
-
-#define OP_DECODE_ARG(fname, pos, name, vargs, vkwds, r)	\
-	if (!(r=decode_arg(fname, pos, name, vargs, vkwds, NULL))) CFAIL()
-#define OP_DECODE_ARG_DEF(fname, pos, name, vargs, vkwds, def, r)	\
-	if (!(r=decode_arg(fname, pos, name, vargs, vkwds, def))) CFAIL()
-#define OP_CHECK_NO_MORE_ARG(fname, n, vargs, r)	\
-	if ((r=check_no_more_arg(fname, n, vargs)) < 0) CFAIL()
-#define OP_CHECK_SELF_NONZERO(fname, self, r)	\
-	if ((r=check_self_nonzero(fname, self)) < 0) CFAIL()
-
 unsigned long long RPyLong_AsUnsignedLongLong(PyObject *v);
 long long RPyLong_AsLongLong(PyObject *v);
 



More information about the Pypy-commit mailing list