[vala/wip/attributes: 4/13] dova: Use get_ccode_name in the codegen



commit b93a8347b8bf1b921ef8b2cabd3ced6cd663b77c
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Jun 25 18:14:43 2011 +0200

    dova: Use get_ccode_name in the codegen

 codegen/valaccodebasemodule.vala        |   30 +++++-
 codegen/valadovaarraymodule.vala        |    2 +-
 codegen/valadovaassignmentmodule.vala   |    2 +-
 codegen/valadovabasemodule.vala         |   94 +++++++++--------
 codegen/valadovadelegatemodule.vala     |   22 ++--
 codegen/valadovaerrormodule.vala        |    2 +-
 codegen/valadovamemberaccessmodule.vala |   18 ++--
 codegen/valadovamethodcallmodule.vala   |    2 +-
 codegen/valadovaobjectmodule.vala       |  180 +++++++++++++++---------------
 codegen/valadovastructmodule.vala       |   12 +-
 codegen/valadovavaluemodule.vala        |   20 ++--
 11 files changed, 206 insertions(+), 178 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index f92dcdb..199e4b1 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -789,7 +789,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
 			var initializer_list = c.value as InitializerList;
 			if (initializer_list != null) {
-				var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ());
+				var cdecl = new CCodeDeclaration (get_ccode_const_name (c.type_reference));
 				var arr = "";
 				if (c.type_reference is ArrayType) {
 					arr = "[%d]".printf (initializer_list.size);
@@ -825,7 +825,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
 			c.value.emit (this);
 
-			string type_name = c.type_reference.get_const_cname ();
+			string type_name = get_ccode_const_name (c.type_reference);
 			string arr = "";
 			if (c.type_reference is ArrayType) {
 				arr = "[]";
@@ -6011,6 +6011,12 @@ public class Vala.CCodeAttribute : AttributeCache {
 			}
 		} else if (node is ObjectType) {
 			var type = (ObjectType) node;
+			if (CodeContext.get ().profile == Profile.DOVA) {
+				if (type.type_symbol.get_full_name () == "string") {
+					return "string_t";
+				}
+			}
+
 			string cname;
 			if (!type.value_owned) {
 				cname = CCodeBaseModule.get_ccode_const_name (type.type_symbol);
@@ -6024,11 +6030,19 @@ public class Vala.CCodeAttribute : AttributeCache {
 			if (type.inline_allocated) {
 				return cname;
 			} else {
-				return "%s*".printf (cname);
+				if (CodeContext.get ().profile == Profile.DOVA) {
+					return "DovaArray";
+				} else {
+					return "%s*".printf (cname);
+				}
 			}
 		} else if (node is DelegateType) {
 			var type = (DelegateType) node;
-			return CCodeBaseModule.get_ccode_name (type.delegate_symbol);
+			if (CodeContext.get ().profile == Profile.DOVA) {
+				return "%s*".printf (CCodeBaseModule.get_ccode_name (type.delegate_symbol));
+			} else {
+				return CCodeBaseModule.get_ccode_name (type.delegate_symbol);
+			}
 		} else if (node is ErrorType) {
 			return "GError*";
 		} else if (node is GenericType) {
@@ -6038,8 +6052,14 @@ public class Vala.CCodeAttribute : AttributeCache {
 			} else {
 				return "gconstpointer";
 			}
-		} else if (node is MethodType || node is NullType) {
+		} else if (node is MethodType) {
 			return "gpointer";
+		} else if (node is NullType) {
+			if (CodeContext.get ().profile == Profile.GOBJECT) {
+				return "gpointer";
+			} else {
+				return "void *";
+			}
 		} else if (node is PointerType) {
 			var type = (PointerType) node;
 			if (type.base_type.data_type != null && type.base_type.data_type.is_reference_type ()) {
diff --git a/codegen/valadovaarraymodule.vala b/codegen/valadovaarraymodule.vala
index 4a3150c..0246cf7 100644
--- a/codegen/valadovaarraymodule.vala
+++ b/codegen/valadovaarraymodule.vala
@@ -82,7 +82,7 @@ public class Vala.DovaArrayModule : DovaMethodCallModule {
 		var array_type = (ArrayType) expr.container.value_type;
 
 		var array = new CCodeFunctionCall (new CCodeIdentifier ("dova_array"));
-		array.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeCastExpression (new CCodeMemberAccess (ccontainer, "data"), array_type.element_type.get_cname () + "*"), cstart));
+		array.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeCastExpression (new CCodeMemberAccess (ccontainer, "data"), get_ccode_name (array_type.element_type) + "*"), cstart));
 		array.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.MINUS, cstop, cstart));
 
 		set_cvalue (expr, array);
diff --git a/codegen/valadovaassignmentmodule.vala b/codegen/valadovaassignmentmodule.vala
index 857c30e..572b24c 100644
--- a/codegen/valadovaassignmentmodule.vala
+++ b/codegen/valadovaassignmentmodule.vala
@@ -93,7 +93,7 @@ public class Vala.DovaAssignmentModule : DovaMemberAccessModule {
 		// it is necessary to use memcpy for fixed-length (stack-allocated) arrays
 		// simple assignments do not work in C
 		var sizeof_call = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
-		sizeof_call.add_argument (new CCodeIdentifier (array_type.element_type.get_cname ()));
+		sizeof_call.add_argument (new CCodeIdentifier (get_ccode_name (array_type.element_type)));
 		var size = new CCodeBinaryExpression (CCodeBinaryOperator.MUL, new CCodeConstant ("%d".printf (array_type.length)), sizeof_call);
 		var ccopy = new CCodeFunctionCall (new CCodeIdentifier ("memcpy"));
 		ccopy.add_argument (lhs);
diff --git a/codegen/valadovabasemodule.vala b/codegen/valadovabasemodule.vala
index d92ac98..5ee0675 100644
--- a/codegen/valadovabasemodule.vala
+++ b/codegen/valadovabasemodule.vala
@@ -364,18 +364,18 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 	}
 
 	public void generate_enum_declaration (Enum en, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, en, en.get_cname ())) {
+		if (add_symbol_declaration (decl_space, en, get_ccode_name (en))) {
 			return;
 		}
 
-		var cenum = new CCodeEnum (en.get_cname ());
+		var cenum = new CCodeEnum (get_ccode_name (en));
 
 		foreach (EnumValue ev in en.get_values ()) {
 			if (ev.value == null) {
-				cenum.add_value (new CCodeEnumValue (ev.get_cname ()));
+				cenum.add_value (new CCodeEnumValue (get_ccode_name (ev)));
 			} else {
 				ev.value.emit (this);
-				cenum.add_value (new CCodeEnumValue (ev.get_cname (), get_cvalue (ev.value)));
+				cenum.add_value (new CCodeEnumValue (get_ccode_name (ev), get_cvalue (ev.value)));
 			}
 		}
 
@@ -394,7 +394,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 	}
 
 	public void generate_constant_declaration (Constant c, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, c, c.get_cname ())) {
+		if (add_symbol_declaration (decl_space, c, get_ccode_name (c))) {
 			return;
 		}
 
@@ -402,17 +402,17 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 			c.value.emit (this);
 
 			if (c.value is InitializerList) {
-				var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ());
+				var cdecl = new CCodeDeclaration (get_ccode_const_name (c.type_reference));
 				var arr = "";
 				if (c.type_reference is ArrayType) {
 					arr = "[]";
 				}
-				cdecl.add_declarator (new CCodeVariableDeclarator ("%s%s".printf (c.get_cname (), arr), get_cvalue (c.value)));
+				cdecl.add_declarator (new CCodeVariableDeclarator ("%s%s".printf (get_ccode_name (c), arr), get_cvalue (c.value)));
 				cdecl.modifiers = CCodeModifiers.STATIC;
 
 				decl_space.add_constant_declaration (cdecl);
 			} else {
-				var cdefine = new CCodeMacroReplacement.with_expression (c.get_cname (), get_cvalue (c.value));
+				var cdefine = new CCodeMacroReplacement.with_expression (get_ccode_name (c), get_cvalue (c.value));
 				decl_space.add_type_member_declaration (cdefine);
 			}
 		}
