gobject-introspection r509 - in trunk: . girepository tests/invoke tests/scanner tools



Author: tml
Date: Thu Aug 28 16:55:37 2008
New Revision: 509
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=509&view=rev

Log:
2008-08-28  Tor Lillqvist  <tml novell com>

	* tools/compiler.c (write_out_typelib): Use binary mode for output
	file on Windows.

	* girepository/girnode.c: Don't print NULL strings.

	* tests/invoke/Makefile.am
	* tests/scanner/Makefile.am: Use -no-undefined on Windows to
	convince libtool to build shared libraries.

	* tests/invoke/invoke.c: Don't needlessly include <dlfcn.h>. Use
	g_assert() instead of printing out expected errors.



Modified:
   trunk/ChangeLog
   trunk/girepository/girnode.c
   trunk/tests/invoke/Makefile.am
   trunk/tests/invoke/invoke.c
   trunk/tests/scanner/Makefile.am
   trunk/tools/compiler.c

Modified: trunk/girepository/girnode.c
==============================================================================
--- trunk/girepository/girnode.c	(original)
+++ trunk/girepository/girnode.c	Thu Aug 28 16:55:37 2008
@@ -821,8 +821,11 @@
       size = 0;
     }
 
-  g_debug ("node '%s' %p type '%s' full size %d", node->name, node,
-	   g_ir_node_type_to_string (node->type), size);
+  g_debug ("node %s%s%s%p type '%s' full size %d",
+	   node->name ? "'" : "",
+	   node->name ? node->name : "",
+	   node->name ? "' " : "",
+	   node, g_ir_node_type_to_string (node->type), size);
 
   return size;
 }
@@ -1170,8 +1173,9 @@
 
   g_assert (node != NULL);
 
-  g_debug ("build_typelib: %s (%s)",
-	   node->name,
+  g_debug ("build_typelib: %s%s(%s)",
+	   node->name ? node->name : "",
+	   node->name ? " " : "",
 	   g_ir_node_type_to_string (node->type));
 
   switch (node->type)
@@ -2122,8 +2126,11 @@
       g_assert_not_reached ();
     }
   
-  g_debug ("node '%s' %p type '%s', offset %d -> %d, offset2 %d -> %d",
-	   node->name, node, g_ir_node_type_to_string (node->type),
+  g_debug ("node %s%s%s%p type '%s', offset %d -> %d, offset2 %d -> %d",
+	   node->name ? "'" : "",
+	   node->name ? node->name : "",
+	   node->name ? "' " : "",
+	   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))

Modified: trunk/tests/invoke/Makefile.am
==============================================================================
--- trunk/tests/invoke/Makefile.am	(original)
+++ trunk/tests/invoke/Makefile.am	Thu Aug 28 16:55:37 2008
@@ -13,6 +13,10 @@
 testfns_la_LDFLAGS = -module -avoid-version
 testfns_la_LIBADD = $(GIREPO_LIBS) $(top_builddir)/girepository/libgirepository.la
 
+if OS_WIN32
+testfns_la_LDFLAGS += -no-undefined
+endif
+
 BUILT_SOURCES = testfns-metadata.c
 CLEANFILES = testfns-metadata.c 
 

Modified: trunk/tests/invoke/invoke.c
==============================================================================
--- trunk/tests/invoke/invoke.c	(original)
+++ trunk/tests/invoke/invoke.c	Thu Aug 28 16:55:37 2008
@@ -1,5 +1,4 @@
 #include <stdlib.h>
-#include <dlfcn.h>
 #include <string.h>
 
 #include <glib.h>
@@ -131,7 +130,7 @@
   
 
   /* test GList*/
-  g_print ("Test 6");
+  g_print ("Test 6\n");
   info = g_irepository_find_by_name (rep, "test", "test6");
   g_assert (g_base_info_get_type (info) == GI_INFO_TYPE_FUNCTION);
   function = (GIFunctionInfo *)info;
@@ -147,7 +146,7 @@
 	       g_base_info_get_name (info),
 	       error->message);
 
-    g_print("returned %d", retval.v_int);
+    g_print("returned %d\n", retval.v_int);
     g_assert (retval.v_int == 2);
     g_list_free (list);
   }
@@ -156,7 +155,7 @@
   g_clear_error (&error);
 
   /* test GList more, transfer ownership*/
-  g_print ("Test 7");
+  g_print ("Test 7\n");
   info = g_irepository_find_by_name (rep, "test", "test7");
   g_assert (g_base_info_get_type (info) == GI_INFO_TYPE_FUNCTION);
   function = (GIFunctionInfo *)info;
