]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Add ccode getters for GType functions of Classes and Interfaces 7ec98fad71a7b9522442cbac8106711fba94cfac
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 18 Nov 2018 15:28:14 +0000 (16:28 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 18 Nov 2018 19:39:22 +0000 (20:39 +0100)
and use them where possible.

codegen/valaccode.vala
codegen/valaccodebasemodule.vala
codegen/valaccodememberaccessmodule.vala
codegen/valaccodemethodcallmodule.vala
codegen/valaccodemethodmodule.vala
codegen/valagsignalmodule.vala
codegen/valagtypemodule.vala
codegen/valatyperegisterfunction.vala

index 170e55f8593b48f1797fb35abc75b5cf1a2dc506..d4d9abee5d726e428f31671b5e203eb667ae7c76 100644 (file)
@@ -49,6 +49,30 @@ namespace Vala {
                return get_ccode_attribute(iface).type_name;
        }
 
+       public static string get_ccode_type_cast_function (ObjectTypeSymbol sym) {
+               assert (!(sym is Class && ((Class) sym).is_compact));
+               return get_ccode_upper_case_name (sym);
+       }
+
+       public static string get_ccode_interface_get_function (Interface iface) {
+               return "%s_GET_INTERFACE".printf (get_ccode_upper_case_name (iface));
+       }
+
+       public static string get_ccode_class_get_function (Class cl) {
+               assert (!cl.is_compact);
+               return "%s_GET_CLASS".printf (get_ccode_upper_case_name (cl));
+       }
+
+       public static string get_ccode_class_get_private_function (Class cl) {
+               assert (!cl.is_compact);
+               return "%s_GET_CLASS_PRIVATE".printf (get_ccode_upper_case_name (cl));
+       }
+
+       public static string get_ccode_class_type_function (Class cl) {
+               assert (!cl.is_compact);
+               return "%s_CLASS".printf (get_ccode_upper_case_name (cl));
+       }
+
        public static string get_ccode_lower_case_name (CodeNode node, string? infix = null) {
                unowned Symbol? sym = node as Symbol;
                if (sym != null) {
@@ -186,6 +210,11 @@ namespace Vala {
                return get_ccode_attribute(node).type_id;
        }
 
+       public static string get_ccode_type_function (TypeSymbol sym) {
+               assert (!((sym is Class && ((Class) sym).is_compact) || sym is ErrorCode || sym is ErrorDomain || sym is Delegate));
+               return "%s_get_type".printf (get_ccode_lower_case_name (sym));
+       }
+
        public static string get_ccode_marshaller_type_name (CodeNode node) {
                return get_ccode_attribute(node).marshaller_type_name;
        }
@@ -218,6 +247,11 @@ namespace Vala {
                }
        }
 
+       public static string get_ccode_class_type_check_function (Class cl) {
+               assert (!cl.is_compact);
+               return "%s_CLASS".printf (get_ccode_type_check_function (cl));
+       }
+
        public static string get_ccode_default_value (TypeSymbol sym) {
                return get_ccode_attribute(sym).default_value;
        }
index 48247a1f80d9c40479046095eb75a4bdbbeeae82..bdb93709a06fbd9d0df3c730ab9cc153de234244 100644 (file)
@@ -844,10 +844,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                decl_space.add_include ("glib-object.h");
                decl_space.add_type_declaration (new CCodeNewline ());
 
-               var macro = "(%s_get_type ())".printf (get_ccode_lower_case_name (en, null));
+               var fun_name = get_ccode_type_function (en);
+
+               var macro = "(%s ())".printf (fun_name);
                decl_space.add_type_declaration (new CCodeMacroReplacement (get_ccode_type_id (en), macro));
 
-               var fun_name = "%s_get_type".printf (get_ccode_lower_case_name (en, null));
                var regfun = new CCodeFunction (fun_name, "GType");
                regfun.modifiers = CCodeModifiers.CONST;
 
@@ -896,9 +897,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                init_context = instance_init_context;
                                finalize_context = instance_finalize_context;
                        } 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(get_ccode_upper_case_name (parent))));
