[vala/wip/attributes: 73/119] codegen: Add get_ccode_upper_case_name



commit ccc4391ed0d61520232520afe822e2c9c39ac74b
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Jun 29 22:28:59 2011 +0200

    codegen: Add get_ccode_upper_case_name

 codegen/valaccodebasemodule.vala         |   34 +++++++++++++++++----------
 codegen/valaccodememberaccessmodule.vala |   10 ++++----
 codegen/valaccodemethodcallmodule.vala   |    4 +-
 codegen/valaccodemethodmodule.vala       |    4 +-
 codegen/valadovadelegatemodule.vala      |    6 ++--
 codegen/valadovamemberaccessmodule.vala  |    6 ++--
 codegen/valadovaobjectmodule.vala        |    6 ++--
 codegen/valadovavaluemodule.vala         |    6 ++--
 codegen/valagdbusclientmodule.vala       |    4 +-
 codegen/valagerrormodule.vala            |    8 +++---
 codegen/valagobjectmodule.vala           |   10 ++++----
 codegen/valagsignalmodule.vala           |    2 +-
 codegen/valagtypemodule.vala             |   36 +++++++++++++++---------------
 13 files changed, 72 insertions(+), 64 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 7bef714..9359efc 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -749,7 +749,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 			} else if (m.is_class_member ()) {
 				TypeSymbol parent = (TypeSymbol)m.parent_symbol;
 
-				var get_class_private_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf(parent.get_upper_case_cname ())));
+				var get_class_private_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf(get_ccode_upper_case_name (parent))));
 				get_class_private_call.add_argument (new CCodeIdentifier ("klass"));
 				l = new CCodeMemberAccess.pointer (get_class_private_call, get_symbol_lock_name (m.name));
 			} else {
@@ -1008,7 +1008,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 			}
 
 			if (f.access == SymbolAccessibility.PRIVATE) {
-				var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (cl.get_upper_case_cname ())));
+				var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (get_ccode_upper_case_name (cl))));
 				ccall.add_argument (new CCodeIdentifier ("klass"));
 				lhs = new CCodeMemberAccess (ccall, get_ccode_name (f), true);
 			} else {
@@ -1460,11 +1460,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 			if (prop.parent_symbol is Interface) {
 				var iface = (Interface) prop.parent_symbol;
 
-				vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (iface.get_upper_case_cname (null))));
+				vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (get_ccode_upper_case_name (iface, null))));
 			} else {
 				var cl = (Class) prop.parent_symbol;
 
-				vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (cl.get_upper_case_cname (null))));
+				vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (cl, null))));
 			}
 			vcast.add_argument (new CCodeIdentifier ("self"));
 
@@ -3341,7 +3341,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 				klass = new CCodeIdentifier ("klass");
 			}
 
-			var get_class_private_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf(parent.get_upper_case_cname ())));
+			var get_class_private_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf(get_ccode_upper_case_name (parent))));
 			get_class_private_call.add_argument (klass);
 			l = new CCodeMemberAccess.pointer (get_class_private_call, get_symbol_lock_name (resource.symbol_reference.name));
 		} else {
@@ -4258,7 +4258,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 			} else {
 				creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_error_new"));
 			}
-			creation_call.add_argument (new CCodeIdentifier (edomain.get_upper_case_cname ()));
+			creation_call.add_argument (new CCodeIdentifier (get_ccode_upper_case_name (edomain)));
 			creation_call.add_argument (new CCodeIdentifier (get_ccode_name (ecode)));
 
 			foreach (Expression arg in expr.get_argument_list ()) {
@@ -4862,12 +4862,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		if (et != null && et.error_code != null) {
 			var matches_call = new CCodeFunctionCall (new CCodeIdentifier ("g_error_matches"));
 			matches_call.add_argument ((CCodeExpression) ccodenode);
-			matches_call.add_argument (new CCodeIdentifier (et.error_domain.get_upper_case_cname ()));
+			matches_call.add_argument (new CCodeIdentifier (get_ccode_upper_case_name (et.error_domain)));
 			matches_call.add_argument (new CCodeIdentifier (get_ccode_name (et.error_code)));
 			return matches_call;
 		} else if (et != null && et.error_domain != null) {
 			var instance_domain = new CCodeMemberAccess.pointer ((CCodeExpression) ccodenode, "domain");
-			var type_domain = new CCodeIdentifier (et.error_domain.get_upper_case_cname ());
+			var type_domain = new CCodeIdentifier (get_ccode_upper_case_name (et.error_domain));
 			return new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, instance_domain, type_domain);
 		} else {
 			string type_check_func = get_ccode_type_check_function (type.data_type);
@@ -5281,7 +5281,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		if (instance is BaseAccess) {
 			if (prop.base_property != null) {
 				var base_class = (Class) prop.base_property.parent_symbol;
-				var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (base_class.get_upper_case_cname (null))));
+				var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
 				vcast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (get_ccode_lower_case_name (current_class, null))));
 				
 				var ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, "set_%s".printf (prop.name)));
