Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23596
Modified Files:
gccxmlparser.py
Log Message:
EnumValues are now exposed at the top level.
Index: gccxmlparser.py
===================================================================
RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/gccxmlparser.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** gccxmlparser.py 7 Jan 2005 18:58:32 -0000 1.9
--- gccxmlparser.py 12 Jan 2005 08:06:28 -0000 1.10
***************
*** 32,37 ****
--- 32,43 ----
# record the result
_id = attrs.get("id", None)
+ # The '_id' attribute is used to link together all the
+ # nodes, in the _fixup_ methods.
if _id is not None:
self.all[_id] = result
+ else:
+ # EnumValue, for example, has no "_id" attribute.
+ # Invent our own...
+ self.all[id(result)] = result
# if this element has children, push onto the context
if name in self.has_values:
***************
*** 192,196 ****
name = self.demangle(attrs["name"])
value = attrs["init"]
! self.context[-1].add_value(name, value)
def _fixup_EnumValue(self, e): pass
--- 198,204 ----
name = self.demangle(attrs["name"])
value = attrs["init"]
! v = typedesc.EnumValue(name, value, self.context[-1])
! self.context[-1].add_value(v)
! return v
def _fixup_EnumValue(self, e): pass
***************
*** 251,259 ****
def get_result(self):
! interesting = (typedesc.Typedef, typedesc.Enumeration,
typedesc.Function, typedesc.Structure, typedesc.Union)
result = []
remove = []
for n, i in self.all.items():
mth = getattr(self, "_fixup_" + type(i).__name__)
try:
--- 259,268 ----
def get_result(self):
! interesting = (typedesc.Typedef, typedesc.Enumeration, typedesc.EnumValue,
typedesc.Function, typedesc.Structure, typedesc.Union)
result = []
remove = []
for n, i in self.all.items():
+ # link together all the nodes (the XML that gccxml generates uses this).
mth = getattr(self, "_fixup_" + type(i).__name__)
try:
|