[vala/wip/transform: 82/82] Merge branch 'master' into wip/transform



commit 7bc225f20247100a3d72569b759f8db9f2f9f2bc
Merge: 8c4491e 6146ea7
Author: Luca Bruno <luca bruno immobiliare it>
Date:   Tue Sep 9 11:30:47 2014 +0200

    Merge branch 'master' into wip/transform
    
    Conflicts:
        codegen/valagdbusmodule.vala
        codegen/valagdbusservermodule.vala
        vala/Makefile.am
        vala/valabinaryexpression.vala
        vala/valaobjectcreationexpression.vala
        vala/valasemanticanalyzer.vala

 .dir-locals.el                                     |    1 +
 Makefile.am                                        |   19 -
 Makefile.common                                    |    3 +
 NEWS                                               |   26 +
 THANKS                                             |    1 +
 ccode/Makefile.am                                  |   17 +-
 codegen/Makefile.am                                |   23 +-
 codegen/valaccodebasemodule.vala                   |   19 +-
 codegen/valaccodecompiler.vala                     |   14 +-
 codegen/valaclassregisterfunction.vala             |    4 +-
 codegen/valagasyncmodule.vala                      |   32 +-
 codegen/valagdbusclientmodule.vala                 |   24 +
 codegen/valagdbusmodule.vala                       |   30 +-
 codegen/valagdbusservermodule.vala                 |   20 -
 codegen/valagerrormodule.vala                      |    2 +-
 codegen/valagirwriter.vala                         |   12 +-
 codegen/valagtypemodule.vala                       |   78 +-
 codegen/valatyperegisterfunction.vala              |   16 +-
 compiler/Makefile.am                               |   20 +-
 compiler/valacompiler.vala                         |   31 +-
 configure.ac                                       |   20 +-
 doc/Makefile.am                                    |   16 +-
 gee/Makefile.am                                    |   15 +-
 libvala.pc.in                                      |    6 +-
 tests/errors/errors.vala                           |    4 +-
 tests/structs/structs.vala                         |   12 -
 vala.doap                                          |    3 +-
 vala/Makefile.am                                   |   19 +-
 vala/valacodecontext.vala                          |    7 +-
 vala/valacodewriter.vala                           |   97 +
 vala/valafield.vala                                |   12 +
 vala/valamethodcall.vala                           |  115 +--
 vala/valaobjectcreationexpression.vala             |   16 +
 vala/valaparser.vala                               |    8 +-
 vala/valasemanticanalyzer.vala                     |  178 ++-
 vala/valastruct.vala                               |    1 -
 vapi/Makefile.am                                   |   24 +-
 vapi/atspi-2.vapi                                  |   10 +-
 vapi/clutter-1.0.vapi                              |    3 +-
 vapi/clutter-gst-1.0.deps                          |    1 +
 vapi/gdk-3.0.vapi                                  |   13 +-
 vapi/gdk-pixbuf-2.0.vapi                           |    7 +
 vapi/gio-2.0.vapi                                  |   13 +
 vapi/glib-2.0.vapi                                 |   35 +-
 vapi/gobject-2.0.vapi                              |    1 +
 vapi/gobject-introspection-1.0.vapi                |    1 +
 vapi/gstreamer-1.0.vapi                            |   18 +-
 vapi/gstreamer-base-1.0.vapi                       |   20 +
 vapi/gstreamer-net-1.0.vapi                        |    2 +
 vapi/gstreamer-rtsp-1.0.vapi                       |    2 +-
 vapi/gstreamer-rtsp-server-1.0.vapi                |    1 +
 vapi/gstreamer-sdp-1.0.vapi                        |  270 ++--
 vapi/gstreamer-video-1.0.vapi                      |    2 +-
 vapi/gtk+-2.0.vapi                                 |  458 +++---
 vapi/gtk+-3.0.vapi                                 | 1279 +++++++-------
 vapi/gtksourceview-3.0.vapi                        |  146 ++-
 vapi/libgdata.vapi                                 |    2 +
 vapi/linux.vapi                                    |   23 +-
 vapi/metadata/GstBase-1.0.metadata                 |    2 +-
 vapi/metadata/GstRtspServer-1.0.metadata           |    1 -
 vapi/metadata/GstSdp-1.0.metadata                  |   19 +
 vapi/metadata/GstVideo-1.0.metadata                |    2 +-
 vapi/metadata/GtkSource-3.0.metadata               |    2 +-
 vapi/metadata/Pango-1.0.metadata                   |    4 +
 .../{WebKit2-3.0.metadata => WebKit2-4.0.metadata} |    0
 ...0.metadata => WebKit2WebExtension-4.0.metadata} |    0
 vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala        |   25 +-
 vapi/packages/gtk+-2.0/gtk+-2.0.metadata           |  226 ++-
 vapi/packages/gtk+-3.0/gtk+-3.0-custom.vala        |   36 +-
 vapi/packages/gtk+-3.0/gtk+-3.0.excludes           |    1 +
 vapi/packages/gtk+-3.0/gtk+-3.0.gi                 |   97 +-
 vapi/packages/gtk+-3.0/gtk+-3.0.metadata           |  629 ++++++-
 vapi/pango.vapi                                    |  127 +-
 vapi/poppler-glib.vapi                             |  324 ++++-
 vapi/rest-0.7.vapi                                 |    1 +
 vapi/{webkit2gtk-3.0.deps => webkit2gtk-4.0.deps}  |    0
 vapi/{webkit2gtk-3.0.vapi => webkit2gtk-4.0.vapi}  |  125 +-
 ...-3.0.deps => webkit2gtk-web-extension-4.0.deps} |    0
 ...-3.0.vapi => webkit2gtk-web-extension-4.0.vapi} | 1943 ++++---------------
 vapi/xcb.vapi                                      |   16 +-
 vapigen/Makefile.am                                |   36 +-
 81 files changed, 3580 insertions(+), 3288 deletions(-)