@@ -5597,6 +5597,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		}
 	}
 
+	public static string get_ccode_upper_case_name (Symbol sym, string? infix = null) {
+		if (sym is Property) {
+			return "%s_%s".printf (sym.parent_symbol.get_lower_case_cname (null), Symbol.camel_case_to_lower_case (sym.name)).up ();
+		} else {
+			return get_ccode_lower_case_name (sym, infix).up ();
+		}
+	}
+
 	public static List<string> get_ccode_header_filenames (Symbol sym) {
 		return get_ccode_attribute(sym).header_filenames;
 	}
@@ -5833,7 +5841,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 	}
 
 	public CCodeFunctionCall generate_instance_cast (CCodeExpression expr, TypeSymbol type) {
-		var result = new CCodeFunctionCall (new CCodeIdentifier (type.get_upper_case_cname (null)));
+		var result = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_upper_case_name (type, null)));
 		result.add_argument (expr);
 		return result;
 	}
@@ -6621,7 +6629,7 @@ public class Vala.CCodeAttribute : AttributeCache {
 		if (sym is ObjectTypeSymbol) {
 			return name;
 		} else if (sym is Enum || sym is ErrorDomain) {
-			return "%s_".printf (((TypeSymbol) sym).get_upper_case_cname (null));
+			return "%s_".printf (get_ccode_upper_case_name (sym));
 		} else if (sym is Namespace) {
 			if (sym.name != null) {
 				var parent_prefix = "";
@@ -6739,7 +6747,7 @@ public class Vala.CCodeAttribute : AttributeCache {
 	private string get_default_type_id () {
 		if (sym != null) {
 			if (sym is Class && !((Class) sym).is_compact || sym is Interface) {
-			return ((Class) sym).get_upper_case_cname ("TYPE_");
+				return get_ccode_upper_case_name (sym, "TYPE_");
 			} else if (sym is ErrorType && sym.source_reference != null && sym.source_reference.file.context.require_glib_version (2, 26)) {
 				return "G_TYPE_ERROR";
 			} else if (sym is Struct) {
@@ -6753,7 +6761,7 @@ public class Vala.CCodeAttribute : AttributeCache {
 						return "G_TYPE_POINTER";
 				}
 				} else {
-					return st.get_upper_case_cname ("TYPE_");
+					return get_ccode_upper_case_name (st, "TYPE_");
 				}
 			} else if (sym is VoidType) {
 				return "G_TYPE_NONE";
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 28480a3..9b88c20 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -51,7 +51,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 			if (expr.inner is BaseAccess) {
 				if (m.base_method != null) {
 					var base_class = (Class) m.base_method.parent_symbol;
-					var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (base_class.get_upper_case_cname (null))));
+					var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
 					vcast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (get_ccode_lower_case_name (current_class, null))));
 					
 					set_cvalue (expr, new CCodeMemberAccess.pointer (vcast, get_ccode_vfunc_name (m)));
@@ -78,7 +78,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 						set_cvalue (expr.inner, ctemp);
 					}
 					var base_class = (Class) m.base_method.parent_symbol;
-					var vclass = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (base_class.get_upper_case_cname (null))));
+					var vclass = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
 					vclass.add_argument (inst);
 					set_cvalue (expr, new CCodeMemberAccess.pointer (vclass, m.name));
 				} else {
@@ -179,7 +179,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 			if (expr.inner is BaseAccess) {
 				if (prop.base_property != null) {
 					var base_class = (Class) prop.base_property.parent_symbol;
-					var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (base_class.get_upper_case_cname (null))));
+					var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
 					vcast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (get_ccode_lower_case_name (current_class, null))));
 					
 					var ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, "get_%s".printf (prop.name)));
