gobject-introspection r151 - in trunk: . tests/parser tools



Author: johan
Date: Tue Mar 11 14:01:20 2008
New Revision: 151
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=151&view=rev

Log:
2008-03-11  Philip Van Hoof  <me pvanhoof be>
 
        * tools/scannerlexer.l:
        * tools/scanner.c:
        * tests/parser/Foo-expected.gidl:
        * tests/parser/foo.c:
        * tests/parser/Makefile.am:
        * tests/parser/foo-object.h:
 
        Added a few extra tests. Which resulted in finding a few
        bugs. Which resulted in me fixing those bugs



Modified:
   trunk/ChangeLog
   trunk/tests/parser/Foo-expected.gidl
   trunk/tests/parser/Makefile.am
   trunk/tests/parser/foo-object.h
   trunk/tests/parser/foo.c
   trunk/tools/scanner.c
   trunk/tools/scannerlexer.l

Modified: trunk/tests/parser/Foo-expected.gidl
==============================================================================
--- trunk/tests/parser/Foo-expected.gidl	(original)
+++ trunk/tests/parser/Foo-expected.gidl	Tue Mar 11 14:01:20 2008
@@ -37,12 +37,55 @@
 			<member name="FOO_FLAGS_THIRD" value="4"/>
 		</flags>
 		<object name="FooObject" parent="GLib.Object" type-name="FooObject" get-type="foo_object_get_type">
+			<method name="calleeowns" symbol="foo_object_calleeowns">
+				<return-type type="gint"/>
+				<parameters>
+					<parameter name="object" type="FooObject*"/>
+					<parameter name="toown" type="GObject*" transfer="full/>
+				</parameters>
+			</method>
+			<method name="calleesowns" symbol="foo_object_calleesowns">
+				<return-type type="gint"/>
+				<parameters>
+					<parameter name="object" type="FooObject*"/>
+					<parameter name="toown1" type="GObject*" transfer="full/>
+					<parameter name="toown2" type="GObject*" transfer="full/>
+				</parameters>
+			</method>
 			<method name="create_object" symbol="foo_object_create_object">
 				<return-type type="GObject*" transfer="full"/>
 				<parameters>
 					<parameter name="object" type="FooObject*"/>
 				</parameters>
 			</method>
+			<method name="in" symbol="foo_object_in">
+				<return-type type="gint"/>
+				<parameters>
+					<parameter name="object" type="FooObject*"/>
+					<parameter name="inarg" type="int*"/>
+				</parameters>
+			</method>
+			<method name="inout" symbol="foo_object_inout">
+				<return-type type="gint"/>
+				<parameters>
+					<parameter name="object" type="FooObject*"/>
+					<parameter name="inoutarg" type="int*" direction="in-out"/>
+				</parameters>
+			</method>
+			<method name="inout2" symbol="foo_object_inout2">
+				<return-type type="gint"/>
+				<parameters>
+					<parameter name="object" type="FooObject*"/>
+					<parameter name="inoutarg" type="int*" direction="in-out"/>
+				</parameters>
+			</method>
+			<method name="inout3" symbol="foo_object_inout3">
+				<return-type type="gint"/>
+				<parameters>
+					<parameter name="object" type="FooObject*"/>
+					<parameter name="inoutarg" type="int*" direction="in-out"/>
+				</parameters>
+			</method>
 			<method name="method" symbol="foo_object_method">
 				<return-type type="gint"/>
 				<parameters>

Modified: trunk/tests/parser/Makefile.am
==============================================================================
--- trunk/tests/parser/Makefile.am	(original)
+++ trunk/tests/parser/Makefile.am	Tue Mar 11 14:01:20 2008
@@ -21,7 +21,7 @@
 	libfoo.la --output $@
 
 check-local: Foo.gidl
-	@diff -u $(srcdir)/Foo-expected.gidl Foo.gidl && echo "Foo.gidl"
+	@diff -u -U 10 $(srcdir)/Foo-expected.gidl Foo.gidl && echo "Foo.gidl"
 	@echo "======================="
 	@echo "All parser tests passed"
 	@echo "======================="

Modified: trunk/tests/parser/foo-object.h
==============================================================================
--- trunk/tests/parser/foo-object.h	(original)
+++ trunk/tests/parser/foo-object.h	Tue Mar 11 14:01:20 2008
@@ -47,6 +47,12 @@
 gint                  foo_object_out               (FooObject *object,
 						    int       *outarg);
 GObject*              foo_object_create_object     (FooObject *object);
+gint                  foo_object_inout             (FooObject *object, int *inoutarg);
+gint                  foo_object_inout2            (FooObject *object, int *inoutarg);
+gint                  foo_object_inout3            (FooObject *object, int *inoutarg);
+gint                  foo_object_in                (FooObject *object, int *inarg);
+gint                  foo_object_calleeowns        (FooObject *object, GObject *toown);
+gint                  foo_object_calleesowns       (FooObject *object, GObject *toown1, GObject *toown2);
 
 
 struct _FooSubobject

