Added a few extra tests. Which resulted in finding a few bugs. Which
authorPhilip Van Hoof <me@pvanhoof.be>
Tue, 11 Mar 2008 14:01:20 +0000 (14:01 +0000)
committerJohan Dahlin <johan@src.gnome.org>
Tue, 11 Mar 2008 14:01:20 +0000 (14:01 +0000)
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

svn path=/trunk/; revision=151

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

index 724a763..f8b3f02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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
+
 2008-03-11  Rob Taylor  <rob.taylor@codethink.co.uk>
 
        * tools/gidlcompilercontext.c: (g_idl_compiler_write_dir_entry),
index a7f673c..522ea5e 100644 (file)
                        <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>
index 56cb99a..6801738 100644 (file)
@@ -21,7 +21,7 @@ Foo.gidl: libfoo.la foo-object.h $(top_builddir)/tools/g-idl-scanner
        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 "======================="
index f904264..f711b0b 100644 (file)
@@ -47,6 +47,12 @@ gint                  foo_object_method            (FooObject *object);
 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
index 018f21c..b13625e 100644 (file)
@@ -44,10 +44,16 @@ foo_object_init (FooObject *object)
 
 }
 
+/**
+ * foo_object_method:
+ * @object: a #GObject
+ *
+ * Return value: an int
+ **/
 gint
 foo_object_method (FooObject *object)
 {
-
+       return 1;
 }
 
 /**
@@ -60,11 +66,106 @@ foo_object_method (FooObject *object)
  * 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
index 1e5ff28..c1b166d 100644 (file)
@@ -715,6 +715,14 @@ g_igenerator_process_function_symbol (GIGenerator * igenerator, CSymbol * sym)
                       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)
index 8dee502..c5a1574 100644 (file)
@@ -226,17 +226,21 @@ parse_gtkdoc (GIGenerator *igenerator,
         {
           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);
         }