gobject-introspection r322 - branches/gir-compiler/tools



Author: johan
Date: Thu Aug  7 22:02:58 2008
New Revision: 322
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=322&view=rev

Log:
Improve debugging, remove leading g prefix from typenames

Modified:
   branches/gir-compiler/tools/compiler.c
   branches/gir-compiler/tools/girnode.c
   branches/gir-compiler/tools/girparser.c

Modified: branches/gir-compiler/tools/compiler.c
==============================================================================
--- branches/gir-compiler/tools/compiler.c	(original)
+++ branches/gir-compiler/tools/compiler.c	Thu Aug  7 22:02:58 2008
@@ -190,6 +190,8 @@
       return 1;
     }
 
+  g_debug ("[parsing] start");
+
   modules = NULL;
   for (i = 0; input[i]; i++)
     {
@@ -207,6 +209,10 @@
       modules = g_list_concat (modules, mods);
     }
 
+  g_debug ("[parsing] done");
+
+  g_debug ("[building] start");
+
   for (m = modules; m; m = m->next)
     {
       GIrModule *module = m->data;
@@ -221,6 +227,9 @@
 	    g_free (module->shared_library);
           module->shared_library = g_strdup (shlib);
 	}
+
+      g_debug ("[building] module %s", module->name);
+
       metadata = g_ir_module_build_metadata (module, modules);
       if (metadata == NULL)
 	{
@@ -249,6 +258,8 @@
 	  break;
 	}
     }
-             
+
+  g_debug ("[building] done");
+
   return 0; 
 }

Modified: branches/gir-compiler/tools/girnode.c
==============================================================================
--- branches/gir-compiler/tools/girnode.c	(original)
+++ branches/gir-compiler/tools/girnode.c	Thu Aug  7 22:02:58 2008
@@ -585,11 +585,13 @@
       break;
 
     default: 
-      g_error ("Unhandled node type %d\n", node->type);
+      g_error ("Unhandled node type '%s'\n",
+	       g_ir_node_type_to_string (node->type));
       size = 0;
     }
 
-  g_debug ("node %p type %d size %d", node, node->type, size);
+  g_debug ("node %p type '%s' size %d", node,
+	   g_ir_node_type_to_string (node->type), size);
 
   return size;
 }
@@ -603,7 +605,7 @@
 
   g_assert (node != NULL);
 
-  g_debug ("node %p type %s\n", node,
+  g_debug ("node %p type '%s'", node,
 	   g_ir_node_type_to_string (node->type));
 
   switch (node->type)
@@ -649,7 +651,7 @@
 	  size = 4;
 	else
 	  {
-	    g_debug ("node %p type tag %s\n", node,
+	    g_debug ("node %p type tag '%s'", node,
 		     gi_type_tag_to_string (type->tag));
 
 	    switch (type->tag)
@@ -875,7 +877,8 @@
       size = 0;
     }
 
-  g_debug ("node %p type %d full size %d", node, node->type, size);
+  g_debug ("node %p type '%s' full size %d", node,
+	   g_ir_node_type_to_string (node->type), size);
 
   return size;
 }
@@ -1088,23 +1091,23 @@
   gint i;
   const gchar* basic[] = {
     "void", 
-    "gboolean", 
-    "gint8", 
-    "guint8", 
-    "gint16", 
-    "guint16", 
-    "gint32", 
-    "guint32", 
-    "gint64", 
-    "guint64", 
-    "gint",
-    "guint",
-    "glong",
-    "gulong",
-    "gssize",
-    "gsize",
-    "gfloat", 
-    "gdouble", 
+    "boolean", 
+    "int8", 
+    "uint8", 
+    "int16", 
+    "uint16", 
+    "int32", 
+    "uint32", 
+    "int64", 
+    "uint64", 
+    "int",
+    "uint",
+    "long",
+    "ulong",
+    "ssize",
+    "size",
+    "float", 
+    "double", 
     "utf8", 
     "filename"
   };
@@ -1209,7 +1212,8 @@
 
   g_assert (node != NULL);
 
-  g_debug ("build_medatadata(%s)\n", g_ir_node_type_to_string (node->type));
+  g_debug ("build_metadata (%s)",
+	   g_ir_node_type_to_string (node->type));
 
   switch (node->type)
     {
@@ -2155,8 +2159,9 @@
       g_assert_not_reached ();
     }
   
-  g_debug ("node %p type %d, offset %d -> %d, offset2 %d -> %d",
-	   node, node->type, old_offset, *offset, old_offset2, *offset2);
+  g_debug ("node %p type '%s', offset %d -> %d, offset2 %d -> %d",
+	   node, g_ir_node_type_to_string (node->type),
+	   old_offset, *offset, old_offset2, *offset2);
 
   if (*offset2 - old_offset2 + *offset - old_offset > g_ir_node_get_full_size (node))
     g_error ("exceeding space reservation !!");

Modified: branches/gir-compiler/tools/girparser.c
==============================================================================
--- branches/gir-compiler/tools/girparser.c	(original)
+++ branches/gir-compiler/tools/girparser.c	Thu Aug  7 22:02:58 2008
@@ -119,7 +119,6 @@
 static void
 state_switch (ParseContext *ctx, ParseState newstate)
 {
-  fprintf (stderr, "state %d -> %d\n", ctx->state, newstate);
   ctx->prev_state = ctx->state;
   ctx->state = newstate;
 }
@@ -1668,6 +1667,8 @@
   return FALSE;
 }
   
+extern GLogLevelFlags logged_levels;
+
 static void
 start_element_handler (GMarkupParseContext *context,
 		       const gchar         *element_name,
@@ -1678,9 +1679,24 @@
 {
   ParseContext *ctx = user_data;
   gint line_number, char_number;
-#if 0
-  g_printerr ("element-name: '%s'\n", element_name);
-#endif
+
+  if (logged_levels & G_LOG_LEVEL_DEBUG)
+    {
+      GString *tags = g_string_new ("");
+      int i;
+      for (i = 0; attribute_names[i]; i++)
+        g_string_append_printf (tags, "%s=\"%s\" ",
+				attribute_names[i],
+				attribute_values[i]);
+
+      if (i)
+        {
+          g_string_insert_c (tags, 0, ' ');
+          g_string_truncate (tags, tags->len - 1);
+        }
+      g_debug ("<%s%s>", element_name, tags->str);
+      g_string_free (tags, TRUE);
+    }
 
   switch (element_name[0]) 
     {
@@ -2005,6 +2021,8 @@
 {
   ParseContext *ctx = user_data;
 
+  g_debug ("</%s>", element_name);
+
   switch (ctx->state)
     {
     case STATE_START:
@@ -2280,6 +2298,8 @@
   gsize length;
   GList *modules;
 
+  g_debug ("[parsing] filename %s", filename);
+
   if (!g_file_get_contents (filename, &buffer, &length, error))
     return NULL;
   



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