@@ -427,19 +427,19 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 	}
 
 	public void generate_field_declaration (Field f, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, f, f.get_cname ())) {
+		if (add_symbol_declaration (decl_space, f, get_ccode_name (f))) {
 			return;
 		}
 
 		generate_type_declaration (f.variable_type, decl_space);
 
-		string field_ctype = f.variable_type.get_cname ();
+		string field_ctype = get_ccode_name (f.variable_type);
 		if (f.is_volatile) {
 			field_ctype = "volatile " + field_ctype;
 		}
 
 		var cdecl = new CCodeDeclaration (field_ctype);
-		cdecl.add_declarator (new CCodeVariableDeclarator (f.get_cname ()));
+		cdecl.add_declarator (new CCodeVariableDeclarator (get_ccode_name (f)));
 		if (f.is_internal_symbol ()) {
 			cdecl.modifiers = CCodeModifiers.STATIC;
 		} else {
@@ -461,14 +461,14 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 				generate_field_declaration (f, header_file);
 			}
 
-			var var_decl = new CCodeVariableDeclarator (f.get_cname ());
+			var var_decl = new CCodeVariableDeclarator (get_ccode_name (f));
 			var_decl.initializer = default_value_for_type (f.variable_type, true);
 
 			if (f.initializer != null) {
 				static_fields.add (f);
 			}
 
-			string field_ctype = f.variable_type.get_cname ();
+			string field_ctype = get_ccode_name (f.variable_type);
 			if (f.is_volatile) {
 				field_ctype = "volatile " + field_ctype;
 			}
@@ -611,7 +611,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 
 		var param_type = param.variable_type.copy ();
 		param_type.value_owned = true;
-		data.add_field (param_type.get_cname (), get_variable_cname (param.name));
+		data.add_field (get_ccode_name (param_type), get_variable_cname (param.name));
 
 		// create copy if necessary as captured variables may need to be kept alive
 		CCodeExpression cparam = get_variable_cexpression (param.name);
@@ -665,7 +665,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 				free_block.add_statement (new CCodeExpressionStatement (unref_call));
 			} else if ((current_method != null && current_method.binding == MemberBinding.INSTANCE) ||
 			           (current_property_accessor != null && current_property_accessor.prop.binding == MemberBinding.INSTANCE)) {
-				data.add_field ("%s *".printf (current_class.get_cname ()), "this");
+				data.add_field ("%s *".printf (get_ccode_name (current_class)), "this");
 
 				var ma = new MemberAccess.simple ("this");
 				ma.symbol_reference = current_class;
@@ -675,7 +675,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 				if (local.captured) {
 					generate_type_declaration (local.variable_type, cfile);
 
-					data.add_field (local.variable_type.get_cname (), get_variable_cname (local.name) + local.variable_type.get_cdeclarator_suffix ());
+					data.add_field (get_ccode_name (local.variable_type), get_variable_cname (local.name) + local.variable_type.get_cdeclarator_suffix ());
 				}
 			}
 			// free in reverse order
@@ -869,7 +869,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 		} else {
 			var cvar = new CCodeVariableDeclarator (get_variable_cname (local.name), rhs, local.variable_type.get_cdeclarator_suffix ());
 
-			var cdecl = new CCodeDeclaration (local.variable_type.get_cname ());
+			var cdecl = new CCodeDeclaration (get_ccode_name (local.variable_type));
 			cdecl.add_declarator (cvar);
 			ccode.add_statement (cdecl);
 
@@ -959,13 +959,13 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 	public CCodeExpression get_type_private_from_type (ObjectTypeSymbol type_symbol, CCodeExpression type_expression) {
 		if (type_symbol is Class) {
 			// class
-			return new CCodeCastExpression (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeCastExpression (type_expression, "char *"), new CCodeIdentifier ("_%s_type_offset".printf (((Class) type_symbol).get_lower_case_cname ()))), "%sTypePrivate *".printf (((Class) type_symbol).get_cname ()));
+			return new CCodeCastExpression (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeCastExpression (type_expression, "char *"), new CCodeIdentifier ("_%s_type_offset".printf (((Class) type_symbol).get_lower_case_cname ()))), "%sTypePrivate *".printf (get_ccode_name (type_symbol)));
 		} else {
 			// interface
 			var get_interface = new CCodeFunctionCall (new CCodeIdentifier ("dova_type_get_interface"));
 			get_interface.add_argument (type_expression);
 			get_interface.add_argument (new CCodeIdentifier ("%s_type".printf (((Interface) type_symbol).get_lower_case_cname ())));
-			return new CCodeCastExpression (get_interface, "%sTypePrivate *".printf (((Interface) type_symbol).get_cname ()));
+			return new CCodeCastExpression (get_interface, "%sTypePrivate *".printf (get_ccode_name (type_symbol)));
 		}
 	}
 
@@ -1148,7 +1148,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 	}
 
 	public void emit_temp_var (LocalVariable local) {
-		var cdecl = new CCodeDeclaration (local.variable_type.get_cname ());
+		var cdecl = new CCodeDeclaration (get_ccode_name (local.variable_type));
 
 		var vardecl = new CCodeVariableDeclarator (local.name, null, local.variable_type.get_cdeclarator_suffix ());
 		cdecl.add_declarator (vardecl);
@@ -1358,7 +1358,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 
 	public override void visit_base_access (BaseAccess expr) {
 		generate_type_declaration (expr.value_type, cfile);
-		set_cvalue (expr, new CCodeCastExpression (new CCodeIdentifier ("this"), expr.value_type.get_cname ()));
+		set_cvalue (expr, new CCodeCastExpression (new CCodeIdentifier ("this"), get_ccode_name (expr.value_type)));
 	}
 
 	public override void visit_postfix_expression (PostfixExpression expr) {
@@ -1532,7 +1532,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 	}
 
 	public virtual void generate_class_declaration (Class cl, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, cl, cl.get_cname ())) {
+		if (add_symbol_declaration (decl_space, cl, get_ccode_name (cl))) {
 			return;
 		}
 	}
@@ -1574,7 +1574,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 				var creation_call = new CCodeFunctionCall (new CCodeIdentifier ("memset"));
 				creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance));
 				creation_call.add_argument (new CCodeConstant ("0"));
-				creation_call.add_argument (new CCodeIdentifier ("sizeof (%s)".printf (expr.type_reference.get_cname ())));
+				creation_call.add_argument (new CCodeIdentifier ("sizeof (%s)".printf (get_ccode_name (expr.type_reference))));
 
 				creation_expr = creation_call;
 			}
@@ -1593,7 +1593,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 				creation_call = new CCodeFunctionCall (new CCodeIdentifier (m.get_real_cname ()));
 				creation_call.add_argument (new CCodeIdentifier (cl.get_type_id ()));
 			} else {
-				creation_call = new CCodeFunctionCall (new CCodeIdentifier (m.get_cname ()));
+				creation_call = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_name (m)));
 			}
 
 			if (struct_by_ref && !(m.cinstance_parameter_position < 0)) {
@@ -1665,7 +1665,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 			// cast the return value of the creation method back to the intended type if
 			// it requested a special C return type
 			if (get_custom_creturn_type (m) != null) {
-				creation_expr = new CCodeCastExpression (creation_expr, expr.type_reference.get_cname ());
+				creation_expr = new CCodeCastExpression (creation_expr, get_ccode_name (expr.type_reference));
 			}
 		} else {
 			assert (false);
@@ -1685,9 +1685,9 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 					var typed_inst = transform_expression (instance, expr.type_reference, instance_target_type);
 					CCodeExpression lhs;
 					if (expr.type_reference.data_type is Struct) {
-						lhs = new CCodeMemberAccess (typed_inst, f.get_cname ());
+						lhs = new CCodeMemberAccess (typed_inst, get_ccode_name (f));
 					} else {
-						lhs = new CCodeMemberAccess.pointer (typed_inst, f.get_cname ());
+						lhs = new CCodeMemberAccess.pointer (typed_inst, get_ccode_name (f));
 					}
 					ccode.add_assignment (lhs, get_cvalue (init.initializer));
 				} else if (init.symbol_reference is Property) {
@@ -1742,7 +1742,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 
 	public override void visit_sizeof_expression (SizeofExpression expr) {
 		var csizeof = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
-		csizeof.add_argument (new CCodeIdentifier (expr.type_reference.get_cname ()));
+		csizeof.add_argument (new CCodeIdentifier (get_ccode_name (expr.type_reference)));
 		set_cvalue (expr, csizeof);
 	}
 
@@ -1785,7 +1785,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 				var ctemp = get_variable_cexpression (temp_decl.name);
 				var cinit = new CCodeAssignment (ctemp, get_cvalue (expr.inner));
 				var ccheck = create_type_check (ctemp, expr.type_reference);
-				var ccast = new CCodeCastExpression (ctemp, expr.type_reference.get_cname ());
+				var ccast = new CCodeCastExpression (ctemp, get_ccode_name (expr.type_reference));
 				var cnull = new CCodeConstant ("NULL");
 
 				ccomma.append_expression (cinit);
@@ -1825,7 +1825,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 			var ccomma = new CCodeCommaExpression ();
 
 			var sizeof_call = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
-			sizeof_call.add_argument (new CCodeIdentifier (expr.type_reference.get_cname ()));
+			sizeof_call.add_argument (new CCodeIdentifier (get_ccode_name (expr.type_reference)));
 
 			var to_any  = new CCodeFunctionCall (new CCodeIdentifier ("dova_type_value_from_any"));
 			to_any.add_argument (get_type_id_expression (expr.type_reference));
@@ -1852,9 +1852,9 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 
 		if (expr.inner.value_type is GenericType && !(expr.type_reference is GenericType)) {
 			// generic types use an extra pointer, dereference that pointer
-			set_cvalue (expr, new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeCastExpression (get_cvalue (expr.inner), expr.type_reference.get_cname () + "*")));
+			set_cvalue (expr, new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeCastExpression (get_cvalue (expr.inner), get_ccode_name (expr.type_reference) + "*")));
 		} else {
-			set_cvalue (expr, new CCodeCastExpression (get_cvalue (expr.inner), expr.type_reference.get_cname ()));
+			set_cvalue (expr, new CCodeCastExpression (get_cvalue (expr.inner), get_ccode_name (expr.type_reference)));
 		}
 	}
 
@@ -1984,7 +1984,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 
 		l.accept_children (this);
 
-		set_cvalue (l, new CCodeIdentifier (l.method.get_cname ()));
+		set_cvalue (l, new CCodeIdentifier (get_ccode_name (l.method)));
 	}
 
 	// manage memory and implicit casts