@@ -599,7 +599,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 			}
 		} else if (field.binding == MemberBinding.CLASS) {
 			var cl = (Class) field.parent_symbol;
-			var cast = new CCodeFunctionCall (new CCodeIdentifier (cl.get_upper_case_cname (null) + "_CLASS"));
+			var cast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_upper_case_name (cl, null) + "_CLASS"));
 
 			CCodeExpression klass;
 			if (instance == null) {
@@ -621,7 +621,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 			cast.add_argument (klass);
 
 			if (field.access == SymbolAccessibility.PRIVATE) {
-				var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (cl.get_upper_case_cname ())));
+				var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (get_ccode_upper_case_name (cl))));
 				ccall.add_argument (klass);
 				result.cvalue = new CCodeMemberAccess.pointer (ccall, get_ccode_name (field));
 			} else {
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 5f6152a..6c2c9ef 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -83,7 +83,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 			if (ma.inner is BaseAccess) {
 				if (m.base_method != null) {
 					var base_class = (Class) m.base_method.parent_symbol;
-					var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (base_class.get_upper_case_cname (null))));
+					var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
 					vcast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (get_ccode_lower_case_name (current_class, null))));
 
 					async_call.call = new CCodeMemberAccess.pointer (vcast, get_ccode_vfunc_name (m));
@@ -207,7 +207,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 			out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
 		} else if (m != null && m.binding == MemberBinding.CLASS) {
 			var cl = (Class) m.parent_symbol;
-			var cast = new CCodeFunctionCall (new CCodeIdentifier (cl.get_upper_case_cname (null) + "_CLASS"));
+			var cast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_upper_case_name (cl, null) + "_CLASS"));
 			
 			CCodeExpression klass;
 			if (ma.inner == null) {
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index e9a68c4..f469368 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -896,11 +896,11 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
 		if (m.parent_symbol is Interface) {
 			var iface = (Interface) m.parent_symbol;
 
-			vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (iface.get_upper_case_cname (null))));
+			vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (get_ccode_upper_case_name (iface))));
 		} else {
 			var cl = (Class) m.parent_symbol;
 
-			vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (cl.get_upper_case_cname (null))));
+			vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (cl))));
 		}
 		vcast.add_argument (new CCodeIdentifier ("self"));
 	
diff --git a/codegen/valadovadelegatemodule.vala b/codegen/valadovadelegatemodule.vala
index 24e9bbb..f8d6106 100644
--- a/codegen/valadovadelegatemodule.vala
+++ b/codegen/valadovadelegatemodule.vala
@@ -83,7 +83,7 @@ public class Vala.DovaDelegateModule : DovaValueModule {
 		init_call.add_argument (new CCodeIdentifier ("target"));
 		function.block.add_statement (new CCodeExpressionStatement (init_call));
 
-		var priv = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (d.get_upper_case_cname ())));
+		var priv = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (get_ccode_upper_case_name (d))));
 		priv.add_argument (new CCodeIdentifier ("this"));
 		var assignment = new CCodeAssignment (new CCodeMemberAccess.pointer (priv, "method"), new CCodeIdentifier ("method"));
 		function.block.add_statement (new CCodeExpressionStatement (assignment));
@@ -135,7 +135,7 @@ public class Vala.DovaDelegateModule : DovaValueModule {
 		cdecl.add_declarator (new CCodeVariableDeclarator ("target", get_target));
 		function.block.add_statement (cdecl);
 
-		var priv = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (d.get_upper_case_cname ())));
+		var priv = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (get_ccode_upper_case_name (d))));
 		priv.add_argument (new CCodeIdentifier ("this"));
 
 		string instance_param_list = "(DovaObject *";
