]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Replace [NoArrayLength] by [CCode (array_length = false)], which can also
authorJürg Billeter <j@bitron.ch>
Sun, 4 Jan 2009 14:55:19 +0000 (14:55 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sun, 4 Jan 2009 14:55:19 +0000 (14:55 +0000)
2009-01-04  Jürg Billeter  <j@bitron.ch>

* vala/valacodewriter.vala:
* vala/valadelegate.vala:
* vala/valafield.vala:
* vala/valaformalparameter.vala:
* vala/valamethod.vala:

Replace [NoArrayLength] by [CCode (array_length = false)], which
can also be applied to single parameters, fixes bug 532486

* gobject/valaccodecompiler.vala:
* compiler/valacompiler.vala:
* vapi/glib-2.0.vapi:
* vapigen/valagidlparser.vala:
* vapigen/valavapigen.vala:

Adapt to attribute changes

svn path=/trunk/; revision=2265

ChangeLog
compiler/valacompiler.vala
gobject/valaccodecompiler.vala
vala/valacodewriter.vala
vala/valadelegate.vala
vala/valafield.vala
vala/valaformalparameter.vala
vala/valamethod.vala
vapi/glib-2.0.vapi
vapigen/valagidlparser.vala
vapigen/valavapigen.vala

index 30b75335a77b87a4b1c33df73b3e98145ec54db1..3790708eb3e856d89370141f05a28497fd4f265c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2009-01-04  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valacodewriter.vala:
+       * vala/valadelegate.vala:
+       * vala/valafield.vala:
+       * vala/valaformalparameter.vala:
+       * vala/valamethod.vala:
+
+       Replace [NoArrayLength] by [CCode (array_length = false)], which
+       can also be applied to single parameters, fixes bug 532486
+
+       * gobject/valaccodecompiler.vala:
+       * compiler/valacompiler.vala:
+       * vapi/glib-2.0.vapi:
+       * vapigen/valagidlparser.vala:
+       * vapigen/valavapigen.vala:
+
+       Adapt to attribute changes
+
 2009-01-04  Jürg Billeter  <j@bitron.ch>
 
        * vala/valabinaryexpression.vala:
index 620da4c8201c9de2e4e9dbe830bfdb27866a0652..a22872425594a11a5d821ae706f23fc0d7abc04a 100644 (file)
@@ -1,6 +1,6 @@
 /* valacompiler.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter
+ * Copyright (C) 2006-2009  Jürg Billeter
  * Copyright (C) 1996-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -27,12 +27,15 @@ class Vala.Compiler {
        static string basedir;
        static string directory;
        static bool version;
-       [NoArrayLength ()]
+       [CCode (array_length = false)]
+       [NoArrayLength]
        static string[] sources;
-       [NoArrayLength ()]
+       [CCode (array_length = false)]
+       [NoArrayLength]
        static string[] vapi_directories;
        static string library;
-       [NoArrayLength ()]
+       [CCode (array_length = false)]
+       [NoArrayLength]
        static string[] packages;
        static string target_glib;
 
@@ -47,6 +50,7 @@ class Vala.Compiler {
        static bool non_null_experimental;
        static bool disable_dbus_transformation;
        static string cc_command;
+       [CCode (array_length = false)]
        [NoArrayLength]
        static string[] cc_options;
        static string dump_tree;
index 229658cfb5a760fd748b299a68de83c0d22ff9a2..c21ed5ac7803920b2940ad54a184bccf8c49db71 100644 (file)
@@ -1,6 +1,6 @@
 /* valaccodecompiler.vala
  *
- * Copyright (C) 2007-2008  Jürg Billeter
+ * Copyright (C) 2007-2009  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -49,7 +49,7 @@ public class Vala.CCodeCompiler {
         * @param context a code context
         */
        [NoArrayLength]
-       public void compile (CodeContext context, string? cc_command, string[] cc_options) {
+       public void compile (CodeContext context, string? cc_command, [CCode (array_length = false)] string[] cc_options) {
                string pc = "pkg-config --cflags";
                if (!context.compile_only) {
                        pc += " --libs";
index 7559bf17f36772dd26da4acdb320fce22382a3d5..4f037c5aa077e8af82de88e2f10ec7f75c5c681c 100644 (file)
@@ -607,7 +607,7 @@ public class Vala.CodeWriter : CodeVisitor {
                bool custom_cname = (f.get_cname () != f.get_default_cname ());
                bool custom_ctype = (f.get_ctype () != null);
                bool custom_cheaders = (f.parent_symbol is Namespace);
-               if (custom_cname || custom_ctype || custom_cheaders) {
+               if (custom_cname || custom_ctype || custom_cheaders || (f.no_array_length && f.field_type is ArrayType)) {
                        write_indent ();
                        write_string ("[CCode (");
 
@@ -641,12 +641,15 @@ public class Vala.CodeWriter : CodeVisitor {
                                write_string ("cheader_filename = \"%s\"".printf (cheaders));
                        }
 
-                       write_string (")]");
-               }
+                       if (f.no_array_length && f.field_type is ArrayType) {
+                               if (custom_cname || custom_ctype || custom_cheaders) {
+                                       write_string (", ");
+                               }
 
-               if (f.no_array_length && f.field_type is ArrayType) {
-                       write_indent ();
-                       write_string ("[NoArrayLength]");
+                               write_string ("array_length = false");
+                       }
+
+                       write_string (")]");
                }
 
                write_indent ();
@@ -714,6 +717,10 @@ public class Vala.CodeWriter : CodeVisitor {
                                ccode_params.append_printf ("%stype = \"%s\"", separator, param.ctype);
                                separator = ", ";
                        }
+                       if (param.no_array_length && param.parameter_type is ArrayType) {
+                               ccode_params.append_printf ("%sarray_length = false", separator);
+                               separator = ", ";
+                       }
                        if (!float_equal (param.carray_length_parameter_position, i + 0.1)) {
                                ccode_params.append_printf ("%sarray_length_pos = %g", separator, param.carray_length_parameter_position);
                                separator = ", ";
@@ -827,19 +834,6 @@ public class Vala.CodeWriter : CodeVisitor {
                        write_indent ();
                        write_string ("[ReturnsModifiedPointer]");
                }
-               if (m.no_array_length) {
-                       bool array_found = (m.return_type is ArrayType);
-                       foreach (FormalParameter param in m.get_parameters ()) {
-                               if (param.parameter_type is ArrayType) {
-                                       array_found = true;
-                                       break;
-                               }
-                       }
-                       if (array_found) {
-                               write_indent ();
-                               write_string ("[NoArrayLength]");
-                       }
-               }
 
                var ccode_params = new StringBuilder ();
                var separator = "";
@@ -866,6 +860,10 @@ public class Vala.CodeWriter : CodeVisitor {
                        ccode_params.append_printf ("%sinstance_pos = %g", separator, m.cinstance_parameter_position);
                        separator = ", ";
                }
+               if (m.no_array_length && m.return_type is ArrayType) {
+                       ccode_params.append_printf ("%sarray_length = false", separator);
+                       separator = ", ";
+               }
                if (!float_equal (m.carray_length_parameter_position, -3)) {
                        ccode_params.append_printf ("%sarray_length_pos = %g", separator, m.carray_length_parameter_position);
                        separator = ", ";
index 329c25888a101f624f75ab5705402f885172a647..1cde204e52f6ea3d721649070ed3ecdbd0b752a5 100644 (file)
@@ -1,6 +1,6 @@
 /* valadelegate.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter
+ * Copyright (C) 2006-2009  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -63,20 +63,10 @@ public class Vala.Delegate : TypeSymbol {
        public double cdelegate_target_parameter_position { get; set; }
 
        /**
-        * Specifies whether the array length should implicitly be passed
-        * if the parameter type is an array.
+        * Specifies whether the array length should be returned implicitly
+        * if the return type is an array.
         */
-       public bool no_array_length {
-               get {
-                       return _no_array_length;
-               }
-               set {
-                       _no_array_length = value;
-                       foreach (FormalParameter param in parameters) {
-                               param.no_array_length = value;
-                       }
-               }
-       }
+       public bool no_array_length { get; set; }
 
        private Gee.List<TypeParameter> type_parameters = new ArrayList<TypeParameter> ();
 
@@ -84,7 +74,6 @@ public class Vala.Delegate : TypeSymbol {
        private string cname;
 
        private DataType _return_type;
-       private bool _no_array_length;
 
        /**
         * Creates a new delegate.
@@ -121,9 +110,6 @@ public class Vala.Delegate : TypeSymbol {
         * @param param a formal parameter
         */
        public void add_parameter (FormalParameter param) {
-               if (no_array_length) {
-                       param.no_array_length = true;
-               }
                // default C parameter position
                param.cparameter_position = parameters.size + 1;
                param.carray_length_parameter_position = param.cparameter_position + 0.1;
@@ -227,6 +213,9 @@ public class Vala.Delegate : TypeSymbol {
                if (a.has_argument ("instance_pos")) {
                        cinstance_parameter_position = a.get_double ("instance_pos");
                }
+               if (a.has_argument ("array_length")) {
+                       no_array_length = !a.get_bool ("array_length");
+               }
                if (a.has_argument ("array_length_pos")) {
                        carray_length_parameter_position = a.get_double ("array_length_pos");
                }
@@ -248,8 +237,6 @@ public class Vala.Delegate : TypeSymbol {
                foreach (Attribute a in attributes) {
                        if (a.name == "CCode") {
                                process_ccode_attribute (a);
-                       } else if (a.name == "NoArrayLength") {
-                               no_array_length = true;
                        }
                }
        }
index 4c3a58b2efab7c8a322fa12444f406b8f6de7333..5ff232de0c901ffb4b8c013da1969d633aa48db3 100644 (file)
@@ -178,6 +178,9 @@ public class Vala.Field : Member, Lockable {
                                add_cheader_filename (filename);
                        }
                }
+               if (a.has_argument ("array_length")) {
+                       no_array_length = !a.get_bool ("array_length");
+               }
                if (a.has_argument ("array_length_cname")) {
                        set_array_length_cname (a.get_string ("array_length_cname"));
                }
@@ -190,8 +193,6 @@ public class Vala.Field : Member, Lockable {
                foreach (Attribute a in attributes) {
                        if (a.name == "CCode") {
                                process_ccode_attribute (a);
-                       } else if (a.name == "NoArrayLength") {
-                               no_array_length = true;
                        }
                }
        }
index 1905b0cdc796c6bf5f4f2a0d784e57ee9be46648..bb5f5053dc744541317e12811c2226289e8204b8 100644 (file)
@@ -1,6 +1,7 @@
 /* valaformalparameter.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -60,7 +61,7 @@ public class Vala.FormalParameter : Symbol {
        public Expression default_expression { get; set; }
        
        /**
-        * Specifies whether the array length should implicitly be passed
+        * Specifies whether the array length should be passed implicitly
         * if the parameter type is an array.
         */
        public bool no_array_length { get; set; }
@@ -139,6 +140,9 @@ public class Vala.FormalParameter : Symbol {
                if (a.has_argument ("type")) {
                        ctype = a.get_string ("type");
                }
+               if (a.has_argument ("array_length")) {
+                       no_array_length = !a.get_bool ("array_length");
+               }
                if (a.has_argument ("array_length_pos")) {
                        carray_length_parameter_position = a.get_double ("array_length_pos");
                }
index b52ab408e36d0a0282f230774c6f6946a796984f..cd37a4c5c81c181d3b5952f58aabf8e9583bb29d 100644 (file)
@@ -1,6 +1,7 @@
 /* valamethod.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -176,20 +177,10 @@ public class Vala.Method : Member {
        public double cdelegate_target_parameter_position { get; set; }
 
        /**
-        * Specifies whether the array length should implicitly be passed
-        * if the parameter type is an array.
+        * Specifies whether the array length should be returned implicitly
+        * if the return type is an array.
         */
-       public bool no_array_length {
-               get {
-                       return _no_array_length;
-               }
-               set {
-                       _no_array_length = value;
-                       foreach (FormalParameter param in parameters) {
-                               param.no_array_length = value;
-                       }
-               }
-       }
+       public bool no_array_length { get; set; }
 
        /**
         * Specifies whether this method expects printf-style format arguments.
@@ -208,7 +199,6 @@ public class Vala.Method : Member {
        private string cname;
        private string _vfunc_name;
        private string _sentinel;
-       private bool _no_array_length;
        private Gee.List<Expression> preconditions = new ArrayList<Expression> ();
        private Gee.List<Expression> postconditions = new ArrayList<Expression> ();
        private DataType _return_type;
@@ -240,9 +230,6 @@ public class Vala.Method : Member {
         * @param param a formal parameter
         */
        public void add_parameter (FormalParameter param) {
-               if (no_array_length) {
-                       param.no_array_length = true;
-               }
                // default C parameter position
                param.cparameter_position = parameters.size + 1;
                param.carray_length_parameter_position = param.cparameter_position + 0.1;
@@ -375,6 +362,9 @@ public class Vala.Method : Member {
                if (a.has_argument ("instance_pos")) {
                        cinstance_parameter_position = a.get_double ("instance_pos");
                }
+               if (a.has_argument ("array_length")) {
+                       no_array_length = !a.get_bool ("array_length");
+               }
                if (a.has_argument ("array_length_pos")) {
                        carray_length_parameter_position = a.get_double ("array_length_pos");
                }
@@ -397,8 +387,6 @@ public class Vala.Method : Member {
                                returns_modified_pointer = true;
                        } else if (a.name == "FloatingReference") {
                                return_type.floating_reference = true;
-                       } else if (a.name == "NoArrayLength") {
-                               no_array_length = true;
                        } else if (a.name == "PrintfFormat") {
                                printf_format = true;
                        }
index 798cd48a791eca5b7b689836949f98f8b3aae3d0..67e76c7241e60b381549c0341fd075dff77ed655 100644 (file)
@@ -717,15 +717,14 @@ public class string {
        public string escape (string exceptions);
        [CCode (cname = "g_strcompress")]
        public string compress ();
-       [CCode (cname = "g_strsplit")]
+       [CCode (cname = "g_strsplit", array_length = false)]
        [NoArrayLength]
        public string[] split (string delimiter, int max_tokens = 0);
-       [CCode (cname = "g_strsplit_set")]
-       [NoArrayLength]
+       [CCode (cname = "g_strsplit_set", array_length = false)]
        public string[] split_set (string delimiters, int max_tokens = 0);
        [CCode (cname = "g_strjoinv")]
        [NoArrayLength]
-       public static string joinv (string separator, string[] str_array);
+       public static string joinv (string separator, [CCode (array_length = false)] string[] str_array);
        [CCode (cname = "g_strjoin")]
        public static string join (string separator, ...);
        [CCode (cname = "g_strnfill")]
@@ -1066,7 +1065,7 @@ namespace GLib {
                public bool wait (Cond cond, Mutex mutex);
                public bool prepare (out int priority);
                public int query (int max_priority, out int timeout_, PollFD[] fds);
-               [NoArrayLength]
+               [CCode (array_length = false)]
                public int check (int max_priority, PollFD[] fds, int n_fds);
                public void dispatch ();
                public void set_poll_func (PollFunc func);
@@ -1505,8 +1504,7 @@ namespace GLib {
 
        /* String Utility Functions */
 
-       [NoArrayLength]
-       public uint strv_length (string[] str_array);
+       public uint strv_length ([CCode (array_length = false)] string[] str_array);
 
        [CCode (cname = "errno", cheader_filename = "errno.h")]
        public int errno;
@@ -1549,7 +1547,7 @@ namespace GLib {
                public static size_t encode_close (bool break_lines, char* _out, ref int state, ref int save);
                public static string encode (uchar[] data);
                public static size_t decode_step (char[] _in, uchar* _out, ref int state, ref uint save);
-               [NoArrayLength]
+               [CCode (array_length = false)]
                public static uchar[] decode (string text, out size_t out_len);
        }
 
@@ -1569,11 +1567,9 @@ namespace GLib {
        public class Checksum {
                public Checksum (ChecksumType checksum_type);
                public Checksum copy ();
-               [NoArrayLength]
-               public void update (uchar[] data, size_t length);
+               public void update ([CCode (array_length = false)] uchar[] data, size_t length);
                public weak string get_string ();
-               [NoArrayLength]
-               public void get_digest (uint8[] buffer, ref size_t digest_len);
+               public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len);
                [CCode (cname = "g_compute_checksum_for_data")]
                public static string compute_for_data (ChecksumType checksum_type, uchar[] data);
                [CCode (cname = "g_compute_checksum_for_string")]
@@ -1750,12 +1746,10 @@ namespace GLib {
        [CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")]
        public class Rand {
                public Rand.with_seed (uint32 seed);
-               [NoArrayLength ()]
-               public Rand.with_seed_array (uint32[] seed, uint seed_length);
+               public Rand.with_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
                public Rand ();
                public void set_seed (uint32 seed);
-               [NoArrayLength ()]
-               public void set_seed_array (uint32[] seed, uint seed_length);
+               public void set_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length);
                public bool boolean ();
                [CCode (cname = "g_rand_int")]
                public uint32 next_int ();
@@ -1793,8 +1787,7 @@ namespace GLib {
                public static bool set_variable (string variable, string value, bool overwrite);
                [CCode (cname = "g_unsetenv")]
                public static void unset_variable (string variable);
-               [CCode (cname = "g_listenv")]
-               [NoArrayLength]
+               [CCode (cname = "g_listenv", array_length = false)]
                public static string[] list_variables ();
                [CCode (cname = "g_get_user_name")]
                public static weak string get_user_name ();
@@ -1808,9 +1801,10 @@ namespace GLib {
                public static weak string get_user_config_dir ();
                [CCode (cname = "g_get_user_special_dir")]
                public static weak string get_user_special_dir (UserDirectory directory);
-               [CCode (cname = "g_get_system_data_dirs"), NoArrayLength]
+               [CCode (cname = "g_get_system_data_dirs", array_length = false)]
+               [NoArrayLength]
                public static weak string[] get_system_data_dirs ();
-               [CCode (cname = "g_get_system_config_dirs"), NoArrayLength]
+               [CCode (cname = "g_get_system_config_dirs")]
                public static weak string[] get_system_config_dirs ();
                [CCode (cname = "g_get_host_name")]
                public static weak string get_host_name ();
@@ -2089,12 +2083,9 @@ namespace GLib {
 
        [CCode (lower_case_cprefix = "g_")]
        namespace Process {
-               [NoArrayLength ()]
-               public static bool spawn_async_with_pipes (string? working_directory, string[] argv, string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid, out int standard_input = null, out int standard_output = null, out int standard_error = null) throws SpawnError;
-               [NoArrayLength ()]
-               public static bool spawn_async (string? working_directory, string[] argv, string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid) throws SpawnError;
-               [NoArrayLength ()]
-               public static bool spawn_sync (string? working_directory, string[] argv, string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out string standard_output = null, out string standard_error = null, out int exit_status = null) throws SpawnError;
+               public static bool spawn_async_with_pipes (string? working_directory, [CCode (array_length = false)] string[] argv, [CCode (array_length = false)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid, out int standard_input = null, out int standard_output = null, out int standard_error = null) throws SpawnError;
+               public static bool spawn_async (string? working_directory, [CCode (array_length = false)] string[] argv, [CCode (array_length = false)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid) throws SpawnError;
+               public static bool spawn_sync (string? working_directory, [CCode (array_length = false)] string[] argv, [CCode (array_length = false)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out string standard_output = null, out string standard_error = null, out int exit_status = null) throws SpawnError;
                public static bool spawn_command_line_async (string command_line) throws SpawnError;
                public static bool spawn_command_line_sync (string command_line, out string standard_output = null, out string standard_error = null, out int exit_status = null) throws SpawnError;
                [CCode (cname = "g_spawn_close_pid")]
@@ -2347,7 +2338,7 @@ namespace GLib {
                public bool get_ignore_unknown_options ();
                public string get_help (bool main_help, OptionGroup? group);
                [NoArrayLength]
-               public void add_main_entries (OptionEntry[] entries, string? translation_domain);
+               public void add_main_entries ([CCode (array_length = false)] OptionEntry[] entries, string? translation_domain);
                public void add_group (OptionGroup# group);
                public void set_main_group (OptionGroup# group);
                public weak OptionGroup get_main_group ();
@@ -2396,8 +2387,7 @@ namespace GLib {
        [CCode (free_function = "g_option_group_free")]
        public class OptionGroup {
                public OptionGroup (string name, string description, string help_description, void* user_data, DestroyNotify? destroy);
-               [NoArrayLength]
-               public void add_entries (OptionEntry[] entries);
+               public void add_entries ([CCode (array_length = false)] OptionEntry[] entries);
                public void set_parse_hooks (OptionParseFunc pre_parse_func, OptionParseFunc post_parse_hook);
                public void set_error_hook (OptionErrorFunc error_func);
                public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify);
@@ -2461,12 +2451,12 @@ namespace GLib {
                public bool match_full (string str, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError;
                public bool match_all (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null);
                public bool match_all_full (string str, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError;
-               [NoArrayLength]
+               [CCode (array_length = false)]
                public static string[] split_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
-               [NoArrayLength]
+               [CCode (array_length = false)]
                public string[] split (string str, RegexMatchFlags match_options = 0);
-               [NoArrayLength]
-               public bool split_full (string str, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, int max_tokens = 0) throws RegexError;
+               [CCode (array_length = false)]
+               public string[] split_full (string str, long string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, int max_tokens = 0) throws RegexError;
                public string replace (string str, long string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
                public string replace_literal (string str, long string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
                public string replace_eval (string str, long string_len, int start_position, RegexMatchFlags match_options = 0, RegexEvalCallback eval, void* user_data) throws RegexError;
@@ -2489,7 +2479,7 @@ namespace GLib {
                public bool fetch_pos (int match_num, out int start_pos, out int end_pos);
                public string fetch_named (string name);
                public bool fetch_named_pos (string name, out int start_pos, out int end_pos);
-               [NoArrayLength]
+               [CCode (array_length = false)]
                public string[] fetch_all ();
        }
 
@@ -2520,8 +2510,7 @@ namespace GLib {
                public void get_position (out int line_number, out int char_number);
        }
        
-       [NoArrayLength]
-       public delegate void MarkupParserStartElementFunc (MarkupParseContext context, string element_name, string[] attribute_names, string[] attribute_values) throws MarkupError;
+       public delegate void MarkupParserStartElementFunc (MarkupParseContext context, string element_name, [CCode (array_length = false)] string[] attribute_names, [CCode (array_length = false)] string[] attribute_values) throws MarkupError;
        
        public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError;
        
@@ -2562,8 +2551,7 @@ namespace GLib {
                public KeyFile ();
                public void set_list_separator (char separator);
                public bool load_from_file (string file, KeyFileFlags @flags) throws KeyFileError;
-               [NoArrayLength]
-               public bool load_from_dirs (string file, string[] search_dirs, out string full_path, KeyFileFlags @flags) throws KeyFileError;
+               public bool load_from_dirs (string file, [CCode (array_length = false)] string[] search_dirs, out string full_path, KeyFileFlags @flags) throws KeyFileError;
                public bool load_from_data (string data, ulong length, KeyFileFlags @flags) throws KeyFileError;
                public bool load_from_data_dirs (string file, out string full_path, KeyFileFlags @flags) throws KeyFileError;
                public string to_data (out size_t length) throws KeyFileError;
index 5b16b34ff118c3004a30ae43700b596b84241ac7..eea086064dbee830f72925f2d9cf7a625052060e 100644 (file)
@@ -1,6 +1,7 @@
 /* valagidlparser.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1509,6 +1510,10 @@ public class Vala.GIdlParser : CodeVisitor {
                                                } else if (eval (nv[1]) == "0") {
                                                        show_param = true;
                                                }
+                                       } else if (nv[0] == "no_array_length") {
+                                               if (eval (nv[1]) == "1") {
+                                                       p.no_array_length = true;
+                                               }
                                        } else if (nv[0] == "array_length_pos") {
                                                set_array_length_pos = true;
                                                array_length_pos = eval (nv[1]).to_double ();
@@ -1803,6 +1808,7 @@ public class Vala.GIdlParser : CodeVisitor {
                return field;
        }
 
+       [CCode (array_length = false)]
        [NoArrayLength]
        private string[]? get_attributes (string codenode) {
                var attributes = codenode_attributes_map.get (codenode);
index 289aee1ab26c4500fb2e5ca9073dcf425eb1b67e..997affd602ef511526169e9eb1ef483cb1852694 100644 (file)
@@ -1,6 +1,6 @@
 /* valavapigen.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter
+ * Copyright (C) 2006-2009  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,12 +26,15 @@ class Vala.VAPIGen : Object {
        static string directory;
        static bool version;
        static bool quiet_mode;
-       [NoArrayLength ()]
+       [CCode (array_length = false)]
+       [NoArrayLength]
        static string[] sources;
-       [NoArrayLength ()]
+       [CCode (array_length = false)]
+       [NoArrayLength]
        static string[] vapi_directories;
        static string library;
-       [NoArrayLength ()]
+       [CCode (array_length = false)]
+       [NoArrayLength]
        static string[] packages;
        static string metadata_filename;
        CodeContext context;