@@ -2116,9 +2116,9 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 			foreach (Parameter param in d.get_parameters ()) {
 				method_param_iter.next ();
 				var method_param = method_param_iter.get ();
-				string ctype = param.variable_type.get_cname ();
+				string ctype = get_ccode_name (param.variable_type);
 				if (param.variable_type is GenericType && !(method_param.variable_type is GenericType)) {
-					ctype = method_param.variable_type.get_cname () + "*";
+					ctype = get_ccode_name (method_param.variable_type) + "*";
 					call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (param.name)));
 				} else if (!(param.variable_type is GenericType) && method_param.variable_type is GenericType) {
 					call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
@@ -2135,11 +2135,11 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 			} else {
 				var method_return_type = method_type.method_symbol.return_type;
 				if (d.return_type is GenericType && !(method_return_type is GenericType)) {
-					wrapper.add_parameter (new CCodeParameter ("result", method_return_type.get_cname () + "*"));
+					wrapper.add_parameter (new CCodeParameter ("result", get_ccode_name (method_return_type) + "*"));
 					wrapper.block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result")), call)));
 				} else if (!(d.return_type is GenericType) && method_return_type is GenericType) {
-					wrapper.return_type = d.return_type.get_cname ();
-					var cdecl = new CCodeDeclaration (d.return_type.get_cname ());
+					wrapper.return_type = get_ccode_name (d.return_type);
+					var cdecl = new CCodeDeclaration (get_ccode_name (d.return_type));
 					cdecl.add_declarator (new CCodeVariableDeclarator ("result"));
 					call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("result")));
 					wrapper.block.add_statement (new CCodeExpressionStatement (call));
@@ -2148,7 +2148,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 					wrapper.add_parameter (new CCodeParameter ("result", "void *"));
 					wrapper.block.add_statement (new CCodeExpressionStatement (call));
 				} else {
-					wrapper.return_type = d.return_type.get_cname ();
+					wrapper.return_type = get_ccode_name (d.return_type);
 					wrapper.block.add_statement (new CCodeReturnStatement (call));
 				}
 			}
@@ -2166,11 +2166,11 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 		if (context.checking && (iface != null || (cl != null && !cl.is_compact))) {
 			// checked cast for strict subtypes of GTypeInstance
 			return generate_instance_cast (cexpr, target_type.data_type);
-		} else if (target_type.data_type != null && expression_type.get_cname () != target_type.get_cname ()) {
+		} else if (target_type.data_type != null && get_ccode_name (expression_type) != get_ccode_name (target_type)) {
 			var st = target_type.data_type as Struct;
 			if (target_type.data_type.is_reference_type () || (st != null && st.is_simple_type ())) {
 				// don't cast non-simple structs
-				return new CCodeCastExpression (cexpr, target_type.get_cname ());
+				return new CCodeCastExpression (cexpr, get_ccode_name (target_type));
 			} else {
 				return cexpr;
 			}
@@ -2190,7 +2190,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 		}
 
 		generate_property_accessor_declaration (base_property.set_accessor, cfile);
-		set_func = base_property.set_accessor.get_cname ();
+		set_func = get_ccode_name (base_property.set_accessor);
 
 		if (!prop.external && prop.external_package) {
 			// internal VAPI properties
@@ -2285,6 +2285,14 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 		return get_cvalue (node);
 	}
 
+	public string get_ccode_name (CodeNode node) {
+		return CCodeBaseModule.get_ccode_name (node);
+	}
+
+	public string get_ccode_const_name (CodeNode node) {
+		return CCodeBaseModule.get_ccode_const_name (node);
+	}
+
 	public DataType? get_this_type () {
 		if (current_method != null && current_method.binding == MemberBinding.INSTANCE) {
 			return current_method.this_parameter.variable_type;
@@ -2295,7 +2303,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 	}
 
 	public CCodeExpression generate_instance_cast (CCodeExpression expr, TypeSymbol type) {
-		return new CCodeCastExpression (expr, type.get_cname () + "*");
+		return new CCodeCastExpression (expr, get_ccode_name (type) + "*");
 	}
 
 	public virtual string? get_custom_creturn_type (Method m) {
diff --git a/codegen/valadovadelegatemodule.vala b/codegen/valadovadelegatemodule.vala
index a96f34e..24e9bbb 100644
--- a/codegen/valadovadelegatemodule.vala
+++ b/codegen/valadovadelegatemodule.vala
@@ -26,11 +26,11 @@
  */
 public class Vala.DovaDelegateModule : DovaValueModule {
 	public override void generate_delegate_declaration (Delegate d, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, d, d.get_cname ())) {
+		if (add_symbol_declaration (decl_space, d, get_ccode_name (d))) {
 			return;
 		}
 
-		decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (d.get_cname ()), new CCodeVariableDeclarator (d.get_cname ())));
+		decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (get_ccode_name (d)), new CCodeVariableDeclarator (get_ccode_name (d))));
 
 		generate_class_declaration (type_class, decl_space);
 		generate_method_declaration ((Method) object_class.scope.lookup ("ref"), decl_space);
@@ -61,7 +61,7 @@ public class Vala.DovaDelegateModule : DovaValueModule {
 	}
 
 	CCodeFunction generate_new_function (Delegate d, CCodeFile decl_space) {
-		var function = new CCodeFunction ("%s_new".printf (d.get_lower_case_cname ()), "%s*".printf (d.get_cname ()));
+		var function = new CCodeFunction ("%s_new".printf (d.get_lower_case_cname ()), "%s*".printf (get_ccode_name (d)));
 		if (d.is_internal_symbol ()) {
 			function.modifiers |= CCodeModifiers.STATIC;
 		}
@@ -74,7 +74,7 @@ public class Vala.DovaDelegateModule : DovaValueModule {
 		var alloc_call = new CCodeFunctionCall (new CCodeIdentifier ("dova_object_alloc"));
 		alloc_call.add_argument (new CCodeFunctionCall (new CCodeIdentifier ("%s_type_get".printf (d.get_lower_case_cname ()))));
 
-		var cdecl = new CCodeDeclaration ("%s*".printf (d.get_cname ()));
+		var cdecl = new CCodeDeclaration ("%s*".printf (get_ccode_name (d)));
 		cdecl.add_declarator (new CCodeVariableDeclarator ("this", alloc_call));
 		function.block.add_statement (cdecl);
 
@@ -100,19 +100,19 @@ public class Vala.DovaDelegateModule : DovaValueModule {
 			function.modifiers |= CCodeModifiers.STATIC;
 		}
 
-		function.add_parameter (new CCodeParameter ("this", "%s*".printf (d.get_cname ())));
+		function.add_parameter (new CCodeParameter ("this", "%s*".printf (get_ccode_name (d))));
 
 		string param_list = "";
 
 		foreach (Parameter param in d.get_parameters ()) {
 			generate_type_declaration (param.variable_type, decl_space);
 
-			function.add_parameter (new CCodeParameter (param.name, param.variable_type.get_cname ()));
+			function.add_parameter (new CCodeParameter (param.name, get_ccode_name (param.variable_type)));
 
 			if (param_list != "") {
 				param_list += ", ";
 			}
-			param_list += param.variable_type.get_cname ();
+			param_list += get_ccode_name (param.variable_type);
 		}
 
 		if (d.return_type is GenericType) {
@@ -123,7 +123,7 @@ public class Vala.DovaDelegateModule : DovaValueModule {
 			}
 			param_list += "void *";
 		} else {
-			function.return_type = d.return_type.get_cname ();
+			function.return_type = get_ccode_name (d.return_type);
 		}
 
 		function.block = new CCodeBlock ();
@@ -195,14 +195,14 @@ public class Vala.DovaDelegateModule : DovaValueModule {
 
 		generate_type_get_function (d, delegate_class);
 
-		var instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (d.get_cname ()));
+		var instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (get_ccode_name (d)));
 
 		instance_priv_struct.add_field ("void", "(*method) (void)");
 
-		cfile.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (instance_priv_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (d.get_cname ()))));
+		cfile.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (instance_priv_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (get_ccode_name (d)))));
 		cfile.add_type_definition (instance_priv_struct);
 
-		string macro = "((%sPrivate *) (((char *) o) + _%s_object_offset))".printf (d.get_cname (), d.get_lower_case_cname ());
+		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));
 
 		var cdecl = new CCodeDeclaration ("intptr_t");
