summaryrefslogtreecommitdiff
path: root/codegen/h2def.py
diff options
context:
space:
mode:
authorXavier Ordoquy <xordoquy@wanadoo.fr>2004-03-22 22:19:42 +0000
committerXavier Ordoquy <xordoquy@src.gnome.org>2004-03-22 22:19:42 +0000
commitfca592fca59fff49fcfbbf1b513e63bed8cc9277 (patch)
treefa2a8b75c5dbcd549df18ac57828f0d6e9aff2f0 /codegen/h2def.py
parent90b47bca28cce672fdc5d1bb51bd7cc2fa340f22 (diff)
downloadpygtk-fca592fca59fff49fcfbbf1b513e63bed8cc9277.tar.gz
Added the interface detection (interface -*Iface- inheriting from
2004-03-22 Xavier Ordoquy <xordoquy@wanadoo.fr> * codegen/h2def.py: Added the interface detection (interface -*Iface- inheriting from GTypeInterface)
Diffstat (limited to 'codegen/h2def.py')
-rwxr-xr-xcodegen/h2def.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/codegen/h2def.py b/codegen/h2def.py
index 5429e834..55f6199e 100755
--- a/codegen/h2def.py
+++ b/codegen/h2def.py
@@ -100,6 +100,20 @@ def find_obj_defs(buf, objdefs=[]):
objdefs.append(t)
pos = m.end()
+ pat = re.compile("typedef struct\s+[_\w]*\s*{\s*" +
+ "(" + obj_name_pat + ")Class\s+[^}]*}\s*" +
+ "(" + obj_name_pat + ")Class\s*;", re.MULTILINE)
+ pos = 0
+ while pos < len(buf):
+ m = pat.search(buf, pos)
+ if not m: break
+ t = (m.group(2), m.group(1))
+ # if we find an object structure together with a corresponding
+ # class structure, then we have probably found a GtkObject subclass.
+ if t in maybeobjdefs:
+ objdefs.append(t)
+ pos = m.end()
+
# now find all structures that look like they might represent a class inherited from GTypeInterface:
pat = re.compile("struct _(" + obj_name_pat + ")Class\s*{\s*" +
"GTypeInterface\s+", re.MULTILINE)
@@ -115,17 +129,18 @@ def find_obj_defs(buf, objdefs=[]):
objdefs.append(t)
pos = m.end()
- pat = re.compile("typedef struct\s+[_\w]*\s*{\s*" +
- "(" + obj_name_pat + ")Class\s+[^}]*}\s*" +
- "(" + obj_name_pat + ")Class\s*;", re.MULTILINE)
+ # now find all structures that look like they might represent an Iface inherited from GTypeInterface:
+ pat = re.compile("struct _(" + obj_name_pat + ")Iface\s*{\s*" +
+ "GTypeInterface\s+", re.MULTILINE)
pos = 0
while pos < len(buf):
m = pat.search(buf, pos)
if not m: break
- t = (m.group(2), m.group(1))
+ t = (m.group(1), '')
+ t2 = (m.group(1)+'Iface', 'GTypeInterface')
# if we find an object structure together with a corresponding
# class structure, then we have probably found a GtkObject subclass.
- if t in maybeobjdefs:
+ if t2 in maybeobjdefs:
objdefs.append(t)
pos = m.end()