@@ -203,7 +203,7 @@ public class Vala.DovaDelegateModule : DovaValueModule {
 		cfile.add_type_definition (instance_priv_struct);
 
 		string macro = "((%sPrivate *) (((char *) o) + _%s_object_offset))".printf (get_ccode_name (d), d.get_lower_case_cname ());
-		cfile.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (d.get_upper_case_cname (null)), macro));
+		cfile.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (get_ccode_upper_case_name (d, null)), macro));
 
 		var cdecl = new CCodeDeclaration ("intptr_t");
 		cdecl.add_declarator (new CCodeVariableDeclarator ("_%s_object_offset".printf (d.get_lower_case_cname ()), new CCodeConstant ("0")));
diff --git a/codegen/valadovamemberaccessmodule.vala b/codegen/valadovamemberaccessmodule.vala
index 378a853..deb5d05 100644
--- a/codegen/valadovamemberaccessmodule.vala
+++ b/codegen/valadovamemberaccessmodule.vala
@@ -77,7 +77,7 @@ public abstract class Vala.DovaMemberAccessModule : DovaControlFlowModule {
 						set_cvalue (expr.inner, ctemp);
 					}
 					var base_class = (Class) m.base_method.parent_symbol;
-					var vclass = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (base_class.get_upper_case_cname (null))));
+					var vclass = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
 					vclass.add_argument (inst);
 					set_cvalue (expr, new CCodeMemberAccess.pointer (vclass, m.name));
 				} else {
@@ -134,7 +134,7 @@ public abstract class Vala.DovaMemberAccessModule : DovaControlFlowModule {
 			if (expr.inner is BaseAccess) {
 				if (prop.base_property != null) {
 					var base_class = (Class) prop.base_property.parent_symbol;
-					var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (base_class.get_upper_case_cname (null))));
+					var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
 					vcast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (current_class.get_lower_case_cname (null))));
 
 					var ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, "get_%s".printf (prop.name)));
@@ -268,7 +268,7 @@ public abstract class Vala.DovaMemberAccessModule : DovaControlFlowModule {
 
 			CCodeExpression inst;
 			if (dova_priv) {
-				var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (cl.get_upper_case_cname (null))));
+				var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (get_ccode_upper_case_name (cl, null))));
 				priv_call.add_argument (pub_inst);
 				inst = priv_call;
 			} else {
diff --git a/codegen/valadovaobjectmodule.vala b/codegen/valadovaobjectmodule.vala
index 17cd9b2..2eeb6d8 100644
--- a/codegen/valadovaobjectmodule.vala
+++ b/codegen/valadovaobjectmodule.vala
@@ -279,7 +279,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			type_offset = new CCodeConstant ("0");
 		}
 		if (!instance_priv_struct.is_empty) {
-			decl_space.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (cl.get_upper_case_cname (null)), macro));
+			decl_space.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (get_ccode_upper_case_name (cl, null)), macro));
 		}
 
 		cdecl = new CCodeDeclaration ("intptr_t");
@@ -770,7 +770,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			if (f.binding == MemberBinding.INSTANCE)  {
 				CCodeExpression lhs = null;
 				if (f.is_internal_symbol ()) {
-					var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (cl.get_upper_case_cname (null))));
+					var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (get_ccode_upper_case_name (cl, null))));
 					priv_call.add_argument (new CCodeIdentifier ("this"));
 					lhs = new CCodeMemberAccess.pointer (priv_call, get_ccode_name (f));
 				} else {
@@ -1780,7 +1780,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 				var calloc_call = new CCodeFunctionCall (new CCodeIdentifier ("calloc"));
 				calloc_call.add_argument (new CCodeConstant ("1"));
 				calloc_call.add_argument (type_get_value_size);
-				var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (current_class.get_upper_case_cname (null))));
+				var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (get_ccode_upper_case_name (current_class, null))));
 				priv_call.add_argument (new CCodeIdentifier ("this"));
 
 				vblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (priv_call, f.name), calloc_call)));
diff --git a/codegen/valadovavaluemodule.vala b/codegen/valadovavaluemodule.vala
index 9ddb11e..f74e7f0 100644
--- a/codegen/valadovavaluemodule.vala
+++ b/codegen/valadovavaluemodule.vala
@@ -76,7 +76,7 @@ public class Vala.DovaValueModule : DovaObjectModule {
 		cfile.add_type_member_declaration (cdecl);
 
 		string macro = "((%s *) (((char *) o) + _%s_object_offset))".printf (get_ccode_name (st), st.get_lower_case_cname ());
-		cfile.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (st.get_upper_case_cname (null)), macro));
+		cfile.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (get_ccode_upper_case_name (st, null)), macro));
 
 
 		cdecl = new CCodeDeclaration ("DovaType *");