diff --git a/codegen/valadovaerrormodule.vala b/codegen/valadovaerrormodule.vala
index c0df425..19ecb8e 100644
--- a/codegen/valadovaerrormodule.vala
+++ b/codegen/valadovaerrormodule.vala
@@ -242,7 +242,7 @@ public class Vala.DovaErrorModule : DovaDelegateModule {
 		}
 
 		if (clause.variable_name != null) {
-			var cdecl = new CCodeDeclaration (clause.error_type.get_cname ());
+			var cdecl = new CCodeDeclaration (get_ccode_name (clause.error_type));
 			cdecl.add_declarator (new CCodeVariableDeclarator (variable_name, new CCodeIdentifier ("dova_error")));
 			ccode.add_statement (cdecl);
 		} else {
diff --git a/codegen/valadovamemberaccessmodule.vala b/codegen/valadovamemberaccessmodule.vala
index 3a23548..378a853 100644
--- a/codegen/valadovamemberaccessmodule.vala
+++ b/codegen/valadovamemberaccessmodule.vala
@@ -81,14 +81,14 @@ public abstract class Vala.DovaMemberAccessModule : DovaControlFlowModule {
 					vclass.add_argument (inst);
 					set_cvalue (expr, new CCodeMemberAccess.pointer (vclass, m.name));
 				} else {
-					set_cvalue (expr, new CCodeIdentifier (m.base_method.get_cname ()));
+					set_cvalue (expr, new CCodeIdentifier (get_ccode_name (m.base_method)));
 				}
 			} else if (m.base_interface_method != null) {
-				set_cvalue (expr, new CCodeIdentifier (m.base_interface_method.get_cname ()));
+				set_cvalue (expr, new CCodeIdentifier (get_ccode_name (m.base_interface_method)));
 			} else if (m is CreationMethod) {
 				set_cvalue (expr, new CCodeIdentifier (m.get_real_cname ()));
 			} else {
-				set_cvalue (expr, new CCodeIdentifier (m.get_cname ()));
+				set_cvalue (expr, new CCodeIdentifier (get_ccode_name (m)));
 			}
 		} else if (expr.symbol_reference is ArrayLengthField) {
 			var array_type = (ArrayType) expr.inner.value_type;
@@ -109,13 +109,13 @@ public abstract class Vala.DovaMemberAccessModule : DovaControlFlowModule {
 
 			generate_enum_declaration ((Enum) ev.parent_symbol, cfile);
 
-			set_cvalue (expr, new CCodeConstant (ev.get_cname ()));
+			set_cvalue (expr, new CCodeConstant (get_ccode_name (ev)));
 		} else if (expr.symbol_reference is Constant) {
 			var c = (Constant) expr.symbol_reference;
 
 			generate_constant_declaration (c, cfile);
 
-			set_cvalue (expr, new CCodeIdentifier (c.get_cname ()));
+			set_cvalue (expr, new CCodeIdentifier (get_ccode_name (c)));
 		} else if (expr.symbol_reference is Property) {
 			var prop = (Property) expr.symbol_reference;
 
@@ -158,7 +158,7 @@ public abstract class Vala.DovaMemberAccessModule : DovaControlFlowModule {
 			} else if (prop.base_interface_property != null) {
 				base_property = prop.base_interface_property;
 			}
-			string getter_cname = base_property.get_accessor.get_cname ();
+			string getter_cname = get_ccode_name (base_property.get_accessor);
 			var ccall = new CCodeFunctionCall (new CCodeIdentifier (getter_cname));
 
 			if (prop.binding == MemberBinding.INSTANCE) {
@@ -275,14 +275,14 @@ public abstract class Vala.DovaMemberAccessModule : DovaControlFlowModule {
 				inst = pub_inst;
 			}
 			if (instance_target_type.data_type.is_reference_type () || (instance != null && instance.value_type is PointerType)) {
-				result.cvalue = new CCodeMemberAccess.pointer (inst, f.get_cname ());
+				result.cvalue = new CCodeMemberAccess.pointer (inst, get_ccode_name (f));
 			} else {
-				result.cvalue = new CCodeMemberAccess (inst, f.get_cname ());
+				result.cvalue = new CCodeMemberAccess (inst, get_ccode_name (f));
 			}
 		} else {
 			generate_field_declaration (f, cfile);
 
-			result.cvalue = new CCodeIdentifier (f.get_cname ());
+			result.cvalue = new CCodeIdentifier (get_ccode_name (f));
 		}
 
 		return result;
diff --git a/codegen/valadovamethodcallmodule.vala b/codegen/valadovamethodcallmodule.vala
index bb5d470..7106bc2 100644
--- a/codegen/valadovamethodcallmodule.vala
+++ b/codegen/valadovamethodcallmodule.vala
@@ -55,7 +55,7 @@ public class Vala.DovaMethodCallModule : DovaAssignmentModule {
 			if (cl == current_class) {
 				ccall.add_argument (new CCodeIdentifier ("this"));
 			} else {
-				ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier ("this"), cl.get_cname () + "*"));
+				ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier ("this"), get_ccode_name (cl) + "*"));
 			}
 		} else if (m != null) {
 			if (m.binding == MemberBinding.INSTANCE) {
diff --git a/codegen/valadovaobjectmodule.vala b/codegen/valadovaobjectmodule.vala
index eec278f..17cd9b2 100644
--- a/codegen/valadovaobjectmodule.vala
+++ b/codegen/valadovaobjectmodule.vala
@@ -22,23 +22,23 @@
 
 public class Vala.DovaObjectModule : DovaArrayModule {
 	public override void generate_class_declaration (Class cl, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, cl, cl.get_cname ())) {
+		if (add_symbol_declaration (decl_space, cl, get_ccode_name (cl))) {
 			return;
 		}
 
 		if (cl.base_class == null) {
-			decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (cl.get_cname ()), new CCodeVariableDeclarator (cl.get_cname ())));
+			decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (get_ccode_name (cl)), new CCodeVariableDeclarator (get_ccode_name (cl))));
 		} else if (cl == string_type.data_type) {
 			generate_class_declaration (cl.base_class, decl_space);
-			decl_space.add_type_declaration (new CCodeTypeDefinition ("const uint8_t *", new CCodeVariableDeclarator (cl.get_cname ())));
+			decl_space.add_type_declaration (new CCodeTypeDefinition ("const uint8_t *", new CCodeVariableDeclarator (get_ccode_name (cl))));
 		} else {
 			// typedef to base class instead of dummy struct to avoid warnings/casts
 			generate_class_declaration (cl.base_class, decl_space);
-			decl_space.add_type_declaration (new CCodeTypeDefinition (cl.base_class.get_cname (), new CCodeVariableDeclarator (cl.get_cname ())));
+			decl_space.add_type_declaration (new CCodeTypeDefinition (get_ccode_name (cl.base_class), new CCodeVariableDeclarator (get_ccode_name (cl))));
 		}
 
 		if (cl.base_class == null) {
-			var instance_struct = new CCodeStruct ("_%s".printf (cl.get_cname ()));
+			var instance_struct = new CCodeStruct ("_%s".printf (get_ccode_name (cl)));
 			instance_struct.add_field ("DovaType *", "type");
 			decl_space.add_type_definition (instance_struct);
 		} else if (cl == type_class) {
@@ -105,7 +105,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 		generate_cparameters (m, decl_space, new CCodeFunction ("fake"), vdeclarator);
 
-		var vdecl = new CCodeDeclaration (m.return_type.get_cname ());
+		var vdecl = new CCodeDeclaration (get_ccode_name (m.return_type));
 		vdecl.add_declarator (vdeclarator);
 		type_struct.add_declaration (vdecl);
 	}
@@ -137,23 +137,23 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 	}
 
 	void generate_class_private_declaration (Class cl, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, cl, cl.get_cname () + "Private")) {
+		if (add_symbol_declaration (decl_space, cl, get_ccode_name (cl) + "Private")) {
 			return;
 		}
 
-		var instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (cl.get_cname ()));
-		var type_priv_struct = new CCodeStruct ("_%sTypePrivate".printf (cl.get_cname ()));
+		var instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (get_ccode_name (cl)));
+		var type_priv_struct = new CCodeStruct ("_%sTypePrivate".printf (get_ccode_name (cl)));
 
 		foreach (Field f in cl.get_fields ()) {
 			if (f.binding == MemberBinding.INSTANCE)  {
 				generate_type_declaration (f.variable_type, decl_space);
 
-				string field_ctype = f.variable_type.get_cname ();
+				string field_ctype = get_ccode_name (f.variable_type);
 				if (f.is_volatile) {
 					field_ctype = "volatile " + field_ctype;
 				}
 
-				instance_priv_struct.add_field (field_ctype, f.get_cname () + f.variable_type.get_cdeclarator_suffix ());
+				instance_priv_struct.add_field (field_ctype, get_ccode_name (f) + f.variable_type.get_cdeclarator_suffix ());
 			}
 		}
 
@@ -223,13 +223,13 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			var t = (ObjectTypeSymbol) prop.parent_symbol;
 
 			var this_type = new ObjectType (t);
-			var cselfparam = new CCodeParameter ("this", this_type.get_cname ());
-			var cvalueparam = new CCodeParameter ("value", prop.property_type.get_cname ());
+			var cselfparam = new CCodeParameter ("this", get_ccode_name (this_type));
+			var cvalueparam = new CCodeParameter ("value", get_ccode_name (prop.property_type));
 
 			if (prop.get_accessor != null) {
 				var vdeclarator = new CCodeFunctionDeclarator ("get_%s".printf (prop.name));
 				vdeclarator.add_parameter (cselfparam);
-				string creturn_type = prop.property_type.get_cname ();
+				string creturn_type = get_ccode_name (prop.property_type);
 
 				var vdecl = new CCodeDeclaration (creturn_type);
 				vdecl.add_declarator (vdeclarator);
@@ -247,12 +247,12 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		}
 
 		if (!instance_priv_struct.is_empty) {
-			decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (instance_priv_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (cl.get_cname ()))));
+			decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (instance_priv_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (get_ccode_name (cl)))));
 			decl_space.add_type_definition (instance_priv_struct);
 		}
 
 		if (!type_priv_struct.is_empty) {
-			decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sTypePrivate".printf (cl.get_cname ()))));
+			decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sTypePrivate".printf (get_ccode_name (cl)))));
 			decl_space.add_type_definition (type_priv_struct);
 		}
 