---
diff --cc codegen/valagdbusmodule.vala
index f4bc808,edfc827..cf1e389
--- a/codegen/valagdbusmodule.vala
+++ b/codegen/valagdbusmodule.vala
@@@ -34,6 -34,30 +34,34 @@@ public class Vala.GDBusModule : GVarian
                return Symbol.lower_case_to_camel_case (symbol.name);
        }
  
+       public static bool is_dbus_visible (CodeNode node) {
+               var dbus_attribute = node.get_attribute ("DBus");
+               if (dbus_attribute != null
+                   && dbus_attribute.has_argument ("visible")
+                   && !dbus_attribute.get_bool ("visible")) {
+                       return false;
+               }
+ 
+               return true;
+       }
+ 
+       public static bool is_dbus_no_reply (Method m) {
+               return m.get_attribute_bool ("DBus", "no_reply");
+       }
+ 
+       public static string dbus_result_name (Method m) {
+               var dbus_name = m.get_attribute_string ("DBus", "result");
+               if (dbus_name != null && dbus_name != "") {
+                       return dbus_name;
+               }
+ 
+               return "result";
+       }
+ 
++      protected CCodeExpression get_interface_info (ObjectTypeSymbol sym) {
++              return new CCodeIdentifier ("_" + get_ccode_lower_case_prefix (sym) + "dbus_interface_info");
++      }
++
        public override void visit_error_domain (ErrorDomain edomain) {
                var edomain_dbus_name = get_dbus_name (edomain);
                if (edomain_dbus_name == null) {
diff --cc codegen/valagdbusservermodule.vala
index 36f0e9d,daf2a62..1834bca
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@@ -21,28 -21,548 +21,8 @@@
   */
  
  public class Vala.GDBusServerModule : GDBusClientModule {
-       public static bool is_dbus_visible (CodeNode node) {
-               var dbus_attribute = node.get_attribute ("DBus");
-               if (dbus_attribute != null
-                   && dbus_attribute.has_argument ("visible")
-                   && !dbus_attribute.get_bool ("visible")) {
-                       return false;
-               }
- 
-               return true;
-       }
- 
-       public static string dbus_result_name (Method m) {
-               var dbus_name = m.get_attribute_string ("DBus", "result");
-               if (dbus_name != null && dbus_name != "") {
-                       return dbus_name;
-               }
- 
-               return "result";
-       }
- 
 -      string generate_dbus_wrapper (Method m, ObjectTypeSymbol sym, bool ready = false) {
 -              string wrapper_name = "_dbus_%s".printf (get_ccode_name (m));
 -
 -              if (m.base_method != null) {
 -                      m = m.base_method;
 -              } else if (m.base_interface_method != null) {
 -                      m = m.base_interface_method;
 -              }
 -
 -              if (ready) {
 -                      // async ready function
 -                      wrapper_name += "_ready";
 -              }
 -
 -              var function = new CCodeFunction (wrapper_name);
 -              function.modifiers = CCodeModifiers.STATIC;
 -
 -              if (!ready) {
 -                      function.add_parameter (new CCodeParameter ("self", get_ccode_name (sym) + "*"));
 -                      function.add_parameter (new CCodeParameter ("_parameters_", "GVariant*"));
 -                      function.add_parameter (new CCodeParameter ("invocation", "GDBusMethodInvocation*"));
 -              } else {
 -                      function.add_parameter (new CCodeParameter ("source_object", "GObject *"));
 -                      function.add_parameter (new CCodeParameter ("_res_", "GAsyncResult *"));
 -                      function.add_parameter (new CCodeParameter ("_user_data_", "gpointer"));
 -              }
 -
 -              push_function (function);
 -
 -              if (ready) {
 -                      ccode.add_declaration ("GDBusMethodInvocation *", new CCodeVariableDeclarator 
("invocation", new CCodeIdentifier ("_user_data_")));
 -              }
 -
 -              var connection = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_get_connection"));
 -              connection.add_argument (new CCodeIdentifier ("invocation"));
 -
 -              bool no_reply = is_dbus_no_reply (m);
 -              bool uses_fd = dbus_method_uses_file_descriptor (m);
 -              if (uses_fd) {
 -                      cfile.add_include ("gio/gunixfdlist.h");
 -              }
 -
 -              bool uses_error = false;
 -
 -              if (!m.coroutine || ready) {
 -                      ccode.add_declaration ("GError*", new CCodeVariableDeclarator.zero ("error", new 
CCodeConstant ("NULL")));
 -                      uses_error = true;
 -              }
 -
 -              if (!ready) {
 -                      ccode.add_declaration ("GVariantIter", new CCodeVariableDeclarator 
("_arguments_iter"));
 -
 -                      var iter_init = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_iter_init"));
 -                      iter_init.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("_arguments_iter")));
 -                      iter_init.add_argument (new CCodeIdentifier ("_parameters_"));
 -                      ccode.add_expression (iter_init);
 -              }
 -
 -              CCodeFunctionCall ccall;
 -              if (!ready) {
 -                      ccall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_name (m)));
 -                      ccall.add_argument (new CCodeIdentifier ("self"));
 -              } else {
 -                      ccall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_finish_name (m)));
 -                      ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier ("source_object"), 
get_ccode_name (sym) + "*"));
 -                      ccall.add_argument (new CCodeIdentifier ("_res_"));
 -              }
 -
 -              if (!ready) {
 -                      if (uses_fd) {
 -                              ccode.add_declaration ("gint", new CCodeVariableDeclarator.zero ("_fd_index", 
new CCodeConstant ("0")));
 -                      }
 -
 -                      foreach (Parameter param in m.get_parameters ()) {
 -                              string param_name = get_variable_cname (param.name);
 -                              if (param.direction != ParameterDirection.IN) {
 -                                      continue;
 -                              }
 -
 -                              if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
 -                                      continue;
 -                              }
 -
 -                              if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
 -                                      // ignore BusName sender parameters
 -                                      continue;
 -                              }
 -
 -                              var owned_type = param.variable_type.copy ();
 -                              owned_type.value_owned = true;
 -
 -                              ccode.add_declaration (get_ccode_name (owned_type), new 
CCodeVariableDeclarator.zero (param_name, default_value_for_type (param.variable_type, true)));
 -
 -                              var array_type = param.variable_type as ArrayType;
 -                              if (array_type != null) {
 -                                      for (int dim = 1; dim <= array_type.rank; dim++) {
 -                                              string length_cname = get_parameter_array_length_cname 
(param, dim);
 -
 -                                              ccode.add_declaration ("int", new 
CCodeVariableDeclarator.zero (length_cname, new CCodeConstant ("0")));
 -                                      }
 -                              }
 -
 -                              var message_expr = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_get_message"));
 -                              message_expr.add_argument (new CCodeIdentifier ("invocation"));
 -
 -                              bool may_fail;
 -                              receive_dbus_value (param.variable_type, message_expr, new CCodeIdentifier 
("_arguments_iter"), new CCodeIdentifier (param_name), param, new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("error")), out may_fail);
 -
 -                              if (may_fail) {
 -                                      if (!uses_error) {
 -                                              ccode.add_declaration ("GError*", new 
CCodeVariableDeclarator.zero ("error", new CCodeConstant ("NULL")));
 -                                              uses_error = true;
 -                                      }
 -
 -                                      ccode.open_if (new CCodeIdentifier ("error"));
 -
 -                                      var return_error = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_return_gerror"));
 -                                      return_error.add_argument (new CCodeIdentifier ("invocation"));
 -                                      return_error.add_argument (new CCodeIdentifier ("error"));
 -                                      ccode.add_expression (return_error);
 -
 -                                      ccode.add_return ();
 -
 -                                      ccode.close ();
 -                              }
 -                      }
 -              }
 -
 -              foreach (Parameter param in m.get_parameters ()) {
 -                      string param_name = get_variable_cname (param.name);
 -                      if (param.direction == ParameterDirection.IN && !ready) {
 -                              if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
 -                                      ccall.add_argument (new CCodeConstant ("NULL"));
 -                                      continue;
 -                              }
 -
 -                              if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
 -                                      // ignore BusName sender parameters
 -                                      var sender = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_get_sender"));
 -                                      sender.add_argument (new CCodeIdentifier ("invocation"));
 -                                      ccall.add_argument (sender);
 -                                      continue;
 -                              }
 -
 -                              var st = param.variable_type.data_type as Struct;
 -                              if (st != null && !st.is_simple_type ()) {
 -                                      ccall.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param_name)));
 -                              } else {
 -                                      ccall.add_argument (new CCodeIdentifier (param_name));
 -                              }
 -                      } else if (param.direction == ParameterDirection.OUT && (!m.coroutine || ready)) {
 -                              ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
new CCodeIdentifier (param_name)));
 -                      }
 -
 -                      var array_type = param.variable_type as ArrayType;
 -                      if (array_type != null) {
 -                              for (int dim = 1; dim <= array_type.rank; dim++) {
 -                                      string length_cname = get_parameter_array_length_cname (param, dim);
 -
 -                                      if (param.direction == ParameterDirection.IN && !ready) {
 -                                              ccall.add_argument (new CCodeIdentifier (length_cname));
 -                                      } else if (param.direction == ParameterDirection.OUT && !no_reply && 
(!m.coroutine || ready)) {
 -                                              ccall.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (length_cname)));
 -                                      }
 -                              }
 -                      }
 -              }
 -
 -              if (!m.coroutine || ready) {
 -                      if (!(m.return_type is VoidType)) {
 -                              if (m.return_type.is_real_non_null_struct_type ()) {
 -                                      ccall.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("result")));
 -                              } else {
 -                                      var array_type = m.return_type as ArrayType;
 -                                      if (array_type != null) {
 -                                              for (int dim = 1; dim <= array_type.rank; dim++) {
 -                                                      string length_cname = get_array_length_cname 
("result", dim);
 -
 -                                                      ccall.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (length_cname)));
 -                                              }
 -                                      }
 -                              }
 -                      }
 -              }
 -
 -              if (m.coroutine && !ready) {
 -                      ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier (wrapper_name + 
"_ready"), "GAsyncReadyCallback"));
 -                      ccall.add_argument (new CCodeIdentifier ("invocation"));
 -              }
 -
 -              if (!m.coroutine || ready) {
 -                      if (m.get_error_types ().size > 0) {
 -                              ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
new CCodeIdentifier ("error")));
 -                      }
 -              }
 -
 -              if (!no_reply && (!m.coroutine || ready)) {
 -                      if (m.return_type is VoidType || m.return_type.is_real_non_null_struct_type ()) {
 -                              ccode.add_expression (ccall);
 -                      } else {
 -                              ccode.add_assignment (new CCodeIdentifier ("result"), ccall);
 -                      }
 -
 -                      if (m.get_error_types ().size > 0) {
 -                              ccode.open_if (new CCodeIdentifier ("error"));
 -
 -                              var return_error = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_return_gerror"));
 -                              return_error.add_argument (new CCodeIdentifier ("invocation"));
 -                              return_error.add_argument (new CCodeIdentifier ("error"));
 -                              ccode.add_expression (return_error);
 -
 -                              ccode.add_return ();
 -
 -                              ccode.close ();
 -                      }
 -
 -                      ccode.add_declaration ("GDBusMessage*", new CCodeVariableDeclarator 
("_reply_message"));
 -
 -                      var message_expr = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_get_message"));
 -                      message_expr.add_argument (new CCodeIdentifier ("invocation"));
 -
 -                      ccall = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_message_new_method_reply"));
 -                      ccall.add_argument (message_expr);
 -                      ccode.add_assignment (new CCodeIdentifier ("_reply_message"), ccall);
 -
 -                      ccode.add_declaration ("GVariant*", new CCodeVariableDeclarator ("_reply"));
 -                      ccode.add_declaration ("GVariantBuilder", new CCodeVariableDeclarator 
("_reply_builder"));
 -
 -                      var builder_init = new CCodeFunctionCall (new CCodeIdentifier 
("g_variant_builder_init"));
 -                      builder_init.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
new CCodeIdentifier ("_reply_builder")));
 -                      builder_init.add_argument (new CCodeIdentifier ("G_VARIANT_TYPE_TUPLE"));
 -                      ccode.add_expression (builder_init);
 -
 -                      if (uses_fd) {
 -                              ccode.add_declaration ("GUnixFDList", new CCodeVariableDeclarator 
("*_fd_list"));
 -                              ccode.add_assignment (new CCodeIdentifier ("_fd_list"), new CCodeFunctionCall 
(new CCodeIdentifier ("g_unix_fd_list_new")));
 -                      }
 -
 -                      foreach (Parameter param in m.get_parameters ()) {
 -                              if (param.direction != ParameterDirection.OUT) {
 -                                      continue;
 -                              }
 -
 -                              string param_name = get_variable_cname (param.name);
 -                              var owned_type = param.variable_type.copy ();
 -                              owned_type.value_owned = true;
 -
 -                              ccode.add_declaration (get_ccode_name (owned_type), new 
CCodeVariableDeclarator.zero (param_name, default_value_for_type (param.variable_type, true)));
 -
 -                              var array_type = param.variable_type as ArrayType;
 -                              if (array_type != null) {
 -                                      for (int dim = 1; dim <= array_type.rank; dim++) {
 -                                              string length_cname = get_parameter_array_length_cname 
(param, dim);
 -
 -                                              ccode.add_declaration ("int", new 
CCodeVariableDeclarator.zero (length_cname, new CCodeConstant ("0")));
 -                                      }
 -                              }
 -
 -                              send_dbus_value (param.variable_type, new CCodeIdentifier ("_reply_builder"), 
new CCodeIdentifier (param_name), param);
 -                      }
 -
 -                      if (!(m.return_type is VoidType)) {
 -                              if (m.return_type.is_real_non_null_struct_type ()) {
 -                                      ccode.add_declaration (get_ccode_name (m.return_type), new 
CCodeVariableDeclarator.zero ("result", default_value_for_type (m.return_type, true)));
 -
 -                                      send_dbus_value (m.return_type, new CCodeIdentifier 
("_reply_builder"), new CCodeIdentifier ("result"), m);
 -
 -                                      if (requires_destroy (m.return_type)) {
 -                                              // keep local alive (symbol_reference is weak)
 -                                              var local = new LocalVariable (m.return_type, ".result");
 -                                              ccode.add_expression (destroy_local (local));
 -                                      }
 -                              } else {
 -                                      ccode.add_declaration (get_ccode_name (m.return_type), new 
CCodeVariableDeclarator ("result"));
 -
 -                                      var array_type = m.return_type as ArrayType;
 -                                      if (array_type != null) {
 -                                              for (int dim = 1; dim <= array_type.rank; dim++) {
 -                                                      string length_cname = get_array_length_cname 
("result", dim);
 -
 -                                                      ccode.add_declaration ("int", new 
CCodeVariableDeclarator.zero (length_cname, new CCodeConstant ("0")));
 -                                              }
 -                                      }
 -
 -                                      send_dbus_value (m.return_type, new CCodeIdentifier 
("_reply_builder"), new CCodeIdentifier ("result"), m);
 -
 -                                      if (requires_destroy (m.return_type)) {
 -                                              // keep local alive (symbol_reference is weak)
 -                                              var local = new LocalVariable (m.return_type, ".result");
 -                                              ccode.add_expression (destroy_local (local));
 -                                      }
 -                              }
 -                      }
 -
 -                      var builder_end = new CCodeFunctionCall (new CCodeIdentifier 
("g_variant_builder_end"));
 -                      builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
new CCodeIdentifier ("_reply_builder")));
 -                      ccode.add_assignment (new CCodeIdentifier ("_reply"), builder_end);
 -
 -                      var set_body = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_message_set_body"));
 -                      set_body.add_argument (new CCodeIdentifier ("_reply_message"));
 -                      set_body.add_argument (new CCodeIdentifier ("_reply"));
 -                      ccode.add_expression (set_body);
 -
 -                      if (uses_fd) {
 -                              ccall = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_message_set_unix_fd_list"));
 -                              ccall.add_argument (new CCodeIdentifier ("_reply_message"));
 -                              ccall.add_argument (new CCodeIdentifier ("_fd_list"));
 -                              ccode.add_expression (ccall);
 -
 -                              ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_unref"));
 -                              ccall.add_argument (new CCodeIdentifier ("_fd_list"));
 -                              ccode.add_expression (ccall);
 -                      }
 -              } else {
 -                      ccode.add_expression (ccall);
 -              }
 -
 -              foreach (Parameter param in m.get_parameters ()) {
 -                      if ((param.direction == ParameterDirection.IN && !ready) ||
 -                          (param.direction == ParameterDirection.OUT && !no_reply && (!m.coroutine || 
ready))) {
 -                              if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
 -                                      continue;
 -                              }
 -
 -                              if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
 -                                      // ignore BusName sender parameters
 -                                      continue;
 -                              }
 -
 -                              var owned_type = param.variable_type.copy ();
 -                              owned_type.value_owned = true;
 -
 -                              if (requires_destroy (owned_type)) {
 -                                      // keep local alive (symbol_reference is weak)
 -                                      var local = new LocalVariable (owned_type, get_variable_cname 
(param.name));
 -                                      ccode.add_expression (destroy_local (local));
 -                              }
 -                      }
 -              }
 -
 -              if (!no_reply && (!m.coroutine || ready)) {
 -                      var return_value = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_connection_send_message"));
 -                      return_value.add_argument (connection);
 -                      return_value.add_argument (new CCodeIdentifier ("_reply_message"));
 -                      return_value.add_argument (new CCodeConstant ("G_DBUS_SEND_MESSAGE_FLAGS_NONE"));
 -                      return_value.add_argument (new CCodeConstant ("NULL"));
 -                      return_value.add_argument (new CCodeConstant ("NULL"));
 -                      ccode.add_expression (return_value);
 -
 -                      // free invocation like g_dbus_method_invocation_return_*
 -                      var unref_call = new CCodeFunctionCall (new CCodeIdentifier ("g_object_unref"));
 -                      unref_call.add_argument (new CCodeIdentifier ("invocation"));
 -                      ccode.add_expression (unref_call);
 -
 -                      unref_call = new CCodeFunctionCall (new CCodeIdentifier ("g_object_unref"));
 -                      unref_call.add_argument (new CCodeIdentifier ("_reply_message"));
 -                      ccode.add_expression (unref_call);
 -              }
 -
 -              pop_function ();
 -
 -              cfile.add_function_declaration (function);
 -              cfile.add_function (function);
 -
 -              if (m.coroutine && !ready) {
 -                      // generate ready function
 -                      generate_dbus_wrapper (m, sym, true);
 -              }
 -
 -              return wrapper_name;
 -      }
 -
        string generate_dbus_signal_wrapper (Signal sig, ObjectTypeSymbol sym, string dbus_iface_name) {
 -              string wrapper_name = "_dbus_%s_%s".printf (get_ccode_lower_case_name (sym), get_ccode_name 
(sig));
 -
 -              var function = new CCodeFunction (wrapper_name, "void");
 -              function.modifiers = CCodeModifiers.STATIC;
 -
 -              function.add_parameter (new CCodeParameter ("_sender", "GObject*"));
 -
 -              foreach (var param in sig.get_parameters ()) {
 -                      // ensure ccodenode of parameter is set
 -                      var cparam = generate_parameter (param, cfile, new HashMap<int,CCodeParameter> (), 
null);
 -
 -                      function.add_parameter (cparam);
 -                      if (param.variable_type is ArrayType) {
 -                              var array_type = (ArrayType) param.variable_type;
 -                              for (int dim = 1; dim <= array_type.rank; dim++) {
 -                                      function.add_parameter (new CCodeParameter 
(get_parameter_array_length_cname (param, dim), "int"));
 -                              }
 -                      }
 -              }
 -
 -              function.add_parameter (new CCodeParameter ("_data", "gpointer*"));
 -
 -              push_function (function);
 -
 -              ccode.add_declaration ("GDBusConnection *", new CCodeVariableDeclarator ("_connection", new 
CCodeElementAccess (new CCodeIdentifier ("_data"), new CCodeConstant ("1"))));
 -              ccode.add_declaration ("const gchar *", new CCodeVariableDeclarator ("_path", new 
CCodeElementAccess (new CCodeIdentifier ("_data"), new CCodeConstant ("2"))));
 -              ccode.add_declaration ("GVariant", new CCodeVariableDeclarator ("*_arguments"));
 -              ccode.add_declaration ("GVariantBuilder", new CCodeVariableDeclarator ("_arguments_builder"));
 -
 -              var builder_init = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_init"));
 -              builder_init.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("_arguments_builder")));
 -              builder_init.add_argument (new CCodeIdentifier ("G_VARIANT_TYPE_TUPLE"));
 -              ccode.add_expression (builder_init);
 -
 -              foreach (Parameter param in sig.get_parameters ()) {
 -                      string param_name = get_variable_cname (param.name);
 -                      CCodeExpression expr = new CCodeIdentifier (param_name);
 -                      if (param.variable_type.is_real_struct_type ()) {
 -                              expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, 
expr);
 -                      }
 -                      write_expression (param.variable_type, new CCodeIdentifier ("_arguments_builder"), 
expr, param);
 -              }
 -
 -              var builder_end = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_end"));
 -              builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("_arguments_builder")));
 -              ccode.add_assignment (new CCodeIdentifier ("_arguments"), builder_end);
 -
 -              var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_connection_emit_signal"));
 -              ccall.add_argument (new CCodeIdentifier ("_connection"));
 -              ccall.add_argument (new CCodeConstant ("NULL"));
 -              ccall.add_argument (new CCodeIdentifier ("_path"));
 -              ccall.add_argument (new CCodeConstant ("\"%s\"".printf (dbus_iface_name)));
 -              ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dbus_name_for_member (sig))));
 -              ccall.add_argument (new CCodeIdentifier ("_arguments"));
 -              ccall.add_argument (new CCodeConstant ("NULL"));
 -              ccode.add_expression (ccall);
 -
 -              pop_function ();
 -
 -              cfile.add_function_declaration (function);
 -              cfile.add_function (function);
 -
 -              return wrapper_name;
 -      }
 -
 -      string generate_dbus_property_get_wrapper (Property prop, ObjectTypeSymbol sym) {
 -              string wrapper_name = "_dbus_%s".printf (get_ccode_name (prop.get_accessor));
 -
 -              var function = new CCodeFunction (wrapper_name, "GVariant*");
 -              function.modifiers = CCodeModifiers.STATIC;
 -              function.add_parameter (new CCodeParameter ("self", get_ccode_name (sym) + "*"));
 -
 -              push_function (function);
 -
 -              var ccall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_name (prop.get_accessor)));
 -              ccall.add_argument (new CCodeIdentifier ("self"));
 -
 -              if (prop.get_accessor.value_type.is_real_non_null_struct_type ()) {
 -                      ccode.add_declaration (get_ccode_name (prop.get_accessor.value_type), new 
CCodeVariableDeclarator.zero ("result", default_value_for_type (prop.get_accessor.value_type, true)));
 -                      ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("result")));
 -
 -                      ccode.add_expression (ccall);
 -              } else {
 -                      ccode.add_declaration (get_ccode_name (prop.get_accessor.value_type), new 
CCodeVariableDeclarator ("result"));
 -                      ccode.add_assignment (new CCodeIdentifier ("result"), ccall);
 -
 -                      var array_type = prop.get_accessor.value_type as ArrayType;
 -                      if (array_type != null) {
 -                              for (int dim = 1; dim <= array_type.rank; dim++) {
 -                                      string length_cname = get_array_length_cname ("result", dim);
 -
 -                                      ccode.add_declaration ("int", new CCodeVariableDeclarator.zero 
(length_cname, new CCodeConstant ("0")));
 -                                      ccall.add_argument (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (length_cname)));
 -                              }
 -                      }
 -              }
 -
 -              var reply_expr = serialize_expression (prop.get_accessor.value_type, new CCodeIdentifier 
("result"));
 -
 -              ccode.add_declaration ("GVariant*", new CCodeVariableDeclarator ("_reply"));
 -              ccode.add_assignment (new CCodeIdentifier ("_reply"), reply_expr);
 -
 -              if (requires_destroy (prop.get_accessor.value_type)) {
 -                      // keep local alive (symbol_reference is weak)
 -                      var local = new LocalVariable (prop.get_accessor.value_type, ".result");
 -                      ccode.add_expression (destroy_local (local));
 -              }
 -
 -              ccode.add_return (new CCodeIdentifier ("_reply"));
 -
 -              pop_function ();
 -
 -              cfile.add_function_declaration (function);
 -              cfile.add_function (function);
 -
 -              return wrapper_name;
 -      }
 -
 -      string generate_dbus_property_set_wrapper (Property prop, ObjectTypeSymbol sym) {
 -              string wrapper_name = "_dbus_%s".printf (get_ccode_name (prop.set_accessor));
 -
 -              var function = new CCodeFunction (wrapper_name);
 -              function.modifiers = CCodeModifiers.STATIC;
 -              function.add_parameter (new CCodeParameter ("self", get_ccode_name (sym) + "*"));
 -              function.add_parameter (new CCodeParameter ("_value", "GVariant*"));
 -
 -              push_function (function);
 -
 -              var ccall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_name (prop.set_accessor)));
 -              ccall.add_argument (new CCodeIdentifier ("self"));
 -
 -              var owned_type = prop.property_type.copy ();
 -              owned_type.value_owned = true;
 -
 -              ccode.add_declaration (get_ccode_name (owned_type), new CCodeVariableDeclarator.zero 
("value", default_value_for_type (prop.property_type, true)));
 -
 -              var st = prop.property_type.data_type as Struct;
 -              if (st != null && !st.is_simple_type ()) {
 -                      ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("value")));
 -              } else {
 -                      ccall.add_argument (new CCodeIdentifier ("value"));
 -
 -                      var array_type = prop.property_type as ArrayType;
 -                      if (array_type != null) {
 -                              for (int dim = 1; dim <= array_type.rank; dim++) {
 -                                      ccode.add_declaration ("int", new CCodeVariableDeclarator 
(get_array_length_cname ("value", dim)));
 -                                      ccall.add_argument (new CCodeIdentifier (get_array_length_cname 
("value", dim)));
 -                              }
 -                      }
 -              }
 -
 -              var target = new CCodeIdentifier ("value");
 -              var expr = deserialize_expression (prop.property_type, new CCodeIdentifier ("_value"), 
target);
 -              ccode.add_assignment (target, expr);
 -
 -              ccode.add_expression (ccall);
 -
 -              if (requires_destroy (owned_type)) {
 -                      // keep local alive (symbol_reference is weak)
 -                      var local = new LocalVariable (owned_type, "value");
 -                      ccode.add_expression (destroy_local (local));
 -              }
 -
 -              pop_function ();
 -
 -              cfile.add_function_declaration (function);
 -              cfile.add_function (function);
 -
 -              return wrapper_name;
 +              return "_dbus_%s_%s".printf (get_ccode_lower_case_name (sym), get_ccode_name (sig));
        }
  
        void handle_signals (ObjectTypeSymbol sym, bool connect) {
diff --cc compiler/valacompiler.vala
index 3740f14,9c50fcb..6805519
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@@ -212,9 -219,9 +222,10 @@@ class Vala.Compiler 
                        context.directory = context.basedir;
                }
                context.vapi_directories = vapi_directories;
+               context.vapi_comments = vapi_comments;
                context.gir_directories = gir_directories;
                context.metadata_directories = metadata_directories;
 +              context.plugin_directories = plugin_directories;
                context.debug = debug;
                context.thread = thread;
                context.mem_profiler = mem_profiler;
diff --cc vala/Makefile.am
index 0a48f8c,54d01bd..bd57b48
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@@ -177,14 -175,22 +179,23 @@@ valainclude_HEADERS = 
        $(NULL)
  
  vala.vapi vala.vala.stamp: $(libvalacore_la_VALASOURCES)
-       $(VALA_V)$(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 
--pkg gmodule-2.0 --vapidir $(srcdir)/../gee --pkg gee --pkg config -H vala.h --library vala $^
+       $(VALA_V)$(VALAC) \
+               $(COVERAGE_VALAFLAGS) \
+               $(VALAFLAGS) \
+               -C \
 -              --vapidir $(top_srcdir)/vapi --pkg gobject-2.0 \
++              --vapidir $(top_srcdir)/vapi --pkg gobject-2.0 --pkg gmodule-2.0 \
+               --vapidir $(top_srcdir)/gee --pkg gee \
+               --pkg config \
+               -H vala.h \
+               --library vala \
+               $^
        @touch $@
  
  libvalacore_la_LIBADD = \
        $(COVERAGE_LIBS) \
        $(GLIB_LIBS) \
 +      $(GMODULE_LIBS) \
-       ../gee/libgee.la \
+       $(top_builddir)/gee/libgee.la \
        $(NULL)
  
  EXTRA_DIST = $(libvalacore_la_VALASOURCES) vala.vapi vala.vala.stamp
diff --cc vala/valacodecontext.vala
index b2277bc,00c242c..3875902
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@@ -731,5 -653,3 +736,5 @@@ public class Vala.CodeContext 
                return rpath;
        }
  }
 +
- public delegate void Vala.RegisterPluginFunction (Vala.CodeContext context);
++public delegate void Vala.RegisterPluginFunction (Vala.CodeContext context);


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