@@ -228,7 +228,7 @@ public class Vala.DovaValueModule : DovaObjectModule {
 		cdecl = new CCodeDeclaration ("DovaObject *");
 		cdecl.add_declarator (new CCodeVariableDeclarator ("result", alloc_call));
 		value_to_any_fun.block.add_statement (cdecl);
-		var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (st.get_upper_case_cname (null))));
+		var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (get_ccode_upper_case_name (st, null))));
 		priv_call.add_argument (new CCodeIdentifier ("result"));
 		var copy_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_copy".printf (st.get_lower_case_cname ())));
 		copy_call.add_argument (priv_call);
@@ -253,7 +253,7 @@ public class Vala.DovaValueModule : DovaObjectModule {
 		value_from_any_fun.add_parameter (new CCodeParameter ("value", get_ccode_name (st) + "*"));
 		value_from_any_fun.add_parameter (new CCodeParameter ("value_index", "intptr_t"));
 		value_from_any_fun.block = new CCodeBlock ();
-		priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (st.get_upper_case_cname (null))));
+		priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (get_ccode_upper_case_name (st, null))));
 		priv_call.add_argument (new CCodeIdentifier ("any_"));
 		copy_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_copy".printf (st.get_lower_case_cname ())));
 		copy_call.add_argument (new CCodeIdentifier ("value"));
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 949d423..7b1ea67 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -128,7 +128,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 		}
 
 		result += "G_IMPLEMENT_INTERFACE (%s, %sproxy_%sinterface_init) ".printf (
-			iface.get_upper_case_cname ("TYPE_"),
+			get_ccode_upper_case_name (iface, "TYPE_"),
 			get_ccode_lower_case_prefix (main_iface),
 			get_ccode_lower_case_prefix (iface));
 		return result;
@@ -529,7 +529,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 			foreach (var error_type in m.get_error_types ()) {
 				var errtype = (ErrorType) error_type;
 				if (errtype.error_domain != null) {
-					ccode.add_expression (new CCodeIdentifier (errtype.error_domain.get_upper_case_cname ()));
+					ccode.add_expression (new CCodeIdentifier (get_ccode_upper_case_name (errtype.error_domain)));
 				}
 			}
 
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index cbad76a..386da2b 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -48,7 +48,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 
 		string quark_fun_name = get_ccode_lower_case_prefix (edomain) + "quark";
 
-		var error_domain_define = new CCodeMacroReplacement (edomain.get_upper_case_cname (), quark_fun_name + " ()");
+		var error_domain_define = new CCodeMacroReplacement (get_ccode_upper_case_name (edomain), quark_fun_name + " ()");
 		decl_space.add_type_definition (error_domain_define);
 
 		var cquark_fun = new CCodeFunction (quark_fun_name, get_ccode_name (gquark_type.data_type));
@@ -217,7 +217,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 							/* catch clause specifies a specific error code */
 							var error_match = new CCodeFunctionCall (new CCodeIdentifier ("g_error_matches"));
 							error_match.add_argument (inner_error);
-							error_match.add_argument (new CCodeIdentifier (catch_type.data_type.get_upper_case_cname ()));
+							error_match.add_argument (new CCodeIdentifier (get_ccode_upper_case_name (catch_type.data_type)));
 							error_match.add_argument (new CCodeIdentifier (get_ccode_name (catch_type.error_code)));
 
 							ccode.open_if (error_match);
@@ -225,7 +225,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 							/* catch clause specifies a full error domain */
 							var ccond = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY,
 									new CCodeMemberAccess.pointer (inner_error, "domain"), new CCodeIdentifier
-									(clause.error_type.data_type.get_upper_case_cname ()));
+									(get_ccode_upper_case_name (clause.error_type.data_type)));
 
 							ccode.open_if (ccond);
 						}
@@ -265,7 +265,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 
 				// Check the allowed error domains to propagate
 				var domain_check = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, new CCodeMemberAccess.pointer