@@ -266,16 +266,16 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		string macro;
 		if (cl.base_class == null) {
 			// offset of any class is 0
-			macro = "((%sPrivate *) o)".printf (cl.get_cname ());
+			macro = "((%sPrivate *) o)".printf (get_ccode_name (cl));
 			type_offset = new CCodeConstant ("sizeof (anyPrivate) + sizeof (DovaObjectPrivate) + sizeof (DovaTypePrivate)");
 		} else if (cl == object_class) {
-			macro = "((%sPrivate *) (((char *) o) + sizeof (anyPrivate)))".printf (cl.get_cname ());
+			macro = "((%sPrivate *) (((char *) o) + sizeof (anyPrivate)))".printf (get_ccode_name (cl));
 			type_offset = new CCodeConstant ("sizeof (anyPrivate) + sizeof (DovaObjectPrivate) + sizeof (DovaTypePrivate) + sizeof (anyTypePrivate)");
 		} else if (cl == type_class) {
-			macro = "((%sPrivate *) (((char *) o) + sizeof (anyPrivate) + sizeof (DovaObjectPrivate)))".printf (cl.get_cname ());
+			macro = "((%sPrivate *) (((char *) o) + sizeof (anyPrivate) + sizeof (DovaObjectPrivate)))".printf (get_ccode_name (cl));
 			type_offset = new CCodeConstant ("sizeof (anyPrivate) + sizeof (DovaObjectPrivate) + sizeof (DovaTypePrivate) + sizeof (anyTypePrivate) + sizeof (DovaObjectTypePrivate)");
 		} else {
-			macro = "((%sPrivate *) (((char *) o) + _%s_object_offset))".printf (cl.get_cname (), cl.get_lower_case_cname ());
+			macro = "((%sPrivate *) (((char *) o) + _%s_object_offset))".printf (get_ccode_name (cl), cl.get_lower_case_cname ());
 			type_offset = new CCodeConstant ("0");
 		}
 		if (!instance_priv_struct.is_empty) {
@@ -442,7 +442,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 		if (base_class == null) {
 			var sizeof_call = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
-			sizeof_call.add_argument (new CCodeIdentifier ("%sPrivate".printf (cl.get_cname ())));
+			sizeof_call.add_argument (new CCodeIdentifier ("%sPrivate".printf (get_ccode_name (cl))));
 
 			var calloc_call = new CCodeFunctionCall (new CCodeIdentifier ("calloc"));
 			calloc_call.add_argument (new CCodeConstant ("1"));
@@ -475,12 +475,12 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			var alloc_call = new CCodeFunctionCall (new CCodeIdentifier ("dova_type_alloc"));
 			alloc_call.add_argument (base_type);
 			if (!(cl is Class) || has_instance_struct ((Class) cl)) {
-				alloc_call.add_argument (new CCodeConstant ("sizeof (%sPrivate)".printf (cl.get_cname ())));
+				alloc_call.add_argument (new CCodeConstant ("sizeof (%sPrivate)".printf (get_ccode_name (cl))));
 			} else {
 				alloc_call.add_argument (new CCodeConstant ("0"));
 			}
 			if ((!(cl is Class) || has_type_struct ((Class) cl)) && !(cl is Delegate)) {
-				alloc_call.add_argument (new CCodeConstant ("sizeof (%sTypePrivate)".printf (cl.get_cname ())));
+				alloc_call.add_argument (new CCodeConstant ("sizeof (%sTypePrivate)".printf (get_ccode_name (cl))));
 			} else {
 				alloc_call.add_argument (new CCodeConstant ("0"));
 			}
@@ -541,12 +541,12 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			var alloc_call = new CCodeFunctionCall (new CCodeIdentifier ("dova_type_alloc"));
 			alloc_call.add_argument (base_type);
 			if (!(cl is Class) || has_instance_struct ((Class) cl)) {
-				alloc_call.add_argument (new CCodeConstant ("sizeof (%sPrivate)".printf (cl.get_cname ())));
+				alloc_call.add_argument (new CCodeConstant ("sizeof (%sPrivate)".printf (get_ccode_name (cl))));
 			} else {
 				alloc_call.add_argument (new CCodeConstant ("0"));
 			}
 			if (!(cl is Class) || has_type_struct ((Class) cl)) {
-				alloc_call.add_argument (new CCodeConstant ("sizeof (%sTypePrivate)".printf (cl.get_cname ())));
+				alloc_call.add_argument (new CCodeConstant ("sizeof (%sTypePrivate)".printf (get_ccode_name (cl))));
 			} else {
 				alloc_call.add_argument (new CCodeConstant ("0"));
 			}
@@ -641,9 +641,9 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			{
 				var value_equals_fun = new CCodeFunction ("%s_value_equals".printf (cl.get_lower_case_cname ()), "bool");
 				value_equals_fun.modifiers = CCodeModifiers.STATIC;
-				value_equals_fun.add_parameter (new CCodeParameter ("value", cl.get_cname () + "**"));
+				value_equals_fun.add_parameter (new CCodeParameter ("value", get_ccode_name (cl) + "**"));
 				value_equals_fun.add_parameter (new CCodeParameter ("value_index", "intptr_t"));
-				value_equals_fun.add_parameter (new CCodeParameter ("other", cl.get_cname () + "**"));
+				value_equals_fun.add_parameter (new CCodeParameter ("other", get_ccode_name (cl) + "**"));
 				value_equals_fun.add_parameter (new CCodeParameter ("other_index", "intptr_t"));
 				value_equals_fun.block = new CCodeBlock ();
 				var val = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("value"), new CCodeIdentifier ("value_index"));
@@ -665,7 +665,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			{
 				var value_hash_fun = new CCodeFunction ("%s_value_hash".printf (cl.get_lower_case_cname ()), "uintptr_t");
 				value_hash_fun.modifiers = CCodeModifiers.STATIC;
-				value_hash_fun.add_parameter (new CCodeParameter ("value", cl.get_cname () + "**"));
+				value_hash_fun.add_parameter (new CCodeParameter ("value", get_ccode_name (cl) + "**"));
 				value_hash_fun.add_parameter (new CCodeParameter ("value_index", "intptr_t"));
 				value_hash_fun.block = new CCodeBlock ();
 				var val = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("value"), new CCodeIdentifier ("value_index"));
@@ -685,7 +685,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			// generate method to box value
 			var value_to_any_fun = new CCodeFunction ("%s_value_to_any".printf (cl.get_lower_case_cname ()), "any*");
 			value_to_any_fun.modifiers = CCodeModifiers.STATIC;
-			value_to_any_fun.add_parameter (new CCodeParameter ("value", cl.get_cname () + "**"));
+			value_to_any_fun.add_parameter (new CCodeParameter ("value", get_ccode_name (cl) + "**"));
 			value_to_any_fun.add_parameter (new CCodeParameter ("value_index", "intptr_t"));
 			value_to_any_fun.block = new CCodeBlock ();
 			var val = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("value"), new CCodeIdentifier ("value_index"));
@@ -709,7 +709,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			var value_from_any_fun = new CCodeFunction ("%s_value_from_any".printf (cl.get_lower_case_cname ()));
 			value_from_any_fun.modifiers = CCodeModifiers.STATIC;
 			value_from_any_fun.add_parameter (new CCodeParameter ("any_", "any *"));
-			value_from_any_fun.add_parameter (new CCodeParameter ("value", cl.get_cname () + "**"));
+			value_from_any_fun.add_parameter (new CCodeParameter ("value", get_ccode_name (cl) + "**"));
 			value_from_any_fun.add_parameter (new CCodeParameter ("value_index", "intptr_t"));
 			value_from_any_fun.block = new CCodeBlock ();
 			string from_any_fun = "%s_ref".printf (cl.get_lower_case_cname ());
@@ -756,7 +756,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		var function = new CCodeFunction ("%sfinalize".printf (cl.get_lower_case_cprefix ()), "void");
 		function.modifiers = CCodeModifiers.STATIC;
 
-		function.add_parameter (new CCodeParameter ("this", cl.get_cname () + "*"));
+		function.add_parameter (new CCodeParameter ("this", get_ccode_name (cl) + "*"));
 
 		push_function (function);
 
@@ -772,9 +772,9 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 				if (f.is_internal_symbol ()) {
 					var priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (cl.get_upper_case_cname (null))));
 					priv_call.add_argument (new CCodeIdentifier ("this"));
-					lhs = new CCodeMemberAccess.pointer (priv_call, f.get_cname ());
+					lhs = new CCodeMemberAccess.pointer (priv_call, get_ccode_name (f));
 				} else {
-					lhs = new CCodeMemberAccess.pointer (new CCodeIdentifier ("this"), f.get_cname ());
+					lhs = new CCodeMemberAccess.pointer (new CCodeIdentifier ("this"), get_ccode_name (f));
 				}
 
 				if (requires_destroy (f.variable_type)) {
@@ -874,13 +874,13 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 				if (prop.get_accessor != null) {
 					var override_call = new CCodeFunctionCall (new CCodeIdentifier ("%soverride_get_%s".printf (prop.base_property.parent_symbol.get_lower_case_cprefix (), prop.name)));
 					override_call.add_argument (new CCodeIdentifier ("type"));
-					override_call.add_argument (new CCodeIdentifier (prop.get_accessor.get_cname ()));
+					override_call.add_argument (new CCodeIdentifier (get_ccode_name (prop.get_accessor)));
 					type_init_block.add_statement (new CCodeExpressionStatement (override_call));
 				}
 				if (prop.set_accessor != null) {
 					var override_call = new CCodeFunctionCall (new CCodeIdentifier ("%soverride_set_%s".printf (prop.base_property.parent_symbol.get_lower_case_cprefix (), prop.name)));
 					override_call.add_argument (new CCodeIdentifier ("type"));
-					override_call.add_argument (new CCodeIdentifier (prop.set_accessor.get_cname ()));
+					override_call.add_argument (new CCodeIdentifier (get_ccode_name (prop.set_accessor)));
 					type_init_block.add_statement (new CCodeExpressionStatement (override_call));
 				}
 			}
@@ -999,7 +999,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 		generate_interface_declaration (iface, cfile);
 
