summaryrefslogtreecommitdiff
path: root/giscanner/utils.py
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2008-08-21 17:47:00 +0000
committerColin Walters <walters@src.gnome.org>2008-08-21 17:47:00 +0000
commitc56ea941193491e5eb33c3510b4cc7ebce5129b3 (patch)
treec97ac553d97ec358192b31cc9e01348e51ad182d /giscanner/utils.py
parent384723fe482a65c7b7f6da8e8bc73f4ad06aa2e0 (diff)
downloadgobject-introspection-c56ea941193491e5eb33c3510b4cc7ebce5129b3.tar.gz
Look up all permutations of class names when scanning methods/ctors based
2008-08-21 Colin Walters <walters@verbum.org> * giscanner/glibtransformer.py: Look up all permutations of class names when scanning methods/ctors based on the prefix instead of using the return value. This associates gtk_window_new with the right class. svn path=/trunk/; revision=442
Diffstat (limited to 'giscanner/utils.py')
-rw-r--r--giscanner/utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/giscanner/utils.py b/giscanner/utils.py
index a41d3d64..2a8ce3b8 100644
--- a/giscanner/utils.py
+++ b/giscanner/utils.py
@@ -36,6 +36,24 @@ def to_underscores(name):
name = _upperstr_pat3.sub(r'\1_\2', name, count=1)
return name
+
+def _gen_pascal_combinations(nameset):
+ firstname = [nameset[0].title(), nameset[0].upper()]
+ if len(nameset) == 1:
+ return firstname
+ else:
+ subset = _gen_pascal_combinations(nameset[1:])
+ results = []
+ for x in subset:
+ results.append(firstname[0] + x)
+ results.append(firstname[1] + x)
+ return results
+
+
+def to_pascal_combinations(name):
+ return _gen_pascal_combinations(name.split('_'))
+
+
_libtool_pat = re.compile("dlname='([A-z0-9\.\-\+]+)'\n")