gobject-introspection r626 - in trunk: giscanner tools



Author: walters
Date: Tue Sep 23 22:18:06 2008
New Revision: 626
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=626&view=rev

Log:
Use symbolic names for type tags instead of hardcoded integers


Modified:
   trunk/giscanner/minixpath.py
   trunk/tools/generate.c

Modified: trunk/giscanner/minixpath.py
==============================================================================
--- trunk/giscanner/minixpath.py	(original)
+++ trunk/giscanner/minixpath.py	Tue Sep 23 22:18:06 2008
@@ -49,11 +49,15 @@
         if not curnodes:
             return None
         found = True
+        #print "LOOKING %d nodes" % (len(curnodes), )
         for node in curnodes:
+            #print "LOOKING: %r expecting: %r attrib: %r" \
+            #    % (node, exp_attrs, node.attrib)
             passes = True
-            for (name, val) in exp_attrs:
+            for name, val in exp_attrs:
                 a = node.attrib.get(name)
                 if not a or a != val:
+                    #print "ATTR FAIL: %r=%r" % (val, a)
                     passes = False
                     break
             if passes:

Modified: trunk/tools/generate.c
==============================================================================
--- trunk/tools/generate.c	(original)
+++ trunk/tools/generate.c	Tue Sep 23 22:18:06 2008
@@ -100,9 +100,9 @@
       else
 	g_fprintf (file, "%s", "none");
     } 
-  else if (tag < 20)
+  else if (tag < GI_TYPE_TAG_ARRAY)
     g_fprintf (file, "%s", basic[tag]);
-  else if (tag == 20)
+  else if (tag == GI_TYPE_TAG_ARRAY)
     {
       gint length;
 
@@ -121,13 +121,13 @@
      g_fprintf (file, "]"); 
       g_base_info_unref ((GIBaseInfo *)type);
     }
-  else if (tag == 21)
+  else if (tag == GI_TYPE_TAG_INTERFACE)
     {
       GIBaseInfo *iface = g_type_info_get_interface (info);
       write_type_name (namespace, iface, file);
       g_base_info_unref (iface);
     }
-  else if (tag == 22)
+  else if (tag == GI_TYPE_TAG_GLIST)
     {
       type = g_type_info_get_param_type (info, 0);
       g_fprintf (file, "GLib.List");
@@ -139,7 +139,7 @@
 	  g_base_info_unref ((GIBaseInfo *)type);
 	}
     }
-  else if (tag == 23)
+  else if (tag == GI_TYPE_TAG_GSLIST)
     {
       type = g_type_info_get_param_type (info, 0);
       g_fprintf (file, "GLib.SList");
@@ -151,7 +151,7 @@
 	  g_base_info_unref ((GIBaseInfo *)type);
 	}
     }
-  else if (tag == 24)
+  else if (tag == GI_TYPE_TAG_GHASH)
     {
       type = g_type_info_get_param_type (info, 0);
       g_fprintf (file, "GLib.HashTable");
@@ -167,7 +167,7 @@
 	  g_base_info_unref ((GIBaseInfo *)type);
 	}
     }
-  else if (tag == 25) 
+  else if (tag == GI_TYPE_TAG_ERROR) 
     {
       gint n;
 
@@ -188,7 +188,10 @@
 	}
     }
   else
-    g_assert_not_reached ();
+    {
+      g_printerr ("Unhandled type tag %d\n", tag);
+      g_assert_not_reached ();
+    }
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]