-		var type_priv_struct = new CCodeStruct ("_%sTypePrivate".printf (iface.get_cname ()));
+		var type_priv_struct = new CCodeStruct ("_%sTypePrivate".printf (get_ccode_name (iface)));
 
 		foreach (var type_param in iface.get_type_parameters ()) {
 			var type_param_decl = new CCodeDeclaration ("DovaType *");
@@ -1012,7 +1012,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		}
 
 		if (!type_priv_struct.is_empty) {
-			cfile.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sTypePrivate".printf (iface.get_cname ()))));
+			cfile.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sTypePrivate".printf (get_ccode_name (iface)))));
 			cfile.add_type_definition (type_priv_struct);
 		}
 
@@ -1036,7 +1036,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		calloc_call.add_argument (new CCodeConstant ("1"));
 
 		if (!type_priv_struct.is_empty) {
-			calloc_call.add_argument (new CCodeConstant ("dova_type_get_type_size (dova_type_type_get ()) + sizeof (%sTypePrivate)".printf (iface.get_cname ())));
+			calloc_call.add_argument (new CCodeConstant ("dova_type_get_type_size (dova_type_type_get ()) + sizeof (%sTypePrivate)".printf (get_ccode_name (iface))));
 		} else {
 			calloc_call.add_argument (new CCodeConstant ("dova_type_get_type_size (dova_type_type_get ())"));
 		}
@@ -1082,7 +1082,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 		var vtable_alloc = new CCodeFunctionCall (new CCodeIdentifier ("calloc"));
 		vtable_alloc.add_argument (new CCodeConstant ("1"));
-		vtable_alloc.add_argument (new CCodeConstant ("sizeof (%sTypePrivate)".printf (iface.get_cname ())));
+		vtable_alloc.add_argument (new CCodeConstant ("sizeof (%sTypePrivate)".printf (get_ccode_name (iface))));
 
 		var type_get_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_type_get".printf (iface.get_lower_case_cname ())));
 		foreach (var type_param in iface.get_type_parameters ()) {
@@ -1105,7 +1105,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 	}
 
 	public override void generate_property_accessor_declaration (PropertyAccessor acc, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, acc.prop, acc.get_cname ())) {
+		if (add_symbol_declaration (decl_space, acc.prop, get_ccode_name (acc))) {
 			return;
 		}
 
@@ -1116,9 +1116,9 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		CCodeFunction function;
 
 		if (acc.readable) {
-			function = new CCodeFunction (acc.get_cname (), acc.value_type.get_cname ());
+			function = new CCodeFunction (get_ccode_name (acc), get_ccode_name (acc.value_type));
 		} else {
-			function = new CCodeFunction (acc.get_cname (), "void");
+			function = new CCodeFunction (get_ccode_name (acc), "void");
 		}
 
 		if (prop.binding == MemberBinding.INSTANCE) {
@@ -1132,13 +1132,13 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			}
 
 			generate_type_declaration (this_type, decl_space);
-			var cselfparam = new CCodeParameter ("this", this_type.get_cname ());
+			var cselfparam = new CCodeParameter ("this", get_ccode_name (this_type));
 
 			function.add_parameter (cselfparam);
 		}
 
 		if (acc.writable) {
-			var cvalueparam = new CCodeParameter ("value", acc.value_type.get_cname ());
+			var cvalueparam = new CCodeParameter ("value", get_ccode_name (acc.value_type));
 			function.add_parameter (cvalueparam);
 		}
 
@@ -1148,16 +1148,16 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		decl_space.add_function_declaration (function);
 
 		if (prop.is_abstract || prop.is_virtual) {
-			string param_list = "(%s *this".printf (((ObjectTypeSymbol) prop.parent_symbol).get_cname ());
+			string param_list = "(%s *this".printf (get_ccode_name (prop.parent_symbol));
 			if (!acc.readable) {
 				param_list += ", ";
-				param_list += acc.value_type.get_cname ();
+				param_list += get_ccode_name (acc.value_type);
 			}
 			param_list += ")";
 
 			var override_func = new CCodeFunction ("%soverride_%s_%s".printf (prop.parent_symbol.get_lower_case_cprefix (), acc.readable ? "get" : "set", prop.name));
 			override_func.add_parameter (new CCodeParameter ("type", "DovaType *"));
-			override_func.add_parameter (new CCodeParameter ("(*function) %s".printf (param_list), acc.readable ? acc.value_type.get_cname () : "void"));
+			override_func.add_parameter (new CCodeParameter ("(*function) %s".printf (param_list), acc.readable ? get_ccode_name (acc.value_type) : "void"));
 
 			decl_space.add_function_declaration (override_func);
 		}
@@ -1188,17 +1188,17 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			var t = (ObjectTypeSymbol) prop.parent_symbol;
 			this_type = new ObjectType (t);
 		}
-		var cselfparam = new CCodeParameter ("this", this_type.get_cname ());
-		var cvalueparam = new CCodeParameter ("value", acc.value_type.get_cname ());
+		var cselfparam = new CCodeParameter ("this", get_ccode_name (this_type));
+		var cvalueparam = new CCodeParameter ("value", get_ccode_name (acc.value_type));
 