-					(inner_error, "domain"), new CCodeIdentifier (error_type.data_type.get_upper_case_cname ()));
+					(inner_error, "domain"), new CCodeIdentifier (get_ccode_upper_case_name (error_type.data_type)));
 				if (ccond == null) {
 					ccond = domain_check;
 				} else {
diff --git a/codegen/valagobjectmodule.vala b/codegen/valagobjectmodule.vala
index 6d95c24..61bf851 100644
--- a/codegen/valagobjectmodule.vala
+++ b/codegen/valagobjectmodule.vala
@@ -140,14 +140,14 @@ public class Vala.GObjectModule : GTypeModule {
 			if (prop.overrides || prop.base_interface_property != null) {
 				var cinst = new CCodeFunctionCall (new CCodeIdentifier ("g_object_class_override_property"));
 				cinst.add_argument (ccall);
-				cinst.add_argument (new CCodeConstant (prop.get_upper_case_cname ()));
+				cinst.add_argument (new CCodeConstant (get_ccode_upper_case_name (prop)));
 				cinst.add_argument (prop.get_canonical_cconstant ());
 			
 				ccode.add_expression (cinst);
 			} else {
 				var cinst = new CCodeFunctionCall (new CCodeIdentifier ("g_object_class_install_property"));
 				cinst.add_argument (ccall);
-				cinst.add_argument (new CCodeConstant (prop.get_upper_case_cname ()));
+				cinst.add_argument (new CCodeConstant (get_ccode_upper_case_name (prop)));
 				cinst.add_argument (get_param_spec (prop));
 			
 				ccode.add_expression (cinst);
@@ -213,7 +213,7 @@ public class Vala.GObjectModule : GTypeModule {
 				generate_property_accessor_declaration (prop.base_interface_property.get_accessor, cfile);
 			}
 
-			ccode.add_case (new CCodeIdentifier (prop.get_upper_case_cname ()));
+			ccode.add_case (new CCodeIdentifier (get_ccode_upper_case_name (prop)));
 			if (prop.property_type.is_real_struct_type ()) {
 				var st = prop.property_type.data_type as Struct;
 
@@ -312,7 +312,7 @@ public class Vala.GObjectModule : GTypeModule {
 				generate_property_accessor_declaration (prop.base_interface_property.set_accessor, cfile);
 			}
 
-			ccode.add_case (new CCodeIdentifier (prop.get_upper_case_cname ()));
+			ccode.add_case (new CCodeIdentifier (get_ccode_upper_case_name (prop)));
 			ccall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_name (base_prop.set_accessor)));
 			ccall.add_argument (cself);
 			if (prop.property_type is ArrayType && ((ArrayType)prop.property_type).element_type.data_type == string_type.data_type) {
@@ -664,7 +664,7 @@ public class Vala.GObjectModule : GTypeModule {
 		base.visit_property (prop);
 
 		if (is_gobject_property (prop) && prop.parent_symbol is Class) {
-			prop_enum.add_value (new CCodeEnumValue (prop.get_upper_case_cname ()));
+			prop_enum.add_value (new CCodeEnumValue (get_ccode_upper_case_name (prop)));
 		}
 	}
 
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index 8f7b223..50eda03 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -472,7 +472,7 @@ public class Vala.GSignalModule : GObjectModule {
 			if (expr.inner is BaseAccess && sig.is_virtual) {
 				var m = sig.default_handler;
 				var base_class = (Class) m.parent_symbol;
-				var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (base_class.get_upper_case_cname (null))));
+				var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
 				vcast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (get_ccode_lower_case_name (current_class))));
 				
 				set_cvalue (expr, new CCodeMemberAccess.pointer (vcast, m.name));
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 319a624..543a1c3 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -67,10 +67,10 @@ public class Vala.GTypeModule : GErrorModule {
 			decl_space.add_type_declaration (new CCodeMacroReplacement (get_ccode_type_id (cl), macro));
 
 			macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
-			decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (cl.get_upper_case_cname (null)), macro));
+			decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_upper_case_name (cl, null)), macro));
 
 			macro = "(G_TYPE_CHECK_CLASS_CAST ((klass), %s, %sClass))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
