summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2004-01-22 17:40:16 +0000
committerDaniel Veillard <veillard@src.gnome.org>2004-01-22 17:40:16 +0000
commit8b83712f687139e902640f7a5ad2c8f7b7793ad5 (patch)
tree048057f229d01dde9c40471dac16f8731ff977de /python
parent618a5d5c00494b7cc5b500c91782b34a76609049 (diff)
downloadlibxslt-8b83712f687139e902640f7a5ad2c8f7b7793ad5.tar.gz
libxslt-8b83712f687139e902640f7a5ad2c8f7b7793ad5.tar.bz2
libxslt-8b83712f687139e902640f7a5ad2c8f7b7793ad5.zip
applied patch from Stefan Kost to fix behaviour on unknown element from
* libxslt/xslt.c: applied patch from Stefan Kost to fix behaviour on unknown element from the XSLT namespace. * python/generator.py: applied patch from Stephane bidoul to export enums in the bindings. Daniel
Diffstat (limited to 'python')
-rwxr-xr-xpython/generator.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/python/generator.py b/python/generator.py
index 454b3552..1327ce7f 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -4,6 +4,7 @@
#
functions = {}
+enums = {} # { enumType: { enumConstant: enumValue } }
import string
@@ -136,6 +137,9 @@ class docParser:
self.function_return_info = attrs['info']
if attrs.has_key('field'):
self.function_return_field = attrs['field']
+ elif tag == 'enum':
+ enum(attrs['type'],attrs['name'],attrs['value'])
+
def end(self, tag):
@@ -166,10 +170,13 @@ class docParser:
def function(name, desc, ret, args, file):
- global functions
-
functions[name] = (desc, ret, args, file)
+def enum(type, name, value):
+ if not enums.has_key(type):
+ enums[type] = {}
+ enums[type][name] = value
+
#######################################################################
#
# Some filtering rukes to drop functions/types which should not
@@ -943,6 +950,17 @@ def buildWrappers():
classes.write(" return ret\n");
classes.write("\n");
+ #
+ # Generate enum constants
+ #
+ for type,enum in enums.items():
+ classes.write("# %s\n" % type)
+ items = enum.items()
+ items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
+ for name,value in items:
+ classes.write("%s = %s\n" % (name,value))
+ classes.write("\n");
+
txt.close()
classes.close()