-		string cname = acc.get_cname ();
+		string cname = get_ccode_name (acc);
 
 		if (prop.is_abstract || prop.is_virtual) {
 			CCodeFunction function;
 			if (acc.readable) {
-				function = new CCodeFunction (acc.get_cname (), current_return_type.get_cname ());
+				function = new CCodeFunction (get_ccode_name (acc), get_ccode_name (current_return_type));
 			} else {
-				function = new CCodeFunction (acc.get_cname (), "void");
+				function = new CCodeFunction (get_ccode_name (acc), "void");
 			}
 			function.add_parameter (cselfparam);
 			if (acc.writable) {
@@ -1230,16 +1230,16 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			cfile.add_function (function);
 
 
-			string param_list = "(%s *this".printf (((ObjectTypeSymbol) prop.parent_symbol).get_cname ());
+			string param_list = "(%s *this".printf (get_ccode_name (prop.parent_symbol));
 			if (!acc.readable) {
 				param_list += ", ";
-				param_list += acc.value_type.get_cname ();
+				param_list += get_ccode_name (acc.value_type);
 			}
 			param_list += ")";
 
 			var override_func = new CCodeFunction ("%soverride_%s_%s".printf (prop.parent_symbol.get_lower_case_cprefix (), acc.readable ? "get" : "set", prop.name));
 			override_func.add_parameter (new CCodeParameter ("type", "DovaType *"));
-			override_func.add_parameter (new CCodeParameter ("(*function) %s".printf (param_list), acc.readable ? acc.value_type.get_cname () : "void"));
+			override_func.add_parameter (new CCodeParameter ("(*function) %s".printf (param_list), acc.readable ? get_ccode_name (acc.value_type) : "void"));
 
 			push_function (override_func);
 
@@ -1257,7 +1257,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			if (acc.writable) {
 				function = new CCodeFunction (cname, "void");
 			} else {
-				function = new CCodeFunction (cname, acc.value_type.get_cname ());
+				function = new CCodeFunction (cname, get_ccode_name (acc.value_type));
 			}
 
 			if (prop.binding == MemberBinding.INSTANCE) {
@@ -1277,7 +1277,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			acc.body.emit (this);
 
 			if (acc.readable) {
-				var cdecl = new CCodeDeclaration (acc.value_type.get_cname ());
+				var cdecl = new CCodeDeclaration (get_ccode_name (acc.value_type));
 				cdecl.add_declarator (new CCodeVariableDeclarator.zero ("result", default_value_for_type (acc.value_type, true)));
 				function.block.prepend_statement (cdecl);
 
@@ -1291,13 +1291,13 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 	}
 
 	public override void generate_interface_declaration (Interface iface, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, iface, iface.get_cname ())) {
+		if (add_symbol_declaration (decl_space, iface, get_ccode_name (iface))) {
 			return;
 		}
 
 		// typedef to DovaObject instead of dummy struct to avoid warnings/casts
 		generate_class_declaration (object_class, decl_space);
-		decl_space.add_type_declaration (new CCodeTypeDefinition ("DovaObject", new CCodeVariableDeclarator (iface.get_cname ())));
+		decl_space.add_type_declaration (new CCodeTypeDefinition ("DovaObject", new CCodeVariableDeclarator (get_ccode_name (iface))));
 
 		generate_class_declaration (type_class, decl_space);
 
@@ -1338,11 +1338,11 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 	}
 
 	public override void generate_method_declaration (Method m, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, m, m.get_cname ())) {
+		if (add_symbol_declaration (decl_space, m, get_ccode_name (m))) {
 			return;
 		}
 
-		var function = new CCodeFunction (m.get_cname ());
+		var function = new CCodeFunction (get_ccode_name (m));
 
 		if (m.is_internal_symbol ()) {
 			function.modifiers |= CCodeModifiers.STATIC;
@@ -1361,10 +1361,10 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			base_func.insert_parameter (0, new CCodeParameter ("base_type", "DovaType *"));
 			decl_space.add_function_declaration (base_func);
 
-			string param_list = "(%s *this".printf (((ObjectTypeSymbol) m.parent_symbol).get_cname ());
+			string param_list = "(%s *this".printf (get_ccode_name (m.parent_symbol));
 			foreach (var param in m.get_parameters ()) {
 				param_list += ", ";
-				param_list += param.variable_type.get_cname ();
+				param_list += get_ccode_name (param.variable_type);
 			}
 			if (m.return_type is GenericType) {
 				param_list += ", void *";
@@ -1373,7 +1373,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 			var override_func = new CCodeFunction ("%soverride_%s".printf (m.parent_symbol.get_lower_case_cprefix (), m.name));
 			override_func.add_parameter (new CCodeParameter ("type", "DovaType *"));
-			override_func.add_parameter (new CCodeParameter ("(*function) %s".printf (param_list), (m.return_type is GenericType) ? "void" : m.return_type.get_cname ()));
+			override_func.add_parameter (new CCodeParameter ("(*function) %s".printf (param_list), (m.return_type is GenericType) ? "void" : get_ccode_name (m.return_type)));
 			decl_space.add_function_declaration (override_func);
 		}
 
@@ -1466,7 +1466,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 					// as closures have block data parameter
 					if (m.binding == MemberBinding.INSTANCE) {
 						var cself = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), "this");
-						var cdecl = new CCodeDeclaration ("%s *".printf (current_class.get_cname ()));
+						var cdecl = new CCodeDeclaration ("%s *".printf (get_ccode_name (current_class)));
 						cdecl.add_declarator (new CCodeVariableDeclarator ("this", cself));
 
 						ccode.add_statement (cdecl);
@@ -1495,7 +1495,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 				m.body.emit (this);
 
 				if (!(m.return_type is VoidType) && !(m.return_type is GenericType)) {
-					var cdecl = new CCodeDeclaration (m.return_type.get_cname ());
+					var cdecl = new CCodeDeclaration (get_ccode_name (m.return_type));
 					cdecl.add_declarator (new CCodeVariableDeclarator.zero ("result", default_value_for_type (m.return_type, true)));
 					ccode.add_statement (cdecl);
 
@@ -1504,7 +1504,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 				var st = m.parent_symbol as Struct;
 				if (m is CreationMethod && st != null && (st.is_boolean_type () || st.is_integer_type () || st.is_floating_type ())) {
-					var cdecl = new CCodeDeclaration (st.get_cname ());
+					var cdecl = new CCodeDeclaration (get_ccode_name (st));
 					cdecl.add_declarator (new CCodeVariableDeclarator ("this", new CCodeConstant ("0")));
 					ccode.add_statement (cdecl);
 
@@ -1518,15 +1518,15 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		if (m.is_abstract || m.is_virtual) {
 			generate_class_declaration ((Class) object_class, cfile);
 
-			var vfunc = new CCodeFunction (m.get_cname (), (m.return_type is GenericType) ? "void" : m.return_type.get_cname ());
+			var vfunc = new CCodeFunction (get_ccode_name (m), (m.return_type is GenericType) ? "void" : get_ccode_name (m.return_type));
 			vfunc.block = new CCodeBlock ();
 
-			vfunc.add_parameter (new CCodeParameter ("this", "%s *".printf (((ObjectTypeSymbol) m.parent_symbol).get_cname ())));
+			vfunc.add_parameter (new CCodeParameter ("this", "%s *".printf (get_ccode_name (m.parent_symbol))));
 			foreach (TypeParameter type_param in m.get_type_parameters ()) {
 				vfunc.add_parameter (new CCodeParameter ("%s_type".printf (type_param.name.down ()), "DovaType*"));
 			}
 			foreach (Parameter param in m.get_parameters ()) {
-				string ctypename = param.variable_type.get_cname ();
+				string ctypename = get_ccode_name (param.variable_type);
 				if (param.direction != ParameterDirection.IN) {
 					ctypename += "*";
 				}
@@ -1578,16 +1578,16 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			cfile.add_function (vfunc);
 
 
-			vfunc = new CCodeFunction ("%sbase_%s".printf (m.parent_symbol.get_lower_case_cprefix (), m.name), (m.return_type is GenericType) ? "void" : m.return_type.get_cname ());
+			vfunc = new CCodeFunction ("%sbase_%s".printf (m.parent_symbol.get_lower_case_cprefix (), m.name), (m.return_type is GenericType) ? "void" : get_ccode_name (m.return_type));
 			vfunc.block = new CCodeBlock ();
 
 			vfunc.add_parameter (new CCodeParameter ("base_type", "DovaType *"));
-			vfunc.add_parameter (new CCodeParameter ("this", "%s *".printf (((ObjectTypeSymbol) m.parent_symbol).get_cname ())));
+			vfunc.add_parameter (new CCodeParameter ("this", "%s *".printf (get_ccode_name (m.parent_symbol))));
 			foreach (TypeParameter type_param in m.get_type_parameters ()) {
 				vfunc.add_parameter (new CCodeParameter ("%s_type".printf (type_param.name.down ()), "DovaType*"));
 			}
 			foreach (Parameter param in m.get_parameters ()) {
-				string ctypename = param.variable_type.get_cname ();
+				string ctypename = get_ccode_name (param.variable_type);
 				if (param.direction != ParameterDirection.IN) {
 					ctypename += "*";
 				}
@@ -1622,10 +1622,10 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			cfile.add_function (vfunc);
 
 
-			string param_list = "(%s *this".printf (((ObjectTypeSymbol) m.parent_symbol).get_cname ());
+			string param_list = "(%s *this".printf (get_ccode_name (m.parent_symbol));
 			foreach (var param in m.get_parameters ()) {
 				param_list += ", ";
-				param_list += param.variable_type.get_cname ();
+				param_list += get_ccode_name (param.variable_type);
 			}
 			if (m.return_type is GenericType) {
 				param_list += ", void *";
@@ -1634,7 +1634,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 			var override_func = new CCodeFunction ("%soverride_%s".printf (m.parent_symbol.get_lower_case_cprefix (), m.name));
 			override_func.add_parameter (new CCodeParameter ("type", "DovaType *"));
-			override_func.add_parameter (new CCodeParameter ("(*function) %s".printf (param_list), (m.return_type is GenericType) ? "void" : m.return_type.get_cname ()));
+			override_func.add_parameter (new CCodeParameter ("(*function) %s".printf (param_list), (m.return_type is GenericType) ? "void" : get_ccode_name (m.return_type)));
 			override_func.block = new CCodeBlock ();
 
 			vcast = get_type_private_from_type ((ObjectTypeSymbol) m.parent_symbol, new CCodeIdentifier ("type"));
@@ -1748,11 +1748,11 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 		// do not generate _new functions for creation methods of abstract classes
 		if (current_type_symbol is Class && !current_class.is_abstract) {
-			var vfunc = new CCodeFunction (m.get_cname ());
+			var vfunc = new CCodeFunction (get_ccode_name (m));
 
 			var vblock = new CCodeBlock ();
 
-			var cdecl = new CCodeDeclaration ("%s *".printf (current_type_symbol.get_cname ()));
+			var cdecl = new CCodeDeclaration ("%s *".printf (get_ccode_name (current_type_symbol)));
 			cdecl.add_declarator (new CCodeVariableDeclarator ("this"));
 			vblock.add_statement (cdecl);
 
@@ -1763,7 +1763,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 			var alloc_call = new CCodeFunctionCall (new CCodeIdentifier ("dova_object_alloc"));
 			alloc_call.add_argument (type_get);
-			vblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("this"), new CCodeCastExpression (alloc_call, "%s *".printf (current_type_symbol.get_cname ())))));
+			vblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("this"), new CCodeCastExpression (alloc_call, "%s *".printf (get_ccode_name (current_type_symbol))))));
 
 			// allocate memory for fields of generic types
 			// this is only a temporary measure until this can be allocated inline at the end of the instance
@@ -1825,7 +1825,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			instance_param = new CCodeParameter ("_data%d_".printf (block_id), "Block%dData*".printf (block_id));
 		} else if (m.parent_symbol is Class && m is CreationMethod) {
 			if (vcall == null) {
-				instance_param = new CCodeParameter ("this", ((Class) m.parent_symbol).get_cname () + "*");
+				instance_param = new CCodeParameter ("this", get_ccode_name (((Class) m.parent_symbol)) + "*");
 			}
 		} else if (m.binding == MemberBinding.INSTANCE || (m.parent_symbol is Struct && m is CreationMethod)) {
 			TypeSymbol parent_type = find_parent_type (m);
@@ -1835,21 +1835,21 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
 			if (m.base_interface_method != null && !m.is_abstract && !m.is_virtual) {
 				var base_type = new ObjectType ((Interface) m.base_interface_method.parent_symbol);
-				instance_param = new CCodeParameter ("this", base_type.get_cname ());
+				instance_param = new CCodeParameter ("this", get_ccode_name (base_type));
 			} else if (m.overrides) {
 				var base_type = new ObjectType ((Class) m.base_method.parent_symbol);
 				generate_type_declaration (base_type, decl_space);
-				instance_param = new CCodeParameter ("this", base_type.get_cname ());
+				instance_param = new CCodeParameter ("this", get_ccode_name (base_type));
 			} else {
 				if (m.parent_symbol is Struct && m is CreationMethod) {
 					var st = (Struct) m.parent_symbol;
 					if (st.is_boolean_type () || st.is_integer_type () || st.is_floating_type ()) {
 						// use return value
 					} else {
-						instance_param = new CCodeParameter ("*this", this_type.get_cname ());
+						instance_param = new CCodeParameter ("*this", get_ccode_name (this_type));
 					}
 				} else {
-					instance_param = new CCodeParameter ("this", this_type.get_cname ());
+					instance_param = new CCodeParameter ("this", get_ccode_name (this_type));
 				}
 			}
 		}
@@ -1888,7 +1888,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		foreach (Parameter param in m.get_parameters ()) {
 			CCodeParameter cparam;
 			if (!param.ellipsis) {
-				string ctypename = param.variable_type.get_cname ();
+				string ctypename = get_ccode_name (param.variable_type);
 
 				generate_type_declaration (param.variable_type, decl_space);
 
@@ -1913,7 +1913,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		}
 
 		if (m.parent_symbol is Class && m is CreationMethod && vcall != null) {
-			func.return_type = ((Class) m.parent_symbol).get_cname () + "*";
+			func.return_type = get_ccode_name (((Class) m.parent_symbol)) + "*";
 		} else {
 			if (m.return_type is GenericType) {
 				func.add_parameter (new CCodeParameter ("result", "void *"));
@@ -1923,9 +1923,9 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			} else {
 				var st = m.parent_symbol as Struct;
 				if (m is CreationMethod && st != null && (st.is_boolean_type () || st.is_integer_type () || st.is_floating_type ())) {
-					func.return_type = st.get_cname ();
+					func.return_type = get_ccode_name (st);
 				} else {
-					func.return_type = m.return_type.get_cname ();
+					func.return_type = get_ccode_name (m.return_type);
 				}
 			}
 
@@ -1963,7 +1963,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 					value_size.add_argument (get_type_id_expression (array_type.element_type));
 					set_cvalue (expr, new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeCastExpression (ccontainer, "char*"), new CCodeBinaryExpression (CCodeBinaryOperator.MUL, value_size, cindex)));
 				} else {
-					set_cvalue (expr, new CCodeElementAccess (new CCodeCastExpression (ccontainer, "%s*".printf (array_type.element_type.get_cname ())), cindex));
+					set_cvalue (expr, new CCodeElementAccess (new CCodeCastExpression (ccontainer, "%s*".printf (get_ccode_name (array_type.element_type))), cindex));
 				}
 			}
 
@@ -1976,7 +1976,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 		foreach (var field in static_fields) {
 			field.initializer.emit (this);
 
-			var lhs = new CCodeIdentifier (field.get_cname ());
+			var lhs = new CCodeIdentifier (get_ccode_name (field));
 			var rhs = get_cvalue (field.initializer);
 
 			ccode.add_assignment (lhs, rhs);
diff --git a/codegen/valadovastructmodule.vala b/codegen/valadovastructmodule.vala
index 94d7ef4..642519d 100644
--- a/codegen/valadovastructmodule.vala
+++ b/codegen/valadovastructmodule.vala
@@ -24,14 +24,14 @@ using GLib;
 
 public abstract class Vala.DovaStructModule : DovaBaseModule {
 	public override void generate_struct_declaration (Struct st, CCodeFile decl_space) {
-		if (add_symbol_declaration (decl_space, st, st.get_cname ())) {
+		if (add_symbol_declaration (decl_space, st, get_ccode_name (st))) {
 			return;
 		}
 
 		if (st.base_struct != null) {
 			generate_struct_declaration (st.base_struct, decl_space);
 
-			decl_space.add_type_declaration (new CCodeTypeDefinition (st.base_struct.get_cname (), new CCodeVariableDeclarator (st.get_cname ())));
+			decl_space.add_type_declaration (new CCodeTypeDefinition (get_ccode_name (st.base_struct), new CCodeVariableDeclarator (get_ccode_name (st))));
 			return;
 		}
 
@@ -49,10 +49,10 @@ public abstract class Vala.DovaStructModule : DovaBaseModule {
 			return;
 		}
 
-		var instance_struct = new CCodeStruct ("_%s".printf (st.get_cname ()));
+		var instance_struct = new CCodeStruct ("_%s".printf (get_ccode_name (st)));
 
 		foreach (Field f in st.get_fields ()) {
-			string field_ctype = f.variable_type.get_cname ();
+			string field_ctype = get_ccode_name (f.variable_type);
 			if (f.is_volatile) {
 				field_ctype = "volatile " + field_ctype;
 			}
@@ -60,11 +60,11 @@ public abstract class Vala.DovaStructModule : DovaBaseModule {
 			if (f.binding == MemberBinding.INSTANCE)  {
 				generate_type_declaration (f.variable_type, decl_space);
 
-				instance_struct.add_field (field_ctype, f.get_cname () + f.variable_type.get_cdeclarator_suffix ());
+				instance_struct.add_field (field_ctype, get_ccode_name (f) + f.variable_type.get_cdeclarator_suffix ());
 			}
 		}
 
-		decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (st.get_cname ()), new CCodeVariableDeclarator (st.get_cname ())));
+		decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (get_ccode_name (st)), new CCodeVariableDeclarator (get_ccode_name (st))));
 
 		decl_space.add_type_definition (instance_struct);
 	}
diff --git a/codegen/valadovavaluemodule.vala b/codegen/valadovavaluemodule.vala
index dee99af..9df833d 100644
--- a/codegen/valadovavaluemodule.vala
+++ b/codegen/valadovavaluemodule.vala
@@ -59,9 +59,9 @@ public class Vala.DovaValueModule : DovaObjectModule {
 			function.modifiers = CCodeModifiers.STATIC;
 		}
 
-		function.add_parameter (new CCodeParameter ("dest", st.get_cname () + "*"));
+		function.add_parameter (new CCodeParameter ("dest", get_ccode_name (st) + "*"));
 		function.add_parameter (new CCodeParameter ("dest_index", "intptr_t"));
-		function.add_parameter (new CCodeParameter ("src", st.get_cname () + "*"));
+		function.add_parameter (new CCodeParameter ("src", get_ccode_name (st) + "*"));
 		function.add_parameter (new CCodeParameter ("src_index", "intptr_t"));
 
 		decl_space.add_function_declaration (function);
@@ -75,7 +75,7 @@ public class Vala.DovaValueModule : DovaObjectModule {
 		cdecl.modifiers = CCodeModifiers.STATIC;
 		cfile.add_type_member_declaration (cdecl);
 
-		string macro = "((%s *) (((char *) o) + _%s_object_offset))".printf (st.get_cname (), st.get_lower_case_cname ());
+		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));
 
 
@@ -126,7 +126,7 @@ public class Vala.DovaValueModule : DovaObjectModule {
 		type_init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("_%s_object_offset".printf (st.get_lower_case_cname ())), base_size)));
 
 		var sizeof_call = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
