[Python-checkins] commit of r41583 - python/branches/ast-objects/Parser/asdl_c.py

brett.cannon python-checkins at python.org
Sun Dec 4 09:54:05 CET 2005


Author: brett.cannon
Date: Sun Dec 4 09:54:00 2005
New Revision: 41583
Modified:
 python/branches/ast-objects/Parser/asdl_c.py
Log:
Add typedefs for sum types and the builtin types of ASDL since their names are
directly used as the type of argument to C functions.
Modified: python/branches/ast-objects/Parser/asdl_c.py
==============================================================================
--- python/branches/ast-objects/Parser/asdl_c.py	(original)
+++ python/branches/ast-objects/Parser/asdl_c.py	Sun Dec 4 09:54:00 2005
@@ -162,6 +162,7 @@
 assert type in asdl.builtin_types, type
 emit("%s %s;" % (type, field.name), depth + 1)
 emit("};")
+ emit("typedef PyObject * %s;" % name)
 emit("#define %s_kind(o) (((struct _%s*)o)->_kind)" % (name, name))
 emit("")
 for t in sum.types:
@@ -519,6 +520,13 @@
 print >> f, " macro, type and constant names which are not Py_-prefixed."
 print >> f, " Therefore, the file should not be included in Python.h;"
 print >> f, " all symbols relevant to linkage are Py_-prefixed. */"
+ print >> f, "\n"
+ print >> f, "/* typedefs of ASDL's builtin types */"
+ print >> f, "typedef PyObject * identifier;"
+ print >> f, "typedef PyObject * string;"
+ print >> f, "typedef PyObject * bool;"
+ print >> f, "typedef PyObject * object;"
+ print >> f, "\n"
 c = HeaderVisitor(f)
 c.visit(mod)
 f.close()


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /