vala r2013 - in trunk: . compiler gobject vala



Author: juergbi
Date: Thu Nov 13 16:27:14 2008
New Revision: 2013
URL: http://svn.gnome.org/viewvc/vala?rev=2013&view=rev

Log:
2008-11-13  JÃrg Billeter  <j bitron ch>

	* vala/valacodecontext.vala:
	* gobject/valadbusclientmodule.vala:
	* compiler/valacompiler.vala:

	Add --disable-dbus-transformation command-line option to disable
	case transformation of D-Bus member names in dynamic D-Bus client
	support, this option will be removed again when Vala gains static
	D-Bus client support


Modified:
   trunk/ChangeLog
   trunk/compiler/valacompiler.vala
   trunk/gobject/valadbusclientmodule.vala
   trunk/vala/valacodecontext.vala

Modified: trunk/compiler/valacompiler.vala
==============================================================================
--- trunk/compiler/valacompiler.vala	(original)
+++ trunk/compiler/valacompiler.vala	Thu Nov 13 16:27:14 2008
@@ -45,6 +45,7 @@
 	static bool enable_checking;
 	static bool disable_non_null;
 	static bool non_null_experimental;
+	static bool disable_dbus_transformation;
 	static string cc_command;
 	[NoArrayLength]
 	static string[] cc_options;
@@ -69,6 +70,7 @@
 		{ "enable-checking", 0, 0, OptionArg.NONE, ref enable_checking, "Enable additional run-time checks", null },
 		{ "disable-non-null", 0, 0, OptionArg.NONE, ref disable_non_null, "Disable non-null types", null },
 		{ "enable-non-null-experimental", 0, 0, OptionArg.NONE, ref non_null_experimental, "Enable experimental enhancements for non-null types", null },
+		{ "disable-dbus-transformation", 0, 0, OptionArg.NONE, ref disable_dbus_transformation, "Disable transformation of D-Bus member names", null },
 		{ "cc", 0, 0, OptionArg.STRING, ref cc_command, "Use COMMAND as C compiler command", "COMMAND" },
 		{ "Xcc", 'X', 0, OptionArg.STRING_ARRAY, ref cc_options, "Pass OPTION to the C compiler", "OPTION..." },
 		{ "save-temps", 0, 0, OptionArg.NONE, ref save_temps, "Keep temporary files", null },
@@ -150,6 +152,7 @@
 		context.checking = enable_checking;
 		context.non_null = !disable_non_null || non_null_experimental;
 		context.non_null_experimental = non_null_experimental;
+		context.dbus_transformation = !disable_dbus_transformation;
 		Report.set_verbose_errors (!quiet_mode);
 
 		context.ccode_only = ccode_only;

Modified: trunk/gobject/valadbusclientmodule.vala
==============================================================================
--- trunk/gobject/valadbusclientmodule.vala	(original)
+++ trunk/gobject/valadbusclientmodule.vala	Thu Nov 13 16:27:14 2008
@@ -35,6 +35,16 @@
 		base (codegen, next);
 	}
 
+	string get_dynamic_dbus_name (string vala_name) {
+		// TODO switch default to no transformation as soon as we have static D-Bus client support
+		// keep transformation by default for static D-Bus client and server support
+		if (context.dbus_transformation) {
+			return Symbol.lower_case_to_camel_case (vala_name);
+		} else {
+			return vala_name;
+		}
+	}
+
 	public override void generate_dynamic_method_wrapper (DynamicMethod method) {
 		var dynamic_method = (DynamicMethod) method;
 
@@ -107,7 +117,7 @@
 			arg_index++;
 		}
 
-		ccall.add_argument (new CCodeConstant ("\"%s\"".printf (Symbol.lower_case_to_camel_case (method.name))));
+		ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dynamic_dbus_name (method.name))));
 
 		if (callback != null) {
 			var reply_method = (Method) callback.symbol_reference;
@@ -614,7 +624,7 @@
 		ccall.add_argument (get_iface);
 
 		ccall.add_argument (new CCodeIdentifier ("G_TYPE_STRING"));
-		ccall.add_argument (new CCodeConstant ("\"%s\"".printf (Symbol.lower_case_to_camel_case (node.name))));
+		ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dynamic_dbus_name (node.name))));
 
 		ccall.add_argument (new CCodeIdentifier ("G_TYPE_INVALID"));
 
@@ -675,7 +685,7 @@
 		ccall.add_argument (get_iface);
 
 		ccall.add_argument (new CCodeIdentifier ("G_TYPE_STRING"));
-		ccall.add_argument (new CCodeConstant ("\"%s\"".printf (Symbol.lower_case_to_camel_case (node.name))));
+		ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dynamic_dbus_name (node.name))));
 
 		ccall.add_argument (new CCodeIdentifier ("G_TYPE_VALUE"));
 		ccall.add_argument (val_ptr);
@@ -751,7 +761,7 @@
 
 		var add_call = new CCodeFunctionCall (new CCodeIdentifier ("dbus_g_proxy_add_signal"));
 		add_call.add_argument (new CCodeIdentifier ("obj"));
-		add_call.add_argument (new CCodeConstant ("\"%s\"".printf (Symbol.lower_case_to_camel_case (sig.name))));
+		add_call.add_argument (new CCodeConstant ("\"%s\"".printf (get_dynamic_dbus_name (sig.name))));
 
 		bool first = true;
 		foreach (FormalParameter param in m.get_parameters ()) {

Modified: trunk/vala/valacodecontext.vala
==============================================================================
--- trunk/vala/valacodecontext.vala	(original)
+++ trunk/vala/valacodecontext.vala	Thu Nov 13 16:27:14 2008
@@ -61,6 +61,11 @@
 	public bool non_null_experimental { get; set; }
 
 	/**
+	 * Enable transformation of D-Bus member names in dynamic client support.
+	 */
+	public bool dbus_transformation { get; set; }
+
+	/**
 	 * Output C code, don't compile to object code.
 	 */
 	public bool ccode_only { get; set; }



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