-		sizeof_call.add_argument (new CCodeIdentifier (st.get_cname ()));
+		sizeof_call.add_argument (new CCodeIdentifier (get_ccode_name (st)));
 		var set_size = new CCodeFunctionCall (new CCodeIdentifier ("dova_type_set_object_size"));
 		set_size.add_argument (new CCodeIdentifier ("%s_type".printf (st.get_lower_case_cname ())));
 		set_size.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, base_size, sizeof_call));
@@ -176,9 +176,9 @@ public class Vala.DovaValueModule : DovaObjectModule {
 		if (st.scope.lookup ("equals") is Method) {
 			var value_equals_fun = new CCodeFunction ("%s_value_equals".printf (st.get_lower_case_cname ()), "bool");
 			value_equals_fun.modifiers = CCodeModifiers.STATIC;
-			value_equals_fun.add_parameter (new CCodeParameter ("value", st.get_cname () + "*"));
+			value_equals_fun.add_parameter (new CCodeParameter ("value", get_ccode_name (st) + "*"));
 			value_equals_fun.add_parameter (new CCodeParameter ("value_index", "intptr_t"));
-			value_equals_fun.add_parameter (new CCodeParameter ("other", st.get_cname () + "*"));
+			value_equals_fun.add_parameter (new CCodeParameter ("other", get_ccode_name (st) + "*"));
 			value_equals_fun.add_parameter (new CCodeParameter ("other_index", "intptr_t"));
 			value_equals_fun.block = new CCodeBlock ();
 			var val = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("value"), new CCodeIdentifier ("value_index"));
@@ -200,7 +200,7 @@ public class Vala.DovaValueModule : DovaObjectModule {
 		if (st.scope.lookup ("hash") is Method) {
 			var value_hash_fun = new CCodeFunction ("%s_value_hash".printf (st.get_lower_case_cname ()), "uintptr_t");
 			value_hash_fun.modifiers = CCodeModifiers.STATIC;
-			value_hash_fun.add_parameter (new CCodeParameter ("value", st.get_cname () + "*"));
+			value_hash_fun.add_parameter (new CCodeParameter ("value", get_ccode_name (st) + "*"));
 			value_hash_fun.add_parameter (new CCodeParameter ("value_index", "intptr_t"));
 			value_hash_fun.block = new CCodeBlock ();
 			var val = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("value"), new CCodeIdentifier ("value_index"));
@@ -250,7 +250,7 @@ public class Vala.DovaValueModule : DovaObjectModule {
 		var value_from_any_fun = new CCodeFunction ("%s_value_from_any".printf (st.get_lower_case_cname ()));
 		value_from_any_fun.modifiers = CCodeModifiers.STATIC;
 		value_from_any_fun.add_parameter (new CCodeParameter ("any_", "any *"));
-		value_from_any_fun.add_parameter (new CCodeParameter ("value", st.get_cname () + "*"));
+		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))));
@@ -281,9 +281,9 @@ public class Vala.DovaValueModule : DovaObjectModule {
 			function.modifiers = CCodeModifiers.STATIC;
 		}
 
-		function.add_parameter (new CCodeParameter ("dest", st.get_cname () + "*"));
+		function.add_parameter (new CCodeParameter ("dest", get_ccode_name (st) + "*"));
 		function.add_parameter (new CCodeParameter ("dest_index", "intptr_t"));
-		function.add_parameter (new CCodeParameter ("src", st.get_cname () + "*"));
+		function.add_parameter (new CCodeParameter ("src", get_ccode_name (st) + "*"));
 		function.add_parameter (new CCodeParameter ("src_index", "intptr_t"));
 
 		var cblock = new CCodeBlock ();



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