gobject-introspection r666 - in trunk: . giscanner tests/scanner



Author: juergbi
Date: Sat Oct 11 20:43:21 2008
New Revision: 666
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=666&view=rev

Log:
2008-10-11  JÃrg Billeter  <j bitron ch>

	Bug 552370: unsigned not scanned properly

	* giscanner/scannerparser.y: combine basic types such as unsigned
	int and long long when scanning
	* tests/scanner/foo-expected.gir:
	* tests/scanner/foo.c: (foo_test_unsigned):
	* tests/scanner/foo.h: test that


Modified:
   trunk/ChangeLog
   trunk/giscanner/scannerparser.y
   trunk/tests/scanner/foo-expected.gir
   trunk/tests/scanner/foo.c
   trunk/tests/scanner/foo.h

Modified: trunk/giscanner/scannerparser.y
==============================================================================
--- trunk/giscanner/scannerparser.y	(original)
+++ trunk/giscanner/scannerparser.y	Sat Oct 11 20:43:21 2008
@@ -559,7 +559,15 @@
 	| type_specifier declaration_specifiers
 	  {
 		$$ = $1;
-		$$->base_type = $2;
+		/* combine basic types like unsigned int and long long */
+		if ($$->type == CTYPE_BASIC_TYPE && $2->type == CTYPE_BASIC_TYPE) {
+			char *name = g_strdup_printf ("%s %s", $$->name, $2->name);
+			g_free ($$->name);
+			$$->name = name;
+			ctype_free ($2);
+		} else {
+			$$->base_type = $2;
+		}
 	  }
 	| type_specifier
 	| type_qualifier declaration_specifiers

Modified: trunk/tests/scanner/foo-expected.gir
==============================================================================
--- trunk/tests/scanner/foo-expected.gir	(original)
+++ trunk/tests/scanner/foo-expected.gir	Sat Oct 11 20:43:21 2008
@@ -184,9 +184,9 @@
       </return-value>
     </function>
     <enumeration name="EnumType"
-                 c:type="FooEnumType"
                  glib:type-name="FooEnumType"
-                 glib:get-type="foo_enum_type_get_type">
+                 glib:get-type="foo_enum_type_get_type"
+                 c:type="FooEnumType">
       <member name="alpha"
               value="0"
               c:identifier="FOO_ENUM_ALPHA"
@@ -221,9 +221,9 @@
       </parameters>
     </function>
     <bitfield name="FlagsType"
-              c:type="FooFlagsType"
               glib:type-name="FooFlagsType"
-              glib:get-type="foo_flags_type_get_type">
+              glib:get-type="foo_flags_type_get_type"
+              c:type="FooFlagsType">
       <member name="first"
               value="1"
               c:identifier="FOO_FLAGS_FIRST"
@@ -448,5 +448,15 @@
         </return-value>
       </method>
     </union>
+    <function name="test_unsigned" c:identifier="foo_test_unsigned">
+      <return-value>
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="unsigned_param">
+          <type name="uint" c:type="unsigned int"/>
+        </parameter>
+      </parameters>
+    </function>
   </namespace>
 </repository>

Modified: trunk/tests/scanner/foo.c
==============================================================================
--- trunk/tests/scanner/foo.c	(original)
+++ trunk/tests/scanner/foo.c	Sat Oct 11 20:43:21 2008
@@ -318,3 +318,8 @@
 					     (GBoxedFreeFunc) g_free);
   return our_type;
 }
+
+void foo_test_unsigned (unsigned int uint)
+{
+}
+

Modified: trunk/tests/scanner/foo.h
==============================================================================
--- trunk/tests/scanner/foo.h	(original)
+++ trunk/tests/scanner/foo.h	Sat Oct 11 20:43:21 2008
@@ -227,4 +227,6 @@
 
 int foo_bunion_get_contained_type (FooBUnion *bunion);
 
+void foo_test_unsigned (unsigned int unsigned_param);
+
 #endif /* __FOO_OBJECT_H__ */



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