Modified: trunk/tests/parser/foo.c
==============================================================================
--- trunk/tests/parser/foo.c	(original)
+++ trunk/tests/parser/foo.c	Tue Mar 11 14:01:20 2008
@@ -44,10 +44,16 @@
 
 }
 
+/**
+ * foo_object_method:
+ * @object: a #GObject
+ *
+ * Return value: an int
+ **/
 gint
 foo_object_method (FooObject *object)
 {
-
+	return 1;
 }
 
 /**
@@ -60,11 +66,106 @@
  * Return value: an int
  */
 gint
+foo_object_in (FooObject *object, int *outarg)
+{
+	return 1;
+}
+
+/**
+ * foo_object_in:
+ * @object: a #GObject
+ *
+ * This is a test for out arguments
+ *
+ * @outarg: (in): This is an argument test
+ * Return value: an int
+ */
+gint
 foo_object_out (FooObject *object, int *outarg)
 {
 	return 1;
 }
 
+
+/**
+ * foo_object_inout:
+ * @object: a #GObject
+ *
+ * This is a test for out arguments
+ *
+ * @inoutarg: (inout): This is an argument test
+ * Return value: an int
+ */
+gint
+foo_object_inout (FooObject *object, int *inoutarg)
+{
+	return 1;
+}
+
+/**
+ * foo_object_inout2:
+ * @object: a #GObject
+ *
+ * This is a second test for out arguments
+ *
+ * @inoutarg: (in) (out): This is an argument test
+ * Return value: an int
+ */
+gint
+foo_object_inout2 (FooObject *object, int *inoutarg)
+{
+	return 1;
+}
+
+
+/**
+ * foo_object_inout3:
+ * @object: a #GObject
+ *
+ * This is a 3th test for out arguments
+ *
+ * @inoutarg: (in-out): This is an argument test
+ * Return value: an int
+ */
+gint
+foo_object_inout3 (FooObject *object, int *inoutarg)
+{
+	return 1;
+}
+
+/**
+ * foo_object_calleeowns:
+ * @object: a #GObject
+ *
+ * This is a test for out arguments
+ *
+ * @toown: (callee-owns): a #GObject
+ * Return value: an int
+ */
+gint
+foo_object_calleeowns (FooObject *object, GObject *toown)
+{
+	return 1;
+}
+
+
+/**
+ * foo_object_calleesowns:
+ * @object: a #GObject
+ *
+ * This is a test for out arguments
+ *
+ * @toown1: (callee-owns): a #GObject
+ * @toown2: (callee-owns): a #GObject
+ * Return value: an int
+ */
+gint
+foo_object_calleesowns (FooObject *object, GObject *toown1, GObject *toown2)
+{
+	return 1;
+}
+
+
 /**
  * foo_object_create_object:
  * @object: a #GObject

Modified: trunk/tools/scanner.c
==============================================================================
--- trunk/tools/scanner.c	(original)
+++ trunk/tools/scanner.c	Tue Mar 11 14:01:20 2008
@@ -715,6 +715,14 @@
                       param->transfer = TRUE;
                   if (g_ascii_strcasecmp (stringy_data, "null-ok") == 0)
                       param->null_ok = TRUE;
+                  if (g_ascii_strcasecmp (stringy_data, "inout") == 0) {
+                      param->in = TRUE;
+                      param->out = TRUE;
+                  }
+                  if (g_ascii_strcasecmp (stringy_data, "in-out") == 0) {
+                      param->in = TRUE;
+                      param->out = TRUE;
+                  }
                   if (g_ascii_strcasecmp (stringy_data, "in") == 0)
                       param->in = TRUE;
                   if (g_ascii_strcasecmp (stringy_data, "out") == 0)

Modified: trunk/tools/scannerlexer.l
==============================================================================
--- trunk/tools/scannerlexer.l	(original)
+++ trunk/tools/scannerlexer.l	Tue Mar 11 14:01:20 2008
@@ -226,17 +226,21 @@
         {
           char *ptr = parts[1];
           GString *current = NULL;
-          gboolean open = FALSE;
+          gboolean open = (*ptr == '(');
 
           current = g_string_new ("");
           value = parts[2];
 
           while (*ptr++) 
             {
-              if (*ptr != ')')
+              if (*ptr == '(')
+                 open = TRUE;
+              else if (*ptr != ')' && open)
                 g_string_append_c (current, *ptr);
-              else if (*ptr == ')')
+              else if (*ptr == ')') {
                 options = g_slist_prepend (options, g_strdup (current->str));
+                open = FALSE;
+              }
             }
           g_string_free (current, TRUE);
         } 



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