gobject-introspection r129 - in trunk: girepository tools



Author: johan
Date: Mon Mar 10 17:44:06 2008
New Revision: 129
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=129&view=rev

Log:
2008-02-21  Mark Doffman  <mark doffman codethink co uk>

    * girepository/ginvoke.c
    * girepository/girepository.h
    * girepository/gmetadata.c
    * girepository/gmetadata.h
    * tools/generate.c
    * tools/gidlparser.c

      Modify TYPE_TAG_INTERFACE to TYPE_TAG_SYMBOL
      to avoid confusion with the interface blob.

    * tools/generate.c
    * tools/gidlparser.c

      Remove magic numbers and replace with type-tag
      enumeration symbols.

    * girepository/gmetadata.c
      Add validate declaration.

WARNING: This commit does not compile. It is a partial change.


Modified:
   trunk/girepository/ginvoke.c
   trunk/girepository/girepository.h
   trunk/girepository/gmetadata.c
   trunk/girepository/gmetadata.h
   trunk/tools/generate.c
   trunk/tools/gidlparser.c

Modified: trunk/girepository/ginvoke.c
==============================================================================
--- trunk/girepository/ginvoke.c	(original)
+++ trunk/girepository/ginvoke.c	Mon Mar 10 17:44:06 2008
@@ -100,8 +100,8 @@
 	break;
       case GI_TYPE_TAG_UTF8:
       case GI_TYPE_TAG_FILENAME:
+      case GI_TYPE_TAG_SYMBOL:
       case GI_TYPE_TAG_ARRAY:
-      case GI_TYPE_TAG_INTERFACE:
       case GI_TYPE_TAG_GLIST:
       case GI_TYPE_TAG_GSLIST:
       case GI_TYPE_TAG_GHASH:

Modified: trunk/girepository/girepository.h
==============================================================================
--- trunk/girepository/girepository.h	(original)
+++ trunk/girepository/girepository.h	Mon Mar 10 17:44:06 2008
@@ -277,8 +277,8 @@
   GI_TYPE_TAG_DOUBLE    = 17,
   GI_TYPE_TAG_UTF8      = 18,
   GI_TYPE_TAG_FILENAME  = 19,
-  GI_TYPE_TAG_ARRAY     = 20,
-  GI_TYPE_TAG_INTERFACE = 21,
+  GI_TYPE_TAG_SYMBOL    = 20,
+  GI_TYPE_TAG_ARRAY     = 21,
   GI_TYPE_TAG_GLIST     = 22,
   GI_TYPE_TAG_GSLIST    = 23,
   GI_TYPE_TAG_GHASH     = 24,

Modified: trunk/girepository/gmetadata.c
==============================================================================
--- trunk/girepository/gmetadata.c	(original)
+++ trunk/girepository/gmetadata.c	Mon Mar 10 17:44:06 2008
@@ -30,6 +30,11 @@
 #define ALIGN_VALUE(this, boundary) \
   (( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
 
+static gboolean
+validate_blob (GMetadata     *metadata,
+	       guint32        offset,
+	       GError       **error);
+
 
 DirEntry *
 g_metadata_get_dir_entry (GMetadata *metadata,
@@ -419,9 +424,9 @@
 				     signature_offset, return_type, error))
 	return FALSE;
       break;
-    case TYPE_TAG_INTERFACE:
-      if (!validate_iface_type_blob (metadata, simple->offset, 
-				     signature_offset, return_type, error))
+    case TYPE_TAG_SYMBOL:
+      if (!validate_blob (metadata, simple->offset,
+			  error))
 	return FALSE;
       break;
     case TYPE_TAG_LIST:

Modified: trunk/girepository/gmetadata.h
==============================================================================
--- trunk/girepository/gmetadata.h	(original)
+++ trunk/girepository/gmetadata.h	Mon Mar 10 17:44:06 2008
@@ -95,10 +95,6 @@
   guint32 offset;
 } DirEntry;
 