@@ -172,7 +171,7 @@
 	       g_base_info_get_name (info),
 	       error->message);
 
-    g_print("returned %s", retval.v_pointer);
+    g_print("returned %s\n", retval.v_pointer);
     g_assert (strcmp(retval.v_pointer, "Hey there...")==0);
     g_list_foreach (list, (GFunc) g_free, NULL);
     g_list_free (list);
@@ -208,34 +207,34 @@
   g_assert (g_base_info_get_type (info) == GI_INFO_TYPE_FUNCTION);
   function = (GIFunctionInfo *)info;
 
-  if (!g_function_info_invoke (function, NULL, 0, NULL, 0, NULL, &error))
-    g_print ("Invokation of %s failed: %s\n",
-	     g_base_info_get_name (info),
-	     error->message);
+  g_assert (!g_function_info_invoke (function, NULL, 0, NULL, 0, NULL, &error) &&
+	    error != NULL &&
+	    error->domain == G_INVOKE_ERROR &&
+	    error->code == G_INVOKE_ERROR_ARGUMENT_MISMATCH);
 
   g_clear_error (&error);
 
   /* too few out arguments */
-  if (!g_function_info_invoke (function, in_args, 1, NULL, 0, NULL, &error))
-    g_print ("Invokation of %s failed: %s\n",
-	     g_base_info_get_name (info),
-	     error->message);
+  g_assert (!g_function_info_invoke (function, in_args, 1, NULL, 0, NULL, &error) &&
+	    error != NULL &&
+	    error->domain == G_INVOKE_ERROR &&
+	    error->code == G_INVOKE_ERROR_ARGUMENT_MISMATCH);
 
   g_clear_error (&error);
 
   /* too many in arguments */
-  if (!g_function_info_invoke (function, in_args, 2, out_args, 1, NULL, &error))
-    g_print ("Invokation of %s failed: %s\n",
-	     g_base_info_get_name (info),
-	     error->message);
+  g_assert (!g_function_info_invoke (function, in_args, 2, out_args, 1, NULL, &error) &&
+	    error != NULL &&
+	    error->domain == G_INVOKE_ERROR &&
+	    error->code == G_INVOKE_ERROR_ARGUMENT_MISMATCH);
 
   g_clear_error (&error);
 
   /* too many out arguments */
-  if (!g_function_info_invoke (function, in_args, 1, out_args, 2, NULL, &error))
-    g_print ("Invokation of %s failed: %s\n",
-	     g_base_info_get_name (info),
-	     error->message);
+  g_assert (!g_function_info_invoke (function, in_args, 1, out_args, 2, NULL, &error) &&
+	    error != NULL &&
+	    error->domain == G_INVOKE_ERROR &&
+	    error->code == G_INVOKE_ERROR_ARGUMENT_MISMATCH);
 
   g_clear_error (&error);
 

Modified: trunk/tests/scanner/Makefile.am
==============================================================================
--- trunk/tests/scanner/Makefile.am	(original)
+++ trunk/tests/scanner/Makefile.am	Thu Aug 28 16:55:37 2008
@@ -17,6 +17,10 @@
 libfoo_la_SOURCES = $(srcdir)/foo.c $(srcdir)/foo.h
 libutility_la_SOURCES = $(srcdir)/utility.c $(srcdir)/utility.h
 
+if OS_WIN32
+AM_LDFLAGS += -no-undefined
+endif
+
 GIRS =
 SCANNER = $(top_srcdir)/tools/g-ir-scanner
 SCANNER_LIBS = \

Modified: trunk/tools/compiler.c
==============================================================================
--- trunk/tools/compiler.c	(original)
+++ trunk/tools/compiler.c	Thu Aug 28 16:55:37 2008
@@ -24,6 +24,11 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
+#ifdef G_OS_WIN32
+#include <io.h>
+#include <fcntl.h>
+#endif
+
 #include "girmodule.h"
 #include "girnode.h"
 #include "girparser.h"
@@ -96,7 +101,12 @@
   FILE *file;
 
   if (output == NULL)
-    file = stdout;
+    {
+      file = stdout;
+#ifdef G_OS_WIN32
+      setmode (fileno (file), _O_BINARY);
+#endif
+    }
   else
     {
       gchar *filename;
@@ -105,7 +115,7 @@
 	filename = g_strdup_printf ("%s-%s", prefix, output);  
       else
 	filename = g_strdup (output);
-      file = g_fopen (filename, "w");
+      file = g_fopen (filename, "wb");
 
       if (file == NULL)
 	{



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