]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Support methods returning null-terminated arrays
authorJürg Billeter <j@bitron.ch>
Sat, 10 Jan 2009 14:37:13 +0000 (14:37 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 10 Jan 2009 14:37:13 +0000 (14:37 +0000)
2009-01-10  Jürg Billeter  <j@bitron.ch>

* vala/valacodewriter.vala:
* vapigen/valagidlparser.vala:

Support methods returning null-terminated arrays

* vapi/packages/gtk+-2.0/:

Fix gtk_selection_data_get_uris binding

* vapi/gtk+-2.0.vapi: regenerated

svn path=/trunk/; revision=2324

ChangeLog
vala/valacodewriter.vala
vapi/gtk+-2.0.vapi
vapi/packages/gtk+-2.0/gtk+-2.0.metadata
vapigen/valagidlparser.vala

index 6d78143d1dea40c17e87e0c8e5154d01dab7f187..5ab55cb570a4ccda54675d99c9e859eef74c96b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-01-10  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valacodewriter.vala:
+       * vapigen/valagidlparser.vala:
+
+       Support methods returning null-terminated arrays
+
+       * vapi/packages/gtk+-2.0/:
+
+       Fix gtk_selection_data_get_uris binding
+
+       * vapi/gtk+-2.0.vapi: regenerated
+
 2009-01-10  Jürg Billeter  <j@bitron.ch>
 
        * vala/valacodewriter.vala:
index 7811c32b2e63090b9a86deadc2fb574d094d3830..8f7a83a32b0be583676f7b962dce00c435e1d942 100644 (file)
@@ -868,6 +868,10 @@ public class Vala.CodeWriter : CodeVisitor {
                        ccode_params.append_printf ("%sarray_length_pos = %g", separator, m.carray_length_parameter_position);
                        separator = ", ";
                }
+               if (m.array_null_terminated && m.return_type is ArrayType) {
+                       ccode_params.append_printf ("%sarray_null_terminated = true", separator);
+                       separator = ", ";
+               }
                if (!float_equal (m.cdelegate_target_parameter_position, -3)) {
                        ccode_params.append_printf ("%sdelegate_target_pos = %g", separator, m.cdelegate_target_parameter_position);
                        separator = ", ";
index f77a3ab686ad0bb98e5fa23b158695a6b937a7e7..f5c1970379e66cf6b531658bfa2b5ed6f75c7dc6 100644 (file)
@@ -3143,7 +3143,7 @@ namespace Gtk {
                public Gdk.Pixbuf? get_pixbuf ();
                public bool get_targets (out Gdk.Atom targets, int n_atoms);
                public string? get_text ();
-               [CCode (array_length = false)]
+               [CCode (array_length = false, array_null_terminated = true)]
                public string[] get_uris ();
                public void set (Gdk.Atom type, int format, uchar[] data);
                public bool set_pixbuf (Gdk.Pixbuf pixbuf);
index 19b3eeb55a16bc5d2cab4b884e9996107347f084..578eeeec7406512dd56b3c210f3673f4296f525a 100644 (file)
@@ -301,7 +301,7 @@ gtk_selection_add_targets.targets is_array="1"
 gtk_selection_data_copy transfer_ownership="1"
 gtk_selection_data_get_pixbuf transfer_ownership="1" nullable="1"
 gtk_selection_data_get_text type_name="string" nullable="1" transfer_ownership="1"
-gtk_selection_data_get_uris is_array="1" transfer_ownership="1" no_array_length="1"
+gtk_selection_data_get_uris is_array="1" transfer_ownership="1" array_null_terminated="1"
 gtk_selection_data_set.length hidden="1"
 gtk_selection_data_set_uris.uris is_array="1" no_array_length="1"
 GtkSettings.queued_settings hidden="1"
index 7278dad6dc21c27e28cbe27751fb94cbc7fecb02..4a9dbf45bc9cd53a5ff5773a5650d5c730eb3756 100644 (file)
@@ -1367,6 +1367,11 @@ public class Vala.GIdlParser : CodeVisitor {
                                        if (eval (nv[1]) == "1") {
                                                m.no_array_length = true;
                                        }
+                               } else if (nv[0] == "array_null_terminated") {
+                                       if (eval (nv[1]) == "1") {
+                                               m.no_array_length = true;
+                                               m.array_null_terminated = true;
+                                       }
                                } else if (nv[0] == "type_name") {
                                        var sym = new UnresolvedSymbol (null, eval (nv[1]));
                                        if (return_type is UnresolvedType) {
@@ -1514,6 +1519,11 @@ public class Vala.GIdlParser : CodeVisitor {
                                                if (eval (nv[1]) == "1") {
                                                        p.no_array_length = true;
                                                }
+                                       } else if (nv[0] == "array_null_terminated") {
+                                               if (eval (nv[1]) == "1") {
+                                                       p.no_array_length = true;
+                                                       p.array_null_terminated = true;
+                                               }
                                        } else if (nv[0] == "array_length_pos") {
                                                set_array_length_pos = true;
                                                array_length_pos = eval (nv[1]).to_double ();