-
-#define TYPE_POINTER_MASK 1 << 7
-#define TYPE_TAG_MASK         63
-
 typedef enum 
 {
   TYPE_TAG_VOID      =  0,
@@ -121,8 +117,8 @@
   TYPE_TAG_DOUBLE    = 17,
   TYPE_TAG_UTF8      = 18,
   TYPE_TAG_FILENAME  = 19,
-  TYPE_TAG_ARRAY     = 20,
-  TYPE_TAG_INTERFACE = 21,
+  TYPE_TAG_SYMBOL    = 20,
+  TYPE_TAG_ARRAY     = 21,
   TYPE_TAG_LIST      = 22,
   TYPE_TAG_SLIST     = 23,
   TYPE_TAG_HASH      = 24,

Modified: trunk/tools/generate.c
==============================================================================
--- trunk/tools/generate.c	(original)
+++ trunk/tools/generate.c	Mon Mar 10 17:44:06 2008
@@ -79,11 +79,11 @@
 
   tag = g_type_info_get_tag (info);
 
-  if (tag < 18)
+  if (tag < TYPE_TAG_UTF8)
     g_fprintf (file, "%s%s", basic[tag], g_type_info_is_pointer (info) ? "*" : "");
-  else if (tag < 20)
+  else if (tag <= TYPE_TAG_FILENAME)
     g_fprintf (file, "%s", basic[tag]);
-  else if (tag == 20)
+  else if (tag == TYPE_TAG_ARRAY)
     {
       gint length;
 
@@ -102,7 +102,7 @@
      g_fprintf (file, "]"); 
       g_base_info_unref ((GIBaseInfo *)type);
     }
-  else if (tag == 21)
+  else if (tag == TYPE_TAG_SYMBOL)
     {
       GIBaseInfo *iface = g_type_info_get_interface (info);
       write_type_name (namespace, iface, file);
@@ -110,7 +110,7 @@
 	g_fprintf (file, "*"); 
       g_base_info_unref (iface);
     }
-  else if (tag == 22)
+  else if (tag == TYPE_TAG_LIST)
     {
       type = g_type_info_get_param_type (info, 0);
       g_fprintf (file, "GList");
@@ -123,7 +123,7 @@
 	}
       g_fprintf (file, "*");
     }
-  else if (tag == 23)
+  else if (tag == TYPE_TAG_SLIST)
     {
       type = g_type_info_get_param_type (info, 0);
       g_fprintf (file, "GSList");
@@ -136,7 +136,7 @@
 	}
       g_fprintf (file, "*");
     }
-  else if (tag == 24)
+  else if (tag == TYPE_TAG_HASH)
     {
       type = g_type_info_get_param_type (info, 0);
       g_fprintf (file, "GHashTable");
@@ -153,7 +153,7 @@
 	}
       g_fprintf (file, "*");
     }
-  else if (tag == 25) 
+  else if (tag == TYPE_TAG_ERROR)
     {
       gint n;
 
@@ -532,8 +532,11 @@
     case GI_TYPE_TAG_FILENAME:
       g_fprintf (file, "%s", value->v_string);
       break;
+    case GI_TYPE_TAG_SYMBOL:
+      g_fprintf (file, "%s", value->v_string);
+      break;
     default:
-      g_assert_not_reached ();
+      g_warning ("Could not get type tag for constant");
     }
 }
 

Modified: trunk/tools/gidlparser.c
==============================================================================
--- trunk/tools/gidlparser.c	(original)
+++ trunk/tools/gidlparser.c	Mon Mar 10 17:44:06 2008
@@ -268,7 +268,7 @@
     }
   else 
     {
-      type->tag = TYPE_TAG_INTERFACE;
+      type->tag = TYPE_TAG_SYMBOL;
       type->is_interface = TRUE; 
       start = *rest;
 



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