[vala/staging: 4/4] codegen: Add ccode getters for GType functions of Classes and Interfaces
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 4/4] codegen: Add ccode getters for GType functions of Classes and Interfaces
- Date: Sun, 18 Nov 2018 19:57:44 +0000 (UTC)
commit 7ec98fad71a7b9522442cbac8106711fba94cfac
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Nov 18 16:28:14 2018 +0100
codegen: Add ccode getters for GType functions of Classes and Interfaces
and use them where possible.
codegen/valaccode.vala | 34 ++++++++++++++++++++++++++++++++
codegen/valaccodebasemodule.vala | 25 +++++++++++------------
codegen/valaccodememberaccessmodule.vala | 10 +++++-----
codegen/valaccodemethodcallmodule.vala | 4 ++--
codegen/valaccodemethodmodule.vala | 4 ++--
codegen/valagsignalmodule.vala | 2 +-
codegen/valagtypemodule.vala | 24 +++++++++++-----------
codegen/valatyperegisterfunction.vala | 4 ++--
8 files changed, 70 insertions(+), 37 deletions(-)
---
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
index 170e55f85..d4d9abee5 100644
--- a/codegen/valaccode.vala
+++ b/codegen/valaccode.vala
@@ -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;
}
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 48247a1f8..bdb93709a 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -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)));
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index ca8b6b6df..faf4545c9 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -51,7 +51,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
if (expr.inner is BaseAccess) {
if (m.base_method != null) {
var base_class = (Class) m.base_method.parent_symbol;
- var vcast = new CCodeFunctionCall (new CCodeIdentifier
("%s_CLASS".printf (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 {
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 82411bf17..0a9fea272 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -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) {
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 999f11901..9506fe6de 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -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");
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index 966deef44..a8aa450e6 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -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));
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index e46573cda..c50696d00 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -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))));
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala
index c4c860624..b78f4d217 100644
--- a/codegen/valatyperegisterfunction.vala
+++ b/codegen/valatyperegisterfunction.vala
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]