gobject-introspection r514 - in trunk: girepository tests/scanner tools



Author: walters
Date: Thu Aug 28 22:13:00 2008
New Revision: 514
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=514&view=rev

Log:
Fix --includedir handling

	* tests/scanner/Makefile.am: Pass the right
	--includedir args.  Add a Makefile dep.
	* tools/compiler.c: Pass includedirs down.
	* girepository/girparser.c: Actually put
	includedirs in context, pass down.  Fix
	locate_gir.


Modified:
   trunk/girepository/girparser.c
   trunk/girepository/girparser.h
   trunk/tests/scanner/Makefile.am
   trunk/tools/compiler.c

Modified: trunk/girepository/girparser.c
==============================================================================
--- trunk/girepository/girparser.c	(original)
+++ trunk/girepository/girparser.c	Thu Aug 28 22:13:00 2008
@@ -68,7 +68,7 @@
   ParseState state;
   ParseState prev_state;
 
-  const char **includes;
+  const char * const*includes;
   
   GList *modules;
   gboolean prefix_aliases;
@@ -126,7 +126,7 @@
 };
 
 static char *
-locate_gir (const char *name, const char **extra_paths)
+locate_gir (const char *name, const char * const* extra_paths)
 {
   const gchar *const *datadirs;
   const gchar *const *dir;
@@ -146,11 +146,14 @@
 	return path;
       g_free (path);
       path = NULL;
-      if (firstpass && !*dir)
-	{
-	  firstpass = FALSE;
-	  dir = extra_paths;
-	}
+    }
+  for (dir = extra_paths; *dir; dir++) 
+    {
+      path = g_build_filename (*dir, girname, NULL);
+      if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
+	return path;
+      g_free (path);
+      path = NULL;
     }
   g_free (girname);
   return path;
@@ -1968,6 +1971,7 @@
   g_free (girpath);
 
   sub_ctx.state = STATE_START;
+  sub_ctx.includes = ctx->includes;
   sub_ctx.prefix_aliases = TRUE;
   sub_ctx.namespace = name;
   sub_ctx.aliases = ctx->aliases;
@@ -2630,7 +2634,8 @@
 };
 
 GList * 
-g_ir_parse_string (const char   *namespace,
+g_ir_parse_string (const gchar  *namespace,
+		   const gchar *const *includes,
 		   const gchar  *buffer, 
 		   gssize        length,
 		   GError      **error)
@@ -2639,6 +2644,7 @@
   GMarkupParseContext *context;
 
   ctx.state = STATE_START;
+  ctx.includes = includes;
   ctx.prefix_aliases = FALSE;
   ctx.namespace = namespace;
   ctx.aliases = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -2672,6 +2678,7 @@
 
 GList *
 g_ir_parse_file (const gchar  *filename,
+		 const gchar *const *includes,
 		 GError      **error)
 {
   gchar *buffer;
@@ -2701,7 +2708,7 @@
   if (!g_file_get_contents (filename, &buffer, &length, error))
     return NULL;
   
-  modules = g_ir_parse_string (namespace, buffer, length, error);
+  modules = g_ir_parse_string (namespace, includes, buffer, length, error);
 
   g_free (namespace);
 

Modified: trunk/girepository/girparser.h
==============================================================================
--- trunk/girepository/girparser.h	(original)
+++ trunk/girepository/girparser.h	Thu Aug 28 22:13:00 2008
@@ -27,9 +27,11 @@
 
 
 GList *g_ir_parse_string (const gchar  *buffer, 
+			  const gchar *const *includes,
 			  gssize        length,
 			  GError      **error);
 GList *g_ir_parse_file   (const gchar  *filename,
+			  const gchar *const *includes,
 			  GError      **error);
 
 

Modified: trunk/tests/scanner/Makefile.am
==============================================================================
--- trunk/tests/scanner/Makefile.am	(original)
+++ trunk/tests/scanner/Makefile.am	Thu Aug 28 22:13:00 2008
@@ -74,8 +74,8 @@
 %.gir.check: %.gir
 	@diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo "* $*.gir"
 
-%.typelib: %.gir
-	$(top_builddir)/tools/g-ir-compiler $< -o $@
+%.typelib: %.gir $(top_builddir)/tools/g-ir-compiler Makefile
+	$(top_builddir)/tools/g-ir-compiler --includedir=. --includedir=$(top_builddir)/gir $< -o $@
 	$(SCANNER) --typelib-xml $< > $<.tmp && mv $<.tmp $<.txml
 
 check-local: pre-check

Modified: trunk/tools/compiler.c
==============================================================================
--- trunk/tools/compiler.c	(original)
+++ trunk/tools/compiler.c	Thu Aug 28 22:13:00 2008
@@ -201,13 +201,14 @@
       return 1;
     }
 
-  g_debug ("[parsing] start");
+  g_debug ("[parsing] start, %d includes", 
+	   includedirs ? g_strv_length (includedirs) : 0);
 
   modules = NULL;
   for (i = 0; input[i]; i++)
     {
       GList *mods;
-      mods = g_ir_parse_file (input[i], &error);
+      mods = g_ir_parse_file (input[i], (const char*const*) includedirs, &error);
       
       if (mods == NULL) 
 	{



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