[vala/staging: 2/6] codegen: Factor out static getters for ccode-attributes
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 2/6] codegen: Factor out static getters for ccode-attributes
- Date: Sun, 19 Nov 2017 13:17:03 +0000 (UTC)
commit 62889306e8c47670f3977cb168c8eb1322eb0057
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Oct 13 22:29:58 2017 +0200
codegen: Factor out static getters for ccode-attributes
https://bugzilla.gnome.org/show_bug.cgi?id=788837
codegen/Makefile.am | 1 +
codegen/valaccode.vala | 375 ++++++++++++++++++++++++++++
codegen/valaccodeattribute.vala | 192 +++++++-------
codegen/valaccodebasemodule.vala | 346 -------------------------
codegen/valaccodemethodcallmodule.vala | 4 +-
codegen/valaclassregisterfunction.vala | 42 ++--
codegen/valagdbusmodule.vala | 2 +-
codegen/valagerrormodule.vala | 2 +-
codegen/valagirwriter.vala | 84 +++---
codegen/valagtypemodule.vala | 16 +-
codegen/valainterfaceregisterfunction.vala | 8 +-
codegen/valatyperegisterfunction.vala | 20 +-
valadoc/treebuilder.vala | 50 ++--
13 files changed, 586 insertions(+), 556 deletions(-)
---
diff --git a/codegen/Makefile.am b/codegen/Makefile.am
index 3579eb9..036652e 100644
--- a/codegen/Makefile.am
+++ b/codegen/Makefile.am
@@ -23,6 +23,7 @@ libvalaccodegen_la_LDFLAGS = \
$(NULL)
libvalaccodegen_la_VALASOURCES = \
+ valaccode.vala \
valaccodearraymodule.vala \
valaccodeassignmentmodule.vala \
valaccodeattribute.vala \
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
new file mode 100644
index 0000000..e84f0e5
--- /dev/null
+++ b/codegen/valaccode.vala
@@ -0,0 +1,375 @@
+/* valaccode.vala
+ *
+ * Copyright (C) 2017 Rico Tzschichholz
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Rico Tzschichholz <ricotz ubuntu com>
+ */
+
+namespace Vala {
+ static int? ccode_attribute_cache_index = null;
+
+ static CCodeAttribute get_ccode_attribute (CodeNode node) {
+ if (ccode_attribute_cache_index == null) {
+ ccode_attribute_cache_index = CodeNode.get_attribute_cache_index ();
+ }
+
+ var attr = node.get_attribute_cache (ccode_attribute_cache_index);
+ if (attr == null) {
+ attr = new CCodeAttribute (node);
+ node.set_attribute_cache (ccode_attribute_cache_index, attr);
+ }
+ return (CCodeAttribute) attr;
+ }
+
+ public static string get_ccode_name (CodeNode node) {
+ return get_ccode_attribute(node).name;
+ }
+
+ public static string get_ccode_const_name (CodeNode node) {
+ return get_ccode_attribute(node).const_name;
+ }
+
+ public static string get_ccode_type_name (Interface iface) {
+ return get_ccode_attribute(iface).type_name;
+ }
+
+ public static string get_ccode_lower_case_name (CodeNode node, string? infix = null) {
+ var sym = node as Symbol;
+ if (sym != null) {
+ if (infix == null) {
+ infix = "";
+ }
+ if (sym is Delegate) {
+ return "%s%s%s".printf (get_ccode_lower_case_prefix (sym.parent_symbol),
infix, Symbol.camel_case_to_lower_case (sym.name));
+ } else if (sym is Signal) {
+ return get_ccode_attribute (sym).name.replace ("-", "_");
+ } else if (sym is ErrorCode) {
+ return get_ccode_name (sym).down ();
+ } else {
+ return "%s%s%s".printf (get_ccode_lower_case_prefix (sym.parent_symbol),
infix, get_ccode_lower_case_suffix (sym));
+ }
+ } else if (node is ErrorType) {
+ var type = (ErrorType) node;
+ if (type.error_domain == null) {
+ if (infix == null) {
+ return "g_error";
+ } else {
+ return "g_%s_error".printf (infix);
+ }
+ } else if (type.error_code == null) {
+ return get_ccode_lower_case_name (type.error_domain, infix);
+ } else {
+ return get_ccode_lower_case_name (type.error_code, infix);
+ }
+ } else if (node is DelegateType) {
+ var type = (DelegateType) node;
+ return get_ccode_lower_case_name (type.delegate_symbol, infix);
+ } else if (node is PointerType) {
+ var type = (PointerType) node;
+ return get_ccode_lower_case_name (type.base_type, infix);
+ } else if (node is GenericType) {
+ return "valageneric";
+ } else if (node is VoidType) {
+ return "valavoid";
+ } else {
+ var type = (DataType) node;
+ return get_ccode_lower_case_name (type.data_type, infix);
+ }
+ }
+
+ public static string get_ccode_upper_case_name (Symbol sym, string? infix = null) {
+ if (sym is Property) {
+ return "%s_%s".printf (get_ccode_lower_case_name (sym.parent_symbol),
Symbol.camel_case_to_lower_case (sym.name)).ascii_up ();
+ } else {
+ return get_ccode_lower_case_name (sym, infix).ascii_up ();
+ }
+ }
+
+ public static string get_ccode_header_filenames (Symbol sym) {
+ return get_ccode_attribute(sym).header_filenames;
+ }
+
+ public static string get_ccode_prefix (Symbol sym) {
+ return get_ccode_attribute(sym).prefix;
+ }
+
+ public static string get_ccode_lower_case_prefix (Symbol sym) {
+ return get_ccode_attribute(sym).lower_case_prefix;
+ }
+
+ public static string get_ccode_lower_case_suffix (Symbol sym) {
+ return get_ccode_attribute(sym).lower_case_suffix;
+ }
+
+ public static string get_ccode_ref_function (TypeSymbol sym) {
+ return get_ccode_attribute(sym).ref_function;
+ }
+
+ public static string get_ccode_quark_name (ErrorDomain edomain) {
+ return get_ccode_lower_case_name (edomain) + "-quark";
+ }
+
+ public static bool is_reference_counting (TypeSymbol sym) {
+ if (sym is Class) {
+ return get_ccode_ref_function (sym) != null;
+ } else if (sym is Interface) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static bool get_ccode_ref_function_void (Class cl) {
+ return get_ccode_attribute(cl).ref_function_void;
+ }
+
+ public static bool get_ccode_free_function_address_of (Class cl) {
+ return get_ccode_attribute(cl).free_function_address_of;
+ }
+
+ public static string get_ccode_unref_function (ObjectTypeSymbol sym) {
+ return get_ccode_attribute(sym).unref_function;
+ }
+
+ public static string get_ccode_ref_sink_function (ObjectTypeSymbol sym) {
+ return get_ccode_attribute(sym).ref_sink_function;
+ }
+
+ public static string get_ccode_copy_function (TypeSymbol sym) {
+ return get_ccode_attribute(sym).copy_function;
+ }
+
+ public static string get_ccode_destroy_function (TypeSymbol sym) {
+ return get_ccode_attribute(sym).destroy_function;
+ }
+
+ public static string? get_ccode_dup_function (TypeSymbol sym) {
+ if (sym is Struct) {
+ return get_ccode_attribute (sym).dup_function;
+ }
+ return get_ccode_copy_function (sym);
+ }
+
+ public static string get_ccode_free_function (TypeSymbol sym) {
+ return get_ccode_attribute(sym).free_function;
+ }
+
+ public static bool get_ccode_is_gboxed (TypeSymbol sym) {
+ return get_ccode_free_function (sym) == "g_boxed_free";
+ }
+
+ public static bool get_ccode_finish_instance (CodeNode node) {
+ return get_ccode_attribute (node).finish_instance;
+ }
+
+ public static string get_ccode_type_id (CodeNode node) {
+ return get_ccode_attribute(node).type_id;
+ }
+
+ public static string get_ccode_marshaller_type_name (CodeNode node) {
+ return get_ccode_attribute(node).marshaller_type_name;
+ }
+
+ public static string get_ccode_get_value_function (CodeNode sym) {
+ return get_ccode_attribute(sym).get_value_function;
+ }
+
+ public static string get_ccode_set_value_function (CodeNode sym) {
+ return get_ccode_attribute(sym).set_value_function;
+ }
+
+ public static string get_ccode_take_value_function (CodeNode sym) {
+ return get_ccode_attribute(sym).take_value_function;
+ }
+
+ public static string get_ccode_param_spec_function (CodeNode sym) {
+ return get_ccode_attribute(sym).param_spec_function;
+ }
+
+ public static string get_ccode_type_check_function (TypeSymbol sym) {
+ var cl = sym as Class;
+ var a = sym.get_attribute_string ("CCode", "type_check_function");
+ if (cl != null && a != null) {
+ return a;
+ } else if ((cl != null && cl.is_compact) || sym is Struct || sym is Enum || sym is Delegate) {
+ return "";
+ } else {
+ return get_ccode_upper_case_name (sym, "IS_");
+ }
+ }
+
+ public static string get_ccode_default_value (TypeSymbol sym) {
+ return get_ccode_attribute(sym).default_value;
+ }
+
+ public static bool get_ccode_has_copy_function (Struct st) {
+ return st.get_attribute_bool ("CCode", "has_copy_function", true);
+ }
+
+ public static bool get_ccode_has_destroy_function (Struct st) {
+ return st.get_attribute_bool ("CCode", "has_destroy_function", true);
+ }
+
+ public static double get_ccode_instance_pos (CodeNode node) {
+ if (node is Delegate) {
+ return node.get_attribute_double ("CCode", "instance_pos", -2);
+ } else {
+ return node.get_attribute_double ("CCode", "instance_pos", 0);
+ }
+ }
+
+ public static bool get_ccode_array_length (CodeNode node) {
+ return get_ccode_attribute(node).array_length;
+ }
+
+ public static string? get_ccode_array_length_type (CodeNode node) {
+ return get_ccode_attribute(node).array_length_type;
+ }
+
+ public static bool get_ccode_array_null_terminated (CodeNode node) {
+ return get_ccode_attribute(node).array_null_terminated;
+ }
+
+ public static string? get_ccode_array_length_name (CodeNode node) {
+ return get_ccode_attribute(node).array_length_name;
+ }
+
+ public static string? get_ccode_array_length_expr (CodeNode node) {
+ return get_ccode_attribute(node).array_length_expr;
+ }
+
+ public static double get_ccode_array_length_pos (CodeNode node) {
+ var a = node.get_attribute ("CCode");
+ if (a != null && a.has_argument ("array_length_pos")) {
+ return a.get_double ("array_length_pos");
+ }
+ if (node is Parameter) {
+ var param = (Parameter) node;
+ return get_ccode_pos (param) + 0.1;
+ } else {
+ return -3;
+ }
+ }
+
+ public static double get_ccode_delegate_target_pos (CodeNode node) {
+ var a = node.get_attribute ("CCode");
+ if (a != null && a.has_argument ("delegate_target_pos")) {
+ return a.get_double ("delegate_target_pos");
+ }
+ if (node is Parameter) {
+ var param = (Parameter) node;
+ return get_ccode_pos (param) + 0.1;
+ } else {
+ return -3;
+ }
+ }
+
+ public static double get_ccode_destroy_notify_pos (CodeNode node) {
+ var a = node.get_attribute ("CCode");
+ if (a != null && a.has_argument ("destroy_notify_pos")) {
+ return a.get_double ("destroy_notify_pos");
+ }
+ if (node is Parameter) {
+ var param = (Parameter) node;
+ return get_ccode_pos (param) + 0.1;
+ } else {
+ return -3;
+ }
+ }
+
+ public static bool get_ccode_delegate_target (CodeNode node) {
+ return get_ccode_attribute(node).delegate_target;
+ }
+
+ public static string get_ccode_delegate_target_name (Variable variable) {
+ return get_ccode_attribute(variable).delegate_target_name;
+ }
+
+ public static double get_ccode_pos (Parameter param) {
+ return get_ccode_attribute(param).pos;
+ }
+
+ public static string? get_ccode_type (CodeNode node) {
+ return get_ccode_attribute(node).ctype;
+ }
+
+ public static bool get_ccode_simple_generics (Method m) {
+ return m.get_attribute_bool ("CCode", "simple_generics");
+ }
+
+ public static string get_ccode_real_name (Symbol sym) {
+ return get_ccode_attribute(sym).real_name;
+ }
+
+ public static string get_ccode_constructv_name (CreationMethod m) {
+ const string infix = "constructv";
+
+ var parent = m.parent_symbol as Class;
+
+ if (m.name == ".new") {
+ return "%s%s".printf (get_ccode_lower_case_prefix (parent), infix);
+ } else {
+ return "%s%s_%s".printf (get_ccode_lower_case_prefix (parent), infix, m.name);
+ }
+ }
+
+ public static string get_ccode_vfunc_name (Method m) {
+ return get_ccode_attribute(m).vfunc_name;
+ }
+
+ public static string get_ccode_finish_name (Method m) {
+ return get_ccode_attribute(m).finish_name;
+ }
+
+ public static string get_ccode_finish_vfunc_name (Method m) {
+ return get_ccode_attribute(m).finish_vfunc_name;
+ }
+
+ public static string get_ccode_finish_real_name (Method m) {
+ return get_ccode_attribute(m).finish_real_name;
+ }
+
+ public static bool get_ccode_no_accessor_method (Property p) {
+ return p.get_attribute ("NoAccessorMethod") != null;
+ }
+
+ public static bool get_ccode_concrete_accessor (Property p) {
+ return p.get_attribute ("ConcreteAccessor") != null;
+ }
+
+ public static bool get_ccode_has_type_id (TypeSymbol sym) {
+ return sym.get_attribute_bool ("CCode", "has_type_id", true);
+ }
+
+ public static bool get_ccode_has_new_function (Method m) {
+ return m.get_attribute_bool ("CCode", "has_new_function", true);
+ }
+
+ public static bool get_ccode_has_generic_type_parameter (Method m) {
+ var a = m.get_attribute ("CCode");
+ return a != null && a.has_argument ("generic_type_pos");
+ }
+
+ public static double get_ccode_generic_type_pos (Method m) {
+ return m.get_attribute_double ("CCode", "generic_type_pos");
+ }
+
+ public static string get_ccode_sentinel (Method m) {
+ return get_ccode_attribute(m).sentinel;
+ }
+}
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index 090c765..3f12ff5 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -64,7 +64,7 @@ public class Vala.CCodeAttribute : AttributeCache {
_type_name = ccode.get_string ("type_cname");
}
if (_type_name == null) {
- _type_name = "%sIface".printf (CCodeBaseModule.get_ccode_name (sym));
+ _type_name = "%sIface".printf (get_ccode_name (sym));
}
}
return _type_name;
@@ -153,7 +153,7 @@ public class Vala.CCodeAttribute : AttributeCache {
} else {
var cl = (Class) sym;
if (cl.base_class != null) {
- _ref_function_void =
CCodeBaseModule.get_ccode_ref_function_void (cl.base_class);
+ _ref_function_void = get_ccode_ref_function_void
(cl.base_class);
} else {
_ref_function_void = false;
}
@@ -260,7 +260,7 @@ public class Vala.CCodeAttribute : AttributeCache {
} else {
var cl = (Class) sym;
if (cl.base_class != null) {
- _free_function_address_of =
CCodeBaseModule.get_ccode_free_function_address_of (cl.base_class);
+ _free_function_address_of =
get_ccode_free_function_address_of (cl.base_class);
} else {
_free_function_address_of = false;
}
@@ -425,7 +425,7 @@ public class Vala.CCodeAttribute : AttributeCache {
if (_vfunc_name == null) {
Method m = node as Method;
if (m != null && m.signal_reference != null) {
- _vfunc_name = CCodeBaseModule.get_ccode_lower_case_name
(m.signal_reference);
+ _vfunc_name = get_ccode_lower_case_name (m.signal_reference);
} else {
_vfunc_name = sym.name;
}
@@ -615,11 +615,11 @@ public class Vala.CCodeAttribute : AttributeCache {
// local constant
return sym.name;
}
- return "%s%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(sym.parent_symbol).ascii_up (), sym.name);
+ return "%s%s".printf (get_ccode_lower_case_prefix
(sym.parent_symbol).ascii_up (), sym.name);
} else if (sym is Field) {
var cname = sym.name;
if (((Field) sym).binding == MemberBinding.STATIC) {
- cname = "%s%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(sym.parent_symbol), sym.name);
+ cname = "%s%s".printf (get_ccode_lower_case_prefix
(sym.parent_symbol), sym.name);
}
if (cname[0].isdigit ()) {
Report.error (node.source_reference, "Field name starts with a digit.
Use the `cname' attribute to provide a valid C name if intended");
@@ -635,57 +635,57 @@ public class Vala.CCodeAttribute : AttributeCache {
infix = "new";
}
if (m.name == ".new") {
- return "%s%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(m.parent_symbol), infix);
+ return "%s%s".printf (get_ccode_lower_case_prefix (m.parent_symbol),
infix);
} else {
- return "%s%s_%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(m.parent_symbol), infix, m.name);
+ return "%s%s_%s".printf (get_ccode_lower_case_prefix
(m.parent_symbol), infix, m.name);
}
} else if (sym is DynamicMethod) {
return "_dynamic_%s%d".printf (sym.name, dynamic_method_id++);
} else if (sym is Method) {
var m = (Method) sym;
if (m.is_async_callback) {
- return "%s_co".printf (CCodeBaseModule.get_ccode_real_name ((Method)
m.parent_symbol));
+ return "%s_co".printf (get_ccode_real_name ((Method)
m.parent_symbol));
}
if (m.signal_reference != null) {
- return "%s%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(m.parent_symbol), CCodeBaseModule.get_ccode_lower_case_name (m.signal_reference));
+ return "%s%s".printf (get_ccode_lower_case_prefix (m.parent_symbol),
get_ccode_lower_case_name (m.signal_reference));
}
if (sym.name == "main" && sym.parent_symbol.name == null) {
// avoid conflict with generated main function
return "_vala_main";
} else if (sym.name.has_prefix ("_")) {
- return "_%s%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(sym.parent_symbol), sym.name.substring (1));
+ return "_%s%s".printf (get_ccode_lower_case_prefix
(sym.parent_symbol), sym.name.substring (1));
} else {
- return "%s%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(sym.parent_symbol), sym.name);
+ return "%s%s".printf (get_ccode_lower_case_prefix
(sym.parent_symbol), sym.name);
}
} else if (sym is PropertyAccessor) {
var acc = (PropertyAccessor) sym;
var t = (TypeSymbol) acc.prop.parent_symbol;
if (acc.readable) {
- return "%sget_%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(t), acc.prop.name);
+ return "%sget_%s".printf (get_ccode_lower_case_prefix (t),
acc.prop.name);
} else {
- return "%sset_%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(t), acc.prop.name);
+ return "%sset_%s".printf (get_ccode_lower_case_prefix (t),
acc.prop.name);
}
} else if (sym is Signal) {
return Symbol.camel_case_to_lower_case (sym.name).replace ("_", "-");;
} else if (sym is LocalVariable || sym is Parameter) {
return sym.name;
} else {
- return "%s%s".printf (CCodeBaseModule.get_ccode_prefix (sym.parent_symbol),
sym.name);
+ return "%s%s".printf (get_ccode_prefix (sym.parent_symbol), sym.name);
}
} else if (node is ObjectType) {
var type = (ObjectType) node;
string cname;
if (!type.value_owned) {
- cname = CCodeBaseModule.get_ccode_const_name (type.type_symbol);
+ cname = get_ccode_const_name (type.type_symbol);
} else {
- cname = CCodeBaseModule.get_ccode_name (type.type_symbol);
+ cname = get_ccode_name (type.type_symbol);
}
return "%s*".printf (cname);
} else if (node is ArrayType) {
var type = (ArrayType) node;
- var cname = CCodeBaseModule.get_ccode_name (type.element_type);
+ var cname = get_ccode_name (type.element_type);
if (type.inline_allocated) {
return cname;
} else {
@@ -693,7 +693,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (node is DelegateType) {
var type = (DelegateType) node;
- return CCodeBaseModule.get_ccode_name (type.delegate_symbol);
+ return get_ccode_name (type.delegate_symbol);
} else if (node is ErrorType) {
return "GError*";
} else if (node is GenericType) {
@@ -710,21 +710,21 @@ public class Vala.CCodeAttribute : AttributeCache {
} else if (node is PointerType) {
var type = (PointerType) node;
if (type.base_type.data_type != null && type.base_type.data_type.is_reference_type
()) {
- return CCodeBaseModule.get_ccode_name (type.base_type);
+ return get_ccode_name (type.base_type);
} else {
- return "%s*".printf (CCodeBaseModule.get_ccode_name (type.base_type));
+ return "%s*".printf (get_ccode_name (type.base_type));
}
} else if (node is VoidType) {
return "void";
} else if (node is ClassType) {
var type = (ClassType) node;
- return "%sClass*".printf (CCodeBaseModule.get_ccode_name (type.class_symbol));
+ return "%sClass*".printf (get_ccode_name (type.class_symbol));
} else if (node is InterfaceType) {
var type = (InterfaceType) node;
- return "%s*".printf (CCodeBaseModule.get_ccode_type_name (type.interface_symbol));
+ return "%s*".printf (get_ccode_type_name (type.interface_symbol));
} else if (node is ValueType) {
var type = (ValueType) node;
- var cname = CCodeBaseModule.get_ccode_name (type.type_symbol);
+ var cname = get_ccode_name (type.type_symbol);
if (type.nullable) {
return "%s*".printf (cname);
} else {
@@ -743,7 +743,7 @@ public class Vala.CCodeAttribute : AttributeCache {
return "";
}
if (sym.parent_symbol != null) {
- var parent_headers = CCodeBaseModule.get_ccode_header_filenames (sym.parent_symbol);
+ var parent_headers = get_ccode_header_filenames (sym.parent_symbol);
if (parent_headers.length > 0) {
return parent_headers;
}
@@ -759,12 +759,12 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym is ObjectTypeSymbol) {
return name;
} else if (sym is Enum || sym is ErrorDomain) {
- return "%s_".printf (CCodeBaseModule.get_ccode_upper_case_name (sym));
+ return "%s_".printf (get_ccode_upper_case_name (sym));
} else if (sym is Namespace) {
if (sym.name != null) {
var parent_prefix = "";
if (sym.parent_symbol != null) {
- parent_prefix = CCodeBaseModule.get_ccode_prefix (sym.parent_symbol);
+ parent_prefix = get_ccode_prefix (sym.parent_symbol);
}
return "%s%s".printf (parent_prefix, sym.name);
} else {
@@ -781,13 +781,13 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym.name == null) {
return "";
} else {
- return "%s%s_".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(sym.parent_symbol), Symbol.camel_case_to_lower_case (sym.name));
+ return "%s%s_".printf (get_ccode_lower_case_prefix (sym.parent_symbol),
Symbol.camel_case_to_lower_case (sym.name));
}
} else if (sym is Method) {
// for lambda expressions
return "";
} else {
- return "%s_".printf (CCodeBaseModule.get_ccode_lower_case_name (sym));
+ return "%s_".printf (get_ccode_lower_case_name (sym));
}
}
@@ -806,7 +806,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
return csuffix;
} else if (sym is Signal) {
- return CCodeBaseModule.get_ccode_attribute (sym).name.replace ("-", "_");
+ return get_ccode_attribute (sym).name.replace ("-", "_");
} else if (sym.name != null) {
return Symbol.camel_case_to_lower_case (sym.name);
}
@@ -819,11 +819,11 @@ public class Vala.CCodeAttribute : AttributeCache {
if (cl.is_fundamental ()) {
return "%sref".printf (lower_case_prefix);
} else if (cl.base_class != null) {
- return CCodeBaseModule.get_ccode_ref_function (cl.base_class);
+ return get_ccode_ref_function (cl.base_class);
}
} else if (sym is Interface) {
foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
- var ref_func = CCodeBaseModule.get_ccode_ref_function ((ObjectTypeSymbol)
prereq.data_type);
+ var ref_func = get_ccode_ref_function ((ObjectTypeSymbol) prereq.data_type);
if (ref_func != null) {
return ref_func;
}
@@ -838,11 +838,11 @@ public class Vala.CCodeAttribute : AttributeCache {
if (cl.is_fundamental ()) {
return "%sunref".printf (lower_case_prefix);
} else if (cl.base_class != null) {
- return CCodeBaseModule.get_ccode_unref_function (cl.base_class);
+ return get_ccode_unref_function (cl.base_class);
}
} else if (sym is Interface) {
foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
- string unref_func = CCodeBaseModule.get_ccode_unref_function
((ObjectTypeSymbol) prereq.data_type);
+ string unref_func = get_ccode_unref_function ((ObjectTypeSymbol)
prereq.data_type);
if (unref_func != null) {
return unref_func;
}
@@ -853,10 +853,10 @@ public class Vala.CCodeAttribute : AttributeCache {
private string get_default_ref_sink_function () {
if (sym is Class) {
- return CCodeBaseModule.get_ccode_ref_sink_function (((Class) sym).base_class);
+ return get_ccode_ref_sink_function (((Class) sym).base_class);
} else if (sym is Interface) {
foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
- string ref_sink_func = CCodeBaseModule.get_ccode_ref_sink_function
((ObjectTypeSymbol) prereq.data_type);
+ string ref_sink_func = get_ccode_ref_sink_function ((ObjectTypeSymbol)
prereq.data_type);
if (ref_sink_func != "") {
return ref_sink_func;
}
@@ -869,7 +869,7 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym is Class) {
var cl = (Class) sym;
if (cl.base_class != null) {
- return CCodeBaseModule.get_ccode_free_function (cl.base_class);
+ return get_ccode_free_function (cl.base_class);
}
return "%sfree".printf (lower_case_prefix);
} else if (sym is Struct) {
@@ -883,26 +883,26 @@ public class Vala.CCodeAttribute : AttributeCache {
private string get_default_type_id () {
if (sym != null) {
if (sym is Class && !((Class) sym).is_compact || sym is Interface) {
- return CCodeBaseModule.get_ccode_upper_case_name (sym, "TYPE_");
+ return get_ccode_upper_case_name (sym, "TYPE_");
} else if (sym is ErrorType) {
return "G_TYPE_ERROR";
} else if (sym is Struct) {
var st = (Struct) sym;
- if (!CCodeBaseModule.get_ccode_has_type_id (st)) {
+ if (!get_ccode_has_type_id (st)) {
var base_struct = st.base_struct;
if (base_struct != null) {
- return CCodeBaseModule.get_ccode_type_id (base_struct);
+ return get_ccode_type_id (base_struct);
}
if (!st.is_simple_type ()) {
return "G_TYPE_POINTER";
}
} else {
- return CCodeBaseModule.get_ccode_upper_case_name (st, "TYPE_");
+ return get_ccode_upper_case_name (st, "TYPE_");
}
} else if (sym is Enum) {
var en = (Enum) sym;
- if (CCodeBaseModule.get_ccode_has_type_id (en)) {
- return CCodeBaseModule.get_ccode_upper_case_name (en, "TYPE_");
+ if (get_ccode_has_type_id (en)) {
+ return get_ccode_upper_case_name (en, "TYPE_");
} else {
return en.is_flags ? "G_TYPE_UINT" : "G_TYPE_INT";
}
@@ -920,7 +920,7 @@ public class Vala.CCodeAttribute : AttributeCache {
} else {
var type = (DataType) node;
if (type.data_type != null) {
- return CCodeBaseModule.get_ccode_type_id (type.data_type);
+ return get_ccode_type_id (type.data_type);
}
}
return "";
@@ -931,9 +931,9 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym is Class) {
var cl = (Class) sym;
if (cl.base_class != null) {
- return CCodeBaseModule.get_ccode_marshaller_type_name (cl.base_class);
+ return get_ccode_marshaller_type_name (cl.base_class);
} else if (!cl.is_compact) {
- return CCodeBaseModule.get_ccode_upper_case_name (cl);
+ return get_ccode_upper_case_name (cl);
} else if (type_id == "G_TYPE_POINTER") {
return "POINTER";
} else {
@@ -941,7 +941,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Enum) {
var en = (Enum) sym;
- if (CCodeBaseModule.get_ccode_has_type_id (en)) {
+ if (get_ccode_has_type_id (en)) {
if (en.is_flags) {
return "FLAGS";
} else {
@@ -956,7 +956,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Interface) {
foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
- var type_name = CCodeBaseModule.get_ccode_marshaller_type_name
(prereq.data_type);
+ var type_name = get_ccode_marshaller_type_name (prereq.data_type);
if (type_name != "") {
return type_name;
}
@@ -966,15 +966,15 @@ public class Vala.CCodeAttribute : AttributeCache {
var st = (Struct) sym;
var base_st = st.base_struct;
while (base_st != null) {
- if (CCodeBaseModule.get_ccode_has_type_id (base_st)) {
- return CCodeBaseModule.get_ccode_marshaller_type_name
(base_st);
+ if (get_ccode_has_type_id (base_st)) {
+ return get_ccode_marshaller_type_name (base_st);
} else {
base_st = base_st.base_struct;
}
}
if (st.is_simple_type ()) {
Report.error (st.source_reference, "The type `%s` doesn't declare a
marshaller type name".printf (st.get_full_name ()));
- } else if (CCodeBaseModule.get_ccode_has_type_id (st)) {
+ } else if (get_ccode_has_type_id (st)) {
return "BOXED";
} else {
return "POINTER";
@@ -984,7 +984,7 @@ public class Vala.CCodeAttribute : AttributeCache {
if (param.direction != ParameterDirection.IN) {
return "POINTER";
} else {
- return CCodeBaseModule.get_ccode_marshaller_type_name
(param.variable_type);
+ return get_ccode_marshaller_type_name (param.variable_type);
}
} else {
return "POINTER";
@@ -1008,7 +1008,7 @@ public class Vala.CCodeAttribute : AttributeCache {
} else if (node is VoidType) {
return "VOID";
} else {
- return CCodeBaseModule.get_ccode_marshaller_type_name (((DataType) node).data_type);
+ return get_ccode_marshaller_type_name (((DataType) node).data_type);
}
return "";
}
@@ -1017,9 +1017,9 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym is Class) {
var cl = (Class) sym;
if (cl.is_fundamental ()) {
- return CCodeBaseModule.get_ccode_lower_case_name (cl, "value_get_");
+ return get_ccode_lower_case_name (cl, "value_get_");
} else if (cl.base_class != null) {
- return CCodeBaseModule.get_ccode_get_value_function (cl.base_class);
+ return get_ccode_get_value_function (cl.base_class);
} else if (type_id == "G_TYPE_POINTER") {
return "g_value_get_pointer";
} else {
@@ -1027,7 +1027,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Enum) {
var en = (Enum) sym;
- if (CCodeBaseModule.get_ccode_has_type_id (en)) {
+ if (get_ccode_has_type_id (en)) {
if (en.is_flags) {
return "g_value_get_flags";
} else {
@@ -1042,7 +1042,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Interface) {
foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
- var type_name = CCodeBaseModule.get_ccode_get_value_function
(prereq.data_type);
+ var type_name = get_ccode_get_value_function (prereq.data_type);
if (type_name != "") {
return type_name;
}
@@ -1052,15 +1052,15 @@ public class Vala.CCodeAttribute : AttributeCache {
var st = (Struct) sym;
var base_st = st.base_struct;
while (base_st != null) {
- if (CCodeBaseModule.get_ccode_has_type_id (base_st)) {
- return CCodeBaseModule.get_ccode_get_value_function (base_st);
+ if (get_ccode_has_type_id (base_st)) {
+ return get_ccode_get_value_function (base_st);
} else {
base_st = base_st.base_struct;
}
}
if (st.is_simple_type ()) {
Report.error (st.source_reference, "The type `%s` doesn't declare a GValue
get function".printf (st.get_full_name ()));
- } else if (CCodeBaseModule.get_ccode_has_type_id (st)) {
+ } else if (get_ccode_has_type_id (st)) {
return "g_value_get_boxed";
} else {
return "g_value_get_pointer";
@@ -1075,9 +1075,9 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym is Class) {
var cl = (Class) sym;
if (cl.is_fundamental ()) {
- return CCodeBaseModule.get_ccode_lower_case_name (cl, "value_set_");
+ return get_ccode_lower_case_name (cl, "value_set_");
} else if (cl.base_class != null) {
- return CCodeBaseModule.get_ccode_set_value_function (cl.base_class);
+ return get_ccode_set_value_function (cl.base_class);
} else if (type_id == "G_TYPE_POINTER") {
return "g_value_set_pointer";
} else {
@@ -1085,7 +1085,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Enum) {
var en = (Enum) sym;
- if (CCodeBaseModule.get_ccode_has_type_id (en)) {
+ if (get_ccode_has_type_id (en)) {
if (en.is_flags) {
return "g_value_set_flags";
} else {
@@ -1100,7 +1100,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Interface) {
foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
- var type_name = CCodeBaseModule.get_ccode_set_value_function
(prereq.data_type);
+ var type_name = get_ccode_set_value_function (prereq.data_type);
if (type_name != "") {
return type_name;
}
@@ -1110,15 +1110,15 @@ public class Vala.CCodeAttribute : AttributeCache {
var st = (Struct) sym;
var base_st = st.base_struct;
while (base_st != null) {
- if (CCodeBaseModule.get_ccode_has_type_id (base_st)) {
- return CCodeBaseModule.get_ccode_set_value_function (base_st);
+ if (get_ccode_has_type_id (base_st)) {
+ return get_ccode_set_value_function (base_st);
} else {
base_st = base_st.base_struct;
}
}
if (st.is_simple_type ()) {
Report.error (st.source_reference, "The type `%s` doesn't declare a GValue
set function".printf (st.get_full_name ()));
- } else if (CCodeBaseModule.get_ccode_has_type_id (st)) {
+ } else if (get_ccode_has_type_id (st)) {
return "g_value_set_boxed";
} else {
return "g_value_set_pointer";
@@ -1133,9 +1133,9 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym is Class) {
var cl = (Class) sym;
if (cl.is_fundamental ()) {
- return CCodeBaseModule.get_ccode_lower_case_name (cl, "value_take_");
+ return get_ccode_lower_case_name (cl, "value_take_");
} else if (cl.base_class != null) {
- return CCodeBaseModule.get_ccode_take_value_function (cl.base_class);
+ return get_ccode_take_value_function (cl.base_class);
} else if (type_id == "G_TYPE_POINTER") {
return "g_value_set_pointer";
} else {
@@ -1143,7 +1143,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Enum) {
var en = (Enum) sym;
- if (CCodeBaseModule.get_ccode_has_type_id (en)) {
+ if (get_ccode_has_type_id (en)) {
if (en.is_flags) {
return "g_value_take_flags";
} else {
@@ -1158,7 +1158,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Interface) {
foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
- var func = CCodeBaseModule.get_ccode_take_value_function (prereq.data_type);
+ var func = get_ccode_take_value_function (prereq.data_type);
if (func != "") {
return func;
}
@@ -1168,15 +1168,15 @@ public class Vala.CCodeAttribute : AttributeCache {
var st = (Struct) sym;
var base_st = st.base_struct;
while (base_st != null) {
- if (CCodeBaseModule.get_ccode_has_type_id (base_st)) {
- return CCodeBaseModule.get_ccode_take_value_function (base_st);
+ if (get_ccode_has_type_id (base_st)) {
+ return get_ccode_take_value_function (base_st);
} else {
base_st = base_st.base_struct;
}
}
if (st.is_simple_type ()) {
Report.error (st.source_reference, "The type `%s` doesn't declare a GValue
take function".printf (st.get_full_name ()));
- } else if (CCodeBaseModule.get_ccode_has_type_id (st)) {
+ } else if (get_ccode_has_type_id (st)) {
return "g_value_take_boxed";
} else {
return "g_value_set_pointer";
@@ -1192,9 +1192,9 @@ public class Vala.CCodeAttribute : AttributeCache {
if (sym is Class) {
var cl = (Class) sym;
if (cl.is_fundamental ()) {
- return CCodeBaseModule.get_ccode_lower_case_name (cl, "param_spec_");
+ return get_ccode_lower_case_name (cl, "param_spec_");
} else if (cl.base_class != null) {
- return CCodeBaseModule.get_ccode_param_spec_function (cl.base_class);
+ return get_ccode_param_spec_function (cl.base_class);
} else if (type_id == "G_TYPE_POINTER") {
return "g_param_spec_pointer";
} else {
@@ -1202,7 +1202,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
} else if (sym is Interface) {
foreach (var prereq in ((Interface) sym).get_prerequisites ()) {
- var func = CCodeBaseModule.get_ccode_param_spec_function
(prereq.data_type);
+ var func = get_ccode_param_spec_function (prereq.data_type);
if (func != "") {
return func;
}
@@ -1210,7 +1210,7 @@ public class Vala.CCodeAttribute : AttributeCache {
return "g_param_spec_pointer";
} else if (sym is Enum) {
var e = sym as Enum;
- if (CCodeBaseModule.get_ccode_has_type_id (e)) {
+ if (get_ccode_has_type_id (e)) {
if (e.is_flags) {
return "g_param_spec_flags";
} else {
@@ -1224,7 +1224,7 @@ public class Vala.CCodeAttribute : AttributeCache {
}
}
} else if (sym is Struct) {
- var type_id = CCodeBaseModule.get_ccode_type_id (sym);
+ var type_id = get_ccode_type_id (sym);
if (type_id == "G_TYPE_INT") {
return "g_param_spec_int";
} else if (type_id == "G_TYPE_UINT") {
@@ -1256,7 +1256,7 @@ public class Vala.CCodeAttribute : AttributeCache {
} else if (node is ArrayType && ((ArrayType)node).element_type.data_type ==
CodeContext.get().analyzer.string_type.data_type) {
return "g_param_spec_boxed";
} else if (node is DataType && ((DataType) node).data_type != null) {
- return CCodeBaseModule.get_ccode_param_spec_function (((DataType) node).data_type);
+ return get_ccode_param_spec_function (((DataType) node).data_type);
}
return "g_param_spec_pointer";
@@ -1270,7 +1270,7 @@ public class Vala.CCodeAttribute : AttributeCache {
var base_st = st.base_struct;
if (base_st != null) {
- return CCodeBaseModule.get_ccode_default_value (base_st);
+ return get_ccode_default_value (base_st);
}
}
return "";
@@ -1296,25 +1296,25 @@ public class Vala.CCodeAttribute : AttributeCache {
string infix = "construct";
if (m.name == ".new") {
- return "%s%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix (parent),
infix);
+ return "%s%s".printf (get_ccode_lower_case_prefix (parent), infix);
} else {
- return "%s%s_%s".printf (CCodeBaseModule.get_ccode_lower_case_prefix
(parent), infix, m.name);
+ return "%s%s_%s".printf (get_ccode_lower_case_prefix (parent), infix, m.name);
}
} else if (sym is Method) {
var m = (Method) sym;
if (m.base_method != null || m.base_interface_method != null) {
string m_name;
if (m.signal_reference != null) {
- m_name = CCodeBaseModule.get_ccode_lower_case_name
(m.signal_reference);
+ m_name = get_ccode_lower_case_name (m.signal_reference);
} else {
m_name = m.name;
}
if (m.base_interface_type != null) {
- return "%sreal_%s%s".printf
(CCodeBaseModule.get_ccode_lower_case_prefix (m.parent_symbol),
-
CCodeBaseModule.get_ccode_lower_case_prefix (m.base_interface_type.data_type),
+ return "%sreal_%s%s".printf (get_ccode_lower_case_prefix
(m.parent_symbol),
+
get_ccode_lower_case_prefix (m.base_interface_type.data_type),
m_name);
} else {
- return "%sreal_%s".printf
(CCodeBaseModule.get_ccode_lower_case_prefix (m.parent_symbol), m_name);
+ return "%sreal_%s".printf (get_ccode_lower_case_prefix
(m.parent_symbol), m_name);
}
} else {
return name;
@@ -1324,9 +1324,9 @@ public class Vala.CCodeAttribute : AttributeCache {
var prop = (Property) acc.prop;
if (prop.base_property != null || prop.base_interface_property != null) {
if (acc.readable) {
- return "%sreal_get_%s".printf
(CCodeBaseModule.get_ccode_lower_case_prefix (prop.parent_symbol), prop.name);
+ return "%sreal_get_%s".printf (get_ccode_lower_case_prefix
(prop.parent_symbol), prop.name);
} else {
- return "%sreal_set_%s".printf
(CCodeBaseModule.get_ccode_lower_case_prefix (prop.parent_symbol), prop.name);
+ return "%sreal_set_%s".printf (get_ccode_lower_case_prefix
(prop.parent_symbol), prop.name);
}
} else {
return name;
@@ -1352,7 +1352,7 @@ public class Vala.CCodeAttribute : AttributeCache {
ptr = "*";
}
- return "const %s%s".printf (CCodeBaseModule.get_ccode_name (t), ptr);
+ return "const %s%s".printf (get_ccode_name (t), ptr);
} else {
if (node is Class && ((Class) node).is_immutable) {
return "const %s".printf (name);
@@ -1366,14 +1366,14 @@ public class Vala.CCodeAttribute : AttributeCache {
if (node is Parameter) {
var param = (Parameter) node;
if (param.base_parameter != null) {
- return CCodeBaseModule.get_ccode_array_length (param.base_parameter);
+ return get_ccode_array_length (param.base_parameter);
}
} else if (node is Method) {
var method = (Method) node;
if (method.base_method != null && method.base_method != method) {
- return CCodeBaseModule.get_ccode_array_length (method.base_method);
+ return get_ccode_array_length (method.base_method);
} else if (method.base_interface_method != null && method.base_interface_method !=
method) {
- return CCodeBaseModule.get_ccode_array_length (method.base_interface_method);
+ return get_ccode_array_length (method.base_interface_method);
}
}
return true;
@@ -1383,14 +1383,14 @@ public class Vala.CCodeAttribute : AttributeCache {
if (node is Parameter) {
var param = (Parameter) node;
if (param.base_parameter != null) {
- return CCodeBaseModule.get_ccode_array_null_terminated (param.base_parameter);
+ return get_ccode_array_null_terminated (param.base_parameter);
}
} else if (node is Method) {
var method = (Method) node;
if (method.base_method != null && method.base_method != method) {
- return CCodeBaseModule.get_ccode_array_null_terminated (method.base_method);
+ return get_ccode_array_null_terminated (method.base_method);
} else if (method.base_interface_method != null && method.base_interface_method !=
method) {
- return CCodeBaseModule.get_ccode_array_null_terminated
(method.base_interface_method);
+ return get_ccode_array_null_terminated (method.base_interface_method);
}
}
return false;
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index cd5ae3d..439c54e 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -6107,352 +6107,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return true;
}
- public static CCodeAttribute get_ccode_attribute (CodeNode node) {
- var attr = node.get_attribute_cache (ccode_attribute_cache_index);
- if (attr == null) {
- attr = new CCodeAttribute (node);
- node.set_attribute_cache (ccode_attribute_cache_index, attr);
- }
- return (CCodeAttribute) attr;
- }
-
- public static string get_ccode_name (CodeNode node) {
- return get_ccode_attribute(node).name;
- }
-
- public static string get_ccode_const_name (CodeNode node) {
- return get_ccode_attribute(node).const_name;
- }
-
- public static string get_ccode_type_name (Interface iface) {
- return get_ccode_attribute(iface).type_name;
- }
-
- public static string get_ccode_lower_case_name (CodeNode node, string? infix = null) {
- var sym = node as Symbol;
- if (sym != null) {
- if (infix == null) {
- infix = "";
- }
- if (sym is Delegate) {
- return "%s%s%s".printf (get_ccode_lower_case_prefix (sym.parent_symbol),
infix, Symbol.camel_case_to_lower_case (sym.name));
- } else if (sym is Signal) {
- return get_ccode_attribute (sym).name.replace ("-", "_");
- } else if (sym is ErrorCode) {
- return get_ccode_name (sym).down ();
- } else {
- return "%s%s%s".printf (get_ccode_lower_case_prefix (sym.parent_symbol),
infix, get_ccode_lower_case_suffix (sym));
- }
- } else if (node is ErrorType) {
- var type = (ErrorType) node;
- if (type.error_domain == null) {
- if (infix == null) {
- return "g_error";
- } else {
- return "g_%s_error".printf (infix);
- }
- } else if (type.error_code == null) {
- return get_ccode_lower_case_name (type.error_domain, infix);
- } else {
- return get_ccode_lower_case_name (type.error_code, infix);
- }
- } else if (node is DelegateType) {
- var type = (DelegateType) node;
- return get_ccode_lower_case_name (type.delegate_symbol, infix);
- } else if (node is PointerType) {
- var type = (PointerType) node;
- return get_ccode_lower_case_name (type.base_type, infix);
- } else if (node is GenericType) {
- return "valageneric";
- } else if (node is VoidType) {
- return "valavoid";
- } else {
- var type = (DataType) node;
- return get_ccode_lower_case_name (type.data_type, infix);
- }
- }
-
- public static string get_ccode_upper_case_name (Symbol sym, string? infix = null) {
- if (sym is Property) {
- return "%s_%s".printf (get_ccode_lower_case_name (sym.parent_symbol),
Symbol.camel_case_to_lower_case (sym.name)).ascii_up ();
- } else {
- return get_ccode_lower_case_name (sym, infix).ascii_up ();
- }
- }
-
- public static string get_ccode_header_filenames (Symbol sym) {
- return get_ccode_attribute(sym).header_filenames;
- }
-
- public static string get_ccode_prefix (Symbol sym) {
- return get_ccode_attribute(sym).prefix;
- }
-
- public static string get_ccode_lower_case_prefix (Symbol sym) {
- return get_ccode_attribute(sym).lower_case_prefix;
- }
-
- public static string get_ccode_lower_case_suffix (Symbol sym) {
- return get_ccode_attribute(sym).lower_case_suffix;
- }
-
- public static string get_ccode_ref_function (TypeSymbol sym) {
- return get_ccode_attribute(sym).ref_function;
- }
-
- public static string get_quark_name (ErrorDomain edomain) {
- return get_ccode_lower_case_name (edomain) + "-quark";
- }
-
- public static bool is_reference_counting (TypeSymbol sym) {
- if (sym is Class) {
- return get_ccode_ref_function (sym) != null;
- } else if (sym is Interface) {
- return true;
- } else {
- return false;
- }
- }
-
- public static bool get_ccode_ref_function_void (Class cl) {
- return get_ccode_attribute(cl).ref_function_void;
- }
-
- public static bool get_ccode_free_function_address_of (Class cl) {
- return get_ccode_attribute(cl).free_function_address_of;
- }
-
- public static string get_ccode_unref_function (ObjectTypeSymbol sym) {
- return get_ccode_attribute(sym).unref_function;
- }
-
- public static string get_ccode_ref_sink_function (ObjectTypeSymbol sym) {
- return get_ccode_attribute(sym).ref_sink_function;
- }
-
- public static string get_ccode_copy_function (TypeSymbol sym) {
- return get_ccode_attribute(sym).copy_function;
- }
-
- public static string get_ccode_destroy_function (TypeSymbol sym) {
- return get_ccode_attribute(sym).destroy_function;
- }
-
- public static string? get_ccode_dup_function (TypeSymbol sym) {
- if (sym is Struct) {
- return get_ccode_attribute (sym).dup_function;
- }
- return get_ccode_copy_function (sym);
- }
-
- public static string get_ccode_free_function (TypeSymbol sym) {
- return get_ccode_attribute(sym).free_function;
- }
-
- public static bool get_ccode_is_gboxed (TypeSymbol sym) {
- return get_ccode_free_function (sym) == "g_boxed_free";
- }
-
- public static bool get_ccode_finish_instance (CodeNode node) {
- return get_ccode_attribute (node).finish_instance;
- }
-
- public static string get_ccode_type_id (CodeNode node) {
- return get_ccode_attribute(node).type_id;
- }
-
- public static string get_ccode_marshaller_type_name (CodeNode node) {
- return get_ccode_attribute(node).marshaller_type_name;
- }
-
- public static string get_ccode_get_value_function (CodeNode sym) {
- return get_ccode_attribute(sym).get_value_function;
- }
-
- public static string get_ccode_set_value_function (CodeNode sym) {
- return get_ccode_attribute(sym).set_value_function;
- }
-
- public static string get_ccode_take_value_function (CodeNode sym) {
- return get_ccode_attribute(sym).take_value_function;
- }
-
- public static string get_ccode_param_spec_function (CodeNode sym) {
- return get_ccode_attribute(sym).param_spec_function;
- }
-
- public static string get_ccode_type_check_function (TypeSymbol sym) {
- var cl = sym as Class;
- var a = sym.get_attribute_string ("CCode", "type_check_function");
- if (cl != null && a != null) {
- return a;
- } else if ((cl != null && cl.is_compact) || sym is Struct || sym is Enum || sym is Delegate) {
- return "";
- } else {
- return get_ccode_upper_case_name (sym, "IS_");
- }
- }
-
- public static string get_ccode_default_value (TypeSymbol sym) {
- return get_ccode_attribute(sym).default_value;
- }
-
- public static bool get_ccode_has_copy_function (Struct st) {
- return st.get_attribute_bool ("CCode", "has_copy_function", true);
- }
-
- public static bool get_ccode_has_destroy_function (Struct st) {
- return st.get_attribute_bool ("CCode", "has_destroy_function", true);
- }
-
- public static double get_ccode_instance_pos (CodeNode node) {
- if (node is Delegate) {
- return node.get_attribute_double ("CCode", "instance_pos", -2);
- } else {
- return node.get_attribute_double ("CCode", "instance_pos", 0);
- }
- }
-
- public static bool get_ccode_array_length (CodeNode node) {
- return get_ccode_attribute(node).array_length;
- }
-
- public static string? get_ccode_array_length_type (CodeNode node) {
- return get_ccode_attribute(node).array_length_type;
- }
-
- public static bool get_ccode_array_null_terminated (CodeNode node) {
- return get_ccode_attribute(node).array_null_terminated;
- }
-
- public static string? get_ccode_array_length_name (CodeNode node) {
- return get_ccode_attribute(node).array_length_name;
- }
-
- public static string? get_ccode_array_length_expr (CodeNode node) {
- return get_ccode_attribute(node).array_length_expr;
- }
-
- public static double get_ccode_array_length_pos (CodeNode node) {
- var a = node.get_attribute ("CCode");
- if (a != null && a.has_argument ("array_length_pos")) {
- return a.get_double ("array_length_pos");
- }
- if (node is Parameter) {
- var param = (Parameter) node;
- return get_ccode_pos (param) + 0.1;
- } else {
- return -3;
- }
- }
-
- public static double get_ccode_delegate_target_pos (CodeNode node) {
- var a = node.get_attribute ("CCode");
- if (a != null && a.has_argument ("delegate_target_pos")) {
- return a.get_double ("delegate_target_pos");
- }
- if (node is Parameter) {
- var param = (Parameter) node;
- return get_ccode_pos (param) + 0.1;
- } else {
- return -3;
- }
- }
-
- public static double get_ccode_destroy_notify_pos (CodeNode node) {
- var a = node.get_attribute ("CCode");
- if (a != null && a.has_argument ("destroy_notify_pos")) {
- return a.get_double ("destroy_notify_pos");
- }
- if (node is Parameter) {
- var param = (Parameter) node;
- return get_ccode_pos (param) + 0.1;
- } else {
- return -3;
- }
- }
-
- public static bool get_ccode_delegate_target (CodeNode node) {
- return get_ccode_attribute(node).delegate_target;
- }
-
- public static string get_ccode_delegate_target_name (Variable variable) {
- return get_ccode_attribute(variable).delegate_target_name;
- }
-
- public static double get_ccode_pos (Parameter param) {
- return get_ccode_attribute(param).pos;
- }
-
- public static string? get_ccode_type (CodeNode node) {
- return get_ccode_attribute(node).ctype;
- }
-
- public static bool get_ccode_simple_generics (Method m) {
- return m.get_attribute_bool ("CCode", "simple_generics");
- }
-
- public static string get_ccode_real_name (Symbol sym) {
- return get_ccode_attribute(sym).real_name;
- }
-
- public static string get_ccode_constructv_name (CreationMethod m) {
- const string infix = "constructv";
-
- var parent = m.parent_symbol as Class;
-
- if (m.name == ".new") {
- return "%s%s".printf (get_ccode_lower_case_prefix (parent), infix);
- } else {
- return "%s%s_%s".printf (get_ccode_lower_case_prefix (parent), infix, m.name);
- }
- }
-
- public static string get_ccode_vfunc_name (Method m) {
- return get_ccode_attribute(m).vfunc_name;
- }
-
- public static string get_ccode_finish_name (Method m) {
- return get_ccode_attribute(m).finish_name;
- }
-
- public static string get_ccode_finish_vfunc_name (Method m) {
- return get_ccode_attribute(m).finish_vfunc_name;
- }
-
- public static string get_ccode_finish_real_name (Method m) {
- return get_ccode_attribute(m).finish_real_name;
- }
-
- public static bool get_ccode_no_accessor_method (Property p) {
- return p.get_attribute ("NoAccessorMethod") != null;
- }
-
- public static bool get_ccode_concrete_accessor (Property p) {
- return p.get_attribute ("ConcreteAccessor") != null;
- }
-
- public static bool get_ccode_has_type_id (TypeSymbol sym) {
- return sym.get_attribute_bool ("CCode", "has_type_id", true);
- }
-
- public static bool get_ccode_has_new_function (Method m) {
- return m.get_attribute_bool ("CCode", "has_new_function", true);
- }
-
- public static bool get_ccode_has_generic_type_parameter (Method m) {
- var a = m.get_attribute ("CCode");
- return a != null && a.has_argument ("generic_type_pos");
- }
-
- public static double get_ccode_generic_type_pos (Method m) {
- return m.get_attribute_double ("CCode", "generic_type_pos");
- }
-
- public static string get_ccode_sentinel (Method m) {
- return get_ccode_attribute(m).sentinel;
- }
-
public CCodeDeclaratorSuffix? get_ccode_declarator_suffix (DataType type) {
var array_type = type as ArrayType;
if (array_type != null) {
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index c911b91..a22a4fe 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -164,7 +164,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
} else if (current_class.base_class == gsource_type) {
// g_source_new
- string class_prefix = CCodeBaseModule.get_ccode_lower_case_name
(current_class);
+ string class_prefix = get_ccode_lower_case_name (current_class);
var funcs = new CCodeDeclaration ("const GSourceFuncs");
funcs.modifiers = CCodeModifiers.STATIC;
@@ -312,7 +312,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
}
generate_dynamic_method_wrapper ((DynamicMethod) m);
} else if (m is CreationMethod && m.parent_symbol is Class) {
- ccode.add_assignment (get_this_cexpression (), new CCodeCastExpression (ccall,
CCodeBaseModule.get_ccode_name (current_class) + "*"));
+ ccode.add_assignment (get_this_cexpression (), new CCodeCastExpression (ccall,
get_ccode_name (current_class) + "*"));
if (current_method.body.captured) {
// capture self after setting it
diff --git a/codegen/valaclassregisterfunction.vala b/codegen/valaclassregisterfunction.vala
index 01aa54c..b7d5a42 100644
--- a/codegen/valaclassregisterfunction.vala
+++ b/codegen/valaclassregisterfunction.vala
@@ -47,12 +47,12 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
}
public override string get_type_struct_name () {
- return "%sClass".printf (CCodeBaseModule.get_ccode_name (class_reference));
+ return "%sClass".printf (get_ccode_name (class_reference));
}
public override string get_base_init_func_name () {
if (class_reference.class_constructor != null) {
- return "%s_base_init".printf (CCodeBaseModule.get_ccode_lower_case_name
(class_reference, null));
+ return "%s_base_init".printf (get_ccode_lower_case_name (class_reference, null));
} else {
return "NULL";
}
@@ -60,7 +60,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
public override string get_class_finalize_func_name () {
if (class_reference.static_destructor != null) {
- return "%s_class_finalize".printf (CCodeBaseModule.get_ccode_lower_case_name
(class_reference, null));
+ return "%s_class_finalize".printf (get_ccode_lower_case_name (class_reference, null));
} else {
return "NULL";
}
@@ -68,26 +68,26 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
public override string get_base_finalize_func_name () {
if (class_reference.class_destructor != null) {
- return "%s_base_finalize".printf (CCodeBaseModule.get_ccode_lower_case_name
(class_reference, null));
+ return "%s_base_finalize".printf (get_ccode_lower_case_name (class_reference, null));
} else {
return "NULL";
}
}
public override string get_class_init_func_name () {
- return "%s_class_init".printf (CCodeBaseModule.get_ccode_lower_case_name (class_reference,
null));
+ return "%s_class_init".printf (get_ccode_lower_case_name (class_reference, null));
}
public override string get_instance_struct_size () {
- return "sizeof (%s)".printf (CCodeBaseModule.get_ccode_name (class_reference));
+ return "sizeof (%s)".printf (get_ccode_name (class_reference));
}
public override string get_instance_init_func_name () {
- return "%s_instance_init".printf (CCodeBaseModule.get_ccode_lower_case_name (class_reference,
null));
+ return "%s_instance_init".printf (get_ccode_lower_case_name (class_reference, null));
}
public override string get_parent_type_name () {
- return CCodeBaseModule.get_ccode_type_id (class_reference.base_class);
+ return get_ccode_type_id (class_reference.base_class);
}
public override string get_type_flags () {
@@ -105,7 +105,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
public override string? get_gtype_value_table_init_function_name () {
bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
- return "%s_init".printf (CCodeBaseModule.get_ccode_lower_case_name (class_reference,
"value_"));
+ return "%s_init".printf (get_ccode_lower_case_name (class_reference, "value_"));
return null;
}
@@ -113,7 +113,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
public override string? get_gtype_value_table_free_function_name () {
bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
- return "%s_free_value".printf (CCodeBaseModule.get_ccode_lower_case_name
(class_reference, "value_"));
+ return "%s_free_value".printf (get_ccode_lower_case_name (class_reference, "value_"));
return null;
}
@@ -121,7 +121,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
public override string? get_gtype_value_table_copy_function_name () {
bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
- return "%s_copy_value".printf (CCodeBaseModule.get_ccode_lower_case_name
(class_reference, "value_"));
+ return "%s_copy_value".printf (get_ccode_lower_case_name (class_reference, "value_"));
return null;
}
@@ -129,7 +129,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
public override string? get_gtype_value_table_peek_pointer_function_name () {
bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
- return "%s_peek_pointer".printf (CCodeBaseModule.get_ccode_lower_case_name
(class_reference, "value_"));
+ return "%s_peek_pointer".printf (get_ccode_lower_case_name (class_reference,
"value_"));
return null;
}
@@ -137,7 +137,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
public override string? get_gtype_value_table_collect_value_function_name () {
bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
- return "%s_collect_value".printf (CCodeBaseModule.get_ccode_lower_case_name
(class_reference, "value_"));
+ return "%s_collect_value".printf (get_ccode_lower_case_name (class_reference,
"value_"));
return null;
}
@@ -145,7 +145,7 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
public override string? get_gtype_value_table_lcopy_value_function_name () {
bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
- return "%s_lcopy_value".printf (CCodeBaseModule.get_ccode_lower_case_name
(class_reference, "value_"));
+ return "%s_lcopy_value".printf (get_ccode_lower_case_name (class_reference,
"value_"));
return null;
}
@@ -160,11 +160,11 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
var iface = (Interface) base_type.data_type;
- var iface_info_name = "%s_info".printf (CCodeBaseModule.get_ccode_lower_case_name
(iface, null));
+ var iface_info_name = "%s_info".printf (get_ccode_lower_case_name (iface, null));
var ctypedecl = new CCodeDeclaration ("const GInterfaceInfo");
ctypedecl.modifiers = CCodeModifiers.STATIC;
- ctypedecl.add_declarator (new CCodeVariableDeclarator (iface_info_name, new
CCodeConstant ("{ (GInterfaceInitFunc) %s_%s_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}".printf
(CCodeBaseModule.get_ccode_lower_case_name (class_reference), CCodeBaseModule.get_ccode_lower_case_name
(iface)))));
+ ctypedecl.add_declarator (new CCodeVariableDeclarator (iface_info_name, new
CCodeConstant ("{ (GInterfaceInitFunc) %s_%s_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}".printf
(get_ccode_lower_case_name (class_reference), get_ccode_lower_case_name (iface)))));
frag.append (ctypedecl);
}
@@ -179,18 +179,18 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
var iface = (Interface) base_type.data_type;
- var iface_info_name = "%s_info".printf (CCodeBaseModule.get_ccode_lower_case_name
(iface, null));
+ var iface_info_name = "%s_info".printf (get_ccode_lower_case_name (iface, null));
if (!plugin) {
var reg_call = new CCodeFunctionCall (new CCodeIdentifier
("g_type_add_interface_static"));
- reg_call.add_argument (new CCodeIdentifier ("%s_type_id".printf
(CCodeBaseModule.get_ccode_lower_case_name (class_reference, null))));
- reg_call.add_argument (new CCodeIdentifier (CCodeBaseModule.get_ccode_type_id
(iface)));
+ reg_call.add_argument (new CCodeIdentifier ("%s_type_id".printf
(get_ccode_lower_case_name (class_reference, null))));
+ reg_call.add_argument (new CCodeIdentifier (get_ccode_type_id (iface)));
reg_call.add_argument (new CCodeIdentifier ("&%s".printf (iface_info_name)));
block.add_statement (new CCodeExpressionStatement (reg_call));
} else {
var reg_call = new CCodeFunctionCall (new CCodeIdentifier
("g_type_module_add_interface"));
reg_call.add_argument (new CCodeIdentifier ("module"));
- reg_call.add_argument (new CCodeIdentifier ("%s_type_id".printf
(CCodeBaseModule.get_ccode_lower_case_name (class_reference, null))));
- reg_call.add_argument (new CCodeIdentifier (CCodeBaseModule.get_ccode_type_id
(iface)));
+ reg_call.add_argument (new CCodeIdentifier ("%s_type_id".printf
(get_ccode_lower_case_name (class_reference, null))));
+ reg_call.add_argument (new CCodeIdentifier (get_ccode_type_id (iface)));
reg_call.add_argument (new CCodeIdentifier ("&%s".printf (iface_info_name)));
block.add_statement (new CCodeExpressionStatement (reg_call));
}
diff --git a/codegen/valagdbusmodule.vala b/codegen/valagdbusmodule.vala
index f8bdaa9..8acb282 100644
--- a/codegen/valagdbusmodule.vala
+++ b/codegen/valagdbusmodule.vala
@@ -108,7 +108,7 @@ public class Vala.GDBusModule : GVariantModule {
ccode.add_declaration ("gsize", new CCodeVariableDeclarator (quark_name, new CCodeConstant
("0")), CCodeModifiers.STATIC | CCodeModifiers.VOLATILE);
var register_call = new CCodeFunctionCall (new CCodeIdentifier
("g_dbus_error_register_error_domain"));
- register_call.add_argument (new CCodeConstant ("\"" + CCodeBaseModule.get_quark_name
(edomain) + "\""));
+ register_call.add_argument (new CCodeConstant ("\"" + get_ccode_quark_name (edomain) + "\""));
register_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new
CCodeIdentifier (quark_name)));
register_call.add_argument (new CCodeIdentifier (get_ccode_lower_case_name (edomain) +
"_entries"));
var nentries = new CCodeFunctionCall (new CCodeIdentifier ("G_N_ELEMENTS"));
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 47056f1..e50aea6 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -76,7 +76,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
push_function (cquark_fun);
var cquark_call = new CCodeFunctionCall (new CCodeIdentifier ("g_quark_from_static_string"));
- cquark_call.add_argument (new CCodeConstant ("\"" + CCodeBaseModule.get_quark_name (edomain)
+ "\""));
+ cquark_call.add_argument (new CCodeConstant ("\"" + get_ccode_quark_name (edomain) + "\""));
ccode.add_return (cquark_call);
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 68d9a04..a115852 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -215,11 +215,11 @@ public class Vala.GIRWriter : CodeVisitor {
private void write_c_includes (Namespace ns) {
// Collect C header filenames
Set<string> header_filenames = new HashSet<string> (str_hash, str_equal);
- foreach (unowned string c_header_filename in CCodeBaseModule.get_ccode_header_filenames
(ns).split (",")) {
+ foreach (unowned string c_header_filename in get_ccode_header_filenames (ns).split (",")) {
header_filenames.add (c_header_filename);
}
foreach (Symbol symbol in ns.scope.get_symbol_table ().get_values ()) {
- foreach (unowned string c_header_filename in
CCodeBaseModule.get_ccode_header_filenames (symbol).split (",")) {
+ foreach (unowned string c_header_filename in get_ccode_header_filenames
(symbol).split (",")) {
header_filenames.add (c_header_filename);
}
}
@@ -257,7 +257,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("<namespace name=\"%s\" version=\"%s\"", gir_namespace, gir_version);
- string? cprefix = CCodeBaseModule.get_ccode_prefix (ns);
+ string? cprefix = get_ccode_prefix (ns);
if (gir_shared_library != null) {
buffer.append_printf(" shared-library=\"%s\"", gir_shared_library);
}
@@ -339,7 +339,7 @@ public class Vala.GIRWriter : CodeVisitor {
buffer.append_printf ("<field name=\"parent_instance\">\n");
indent++;
write_indent ();
- buffer.append_printf ("<type name=\"%s\" c:type=\"%s\"/>\n", gi_type_name
(cl.base_class), CCodeBaseModule.get_ccode_name (cl.base_class));
+ buffer.append_printf ("<type name=\"%s\" c:type=\"%s\"/>\n", gi_type_name
(cl.base_class), get_ccode_name (cl.base_class));
indent--;
write_indent ();
buffer.append_printf("</field>\n");
@@ -348,7 +348,7 @@ public class Vala.GIRWriter : CodeVisitor {
buffer.append_printf ("<field name=\"priv\">\n");
indent++;
write_indent ();
- buffer.append_printf ("<type name=\"%sPrivate\" c:type=\"%sPrivate*\"/>\n",
get_gir_name (cl), CCodeBaseModule.get_ccode_name (cl));
+ buffer.append_printf ("<type name=\"%sPrivate\" c:type=\"%sPrivate*\"/>\n",
get_gir_name (cl), get_ccode_name (cl));
indent--;
write_indent ();
buffer.append_printf("</field>\n");
@@ -372,7 +372,7 @@ public class Vala.GIRWriter : CodeVisitor {
buffer.append_printf ("<field name=\"parent_class\">\n");
indent++;
write_indent ();
- buffer.append_printf ("<type name=\"%sClass\" c:type=\"%sClass\"/>\n", gi_type_name
(cl.base_class), CCodeBaseModule.get_ccode_name (cl.base_class));
+ buffer.append_printf ("<type name=\"%sClass\" c:type=\"%sClass\"/>\n", gi_type_name
(cl.base_class), get_ccode_name (cl.base_class));
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -390,7 +390,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf("<field name=\"%s\">\n", m.name);
indent++;
- do_write_signature (m, "callback", true, m.name,
CCodeBaseModule.get_ccode_name (m), m.get_async_begin_parameters (), new VoidType (), false, false);
+ do_write_signature (m, "callback", true, m.name,
get_ccode_name (m), m.get_async_begin_parameters (), new VoidType (), false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -398,7 +398,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf("<field name=\"%s\">\n", finish_name);
indent++;
- do_write_signature (m, "callback", true, finish_name,
CCodeBaseModule.get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail,
false);
+ do_write_signature (m, "callback", true, finish_name,
get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -406,7 +406,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf("<field name=\"%s\">\n", m.name);
indent++;
- do_write_signature (m, "callback", true, m.name,
CCodeBaseModule.get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false);
+ do_write_signature (m, "callback", true, m.name,
get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -417,7 +417,7 @@ public class Vala.GIRWriter : CodeVisitor {
foreach (Signal sig in cl.get_signals ()) {
if (sig.default_handler != null) {
write_indent ();
- buffer.append_printf ("<field name=\"%s\">\n",
CCodeBaseModule.get_ccode_lower_case_name (sig));
+ buffer.append_printf ("<field name=\"%s\">\n",
get_ccode_lower_case_name (sig));
indent++;
write_signature (sig.default_handler, "callback", false, true);
indent--;
@@ -431,7 +431,7 @@ public class Vala.GIRWriter : CodeVisitor {
buffer.append_printf ("</record>\n");
write_indent ();
- buffer.append_printf ("<record name=\"%sPrivate\" c:type=\"%sPrivate\"
disguised=\"1\"/>\n", get_gir_name (cl), CCodeBaseModule.get_ccode_name (cl));
+ buffer.append_printf ("<record name=\"%sPrivate\" c:type=\"%sPrivate\"
disguised=\"1\"/>\n", get_gir_name (cl), get_ccode_name (cl));
} else {
write_indent ();
buffer.append_printf ("<record name=\"%s\"", get_gir_name (cl));
@@ -562,7 +562,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf("<field name=\"%s\">\n", m.name);
indent++;
- do_write_signature (m, "callback", true, m.name,
CCodeBaseModule.get_ccode_name (m), m.get_async_begin_parameters (), new VoidType (), false, false);
+ do_write_signature (m, "callback", true, m.name, get_ccode_name (m),
m.get_async_begin_parameters (), new VoidType (), false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -570,7 +570,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf("<field name=\"%s\">\n", finish_name);
indent++;
- do_write_signature (m, "callback", true, finish_name,
CCodeBaseModule.get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail,
false);
+ do_write_signature (m, "callback", true, finish_name,
get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -578,7 +578,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf("<field name=\"%s\">\n", m.name);
indent++;
- do_write_signature (m, "callback", true, m.name,
CCodeBaseModule.get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false);
+ do_write_signature (m, "callback", true, m.name, get_ccode_name (m),
m.get_parameters (), m.return_type, m.tree_can_fail, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -593,7 +593,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf("<field name=\"%s\">\n", m.name);
indent++;
- do_write_signature (m, "callback", true, m.name,
CCodeBaseModule.get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false);
+ do_write_signature (m, "callback", true, m.name, get_ccode_name (m),
m.get_parameters (), m.return_type, m.tree_can_fail, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -604,7 +604,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf("<field name=\"%s\">\n", m.name);
indent++;
- do_write_signature (m, "callback", true, m.name,
CCodeBaseModule.get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false);
+ do_write_signature (m, "callback", true, m.name, get_ccode_name (m),
m.get_parameters (), m.return_type, m.tree_can_fail, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -691,7 +691,7 @@ public class Vala.GIRWriter : CodeVisitor {
public override void visit_enum_value (EnumValue ev) {
write_indent ();
var en = (Enum) hierarchy[0];
- buffer.append_printf ("<member name=\"%s\" c:identifier=\"%s\"", ev.name.down (),
CCodeBaseModule.get_ccode_name (ev));
+ buffer.append_printf ("<member name=\"%s\" c:identifier=\"%s\"", ev.name.down (),
get_ccode_name (ev));
if (ev.value != null) {
string value = literal_expression_to_value_string (ev.value);
buffer.append_printf (" value=\"%s\"", value);
@@ -731,7 +731,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("<enumeration name=\"%s\"", edomain.name);
write_ctype_attributes (edomain);
- buffer.append_printf (" glib:error-domain=\"%s\"", CCodeBaseModule.get_quark_name (edomain));
+ buffer.append_printf (" glib:error-domain=\"%s\"", get_ccode_quark_name (edomain));
buffer.append_printf (">\n");
indent++;
@@ -751,7 +751,7 @@ public class Vala.GIRWriter : CodeVisitor {
public override void visit_error_code (ErrorCode ecode) {
write_indent ();
- buffer.append_printf ("<member name=\"%s\" c:identifier=\"%s\"", ecode.name.down (),
CCodeBaseModule.get_ccode_name (ecode));
+ buffer.append_printf ("<member name=\"%s\" c:identifier=\"%s\"", ecode.name.down (),
get_ccode_name (ecode));
if (ecode.value != null) {
string value = literal_expression_to_value_string (ecode.value);
buffer.append_printf (" value=\"%s\"", value);
@@ -789,7 +789,7 @@ public class Vala.GIRWriter : CodeVisitor {
string value = literal_expression_to_value_string (initializer);
write_indent ();
- buffer.append_printf ("<constant name=\"%s\" c:identifier=\"%s\"", c.name,
CCodeBaseModule.get_ccode_name (c));
+ buffer.append_printf ("<constant name=\"%s\" c:identifier=\"%s\"", c.name, get_ccode_name
(c));
buffer.append_printf (" value=\"%s\"", value);
write_symbol_attributes (c);
buffer.append_printf (">\n");
@@ -814,7 +814,7 @@ public class Vala.GIRWriter : CodeVisitor {
}
write_indent ();
- buffer.append_printf ("<field name=\"%s\"", CCodeBaseModule.get_ccode_name (f));
+ buffer.append_printf ("<field name=\"%s\"", get_ccode_name (f));
if (f.variable_type.nullable) {
buffer.append_printf (" allow-none=\"1\"");
}
@@ -878,7 +878,7 @@ public class Vala.GIRWriter : CodeVisitor {
foreach (Parameter param in params) {
index++;
- skip_implicit_params (param.variable_type, ref index,
CCodeBaseModule.get_ccode_array_length (param));
+ skip_implicit_params (param.variable_type, ref index, get_ccode_array_length
(param));
}
if (ret_is_struct) {
@@ -910,9 +910,9 @@ public class Vala.GIRWriter : CodeVisitor {
}
foreach (Parameter param in params) {
- write_param_or_return (param.variable_type, true, ref index,
CCodeBaseModule.get_ccode_array_length (param), param.name, get_parameter_comment (param), param.direction);
+ write_param_or_return (param.variable_type, true, ref index,
get_ccode_array_length (param), param.name, get_parameter_comment (param), param.direction);
- write_implicit_params (param.variable_type, ref index,
CCodeBaseModule.get_ccode_array_length (param), param.name, param.direction);
+ write_implicit_params (param.variable_type, ref index, get_ccode_array_length
(param), param.name, param.direction);
}
if (ret_is_struct) {
@@ -950,7 +950,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("<callback name=\"%s\"", cb.name);
- buffer.append_printf (" c:type=\"%s\"", CCodeBaseModule.get_ccode_name (cb));
+ buffer.append_printf (" c:type=\"%s\"", get_ccode_name (cb));
if (cb.tree_can_fail) {
buffer.append_printf (" throws=\"1\"");
}
@@ -962,7 +962,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_annotations (cb);
- write_params_and_return (cb.get_parameters (), cb.return_type,
CCodeBaseModule.get_ccode_array_length (cb), get_delegate_return_comment (cb), false, null, cb.has_target);
+ write_params_and_return (cb.get_parameters (), cb.return_type, get_ccode_array_length (cb),
get_delegate_return_comment (cb), false, null, cb.has_target);
indent--;
write_indent ();
@@ -1004,7 +1004,7 @@ public class Vala.GIRWriter : CodeVisitor {
bool check_type (DataType type) {
// gobject-introspection does not currently support va_list parameters
- if (CCodeBaseModule.get_ccode_name (type) == "va_list") {
+ if (get_ccode_name (type) == "va_list") {
return false;
}
@@ -1028,8 +1028,8 @@ public class Vala.GIRWriter : CodeVisitor {
string name;
if (m.parent_symbol != parent) {
instance = false;
- name = CCodeBaseModule.get_ccode_name (m);
- var parent_prefix = CCodeBaseModule.get_ccode_lower_case_prefix (parent);
+ name = get_ccode_name (m);
+ var parent_prefix = get_ccode_lower_case_prefix (parent);
if (name.has_prefix (parent_prefix)) {
name = name.substring (parent_prefix.length);
}
@@ -1043,10 +1043,10 @@ public class Vala.GIRWriter : CodeVisitor {
finish_name = finish_name.substring (0, finish_name.length - "_async".length);
}
finish_name += "_finish";
- do_write_signature (m, tag_name, instance, name, CCodeBaseModule.get_ccode_name (m),
m.get_async_begin_parameters (), new VoidType (), false, true);
- do_write_signature (m, tag_name, instance, finish_name,
CCodeBaseModule.get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail,
false);
+ do_write_signature (m, tag_name, instance, name, get_ccode_name (m),
m.get_async_begin_parameters (), new VoidType (), false, true);
+ do_write_signature (m, tag_name, instance, finish_name, get_ccode_finish_name (m),
m.get_async_end_parameters (), m.return_type, m.tree_can_fail, false);
} else {
- do_write_signature (m, tag_name, instance, name, CCodeBaseModule.get_ccode_name (m),
m.get_parameters (), m.return_type, m.tree_can_fail, true);
+ do_write_signature (m, tag_name, instance, name, get_ccode_name (m), m.get_parameters
(), m.return_type, m.tree_can_fail, true);
}
}
@@ -1081,7 +1081,7 @@ public class Vala.GIRWriter : CodeVisitor {
instance_type = CCodeBaseModule.get_data_type_for_symbol ((TypeSymbol)
m.parent_symbol);
}
- write_params_and_return (params, return_type, CCodeBaseModule.get_ccode_array_length (m),
return_comment, false, instance_type);
+ write_params_and_return (params, return_type, get_ccode_array_length (m), return_comment,
false, instance_type);
indent--;
write_indent ();
@@ -1110,9 +1110,9 @@ public class Vala.GIRWriter : CodeVisitor {
if (m.parent_symbol is Class && m == ((Class)m.parent_symbol).default_construction_method ||
m.parent_symbol is Struct && m ==
((Struct)m.parent_symbol).default_construction_method) {
string m_name = is_struct ? "init" : "new";
- buffer.append_printf ("<%s name=\"%s\" c:identifier=\"%s\"", tag_name, m_name,
CCodeBaseModule.get_ccode_name (m));
+ buffer.append_printf ("<%s name=\"%s\" c:identifier=\"%s\"", tag_name, m_name,
get_ccode_name (m));
} else {
- buffer.append_printf ("<%s name=\"%s\" c:identifier=\"%s\"", tag_name, m.name,
CCodeBaseModule.get_ccode_name (m));
+ buffer.append_printf ("<%s name=\"%s\" c:identifier=\"%s\"", tag_name, m.name,
get_ccode_name (m));
}
if (m.tree_can_fail) {
@@ -1193,7 +1193,7 @@ public class Vala.GIRWriter : CodeVisitor {
}
write_indent ();
- buffer.append_printf ("<glib:signal name=\"%s\"", CCodeBaseModule.get_ccode_name (sig));
+ buffer.append_printf ("<glib:signal name=\"%s\"", get_ccode_name (sig));
write_symbol_attributes (sig);
buffer.append_printf (">\n");
indent++;
@@ -1294,13 +1294,13 @@ public class Vala.GIRWriter : CodeVisitor {
}
private void write_ctype_attributes (TypeSymbol symbol, string suffix = "") {
- buffer.append_printf (" c:type=\"%s%s\"", CCodeBaseModule.get_ccode_name (symbol), suffix);
+ buffer.append_printf (" c:type=\"%s%s\"", get_ccode_name (symbol), suffix);
}
private void write_gtype_attributes (TypeSymbol symbol) {
write_ctype_attributes(symbol);
- buffer.append_printf (" glib:type-name=\"%s\"", CCodeBaseModule.get_ccode_name (symbol));
- buffer.append_printf (" glib:get-type=\"%sget_type\"",
CCodeBaseModule.get_ccode_lower_case_prefix (symbol));
+ buffer.append_printf (" glib:type-name=\"%s\"", get_ccode_name (symbol));
+ buffer.append_printf (" glib:get-type=\"%sget_type\"", get_ccode_lower_case_prefix (symbol));
}
private void write_type (DataType type, int index = -1, ParameterDirection direction =
ParameterDirection.IN) {
@@ -1328,7 +1328,7 @@ public class Vala.GIRWriter : CodeVisitor {
buffer.append_printf ("<type name=\"none\"/>\n");
} else if (type is PointerType) {
write_indent ();
- buffer.append_printf ("<type name=\"gpointer\" c:type=\"%s\"/>\n",
CCodeBaseModule.get_ccode_name (type));
+ buffer.append_printf ("<type name=\"gpointer\" c:type=\"%s\"/>\n", get_ccode_name
(type));
} else if (type.data_type != null) {
write_indent ();
string type_name = gi_type_name (type.data_type);
@@ -1336,7 +1336,7 @@ public class Vala.GIRWriter : CodeVisitor {
if ((type_name == "GLib.Array") || (type_name == "GLib.PtrArray")) {
is_array = true;
}
- buffer.append_printf ("<%s name=\"%s\" c:type=\"%s%s\"", is_array ? "array" : "type",
gi_type_name (type.data_type), CCodeBaseModule.get_ccode_name (type), direction == ParameterDirection.IN ? ""
: "*");
+ buffer.append_printf ("<%s name=\"%s\" c:type=\"%s%s\"", is_array ? "array" : "type",
gi_type_name (type.data_type), get_ccode_name (type), direction == ParameterDirection.IN ? "" : "*");
List<DataType> type_arguments = type.get_type_arguments ();
if (type_arguments.size == 0) {
@@ -1356,7 +1356,7 @@ public class Vala.GIRWriter : CodeVisitor {
} else if (type is DelegateType) {
var deleg_type = (DelegateType) type;
write_indent ();
- buffer.append_printf ("<type name=\"%s\" c:type=\"%s\"/>\n", gi_type_name
(deleg_type.delegate_symbol), CCodeBaseModule.get_ccode_name (type));
+ buffer.append_printf ("<type name=\"%s\" c:type=\"%s\"/>\n", gi_type_name
(deleg_type.delegate_symbol), get_ccode_name (type));
} else if (type is GenericType) {
// generic type parameters not supported in GIR
write_indent ();
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index aefcd08..1370c75 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1256,11 +1256,11 @@ public class Vala.GTypeModule : GErrorModule {
if (!get_ccode_no_accessor_method (prop.base_property) &&
!get_ccode_concrete_accessor (prop.base_property)) {
if (prop.get_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name
(prop.get_accessor);
+ string cname = get_ccode_real_name (prop.get_accessor);
ccode.add_assignment (new CCodeMemberAccess.pointer (ccast,
"get_%s".printf (prop.name)), new CCodeIdentifier (cname));
}
if (prop.set_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name
(prop.set_accessor);
+ string cname = get_ccode_real_name (prop.set_accessor);
ccode.add_assignment (new CCodeMemberAccess.pointer (ccast,
"set_%s".printf (prop.name)), new CCodeIdentifier (cname));
}
}
@@ -1423,9 +1423,9 @@ public class Vala.GTypeModule : GErrorModule {
if (!get_ccode_no_accessor_method (prop.base_interface_property) &&
!get_ccode_concrete_accessor (prop.base_interface_property)) {
if (prop.get_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name
(prop.get_accessor);
+ string cname = get_ccode_real_name (prop.get_accessor);
if (prop.is_abstract || prop.is_virtual) {
- cname = CCodeBaseModule.get_ccode_name (prop.get_accessor);
+ cname = get_ccode_name (prop.get_accessor);
}
CCodeExpression cfunc = new CCodeIdentifier (cname);
@@ -1435,9 +1435,9 @@ public class Vala.GTypeModule : GErrorModule {
ccode.add_assignment (new CCodeMemberAccess.pointer (ciface,
"get_%s".printf (prop.name)), cfunc);
}
if (prop.set_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name
(prop.set_accessor);
+ string cname = get_ccode_real_name (prop.set_accessor);
if (prop.is_abstract || prop.is_virtual) {
- cname = CCodeBaseModule.get_ccode_name (prop.set_accessor);
+ cname = get_ccode_name (prop.set_accessor);
}
CCodeExpression cfunc = new CCodeIdentifier (cname);
@@ -2191,11 +2191,11 @@ public class Vala.GTypeModule : GErrorModule {
foreach (Property prop in iface.get_properties ()) {
if (prop.is_virtual) {
if (prop.get_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name
(prop.get_accessor);
+ string cname = get_ccode_real_name (prop.get_accessor);
ccode.add_assignment (new CCodeMemberAccess.pointer (ciface,
"get_%s".printf (prop.name)), new CCodeIdentifier (cname));
}
if (prop.set_accessor != null) {
- string cname = CCodeBaseModule.get_ccode_real_name
(prop.set_accessor);
+ string cname = get_ccode_real_name (prop.set_accessor);
ccode.add_assignment (new CCodeMemberAccess.pointer (ciface,
"set_%s".printf (prop.name)), new CCodeIdentifier (cname));
}
}
diff --git a/codegen/valainterfaceregisterfunction.vala b/codegen/valainterfaceregisterfunction.vala
index 0b900ea..7f20c78 100644
--- a/codegen/valainterfaceregisterfunction.vala
+++ b/codegen/valainterfaceregisterfunction.vala
@@ -43,11 +43,11 @@ public class Vala.InterfaceRegisterFunction : TypeRegisterFunction {
}
public override string get_type_struct_name () {
- return CCodeBaseModule.get_ccode_type_name (interface_reference);
+ return get_ccode_type_name (interface_reference);
}
public override string get_base_init_func_name () {
- return "%s_base_init".printf (CCodeBaseModule.get_ccode_lower_case_name
(interface_reference));
+ return "%s_base_init".printf (get_ccode_lower_case_name (interface_reference));
}
public override string get_class_finalize_func_name () {
@@ -84,8 +84,8 @@ public class Vala.InterfaceRegisterFunction : TypeRegisterFunction {
var prereq = prereq_ref.data_type;
var func = new CCodeFunctionCall (new CCodeIdentifier
("g_type_interface_add_prerequisite"));
- func.add_argument (new CCodeIdentifier ("%s_type_id".printf
(CCodeBaseModule.get_ccode_lower_case_name (interface_reference))));
- func.add_argument (new CCodeIdentifier (CCodeBaseModule.get_ccode_type_id (prereq)));
+ func.add_argument (new CCodeIdentifier ("%s_type_id".printf
(get_ccode_lower_case_name (interface_reference))));
+ func.add_argument (new CCodeIdentifier (get_ccode_type_id (prereq)));
block.add_statement (new CCodeExpressionStatement (func));
}
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala
index 72793cd..97dcf9a 100644
--- a/codegen/valatyperegisterfunction.vala
+++ b/codegen/valatyperegisterfunction.vala
@@ -44,7 +44,7 @@ public abstract class Vala.TypeRegisterFunction {
fundamental = true;
}
- string type_id_name = "%s_type_id".printf (CCodeBaseModule.get_ccode_lower_case_name
(get_type_declaration ()));
+ string type_id_name = "%s_type_id".printf (get_ccode_lower_case_name (get_type_declaration
()));
var type_block = new CCodeBlock ();
CCodeDeclaration cdecl;
@@ -67,7 +67,7 @@ public abstract class Vala.TypeRegisterFunction {
CCodeFunction fun;
if (!plugin) {
- fun = new CCodeFunction ("%s_get_type".printf
(CCodeBaseModule.get_ccode_lower_case_name (get_type_declaration ())), "GType");
+ fun = new CCodeFunction ("%s_get_type".printf (get_ccode_lower_case_name
(get_type_declaration ())), "GType");
fun.modifiers = CCodeModifiers.CONST;
/* Function will not be prototyped anyway */
@@ -83,10 +83,10 @@ public abstract class Vala.TypeRegisterFunction {
declaration_fragment.append (fun.copy ());
fun.is_declaration = false;
} else {
- fun = new CCodeFunction ("%s_register_type".printf
(CCodeBaseModule.get_ccode_lower_case_name (get_type_declaration ())), "GType");
+ fun = new CCodeFunction ("%s_register_type".printf (get_ccode_lower_case_name
(get_type_declaration ())), "GType");
fun.add_parameter (new CCodeParameter ("module", "GTypeModule *"));
- var get_fun = new CCodeFunction ("%s_get_type".printf
(CCodeBaseModule.get_ccode_lower_case_name (get_type_declaration ())), "GType");
+ var get_fun = new CCodeFunction ("%s_get_type".printf (get_ccode_lower_case_name
(get_type_declaration ())), "GType");
get_fun.modifiers = CCodeModifiers.CONST;
get_fun.is_declaration = true;
@@ -151,11 +151,11 @@ public abstract class Vala.TypeRegisterFunction {
reg_call.add_argument (new CCodeIdentifier ("module"));
reg_call.add_argument (new CCodeIdentifier (get_parent_type_name ()));
}
- reg_call.add_argument (new CCodeConstant ("\"%s\"".printf (CCodeBaseModule.get_ccode_name
(get_type_declaration ()))));
+ reg_call.add_argument (new CCodeConstant ("\"%s\"".printf (get_ccode_name
(get_type_declaration ()))));
if (get_type_declaration () is Struct) {
var st = (Struct) get_type_declaration ();
- reg_call.add_argument (new CCodeCastExpression (new CCodeIdentifier
(CCodeBaseModule.get_ccode_dup_function (st)), "GBoxedCopyFunc"));
- reg_call.add_argument (new CCodeCastExpression (new CCodeIdentifier
(CCodeBaseModule.get_ccode_free_function (st)), "GBoxedFreeFunc"));
+ reg_call.add_argument (new CCodeCastExpression (new CCodeIdentifier
(get_ccode_dup_function (st)), "GBoxedCopyFunc"));
+ reg_call.add_argument (new CCodeCastExpression (new CCodeIdentifier
(get_ccode_free_function (st)), "GBoxedFreeFunc"));
} else if (get_type_declaration () is Enum) {
var en = get_type_declaration () as Enum;
var clist = new CCodeInitializerList (); /* or during visit time? */
@@ -163,8 +163,8 @@ public abstract class Vala.TypeRegisterFunction {
CCodeInitializerList clist_ev = null;
foreach (EnumValue ev in en.get_values ()) {
clist_ev = new CCodeInitializerList ();
- clist_ev.append (new CCodeConstant (CCodeBaseModule.get_ccode_name (ev)));
- clist_ev.append (new CCodeIdentifier ("\"%s\"".printf
(CCodeBaseModule.get_ccode_name (ev))));
+ clist_ev.append (new CCodeConstant (get_ccode_name (ev)));
+ clist_ev.append (new CCodeIdentifier ("\"%s\"".printf (get_ccode_name (ev))));
clist_ev.append (CCodeBaseModule.get_enum_value_canonical_cconstant (ev));
clist.append (clist_ev);
}
@@ -210,7 +210,7 @@ public abstract class Vala.TypeRegisterFunction {
add_class_private_call = new CCodeFunctionCall (new CCodeIdentifier
("g_type_add_class_private"));
add_class_private_call.add_argument (new CCodeIdentifier (type_id_name));
- add_class_private_call.add_argument (new CCodeIdentifier ("sizeof
(%sClassPrivate)".printf (CCodeBaseModule.get_ccode_name (get_type_declaration ()))));
+ add_class_private_call.add_argument (new CCodeIdentifier ("sizeof
(%sClassPrivate)".printf (get_ccode_name (get_type_declaration ()))));
type_init.add_statement (new CCodeExpressionStatement (add_class_private_call));
}
diff --git a/valadoc/treebuilder.vala b/valadoc/treebuilder.vala
index 7615eb8..b060e0c 100644
--- a/valadoc/treebuilder.vala
+++ b/valadoc/treebuilder.vala
@@ -281,19 +281,19 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
}
private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
+ return Vala.get_ccode_type_id (node);
}
private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
+ return Vala.is_reference_counting (sym);
}
private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
+ return Vala.get_ccode_ref_function (sym);
}
private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
+ return Vala.get_ccode_unref_function (sym);
}
private string? get_finalize_function_name (Vala.Class element) {
@@ -301,7 +301,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return null;
}
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
+ return "%s_finalize".printf (Vala.get_ccode_lower_case_name (element, null));
}
private string? get_free_function_name (Vala.Class element) {
@@ -309,48 +309,48 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return null;
}
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
+ return Vala.get_ccode_free_function (element);
}
private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
+ return Vala.get_ccode_finish_name (m);
}
private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
+ return Vala.get_ccode_take_value_function (sym);
}
private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
+ return Vala.get_ccode_get_value_function (sym);
}
private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
+ return Vala.get_ccode_set_value_function (sym);
}
private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
+ return Vala.get_ccode_param_spec_function (sym);
}
private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
+ return Vala.get_ccode_dup_function (sym);
}
private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
+ return Vala.get_ccode_copy_function (sym);
}
private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
+ return Vala.get_ccode_destroy_function (sym);
}
private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
+ return Vala.get_ccode_free_function (sym);
}
private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
+ return Vala.get_ccode_name (symbol);
}
private SourceComment? create_comment (Vala.Comment? comment) {
@@ -413,7 +413,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
}
private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
+ return Vala.get_ccode_upper_case_name (element, null);
}
private string? get_private_cname (Vala.Class element) {
@@ -430,7 +430,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return null;
}
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+ return "%s_GET_CLASS".printf (Vala.get_ccode_upper_case_name (element, null));
}
private string? get_class_type_macro_name (Vala.Class element) {
@@ -438,11 +438,11 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return null;
}
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+ return "%s_CLASS".printf (Vala.get_ccode_upper_case_name (element, null));
}
private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
+ string? name = Vala.get_ccode_type_check_function (element);
return (name != null && name != "")? name : null;
}
@@ -460,7 +460,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return null;
}
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
+ return "%s_get_type".printf (Vala.get_ccode_lower_case_name (element, null));
}
private string? get_type_macro_name (Vala.TypeSymbol element) {
@@ -472,7 +472,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return null;
}
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
+ return Vala.get_ccode_type_id (element);
}
private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
@@ -480,18 +480,18 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
&& !((Vala.Class) element).is_compact)
|| element is Vala.Interface)
{
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
+ return Vala.get_ccode_upper_case_name (element, null);
} else {
return null;
}
}
private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element,
null));
+ return "%s_GET_INTERFACE".printf (Vala.get_ccode_upper_case_name (element, null));
}
private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
+ return Vala.get_ccode_lower_case_prefix (element) + "quark";
}
private PackageMetaData? get_package_meta_data (Package pkg) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]