+                               var get_class_private_call = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_private_function ((Class) m.parent_symbol)));
                                get_class_private_call.add_argument (new CCodeIdentifier ("klass"));
                                l = new CCodeMemberAccess.pointer (get_class_private_call, get_symbol_lock_name (get_ccode_name (m)));
                        } else {
@@ -1201,7 +1200,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
                } else if (f.binding == MemberBinding.CLASS)  {
                        if (f.access == SymbolAccessibility.PRIVATE) {
-                               var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS_PRIVATE".printf (get_ccode_upper_case_name (cl))));
+                               var ccall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_private_function (cl)));
                                ccall.add_argument (new CCodeIdentifier ("klass"));
                                lhs = new CCodeMemberAccess (ccall, get_ccode_name (f), true);
                        } else {
@@ -1691,12 +1690,12 @@ 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 (get_ccode_upper_case_name (iface, null))));
+                               vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_interface_get_function (iface)));
                                ((CCodeFunctionCall) vcast).add_argument (new CCodeIdentifier ("self"));
                        } else {
                                var cl = (Class) prop.parent_symbol;
                                if (!cl.is_compact) {
-                                       vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (cl, null))));
+                                       vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_function (cl)));
                                        ((CCodeFunctionCall) vcast).add_argument (new CCodeIdentifier ("self"));
                                } else {
                                        vcast = new CCodeIdentifier ("self");
@@ -2663,7 +2662,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                require_generic_accessors (iface);
 
                                string method_name = "get_%s_type".printf (type_parameter.name.down ());
-                               var cast_self = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (get_ccode_upper_case_name (iface))));
+                               var cast_self = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_interface_get_function (iface)));
                                cast_self.add_argument (new CCodeIdentifier ("self"));
                                var function_call = new CCodeFunctionCall (new CCodeMemberAccess.pointer (cast_self, method_name));
                                function_call.add_argument (new CCodeIdentifier ("self"));
@@ -2733,7 +2732,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                require_generic_accessors (iface);
 
                                string method_name = "get_%s_dup_func".printf (type_parameter.name.down ());
-                               var cast_self = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (get_ccode_upper_case_name (iface))));
+                               var cast_self = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_interface_get_function (iface)));
                                cast_self.add_argument (new CCodeIdentifier ("self"));
                                var function_call = new CCodeFunctionCall (new CCodeMemberAccess.pointer (cast_self, method_name));
                                function_call.add_argument (new CCodeIdentifier ("self"));
@@ -3276,7 +3275,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                require_generic_accessors (iface);
 
                                string method_name = "get_%s_destroy_func".printf (type_parameter.name.down ());
-                               var cast_self = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_INTERFACE".printf (get_ccode_upper_case_name (iface))));
+                               var cast_self = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_interface_get_function (iface)));
                                cast_self.add_argument (new CCodeIdentifier ("self"));
                                var function_call = new CCodeFunctionCall (new CCodeMemberAccess.pointer (cast_self, method_name));
                                function_call.add_argument (new CCodeIdentifier ("self"));
@@ -3948,7 +3947,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(get_ccode_upper_case_name (parent))));
+                       var get_class_private_call = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_private_function ((Class) parent)));
                        get_class_private_call.add_argument (klass);
                        l = new CCodeMemberAccess.pointer (get_class_private_call, get_symbol_lock_name (get_ccode_name (member)));
                } else {
@@ -6152,7 +6151,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 (get_ccode_upper_case_name (base_class, null))));
+                               var vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (base_class)));
                                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)));
index ca8b6b6df79097d031fc4d1a8db3cbb9a3e32c40..faf4545c9906118264358e90c56c259f5e9d1fba 100644 (file)
@@ -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 (get_ccode_upper_case_name (base_class, null))));
+                                       var vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (base_class)));
                                        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)));
@@ -69,7 +69,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                if (!method_has_wrapper (m.base_method)) {
                                        var base_class = (Class) m.base_method.parent_symbol;
                                        if (!base_class.is_compact) {
-                                               var vclass = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (base_class))));
+                                               var vclass = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_function (base_class)));
                                                vclass.add_argument (pub_inst);
                                                set_cvalue (expr, new CCodeMemberAccess.pointer (vclass, get_ccode_vfunc_name (m)));
                                        } else {
@@ -183,7 +183,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                }
                                if (base_prop.parent_symbol is Class) {
                                        var base_class = (Class) base_prop.parent_symbol;
-                                       var vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_class, null))));
+                                       var vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (base_class)));
                                        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)));
@@ -639,7 +639,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 (get_ccode_upper_case_name (cl, null) + "_CLASS"));
+                       var cast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (cl)));
 
                        CCodeExpression klass;
                        if (instance == null) {
@@ -661,7 +661,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 (get_ccode_upper_case_name (cl))));
+                               var ccall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_private_function (cl)));
                                ccall.add_argument (klass);
                                result.cvalue = new CCodeMemberAccess.pointer (ccall, get_ccode_name (field));
                        } else {
index 82411bf177b56395d30839f317e875fa52ec8521..0a9fea272ba7420267536bd6be1c5389bb4a6c8b 100644 (file)
@@ -97,7 +97,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 (get_ccode_upper_case_name (base_class, null))));
+                                       var vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (base_class)));
                                        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));