-			decl_space.add_type_declaration (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (cl.get_upper_case_cname (null)), macro));
+			decl_space.add_type_declaration (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (get_ccode_upper_case_name (cl, null)), macro));
 
 			macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (get_ccode_type_id (cl));
 			decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_type_check_function (cl)), macro));
@@ -79,7 +79,7 @@ public class Vala.GTypeModule : GErrorModule {
 			decl_space.add_type_declaration (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (get_ccode_type_check_function (cl)), macro));
 
 			macro = "(G_TYPE_INSTANCE_GET_CLASS ((obj), %s, %sClass))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
-			decl_space.add_type_declaration (new CCodeMacroReplacement ("%s_GET_CLASS(obj)".printf (cl.get_upper_case_cname (null)), macro));
+			decl_space.add_type_declaration (new CCodeMacroReplacement ("%s_GET_CLASS(obj)".printf (get_ccode_upper_case_name (cl, null)), macro));
 			decl_space.add_type_declaration (new CCodeNewline ());
 		}
 
@@ -501,7 +501,7 @@ public class Vala.GTypeModule : GErrorModule {
 			if (cl.has_private_fields || cl.get_type_parameters ().size > 0) {
 				decl_space.add_type_definition (instance_priv_struct);
 				var macro = "(G_TYPE_INSTANCE_GET_PRIVATE ((o), %s, %sPrivate))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
-				decl_space.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (cl.get_upper_case_cname (null)), macro));
+				decl_space.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (get_ccode_upper_case_name (cl, null)), macro));
 			}
 
 			if (cl.has_class_private_fields || has_class_locks) {
@@ -513,7 +513,7 @@ public class Vala.GTypeModule : GErrorModule {
 				} else {
 					macro = "((%sClassPrivate *) g_type_get_qdata (G_TYPE_FROM_CLASS (klass), _vala_%s_class_private_quark))".printf (get_ccode_name (cl), get_ccode_lower_case_name (cl));
 				}
-				decl_space.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_CLASS_PRIVATE(klass)".printf (cl.get_upper_case_cname (null)), macro));
+				decl_space.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_CLASS_PRIVATE(klass)".printf (get_ccode_upper_case_name (cl, null)), macro));
 			}
 			decl_space.add_type_member_declaration (prop_enum);
 		} else {
@@ -545,7 +545,7 @@ public class Vala.GTypeModule : GErrorModule {
 		}
 
 		prop_enum = new CCodeEnum ();
-		prop_enum.add_value (new CCodeEnumValue ("%s_DUMMY_PROPERTY".printf (cl.get_upper_case_cname (null))));
+		prop_enum.add_value (new CCodeEnumValue ("%s_DUMMY_PROPERTY".printf (get_ccode_upper_case_name (cl, null))));
 		class_init_context = new EmitContext (cl);
 		base_init_context = new EmitContext (cl);
 		class_finalize_context = new EmitContext (cl);
@@ -675,11 +675,11 @@ public class Vala.GTypeModule : GErrorModule {
 				ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ref_count));
 				ccode.open_if (ccall);
 
-				var get_class = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (cl.get_upper_case_cname (null))));
+				var get_class = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (cl, null))));
 				get_class.add_argument (new CCodeIdentifier ("self"));
 
 				// finalize class
-				var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (cl.get_upper_case_cname (null))));
+				var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (cl, null))));
 				ccast.add_argument (new CCodeIdentifier ("self"));
 				ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (ccast, "finalize"));
 				ccall.add_argument (new CCodeIdentifier ("self"));
@@ -1120,7 +1120,7 @@ public class Vala.GTypeModule : GErrorModule {
 			ccode.add_assignment (new CCodeIdentifier ("parent_type"), ccall);
 
 			ccode.open_if (new CCodeIdentifier ("parent_type"));
-			ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (cl.get_upper_case_cname (null))));
+			ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (get_ccode_upper_case_name (cl, null))));
 			ccall2 = new CCodeFunctionCall (new CCodeIdentifier ("g_type_class_peek"));
 			ccall2.add_argument (new CCodeIdentifier ("parent_type"));
 			ccall.add_argument (ccall2);
@@ -1192,7 +1192,7 @@ public class Vala.GTypeModule : GErrorModule {
 				fundamental_class = fundamental_class.base_class;
 			}
 
