decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%sClass".printf (cl.get_cname ()), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ()))));
var type_fun = new ClassRegisterFunction (cl, context);
- type_fun.init_from_type (in_plugin);
+ type_fun.init_from_type (in_plugin, true);
decl_space.add_type_member_declaration (type_fun.get_declaration ());
}
}
}
var type_fun = new ClassRegisterFunction (cl, context);
- type_fun.init_from_type (in_plugin);
+ type_fun.init_from_type (in_plugin, false);
cfile.add_type_member_declaration (type_fun.get_source_declaration ());
cfile.add_type_member_definition (type_fun.get_definition ());
decl_space.add_type_definition (type_struct);
var type_fun = new InterfaceRegisterFunction (iface, context);
- type_fun.init_from_type (in_plugin);
+ type_fun.init_from_type (in_plugin, true);
decl_space.add_type_member_declaration (type_fun.get_declaration ());
}
}
var type_fun = new InterfaceRegisterFunction (iface, context);
- type_fun.init_from_type (in_plugin);
+ type_fun.init_from_type (in_plugin, false);
cfile.add_type_member_declaration (type_fun.get_source_declaration ());
cfile.add_type_member_definition (type_fun.get_definition ());
if (st.has_type_id) {
var type_fun = new StructRegisterFunction (st, context);
- type_fun.init_from_type (false);
+ type_fun.init_from_type (false, false);
cfile.add_type_member_definition (type_fun.get_definition ());
}
}
if (en.has_type_id) {
var type_fun = new EnumRegisterFunction (en, context);
- type_fun.init_from_type (false);
+ type_fun.init_from_type (false, false);
cfile.add_type_member_definition (type_fun.get_definition ());
}
}
/**
* Constructs the C function from the specified type.
*/
- public void init_from_type (bool plugin) {
+ public void init_from_type (bool plugin, bool declaration_only) {
bool use_thread_safe = !plugin;
bool fundamental = false;
type_init.add_statement (new CCodeExpressionStatement (add_class_private_call));
}
- get_type_interface_init_statements (type_init, plugin);
+ if (!declaration_only) {
+ get_type_interface_init_statements (type_init, plugin);
+ }
if (!plugin) {
CCodeExpression condition; // the condition that guards the type initialisation