@@ -243,7 +243,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        }
                } else if (m != null && m.binding == MemberBinding.CLASS) {
                        var cl = (Class) m.parent_symbol;
-                       var cast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_upper_case_name (cl, null) + "_CLASS"));
+                       var cast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (cl)));
 
                        CCodeExpression klass;
                        if (ma.inner == null) {
index 999f119010b1f7001a4b474a0c4c8711147a0773..9506fe6de926b927a75917a97de124402d915ea9 100644 (file)
@@ -1094,12 +1094,12 @@ 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 (get_ccode_upper_case_name (iface))));
+                       vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_interface_get_function (iface)));
                        ((CCodeFunctionCall) vcast).add_argument (new CCodeIdentifier ("self"));
                } else {
                        var cl = (Class) m.parent_symbol;
                        if (!cl.is_compact) {
-                               vcast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (cl))));
+                               vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_function (cl)));
                                ((CCodeFunctionCall) vcast).add_argument (new CCodeIdentifier ("self"));
                        } else {
                                vcast = new CCodeIdentifier ("self");
index 966deef446d73dea60096b1bd04250899847d7c1..a8aa450e6b12acf9e2188846f0955c3cfa1c51be 100644 (file)
@@ -485,7 +485,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 (get_ccode_upper_case_name (base_class, null))));
+                               var vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (base_class)));
                                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));
index e46573cdad6bcdbad263eb2a601a21c8ad3c8b40..c50696d004f7e022dfda4861bf53ba7e0c450f67 100644 (file)
@@ -71,19 +71,19 @@ 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 (get_ccode_upper_case_name (cl, null)), macro));
+                       decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_type_cast_function (cl)), 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 (get_ccode_upper_case_name (cl, null)), macro));
+                       decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(klass)".printf (get_ccode_class_type_function (cl)), 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));
 
                        macro = "(G_TYPE_CHECK_CLASS_TYPE ((klass), %s))".printf (get_ccode_type_id (cl));
-                       decl_space.add_type_declaration (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (get_ccode_type_check_function (cl)), macro));
+                       decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(klass)".printf (get_ccode_class_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 (get_ccode_upper_case_name (cl, null)), macro));
+                       decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_class_get_function (cl)), macro));
                        decl_space.add_type_declaration (new CCodeNewline ());
                }
 
@@ -614,7 +614,7 @@ public class Vala.GTypeModule : GErrorModule {
                                decl_space.add_type_member_declaration (type_priv_struct);
 
                                string macro = "(G_TYPE_CLASS_GET_PRIVATE (klass, %s, %sClassPrivate))".printf (get_ccode_type_id (cl), get_ccode_name (cl));
-                               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 (new CCodeMacroReplacement ("%s(klass)".printf (get_ccode_class_get_private_function (cl)), macro));
                        }
                }
        }
@@ -805,11 +805,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 (get_ccode_upper_case_name (cl, null))));
+                               var get_class = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_function (cl)));
                                get_class.add_argument (new CCodeIdentifier ("self"));
 
                                // finalize class
-                               var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (get_ccode_upper_case_name (cl, null))));
+                               var ccast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_get_function (cl)));
                                ccast.add_argument (new CCodeIdentifier ("self"));
                                ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (ccast, "finalize"));
                                ccall.add_argument (new CCodeIdentifier ("self"));
@@ -1339,9 +1339,9 @@ public class Vala.GTypeModule : GErrorModule {
                        if (prop.base_property == null) {
                                continue;
                        }
-                       var base_type = prop.base_property.parent_symbol;
+                       var base_type = (Class) prop.base_property.parent_symbol;
 
-                       var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (get_ccode_upper_case_name (base_type))));
+                       var ccast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (base_type)));
                        ccast.add_argument (new CCodeIdentifier ("klass"));
 
                        if (!get_ccode_no_accessor_method (prop.base_property) && !get_ccode_concrete_accessor (prop.base_property)) {
@@ -1842,7 +1842,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 (get_ccode_upper_case_name (fundamental_class))));
+                               var ccast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (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"));
@@ -2088,13 +2088,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 (get_ccode_upper_case_name (iface, null)), macro));
+               decl_space.add_type_declaration (new CCodeMacroReplacement ("%s(obj)".printf (get_ccode_type_cast_function (iface)), 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), get_ccode_type_name (iface));
-               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 CCodeMacroReplacement ("%s(obj)".printf (get_ccode_interface_get_function (iface)), 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))));
index c4c860624fa26e5cfe4b042373203137c68e04a6..b78f4d2172d12baa013cd1291903cac182a3f726 100644 (file)
@@ -66,7 +66,7 @@ public abstract class Vala.TypeRegisterFunction {
 
                CCodeFunction fun;
                if (!plugin) {
-                       fun = new CCodeFunction ("%s_get_type".printf (get_ccode_lower_case_name (type_symbol)), "GType");
+                       fun = new CCodeFunction (get_ccode_type_function (type_symbol), "GType");
                        fun.modifiers = CCodeModifiers.CONST;
 
                        /* Function will not be prototyped anyway */
@@ -89,7 +89,7 @@ public abstract class Vala.TypeRegisterFunction {
                        declaration_fragment.append (fun.copy ());
                        fun.is_declaration = false;
 
-                       var get_fun = new CCodeFunction ("%s_get_type".printf (get_ccode_lower_case_name (type_symbol)), "GType");
+                       var get_fun = new CCodeFunction (get_ccode_type_function (type_symbol), "GType");
                        get_fun.modifiers = CCodeModifiers.CONST;
 
                        get_fun.is_declaration = true;