-			ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (fundamental_class.get_upper_case_cname (null))));
+			ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (fundamental_class, null))));
 			ccall.add_argument (new CCodeIdentifier ("klass"));
 			var finalize_assignment = new CCodeAssignment (new CCodeMemberAccess.pointer (ccall, "finalize"), new CCodeIdentifier (get_ccode_lower_case_prefix (cl) + "finalize"));
 			ccode.add_expression (finalize_assignment);
@@ -1215,7 +1215,7 @@ public class Vala.GTypeModule : GErrorModule {
 
 			// there is currently no default handler for abstract async methods
 			if (!m.is_abstract || !m.coroutine) {
-				var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (((Class) base_type).get_upper_case_cname (null))));
+				var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_type))));
 				ccast.add_argument (new CCodeIdentifier ("klass"));
 
 				ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name (m.base_method)), new CCodeIdentifier (m.get_real_cname ()));
@@ -1231,7 +1231,7 @@ public class Vala.GTypeModule : GErrorModule {
 			if (sig.default_handler == null) {
 				continue;
 			}
-			var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (cl.get_upper_case_cname (null))));
+			var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (cl, null))));
 			ccast.add_argument (new CCodeIdentifier ("klass"));
 			ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name (sig.default_handler)), new CCodeIdentifier (sig.default_handler.get_real_cname ()));
 		}
@@ -1243,7 +1243,7 @@ public class Vala.GTypeModule : GErrorModule {
 			}
 			var base_type = prop.base_property.parent_symbol;
 			
-			var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (((Class) base_type).get_upper_case_cname (null))));
+			var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_type))));
 			ccast.add_argument (new CCodeIdentifier ("klass"));
 
 			if (prop.get_accessor != null) {
@@ -1501,7 +1501,7 @@ public class Vala.GTypeModule : GErrorModule {
 		}
 
 		if (!cl.is_compact && (cl.has_private_fields || cl.get_type_parameters ().size > 0)) {
-			var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (cl.get_upper_case_cname (null))));
+			var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (get_ccode_upper_case_name (cl, null))));
 			ccall.add_argument (new CCodeIdentifier ("self"));
 			func.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), ccall);
 		}
@@ -1562,7 +1562,7 @@ public class Vala.GTypeModule : GErrorModule {
 			cdecl.add_declarator (new CCodeVariableDeclarator ("priv"));
 			ccode.add_statement (cdecl);
 
-			var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (cl.get_upper_case_cname (null))));
+			var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (get_ccode_upper_case_name (cl, null))));
 			ccall.add_argument (new CCodeConstant ("klass"));
 			ccode.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("priv"), ccall)));
 
@@ -1635,7 +1635,7 @@ public class Vala.GTypeModule : GErrorModule {
 
 			// chain up to finalize function of the base class
 			if (cl.base_class != null) {
-				var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (fundamental_class.get_upper_case_cname ())));
+				var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (fundamental_class))));
 				ccast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (get_ccode_lower_case_name (cl, null))));
 				var ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (ccast, "finalize"));
 				ccall.add_argument (new CCodeIdentifier ("obj"));
@@ -1855,13 +1855,13 @@ public class Vala.GTypeModule : GErrorModule {
 		decl_space.add_type_declaration (new CCodeMacroReplacement (get_ccode_type_id (iface), macro));
 
 		macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (get_ccode_type_id (iface), get_ccode_name (iface));
-		decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname (null)), macro));
+		decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_upper_case_name (iface, null)), macro));
 
 		macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (get_ccode_type_id (iface));
 		decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_type_check_function (iface)), macro));
 
 		macro = "(G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, %s))".printf (get_ccode_type_id (iface), iface.get_type_cname ());
-		decl_space.add_type_declaration (new CCodeMacroReplacement ("%s_GET_INTERFACE(obj)".printf (iface.get_upper_case_cname (null)), macro));
+		decl_space.add_type_declaration (new CCodeMacroReplacement ("%s_GET_INTERFACE(obj)".printf (get_ccode_upper_case_name (iface, null)), macro));
 		decl_space.add_type_declaration (new CCodeNewline ());
 
 		decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (get_ccode_name (iface)), new CCodeVariableDeclarator (get_ccode_name (iface))));



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