All pastes #118568 Raw Edit

James Livingston

public text v1 · immutable
·published 2006-08-06 13:21 UTC
rendered paste body
diff -u -p -r1.29 h2def.py
--- codegen/h2def.py	6 May 2006 18:38:03 -0000	1.29
+++ codegen/h2def.py	6 Aug 2006 13:16:05 -0000
@@ -128,7 +128,7 @@ def find_obj_defs(buf, objdefs=[]):
     while pos < len(buf):
         m = pat.search(buf, pos)
         if not m: break
-        t = (m.group(1), '')
+        t = (m.group(1), 'GTypeInterface')
         t2 = (m.group(1)+'Class', 'GTypeInterface')
         # if we find an object structure together with a corresponding
         # class structure, then we have probably found a GtkObject subclass.
@@ -144,7 +144,7 @@ def find_obj_defs(buf, objdefs=[]):
     while pos < len(buf):
         m = pat.search(buf, pos)
         if not m: break
-        t = (m.group(1), '')
+        t = (m.group(1), 'GTypeInterface')
         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.
@@ -350,10 +350,13 @@ class DefsWriter:
             if m:
                 cmodule = m.group(1)
                 cname = m.group(2)
-            fp.write('(define-object ' + cname + '\n')
+            if parent == 'GTypeInterface':
+              fp.write('(define-interface ' + cname + '\n')
+            else:
+              fp.write('(define-object ' + cname + '\n')
             if cmodule:
                 fp.write('  (in-module "' + cmodule + '")\n')
-            if parent:
+            if parent and parent != 'GTypeInterface':
                 fp.write('  (parent "' + parent + '")\n')
             fp.write('  (c-name "' + klass + '")\n')
             fp.write('  (gtype-id "' + typecode(klass) + '")\n')