+2009-01-09 Jürg Billeter <j@bitron.ch>
+
+ * ccode/valaccodevariabledeclarator.vala:
+ * gobject/valaccodebasemodule.vala:
+ * gobject/valaccodecontrolflowmodule.vala:
+ * gobject/valaccodemethodmodule.vala:
+ * gobject/valaclassregisterfunction.vala:
+ * gobject/valadbusclientmodule.vala:
+ * gobject/valadbusmodule.vala:
+ * gobject/valadbusservermodule.vala:
+ * gobject/valagerrormodule.vala:
+ * gobject/valagobjectmodule.vala:
+ * gobject/valagsignalmodule.vala:
+ * gobject/valagtypemodule.vala:
+ * gobject/valatyperegisterfunction.vala:
+
+ Simplify CCodeVariableDeclarator construction with initializer
+
2009-01-09 Jürg Billeter <j@bitron.ch>
* vapi/gsl.vapi:
/* valaccodevariabledeclarator.vala
*
- * Copyright (C) 2006-2008 Jürg Billeter
+ * Copyright (C) 2006-2009 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
*/
public CCodeExpression? initializer { get; set; }
- public CCodeVariableDeclarator (string name) {
- this.name = name;
- }
-
- public CCodeVariableDeclarator.with_initializer (string name, CCodeExpression? initializer) {
+ public CCodeVariableDeclarator (string name, CCodeExpression? initializer = null) {
this.name = name;
this.initializer = initializer;
}
clist_ev.append (new CCodeConstant ("NULL"));
clist.append (clist_ev);
- var enum_decl = new CCodeVariableDeclarator.with_initializer ("values[]", clist);
+ var enum_decl = new CCodeVariableDeclarator ("values[]", clist);
CCodeDeclaration cdecl = null;
if (en.is_flags) {
cdecl = new CCodeDeclaration ("GType");
string type_id_name = "%s_type_id".printf (en.get_lower_case_cname (null));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (type_id_name, new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (type_id_name, new CCodeConstant ("0")));
cdecl.modifiers = CCodeModifiers.STATIC;
regblock.add_statement (cdecl);
if (c.type_reference is ArrayType) {
arr = "[]";
}
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("%s%s".printf (c.get_cname (), arr), (CCodeExpression) c.initializer.ccodenode));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("%s%s".printf (c.get_cname (), arr), (CCodeExpression) c.initializer.ccodenode));
cdecl.modifiers = CCodeModifiers.STATIC;
if (!c.is_internal_symbol ()) {
}
var len_def = new CCodeDeclaration (len_type.get_cname ());
- len_def.add_declarator (new CCodeVariableDeclarator.with_initializer (head.get_array_length_cname (f.get_cname (), dim), new CCodeConstant ("0")));
+ len_def.add_declarator (new CCodeVariableDeclarator (head.get_array_length_cname (f.get_cname (), dim), new CCodeConstant ("0")));
if (!f.is_internal_symbol ()) {
len_def.modifiers = CCodeModifiers.EXTERN;
} else {
var len_type = int_type.copy ();
var cdecl = new CCodeDeclaration (len_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (head.get_array_size_cname (f.get_cname ()), new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (head.get_array_size_cname (f.get_cname ()), new CCodeConstant ("0")));
cdecl.modifiers = CCodeModifiers.STATIC;
source_type_member_declaration.append (cdecl);
}
}
var target_def = new CCodeDeclaration ("gpointer");
- target_def.add_declarator (new CCodeVariableDeclarator.with_initializer (get_delegate_target_cname (f.get_cname ()), new CCodeConstant ("NULL")));
+ target_def.add_declarator (new CCodeVariableDeclarator (get_delegate_target_cname (f.get_cname ()), new CCodeConstant ("NULL")));
if (!f.is_internal_symbol ()) {
target_def.modifiers = CCodeModifiers.EXTERN;
} else {
if (is_virtual) {
var cdecl = new CCodeDeclaration (this_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", transform_expression (new CCodeIdentifier ("base"), base_type, this_type)));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("self", transform_expression (new CCodeIdentifier ("base"), base_type, this_type)));
function.block.prepend_statement (cdecl);
}
if (current_method_inner_error) {
var cdecl = new CCodeDeclaration ("GError *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("inner_error", new CCodeConstant ("NULL")));
function.block.prepend_statement (cdecl);
}
if (current_method_inner_error) {
var cdecl = new CCodeDeclaration ("GError *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("inner_error", new CCodeConstant ("NULL")));
cfrag.append (cdecl);
}
cfrag.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_variable_cname (local.name)), rhs)));
}
} else {
- var cvar = new CCodeVariableDeclarator.with_initializer (get_variable_cname (local.name), rhs);
+ var cvar = new CCodeVariableDeclarator (get_variable_cname (local.name), rhs);
var cdecl = new CCodeDeclaration (local.variable_type.get_cname ());
cdecl.add_declarator (cvar);
var cdecl = new CCodeDeclaration (gquark_type.get_cname ());
cdecl.modifiers = CCodeModifiers.STATIC;
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (cname, czero));
+ cdecl.add_declarator (new CCodeVariableDeclarator (cname, czero));
cswitchblock.append (cdecl);
}
cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (get_variable_cexpression (collection_backup.name), (CCodeExpression) stmt.collection.ccodenode)));
} else {
var ccoldecl = new CCodeDeclaration (collection_type.get_cname ());
- var ccolvardecl = new CCodeVariableDeclarator.with_initializer (collection_backup.name, (CCodeExpression) stmt.collection.ccodenode);
+ var ccolvardecl = new CCodeVariableDeclarator (collection_backup.name, (CCodeExpression) stmt.collection.ccodenode);
ccolvardecl.line = cblock.line;
ccoldecl.add_declarator (ccolvardecl);
cblock.add_statement (ccoldecl);
cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (get_variable_cexpression (head.get_array_length_cname (collection_backup.name, 1)), array_len)));
} else {
var clendecl = new CCodeDeclaration ("int");
- clendecl.add_declarator (new CCodeVariableDeclarator.with_initializer (head.get_array_length_cname (collection_backup.name, 1), array_len));
+ clendecl.add_declarator (new CCodeVariableDeclarator (head.get_array_length_cname (collection_backup.name, 1), array_len));
cblock.add_statement (clendecl);
}
cbody.add_statement (new CCodeExpressionStatement (new CCodeAssignment (get_variable_cexpression (stmt.variable_name), element_expr)));
} else {
var cdecl = new CCodeDeclaration (stmt.type_reference.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (stmt.variable_name, element_expr));
+ cdecl.add_declarator (new CCodeVariableDeclarator (stmt.variable_name, element_expr));
cbody.add_statement (cdecl);
}
cbody.add_statement (new CCodeExpressionStatement (new CCodeAssignment (get_variable_cexpression (head.get_array_length_cname (stmt.variable_name, dim)), new CCodeConstant ("-1"))));
} else {
var cdecl = new CCodeDeclaration ("int");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (head.get_array_length_cname (stmt.variable_name, dim), new CCodeConstant ("-1")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (head.get_array_length_cname (stmt.variable_name, dim), new CCodeConstant ("-1")));
cbody.add_statement (cdecl);
}
}
cbody.add_statement (new CCodeExpressionStatement (new CCodeAssignment (get_variable_cexpression (stmt.variable_name), element_expr)));
} else {
var cdecl = new CCodeDeclaration (stmt.type_reference.get_cname ());
- var cvardecl = new CCodeVariableDeclarator.with_initializer (stmt.variable_name, element_expr);
+ var cvardecl = new CCodeVariableDeclarator (stmt.variable_name, element_expr);
cvardecl.line = cblock.line;
cdecl.add_declarator (cvardecl);
cbody.add_statement (cdecl);
CCodeExpression cself = transform_expression (new CCodeIdentifier ("base"), base_expression_type, self_target_type);
var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", cself));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("self", cself));
cinit.append (cdecl);
} else if (m.binding == MemberBinding.INSTANCE
// no initialization necessary, closure struct is zeroed
} else {
var cdecl = new CCodeDeclaration ("GError *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("inner_error", new CCodeConstant ("NULL")));
cinit.append (cdecl);
}
}
cparamsinit.add_argument (new CCodeConstant ((n_params + 3 * current_class.get_type_parameters ().size).to_string ()));
var cdecl = new CCodeDeclaration ("GParameter *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("__params", cparamsinit));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("__params", cparamsinit));
cinit.append (cdecl);
cdecl = new CCodeDeclaration ("GParameter *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("__params_it", new CCodeIdentifier ("__params")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("__params_it", new CCodeIdentifier ("__params")));
cinit.append (cdecl);
}
var cdecl = new CCodeDeclaration (cl.get_cname () + "*");
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_slice_new0"));
ccall.add_argument (new CCodeIdentifier (cl.get_cname ()));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("self", ccall));
cinit.append (cdecl);
var cinitcall = new CCodeFunctionCall (new CCodeIdentifier ("%s_instance_init".printf (cl.get_lower_case_cname (null))));
} else {
/* store method return value for postconditions */
var cdecl = new CCodeDeclaration (get_creturn_type (m, return_type.get_cname ()));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("result", vcall));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("result", vcall));
cstmt = cdecl;
}
cstmt.line = vfunc.line;
var ctypedecl = new CCodeDeclaration ("const GInterfaceInfo");
ctypedecl.modifiers = CCodeModifiers.STATIC;
- ctypedecl.add_declarator (new CCodeVariableDeclarator.with_initializer (iface_info_name, new CCodeConstant ("{ (GInterfaceInitFunc) %s_%s_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}".printf (class_reference.get_lower_case_cname (null), iface.get_lower_case_cname (null)))));
+ ctypedecl.add_declarator (new CCodeVariableDeclarator (iface_info_name, new CCodeConstant ("{ (GInterfaceInitFunc) %s_%s_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}".printf (class_reference.get_lower_case_cname (null), iface.get_lower_case_cname (null)))));
frag.append (ctypedecl);
}
cb_fun.add_parameter (new CCodeFormalParameter ("user_data", "void*"));
cb_fun.block = new CCodeBlock ();
var cerrdecl = new CCodeDeclaration ("GError*");
- cerrdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("error", new CCodeConstant ("NULL")));
+ cerrdecl.add_declarator (new CCodeVariableDeclarator ("error", new CCodeConstant ("NULL")));
cb_fun.block.add_statement (cerrdecl);
var cend_call = new CCodeFunctionCall (new CCodeIdentifier ("dbus_g_proxy_end_call"));
cend_call.add_argument (new CCodeIdentifier ("proxy"));
array_construct.add_argument (sizeof_call);
}
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("dbus_%s".printf (param.name), array_construct));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("dbus_%s".printf (param.name), array_construct));
block.add_statement (cdecl);
if (dbus_use_ptr_array (array_type)) {
array_construct.add_argument (new CCodeConstant ("0"));
var cdecl = new CCodeDeclaration ("GValueArray*");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("dbus_%s".printf (param.name), array_construct));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("dbus_%s".printf (param.name), array_construct));
block.add_statement (cdecl);
var type_call = new CCodeFunctionCall (new CCodeIdentifier ("dbus_g_type_get_struct"));
cvalinit.append (new CCodeConstant ("0"));
var cval_decl = new CCodeDeclaration ("GValue");
- cval_decl.add_declarator (new CCodeVariableDeclarator.with_initializer (val_name, cvalinit));
+ cval_decl.add_declarator (new CCodeVariableDeclarator (val_name, cvalinit));
block.add_statement (cval_decl);
var val_ptr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (val_name));
prop_proxy_call.add_argument (new CCodeConstant ("NULL"));
var prop_proxy_decl = new CCodeDeclaration ("DBusGProxy*");
- prop_proxy_decl.add_declarator (new CCodeVariableDeclarator.with_initializer ("property_proxy", prop_proxy_call));
+ prop_proxy_decl.add_declarator (new CCodeVariableDeclarator ("property_proxy", prop_proxy_call));
block.add_statement (prop_proxy_decl);
}
cvalinit.append (new CCodeConstant ("0"));
var cval_decl = new CCodeDeclaration ("GValue");
- cval_decl.add_declarator (new CCodeVariableDeclarator.with_initializer ("gvalue", cvalinit));
+ cval_decl.add_declarator (new CCodeVariableDeclarator ("gvalue", cvalinit));
block.add_statement (cval_decl);
var val_ptr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("gvalue"));
cvalinit.append (new CCodeConstant ("0"));
var cval_decl = new CCodeDeclaration ("GValue");
- cval_decl.add_declarator (new CCodeVariableDeclarator.with_initializer ("gvalue", cvalinit));
+ cval_decl.add_declarator (new CCodeVariableDeclarator ("gvalue", cvalinit));
block.add_statement (cval_decl);
var val_ptr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("gvalue"));
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
cdecl = new CCodeDeclaration ("int");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("_%s_length%d".printf (param.name, dim), new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("_%s_length%d".printf (param.name, dim), new CCodeConstant ("0")));
postfragment.append (cdecl);
}
}
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
cdecl = new CCodeDeclaration ("int");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("_result_length%d".printf (dim), new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("_result_length%d".printf (dim), new CCodeConstant ("0")));
postfragment.append (cdecl);
}
}
string temp_name = "_tmp%d".printf (next_temp_var_id++);
var cdecl = new CCodeDeclaration (array_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (temp_name, new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (temp_name, new CCodeConstant ("NULL")));
fragment.append (cdecl);
cdecl = new CCodeDeclaration ("int");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (temp_name + "_length", new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (temp_name + "_length", new CCodeConstant ("0")));
fragment.append (cdecl);
cdecl = new CCodeDeclaration ("int");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (temp_name + "_size", new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (temp_name + "_size", new CCodeConstant ("0")));
fragment.append (cdecl);
read_array_dim (fragment, array_type, 1, temp_name, iter_expr, expr);
string subiter_name = "_tmp%d".printf (next_temp_var_id++);
var cdecl = new CCodeDeclaration ("int");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("%s_length%d".printf (temp_name, dim), new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("%s_length%d".printf (temp_name, dim), new CCodeConstant ("0")));
fragment.append (cdecl);
cdecl = new CCodeDeclaration ("DBusMessageIter");
cvalinit.append (new CCodeConstant ("0"));
var cdecl = new CCodeDeclaration ("GValue");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (temp_name, cvalinit));
+ cdecl.add_declarator (new CCodeVariableDeclarator (temp_name, cvalinit));
fragment.append (cdecl);
cdecl = new CCodeDeclaration ("DBusMessageIter");
block.add_statement (cdecl);
cdecl = new CCodeDeclaration ("GError*");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("error", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("error", new CCodeConstant ("NULL")));
block.add_statement (cdecl);
block.add_statement (prefragment);
foreach (FormalParameter param in m.get_parameters ()) {
cdecl = new CCodeDeclaration (param.parameter_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (param.name, default_value_for_type (param.parameter_type, true)));
+ cdecl.add_declarator (new CCodeVariableDeclarator (param.name, default_value_for_type (param.parameter_type, true)));
prefragment.append (cdecl);
if (type_signature == ""
&& param.direction == ParameterDirection.IN
string length_cname = get_array_length_cname (param.name, dim);
cdecl = new CCodeDeclaration ("int");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (length_cname, new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (length_cname, new CCodeConstant ("0")));
prefragment.append (cdecl);
if (param.direction != ParameterDirection.IN) {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (length_cname)));
string length_cname = get_array_length_cname ("result", dim);
cdecl = new CCodeDeclaration ("int");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (length_cname, new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (length_cname, new CCodeConstant ("0")));
prefragment.append (cdecl);
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (length_cname)));
}
path.add_argument (new CCodeConstant ("\"dbus_object_path\""));
cdecl = new CCodeDeclaration ("const char *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("_path", path));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("_path", path));
block.add_statement (cdecl);
cdecl = new CCodeDeclaration ("DBusMessage");
cfunc.block = block;
var cdecl = new CCodeDeclaration ("DBusMessage*");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("reply", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("reply", new CCodeConstant ("NULL")));
block.add_statement (cdecl);
CCodeIfStatement clastif = null;
generate_register_function (object_type);
var cdecl = new CCodeDeclaration ("const _DBusObjectVTable");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("_" + sym.get_lower_case_cprefix () + "dbus_vtable", vtable));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("_" + sym.get_lower_case_cprefix () + "dbus_vtable", vtable));
cdecl.modifiers = CCodeModifiers.STATIC;
source_constant_declaration.append (cdecl);
generate_message_function (object_type);
var cdecl = new CCodeDeclaration ("const DBusObjectPathVTable");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("_" + sym.get_lower_case_cprefix () + "dbus_path_vtable", vtable));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("_" + sym.get_lower_case_cprefix () + "dbus_path_vtable", vtable));
cdecl.modifiers = CCodeModifiers.STATIC;
source_constant_declaration.append (cdecl);
cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (get_variable_cexpression (variable_name), get_variable_cexpression ("inner_error"))));
} else {
var cdecl = new CCodeDeclaration ("GError *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (variable_name, get_variable_cexpression ("inner_error")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (variable_name, get_variable_cexpression ("inner_error")));
cblock.add_statement (cdecl);
}
cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (get_variable_cexpression ("inner_error"), new CCodeConstant ("NULL"))));
if (cl.has_class_private_fields) {
decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sClassPrivate".printf (cl.get_cname ()))));
var cdecl = new CCodeDeclaration ("GQuark");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("_vala_%s_class_private_quark".printf (cl.get_lower_case_cname ()), new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("_vala_%s_class_private_quark".printf (cl.get_lower_case_cname ()), new CCodeConstant ("0")));
cdecl.modifiers = CCodeModifiers.STATIC;
decl_frag.append (cdecl);
}
var unref_block = new CCodeBlock ();
var cdecl = new CCodeDeclaration (cl.get_cname () + "*");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", new CCodeIdentifier ("instance")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("self", new CCodeIdentifier ("instance")));
ref_block.add_statement (cdecl);
unref_block.add_statement (cdecl);
var init_block = new CCodeBlock ();
var ctypedecl = new CCodeDeclaration (cl.get_cname () + "**");
- ctypedecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("object_p", new CCodeMemberAccess (new CCodeIdentifier ("collect_values[0]"),"v_pointer")));
+ ctypedecl.add_declarator (new CCodeVariableDeclarator ("object_p", new CCodeMemberAccess (new CCodeIdentifier ("collect_values[0]"),"v_pointer")));
init_block.add_statement (ctypedecl);
var value_type_name_fct = new CCodeFunctionCall (new CCodeIdentifier ("G_VALUE_TYPE_NAME"));
var obj_identifier = new CCodeIdentifier ("object");
var ctypedecl = new CCodeDeclaration (cl.get_cname () + "*");
- ctypedecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("object", collect_vpointer));
+ ctypedecl.add_declarator (new CCodeVariableDeclarator ("object", collect_vpointer));
true_stmt.add_statement (ctypedecl);
var l_expression = new CCodeMemberAccess (new CCodeMemberAccess.pointer (obj_identifier, "parent_instance"), "g_class");
cdecl.add_declarator (new CCodeVariableDeclarator ("priv"));
block.add_statement (cdecl);
cdecl = new CCodeDeclaration ("%sClassPrivate *".printf (cl.get_cname ()));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("parent_priv", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("parent_priv", new CCodeConstant ("NULL")));
block.add_statement (cdecl);
cdecl = new CCodeDeclaration ("GType");
cdecl.add_declarator (new CCodeVariableDeclarator ("parent_type"));
CCodeFunctionCall ccall = new InstanceCast (new CCodeIdentifier ("obj"), cl);
var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("self", ccall));
cblock.add_statement (cdecl);
CCodeFunctionCall ccall = new InstanceCast (new CCodeIdentifier ("object"), cl);
var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("self", ccall));
block.add_statement (cdecl);
cdecl = new CCodeDeclaration ("gpointer");
CCodeFunctionCall ccall = new InstanceCast (new CCodeIdentifier ("object"), cl);
var cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("self", ccall));
block.add_statement (cdecl);
var cswitch = new CCodeSwitchStatement (new CCodeIdentifier ("property_id"));
ccall = new InstanceCast (new CCodeIdentifier ("obj"), cl);
cdecl = new CCodeDeclaration ("%s *".printf (cl.get_cname ()));
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("self", ccall));
cblock.add_statement (cdecl);
if (current_method_inner_error) {
* as error may be set to NULL but we're always interested in inner errors
*/
cdecl = new CCodeDeclaration ("GError *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("inner_error", new CCodeConstant ("NULL")));
cblock.add_statement (cdecl);
}
* as error may be set to NULL but we're always interested in inner errors
*/
var cdecl = new CCodeDeclaration ("GError *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("inner_error", new CCodeConstant ("NULL")));
base_init_fragment.append (cdecl);
}
* as error may be set to NULL but we're always interested in inner errors
*/
var cdecl = new CCodeDeclaration ("GError *");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("inner_error", new CCodeConstant ("NULL")));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("inner_error", new CCodeConstant ("NULL")));
class_init_fragment.append (cdecl);
}
var_decl = new CCodeDeclaration ("GCClosure *");
var_decl.modifiers = CCodeModifiers.REGISTER;
- var_decl.add_declarator (new CCodeVariableDeclarator.with_initializer ("cc", new CCodeCastExpression (new CCodeIdentifier ("closure"), "GCClosure *")));
+ var_decl.add_declarator (new CCodeVariableDeclarator ("cc", new CCodeCastExpression (new CCodeIdentifier ("closure"), "GCClosure *")));
marshaller_body.add_statement (var_decl);
var_decl = new CCodeDeclaration ("gpointer");
base_init.block = new CCodeBlock ();
var decl = new CCodeDeclaration (bool_type.get_cname ());
decl.modifiers |= CCodeModifiers.STATIC;
- decl.add_declarator (new CCodeVariableDeclarator.with_initializer ("initialized", new CCodeConstant ("FALSE")));
+ decl.add_declarator (new CCodeVariableDeclarator ("initialized", new CCodeConstant ("FALSE")));
base_init.block.add_statement (decl);
var cif = new CCodeIfStatement (new CCodeUnaryExpression (CCodeUnaryOperator.LOGICAL_NEGATION, new CCodeIdentifier ("initialized")), init_block);
base_init.block.add_statement (cif);
CCodeDeclaration cdecl;
if (use_thread_safe) {
cdecl = new CCodeDeclaration ("gsize");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (type_id_name + "__volatile", new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (type_id_name + "__volatile", new CCodeConstant ("0")));
} else {
cdecl = new CCodeDeclaration ("GType");
- cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer (type_id_name, new CCodeConstant ("0")));
+ cdecl.add_declarator (new CCodeVariableDeclarator (type_id_name, new CCodeConstant ("0")));
}
cdecl.modifiers = CCodeModifiers.STATIC;
if (use_thread_safe) {
var cgtypetabledecl = new CCodeDeclaration ("const GTypeValueTable");
cgtypetabledecl.modifiers = CCodeModifiers.STATIC;
- cgtypetabledecl.add_declarator (new CCodeVariableDeclarator.with_initializer ( "g_define_type_value_table", new CCodeConstant ("{ %s, %s, %s, %s, \"p\", %s, \"p\", %s }".printf (get_gtype_value_table_init_function_name (), get_gtype_value_table_free_function_name (), get_gtype_value_table_copy_function_name (), get_gtype_value_table_peek_pointer_function_name (), get_gtype_value_table_collect_value_function_name (), get_gtype_value_table_lcopy_value_function_name ()))));
+ cgtypetabledecl.add_declarator (new CCodeVariableDeclarator ( "g_define_type_value_table", new CCodeConstant ("{ %s, %s, %s, %s, \"p\", %s, \"p\", %s }".printf (get_gtype_value_table_init_function_name (), get_gtype_value_table_free_function_name (), get_gtype_value_table_copy_function_name (), get_gtype_value_table_peek_pointer_function_name (), get_gtype_value_table_collect_value_function_name (), get_gtype_value_table_lcopy_value_function_name ()))));
type_value_table_decl_name = "&g_define_type_value_table";
type_init.add_statement ( cgtypetabledecl );
}
if (get_type_declaration () is ObjectTypeSymbol) {
var ctypedecl = new CCodeDeclaration ("const GTypeInfo");
ctypedecl.modifiers = CCodeModifiers.STATIC;
- ctypedecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("g_define_type_info", new CCodeConstant ("{ sizeof (%s), (GBaseInitFunc) %s, (GBaseFinalizeFunc) %s, (GClassInitFunc) %s, (GClassFinalizeFunc) %s, NULL, %s, 0, (GInstanceInitFunc) %s, %s }".printf (get_type_struct_name (), get_base_init_func_name (), (plugin) ? get_base_finalize_func_name () : "NULL", get_class_init_func_name (), get_class_finalize_func_name (), get_instance_struct_size (), get_instance_init_func_name (), type_value_table_decl_name))));
+ ctypedecl.add_declarator (new CCodeVariableDeclarator ("g_define_type_info", new CCodeConstant ("{ sizeof (%s), (GBaseInitFunc) %s, (GBaseFinalizeFunc) %s, (GClassInitFunc) %s, (GClassFinalizeFunc) %s, NULL, %s, 0, (GInstanceInitFunc) %s, %s }".printf (get_type_struct_name (), get_base_init_func_name (), (plugin) ? get_base_finalize_func_name () : "NULL", get_class_init_func_name (), get_class_finalize_func_name (), get_instance_struct_size (), get_instance_init_func_name (), type_value_table_decl_name))));
type_init.add_statement (ctypedecl);
if (fundamental) {
var ctypefundamentaldecl = new CCodeDeclaration ("const GTypeFundamentalInfo");
ctypefundamentaldecl.modifiers = CCodeModifiers.STATIC;
- ctypefundamentaldecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("g_define_type_fundamental_info", new CCodeConstant ("{ (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }")));
+ ctypefundamentaldecl.add_declarator (new CCodeVariableDeclarator ("g_define_type_fundamental_info", new CCodeConstant ("{ (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }")));
type_init.add_statement (ctypefundamentaldecl);
}
}
if (use_thread_safe && !plugin) {
var temp_decl = new CCodeDeclaration ("GType");
- temp_decl.add_declarator (new CCodeVariableDeclarator.with_initializer (type_id_name, reg_call));
+ temp_decl.add_declarator (new CCodeVariableDeclarator (type_id_name, reg_call));
type_init.add_statement (temp_decl);
} else {
type_init.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier (type_id_name), reg_call)));