Logo Search packages:      
Sourcecode: vala-0.14 version File versions  Download package

valaccodestructmodule.c

/* valaccodestructmodule.c generated by valac, the Vala compiler
 * generated from valaccodestructmodule.vala, do not modify */

/* valaccodestructmodule.vala
 *
 * Copyright (C) 2006-2009  Jürg Billeter
 * Copyright (C) 2006-2008  Raffaele Sandrini
 *
 * 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:
 *    Jürg Billeter <j@bitron.ch>
 *    Raffaele Sandrini <raffaele@sandrini.ch>
 */

#include <glib.h>
#include <glib-object.h>
#include <vala.h>
#include <valaccode.h>
#include <valagee.h>
#include <stdlib.h>
#include <string.h>


#define VALA_TYPE_CCODE_BASE_MODULE (vala_ccode_base_module_get_type ())
#define VALA_CCODE_BASE_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CCODE_BASE_MODULE, ValaCCodeBaseModule))
#define VALA_CCODE_BASE_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CCODE_BASE_MODULE, ValaCCodeBaseModuleClass))
#define VALA_IS_CCODE_BASE_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CCODE_BASE_MODULE))
#define VALA_IS_CCODE_BASE_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CCODE_BASE_MODULE))
#define VALA_CCODE_BASE_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CCODE_BASE_MODULE, ValaCCodeBaseModuleClass))

typedef struct _ValaCCodeBaseModule ValaCCodeBaseModule;
typedef struct _ValaCCodeBaseModuleClass ValaCCodeBaseModuleClass;
typedef struct _ValaCCodeBaseModulePrivate ValaCCodeBaseModulePrivate;

#define VALA_CCODE_BASE_MODULE_TYPE_EMIT_CONTEXT (vala_ccode_base_module_emit_context_get_type ())
#define VALA_CCODE_BASE_MODULE_EMIT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_CCODE_BASE_MODULE_TYPE_EMIT_CONTEXT, ValaCCodeBaseModuleEmitContext))
#define VALA_CCODE_BASE_MODULE_EMIT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_CCODE_BASE_MODULE_TYPE_EMIT_CONTEXT, ValaCCodeBaseModuleEmitContextClass))
#define VALA_CCODE_BASE_MODULE_IS_EMIT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_CCODE_BASE_MODULE_TYPE_EMIT_CONTEXT))
#define VALA_CCODE_BASE_MODULE_IS_EMIT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_CCODE_BASE_MODULE_TYPE_EMIT_CONTEXT))
#define VALA_CCODE_BASE_MODULE_EMIT_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_CCODE_BASE_MODULE_TYPE_EMIT_CONTEXT, ValaCCodeBaseModuleEmitContextClass))

typedef struct _ValaCCodeBaseModuleEmitContext ValaCCodeBaseModuleEmitContext;
typedef struct _ValaCCodeBaseModuleEmitContextClass ValaCCodeBaseModuleEmitContextClass;

#define VALA_TYPE_CCODE_STRUCT_MODULE (vala_ccode_struct_module_get_type ())
#define VALA_CCODE_STRUCT_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CCODE_STRUCT_MODULE, ValaCCodeStructModule))
#define VALA_CCODE_STRUCT_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CCODE_STRUCT_MODULE, ValaCCodeStructModuleClass))
#define VALA_IS_CCODE_STRUCT_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CCODE_STRUCT_MODULE))
#define VALA_IS_CCODE_STRUCT_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CCODE_STRUCT_MODULE))
#define VALA_CCODE_STRUCT_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CCODE_STRUCT_MODULE, ValaCCodeStructModuleClass))

typedef struct _ValaCCodeStructModule ValaCCodeStructModule;
typedef struct _ValaCCodeStructModuleClass ValaCCodeStructModuleClass;
typedef struct _ValaCCodeStructModulePrivate ValaCCodeStructModulePrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))

#define VALA_TYPE_TYPEREGISTER_FUNCTION (vala_typeregister_function_get_type ())
#define VALA_TYPEREGISTER_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_TYPEREGISTER_FUNCTION, ValaTypeRegisterFunction))
#define VALA_TYPEREGISTER_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_TYPEREGISTER_FUNCTION, ValaTypeRegisterFunctionClass))
#define VALA_IS_TYPEREGISTER_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_TYPEREGISTER_FUNCTION))
#define VALA_IS_TYPEREGISTER_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_TYPEREGISTER_FUNCTION))
#define VALA_TYPEREGISTER_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_TYPEREGISTER_FUNCTION, ValaTypeRegisterFunctionClass))

typedef struct _ValaTypeRegisterFunction ValaTypeRegisterFunction;
typedef struct _ValaTypeRegisterFunctionClass ValaTypeRegisterFunctionClass;

#define VALA_TYPE_STRUCT_REGISTER_FUNCTION (vala_struct_register_function_get_type ())
#define VALA_STRUCT_REGISTER_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_STRUCT_REGISTER_FUNCTION, ValaStructRegisterFunction))
#define VALA_STRUCT_REGISTER_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_STRUCT_REGISTER_FUNCTION, ValaStructRegisterFunctionClass))
#define VALA_IS_STRUCT_REGISTER_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_STRUCT_REGISTER_FUNCTION))
#define VALA_IS_STRUCT_REGISTER_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_STRUCT_REGISTER_FUNCTION))
#define VALA_STRUCT_REGISTER_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_STRUCT_REGISTER_FUNCTION, ValaStructRegisterFunctionClass))

typedef struct _ValaStructRegisterFunction ValaStructRegisterFunction;
typedef struct _ValaStructRegisterFunctionClass ValaStructRegisterFunctionClass;
#define _vala_typeregister_function_unref0(var) ((var == NULL) ? NULL : (var = (vala_typeregister_function_unref (var), NULL)))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _vala_ccode_base_module_emit_context_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_base_module_emit_context_unref (var), NULL)))

#define VALA_TYPE_GLIB_VALUE (vala_glib_value_get_type ())
#define VALA_GLIB_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_GLIB_VALUE, ValaGLibValue))
#define VALA_GLIB_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_GLIB_VALUE, ValaGLibValueClass))
#define VALA_IS_GLIB_VALUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_GLIB_VALUE))
#define VALA_IS_GLIB_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_GLIB_VALUE))
#define VALA_GLIB_VALUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_GLIB_VALUE, ValaGLibValueClass))

typedef struct _ValaGLibValue ValaGLibValue;
typedef struct _ValaGLibValueClass ValaGLibValueClass;
#define _vala_target_value_unref0(var) ((var == NULL) ? NULL : (var = (vala_target_value_unref (var), NULL)))
typedef struct _ValaCCodeBaseModuleEmitContextPrivate ValaCCodeBaseModuleEmitContextPrivate;

struct _ValaCCodeBaseModule {
      ValaCodeGenerator parent_instance;
      ValaCCodeBaseModulePrivate * priv;
      ValaSymbol* root_symbol;
      ValaCCodeBaseModuleEmitContext* emit_context;
      ValaCCodeFile* header_file;
      ValaCCodeFile* internal_header_file;
      ValaCCodeFile* cfile;
      ValaCCodeBaseModuleEmitContext* class_init_context;
      ValaCCodeBaseModuleEmitContext* base_init_context;
      ValaCCodeBaseModuleEmitContext* class_finalize_context;
      ValaCCodeBaseModuleEmitContext* base_finalize_context;
      ValaCCodeBaseModuleEmitContext* instance_init_context;
      ValaCCodeBaseModuleEmitContext* instance_finalize_context;
      ValaCCodeStruct* param_spec_struct;
      ValaCCodeStruct* closure_struct;
      ValaCCodeEnum* prop_enum;
      ValaSet* user_marshal_set;
      ValaSet* predefined_marshal_set;
      gint next_regex_id;
      gboolean in_constructor;
      gboolean in_static_or_class_context;
      gint next_coroutine_state;
      ValaDataType* void_type;
      ValaDataType* bool_type;
      ValaDataType* char_type;
      ValaDataType* uchar_type;
      ValaDataType* unichar_type;
      ValaDataType* short_type;
      ValaDataType* ushort_type;
      ValaDataType* int_type;
      ValaDataType* uint_type;
      ValaDataType* long_type;
      ValaDataType* ulong_type;
      ValaDataType* int8_type;
      ValaDataType* uint8_type;
      ValaDataType* int16_type;
      ValaDataType* uint16_type;
      ValaDataType* int32_type;
      ValaDataType* uint32_type;
      ValaDataType* int64_type;
      ValaDataType* uint64_type;
      ValaDataType* string_type;
      ValaDataType* regex_type;
      ValaDataType* float_type;
      ValaDataType* double_type;
      ValaTypeSymbol* gtype_type;
      ValaTypeSymbol* gobject_type;
      ValaErrorType* gerror_type;
      ValaClass* glist_type;
      ValaClass* gslist_type;
      ValaClass* gnode_type;
      ValaClass* gvaluearray_type;
      ValaTypeSymbol* gstringbuilder_type;
      ValaTypeSymbol* garray_type;
      ValaTypeSymbol* gbytearray_type;
      ValaTypeSymbol* gptrarray_type;
      ValaTypeSymbol* gthreadpool_type;
      ValaDataType* gdestroynotify_type;
      ValaDataType* gquark_type;
      ValaStruct* gvalue_type;
      ValaClass* gvariant_type;
      ValaStruct* mutex_type;
      ValaTypeSymbol* type_module_type;
      ValaTypeSymbol* dbus_proxy_type;
      gboolean in_plugin;
      gchar* module_init_param_name;
      gboolean gvaluecollector_h_needed;
      gboolean requires_array_free;
      gboolean requires_array_move;
      gboolean requires_array_length;
      ValaSet* wrappers;
};

struct _ValaCCodeBaseModuleClass {
      ValaCodeGeneratorClass parent_class;
      void (*append_vala_array_free) (ValaCCodeBaseModule* self);
      void (*append_vala_array_move) (ValaCCodeBaseModule* self);
      void (*append_vala_array_length) (ValaCCodeBaseModule* self);
      gboolean (*generate_enum_declaration) (ValaCCodeBaseModule* self, ValaEnum* en, ValaCCodeFile* decl_space);
      void (*generate_class_struct_declaration) (ValaCCodeBaseModule* self, ValaClass* cl, ValaCCodeFile* decl_space);
      void (*generate_struct_declaration) (ValaCCodeBaseModule* self, ValaStruct* st, ValaCCodeFile* decl_space);
      void (*generate_delegate_declaration) (ValaCCodeBaseModule* self, ValaDelegate* d, ValaCCodeFile* decl_space);
      void (*generate_cparameters) (ValaCCodeBaseModule* self, ValaMethod* m, ValaCCodeFile* decl_space, ValaMap* cparam_map, ValaCCodeFunction* func, ValaCCodeFunctionDeclarator* vdeclarator, ValaMap* carg_map, ValaCCodeFunctionCall* vcall, gint direction);
      ValaCCodeExpression* (*get_dup_func_expression) (ValaCCodeBaseModule* self, ValaDataType* type, ValaSourceReference* source_reference, gboolean is_chainup);
      gchar* (*append_struct_array_free) (ValaCCodeBaseModule* self, ValaStruct* st);
      ValaCCodeExpression* (*destroy_value) (ValaCCodeBaseModule* self, ValaTargetValue* value, gboolean is_macro_definition);
      void (*append_scope_free) (ValaCCodeBaseModule* self, ValaSymbol* sym, ValaCodeNode* stop_at);
      ValaTargetValue* (*get_local_cvalue) (ValaCCodeBaseModule* self, ValaLocalVariable* local);
      ValaTargetValue* (*get_parameter_cvalue) (ValaCCodeBaseModule* self, ValaParameter* param);
      ValaTargetValue* (*get_field_cvalue) (ValaCCodeBaseModule* self, ValaField* field, ValaTargetValue* instance);
      ValaTargetValue* (*load_this_parameter) (ValaCCodeBaseModule* self, ValaTypeSymbol* sym);
      void (*store_value) (ValaCCodeBaseModule* self, ValaTargetValue* lvalue, ValaTargetValue* value);
      gchar* (*get_delegate_target_cname) (ValaCCodeBaseModule* self, const gchar* delegate_cname);
      ValaCCodeExpression* (*get_delegate_target_cexpression) (ValaCCodeBaseModule* self, ValaExpression* delegate_expr, ValaCCodeExpression** delegate_target_destroy_notify);
      ValaCCodeExpression* (*get_delegate_target_cvalue) (ValaCCodeBaseModule* self, ValaTargetValue* value);
      ValaCCodeExpression* (*get_delegate_target_destroy_notify_cvalue) (ValaCCodeBaseModule* self, ValaTargetValue* value);
      gchar* (*get_delegate_target_destroy_notify_cname) (ValaCCodeBaseModule* self, const gchar* delegate_cname);
      ValaTargetValue* (*copy_value) (ValaCCodeBaseModule* self, ValaTargetValue* value, ValaCodeNode* node);
      void (*generate_class_declaration) (ValaCCodeBaseModule* self, ValaClass* cl, ValaCCodeFile* decl_space);
      void (*generate_interface_declaration) (ValaCCodeBaseModule* self, ValaInterface* iface, ValaCCodeFile* decl_space);
      void (*generate_method_declaration) (ValaCCodeBaseModule* self, ValaMethod* m, ValaCCodeFile* decl_space);
      void (*generate_error_domain_declaration) (ValaCCodeBaseModule* self, ValaErrorDomain* edomain, ValaCCodeFile* decl_space);
      ValaCCodeExpression* (*deserialize_expression) (ValaCCodeBaseModule* self, ValaDataType* type, ValaCCodeExpression* variant_expr, ValaCCodeExpression* expr, ValaCCodeExpression* error_expr, gboolean* may_fail);
      ValaCCodeExpression* (*serialize_expression) (ValaCCodeBaseModule* self, ValaDataType* type, ValaCCodeExpression* expr);
      ValaCCodeExpression* (*get_implicit_cast_expression) (ValaCCodeBaseModule* self, ValaCCodeExpression* source_cexpr, ValaDataType* expression_type, ValaDataType* target_type, ValaCodeNode* node);
      gboolean (*is_gobject_property) (ValaCCodeBaseModule* self, ValaProperty* prop);
      gchar* (*get_custom_creturn_type) (ValaCCodeBaseModule* self, ValaMethod* m);
      void (*generate_dynamic_method_wrapper) (ValaCCodeBaseModule* self, ValaDynamicMethod* method);
      gboolean (*method_has_wrapper) (ValaCCodeBaseModule* self, ValaMethod* method);
      ValaCCodeFunctionCall* (*get_param_spec) (ValaCCodeBaseModule* self, ValaProperty* prop);
      ValaCCodeFunctionCall* (*get_signal_creation) (ValaCCodeBaseModule* self, ValaSignal* sig, ValaTypeSymbol* type);
      void (*register_dbus_info) (ValaCCodeBaseModule* self, ValaCCodeBlock* block, ValaObjectTypeSymbol* bindable);
      gchar* (*get_dynamic_property_getter_cname) (ValaCCodeBaseModule* self, ValaDynamicProperty* node);
      gchar* (*get_dynamic_property_setter_cname) (ValaCCodeBaseModule* self, ValaDynamicProperty* node);
      gchar* (*get_dynamic_signal_cname) (ValaCCodeBaseModule* self, ValaDynamicSignal* node);
      gchar* (*get_dynamic_signal_connect_wrapper_name) (ValaCCodeBaseModule* self, ValaDynamicSignal* node);
      gchar* (*get_dynamic_signal_connect_after_wrapper_name) (ValaCCodeBaseModule* self, ValaDynamicSignal* node);
      gchar* (*get_dynamic_signal_disconnect_wrapper_name) (ValaCCodeBaseModule* self, ValaDynamicSignal* node);
      gchar* (*get_array_length_cname) (ValaCCodeBaseModule* self, const gchar* array_cname, gint dim);
      gchar* (*get_parameter_array_length_cname) (ValaCCodeBaseModule* self, ValaParameter* param, gint dim);
      ValaCCodeExpression* (*get_array_length_cexpression) (ValaCCodeBaseModule* self, ValaExpression* array_expr, gint dim);
      ValaCCodeExpression* (*get_array_length_cvalue) (ValaCCodeBaseModule* self, ValaTargetValue* value, gint dim);
      gchar* (*get_array_size_cname) (ValaCCodeBaseModule* self, const gchar* array_cname);
      void (*add_simple_check) (ValaCCodeBaseModule* self, ValaCodeNode* node, gboolean always_fails);
      gchar* (*generate_ready_function) (ValaCCodeBaseModule* self, ValaMethod* m);
};

struct _ValaCCodeStructModule {
      ValaCCodeBaseModule parent_instance;
      ValaCCodeStructModulePrivate * priv;
};

struct _ValaCCodeStructModuleClass {
      ValaCCodeBaseModuleClass parent_class;
};

struct _ValaCCodeBaseModuleEmitContext {
      GTypeInstance parent_instance;
      volatile int ref_count;
      ValaCCodeBaseModuleEmitContextPrivate * priv;
      ValaSymbol* current_symbol;
      ValaArrayList* symbol_stack;
      ValaTryStatement* current_try;
      ValaCatchClause* current_catch;
      ValaCCodeFunction* ccode;
      ValaArrayList* ccode_stack;
      ValaArrayList* temp_ref_vars;
      gint next_temp_var_id;
      gboolean current_method_inner_error;
      gboolean current_method_return;
      ValaMap* variable_name_map;
};

struct _ValaCCodeBaseModuleEmitContextClass {
      GTypeClass parent_class;
      void (*finalize) (ValaCCodeBaseModuleEmitContext *self);
};


static gpointer vala_ccode_struct_module_parent_class = NULL;

GType vala_ccode_base_module_get_type (void) G_GNUC_CONST;
gpointer vala_ccode_base_module_emit_context_ref (gpointer instance);
void vala_ccode_base_module_emit_context_unref (gpointer instance);
GParamSpec* vala_ccode_base_module_param_spec_emit_context (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_ccode_base_module_value_set_emit_context (GValue* value, gpointer v_object);
void vala_ccode_base_module_value_take_emit_context (GValue* value, gpointer v_object);
gpointer vala_ccode_base_module_value_get_emit_context (const GValue* value);
GType vala_ccode_base_module_emit_context_get_type (void) G_GNUC_CONST;
GType vala_ccode_struct_module_get_type (void) G_GNUC_CONST;
enum  {
      VALA_CCODE_STRUCT_MODULE_DUMMY_PROPERTY
};
static void vala_ccode_struct_module_real_generate_struct_declaration (ValaCCodeBaseModule* base, ValaStruct* st, ValaCCodeFile* decl_space);
gboolean vala_ccode_base_module_add_symbol_declaration (ValaCCodeBaseModule* self, ValaCCodeFile* decl_space, ValaSymbol* sym, const gchar* name);
ValaCodeContext* vala_ccode_base_module_get_context (ValaCCodeBaseModule* self);
ValaStructRegisterFunction* vala_struct_register_function_new (ValaStruct* st, ValaCodeContext* context);
ValaStructRegisterFunction* vala_struct_register_function_construct (GType object_type, ValaStruct* st, ValaCodeContext* context);
gpointer vala_typeregister_function_ref (gpointer instance);
void vala_typeregister_function_unref (gpointer instance);
GParamSpec* vala_param_spec_typeregister_function (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vala_value_set_typeregister_function (GValue* value, gpointer v_object);
void vala_value_take_typeregister_function (GValue* value, gpointer v_object);
gpointer vala_value_get_typeregister_function (const GValue* value);
GType vala_typeregister_function_get_type (void) G_GNUC_CONST;
GType vala_struct_register_function_get_type (void) G_GNUC_CONST;
void vala_typeregister_function_init_from_type (ValaTypeRegisterFunction* self, gboolean plugin, gboolean declaration_only);
ValaCCodeFragment* vala_typeregister_function_get_declaration (ValaTypeRegisterFunction* self);
void vala_ccode_base_module_generate_type_declaration (ValaCCodeBaseModule* self, ValaDataType* type, ValaCCodeFile* decl_space);
gchar* vala_ccode_base_module_get_array_length_cname (ValaCCodeBaseModule* self, const gchar* array_cname, gint dim);
gchar* vala_ccode_base_module_get_array_size_cname (ValaCCodeBaseModule* self, const gchar* array_cname);
gchar* vala_ccode_base_module_get_delegate_target_cname (ValaCCodeBaseModule* self, const gchar* delegate_cname);
gchar* vala_ccode_base_module_get_delegate_target_destroy_notify_cname (ValaCCodeBaseModule* self, const gchar* delegate_cname);
static void vala_ccode_struct_module_real_visit_struct (ValaCodeVisitor* base, ValaStruct* st);
void vala_ccode_base_module_push_context (ValaCCodeBaseModule* self, ValaCCodeBaseModuleEmitContext* emit_context);
ValaCCodeBaseModuleEmitContext* vala_ccode_base_module_emit_context_new (ValaSymbol* symbol);
ValaCCodeBaseModuleEmitContext* vala_ccode_base_module_emit_context_construct (GType object_type, ValaSymbol* symbol);
void vala_ccode_base_module_generate_struct_declaration (ValaCCodeBaseModule* self, ValaStruct* st, ValaCCodeFile* decl_space);
static void vala_ccode_struct_module_begin_struct_destroy_function (ValaCCodeStructModule* self, ValaStruct* st);
static void vala_ccode_struct_module_add_struct_copy_function (ValaCCodeStructModule* self, ValaStruct* st);
static void vala_ccode_struct_module_add_struct_destroy_function (ValaCCodeStructModule* self, ValaStruct* st);
static void vala_ccode_struct_module_add_struct_dup_function (ValaCCodeStructModule* self, ValaStruct* st);
static void vala_ccode_struct_module_add_struct_free_function (ValaCCodeStructModule* self, ValaStruct* st);
void vala_ccode_base_module_pop_context (ValaCCodeBaseModule* self);
void vala_ccode_base_module_push_function (ValaCCodeBaseModule* self, ValaCCodeFunction* func);
ValaCCodeFunction* vala_ccode_base_module_get_ccode (ValaCCodeBaseModule* self);
void vala_ccode_base_module_pop_function (ValaCCodeBaseModule* self);
ValaDataType* vala_ccode_base_module_get_data_type_for_symbol (ValaTypeSymbol* sym);
ValaGLibValue* vala_glib_value_new (ValaDataType* value_type, ValaCCodeExpression* cvalue);
ValaGLibValue* vala_glib_value_construct (GType object_type, ValaDataType* value_type, ValaCCodeExpression* cvalue);
GType vala_glib_value_get_type (void) G_GNUC_CONST;
ValaTargetValue* vala_ccode_base_module_load_this_parameter (ValaCCodeBaseModule* self, ValaTypeSymbol* sym);
gboolean vala_ccode_base_module_requires_copy (ValaCCodeBaseModule* self, ValaDataType* type);
ValaTargetValue* vala_ccode_base_module_copy_value (ValaCCodeBaseModule* self, ValaTargetValue* value, ValaCodeNode* node);
ValaCCodeStructModule* vala_ccode_struct_module_construct (GType object_type);
ValaCCodeBaseModule* vala_ccode_base_module_construct (GType object_type);


static gpointer _vala_code_node_ref0 (gpointer self) {
      return self ? vala_code_node_ref (self) : NULL;
}


static void vala_ccode_struct_module_real_generate_struct_declaration (ValaCCodeBaseModule* base, ValaStruct* st, ValaCCodeFile* decl_space) {
      ValaCCodeStructModule * self;
      gchar* _tmp0_ = NULL;
      gchar* _tmp1_;
      gboolean _tmp2_;
      gboolean _tmp3_;
      gboolean _tmp4_;
      ValaCodeContext* _tmp14_ = NULL;
      ValaProfile _tmp15_;
      gchar* _tmp31_ = NULL;
      gchar* _tmp32_;
      gchar* _tmp33_ = NULL;
      gchar* _tmp34_;
      ValaCCodeStruct* _tmp35_ = NULL;
      ValaCCodeStruct* _tmp36_;
      ValaCCodeStruct* instance_struct;
      gboolean _tmp37_;
      ValaStruct* _tmp91_ = NULL;
      gchar* _tmp111_ = NULL;
      gchar* _tmp112_;
      gchar* _tmp113_ = NULL;
      gchar* _tmp114_;
      gchar* _tmp115_;
      gchar* _tmp116_;
      ValaCCodeFunction* _tmp117_ = NULL;
      ValaCCodeFunction* _tmp118_;
      ValaCCodeFunction* function;
      gboolean _tmp119_;
      gchar* _tmp120_ = NULL;
      gchar* _tmp121_;
      gchar* _tmp122_;
      gchar* _tmp123_;
      gchar* _tmp124_;
      gchar* _tmp125_;
      ValaCCodeParameter* _tmp126_ = NULL;
      ValaCCodeParameter* _tmp127_;
      gchar* _tmp128_ = NULL;
      gchar* _tmp129_;
      ValaCCodeFunction* _tmp130_ = NULL;
      gboolean _tmp131_;
      gchar* _tmp132_ = NULL;
      gchar* _tmp133_;
      gchar* _tmp134_;
      gchar* _tmp135_;
      ValaCCodeParameter* _tmp136_ = NULL;
      ValaCCodeParameter* _tmp137_;
      gboolean _tmp138_;
      self = (ValaCCodeStructModule*) base;
      g_return_if_fail (st != NULL);
      g_return_if_fail (decl_space != NULL);
      _tmp0_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp1_ = _tmp0_;
      _tmp2_ = vala_ccode_base_module_add_symbol_declaration ((ValaCCodeBaseModule*) self, decl_space, (ValaSymbol*) st, _tmp1_);
      _tmp3_ = _tmp2_;
      _g_free0 (_tmp1_);
      if (_tmp3_) {
            return;
      }
      _tmp4_ = vala_struct_is_boolean_type (st);
      if (_tmp4_) {
            vala_ccode_file_add_include (decl_space, "stdbool.h", FALSE);
            vala_struct_set_cname (st, "bool");
            return;
      } else {
            gboolean _tmp5_;
            _tmp5_ = vala_struct_is_integer_type (st);
            if (_tmp5_) {
                  const gchar* _tmp6_ = NULL;
                  gboolean _tmp7_;
                  gint _tmp8_;
                  gchar* _tmp9_ = NULL;
                  gchar* _tmp10_;
                  vala_ccode_file_add_include (decl_space, "stdint.h", FALSE);
                  _tmp7_ = vala_struct_get_signed (st);
                  if (_tmp7_) {
                        _tmp6_ = "";
                  } else {
                        _tmp6_ = "u";
                  }
                  _tmp8_ = vala_struct_get_width (st);
                  _tmp9_ = g_strdup_printf ("%sint%d_t", _tmp6_, _tmp8_);
                  _tmp10_ = _tmp9_;
                  vala_struct_set_cname (st, _tmp10_);
                  _g_free0 (_tmp10_);
                  return;
            } else {
                  gboolean _tmp11_;
                  _tmp11_ = vala_struct_is_floating_type (st);
                  if (_tmp11_) {
                        const gchar* _tmp12_ = NULL;
                        gint _tmp13_;
                        _tmp13_ = vala_struct_get_width (st);
                        if (_tmp13_ == 64) {
                              _tmp12_ = "double";
                        } else {
                              _tmp12_ = "float";
                        }
                        vala_struct_set_cname (st, _tmp12_);
                        return;
                  }
            }
      }
      _tmp14_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
      _tmp15_ = vala_code_context_get_profile (_tmp14_);
      if (_tmp15_ == VALA_PROFILE_GOBJECT) {
            gboolean _tmp16_;
            _tmp16_ = vala_struct_get_has_type_id (st);
            if (_tmp16_) {
                  ValaCCodeNewline* _tmp17_ = NULL;
                  ValaCCodeNewline* _tmp18_;
                  gchar* _tmp19_ = NULL;
                  gchar* _tmp20_;
                  gchar* _tmp21_ = NULL;
                  gchar* _tmp22_;
                  gchar* macro;
                  gchar* _tmp23_ = NULL;
                  gchar* _tmp24_;
                  ValaCCodeMacroReplacement* _tmp25_ = NULL;
                  ValaCCodeMacroReplacement* _tmp26_;
                  ValaCodeContext* _tmp27_ = NULL;
                  ValaStructRegisterFunction* _tmp28_ = NULL;
                  ValaStructRegisterFunction* type_fun;
                  ValaCCodeFragment* _tmp29_ = NULL;
                  ValaCCodeFragment* _tmp30_;
                  _tmp17_ = vala_ccode_newline_new ();
                  _tmp18_ = _tmp17_;
                  vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp18_);
                  _vala_ccode_node_unref0 (_tmp18_);
                  _tmp19_ = vala_symbol_get_lower_case_cname ((ValaSymbol*) st, NULL);
                  _tmp20_ = _tmp19_;
                  _tmp21_ = g_strdup_printf ("(%s_get_type ())", _tmp20_);
                  _tmp22_ = _tmp21_;
                  _g_free0 (_tmp20_);
                  macro = _tmp22_;
                  _tmp23_ = vala_typesymbol_get_type_id ((ValaTypeSymbol*) st);
                  _tmp24_ = _tmp23_;
                  _tmp25_ = vala_ccode_macro_replacement_new (_tmp24_, macro);
                  _tmp26_ = _tmp25_;
                  vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp26_);
                  _vala_ccode_node_unref0 (_tmp26_);
                  _g_free0 (_tmp24_);
                  _tmp27_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
                  _tmp28_ = vala_struct_register_function_new (st, _tmp27_);
                  type_fun = _tmp28_;
                  vala_typeregister_function_init_from_type ((ValaTypeRegisterFunction*) type_fun, FALSE, TRUE);
                  _tmp29_ = vala_typeregister_function_get_declaration ((ValaTypeRegisterFunction*) type_fun);
                  _tmp30_ = _tmp29_;
                  vala_ccode_file_add_type_member_declaration (decl_space, (ValaCCodeNode*) _tmp30_);
                  _vala_ccode_node_unref0 (_tmp30_);
                  _vala_typeregister_function_unref0 (type_fun);
                  _g_free0 (macro);
            }
      }
      _tmp31_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp32_ = _tmp31_;
      _tmp33_ = g_strdup_printf ("_%s", _tmp32_);
      _tmp34_ = _tmp33_;
      _tmp35_ = vala_ccode_struct_new (_tmp34_);
      _tmp36_ = _tmp35_;
      _g_free0 (_tmp34_);
      _g_free0 (_tmp32_);
      instance_struct = _tmp36_;
      _tmp37_ = vala_symbol_get_deprecated ((ValaSymbol*) st);
      vala_ccode_struct_set_deprecated (instance_struct, _tmp37_);
      {
            ValaList* _tmp38_ = NULL;
            ValaList* _f_list;
            gint _tmp39_;
            gint _f_size;
            gint _f_index;
            _tmp38_ = vala_struct_get_fields (st);
            _f_list = _tmp38_;
            _tmp39_ = vala_collection_get_size ((ValaCollection*) _f_list);
            _f_size = _tmp39_;
            _f_index = -1;
            while (TRUE) {
                  gpointer _tmp40_ = NULL;
                  ValaField* f;
                  ValaDataType* _tmp41_ = NULL;
                  gchar* _tmp42_ = NULL;
                  gchar* field_ctype;
                  gboolean _tmp43_;
                  ValaMemberBinding _tmp45_;
                  _f_index = _f_index + 1;
                  if (!(_f_index < _f_size)) {
                        break;
                  }
                  _tmp40_ = vala_list_get (_f_list, _f_index);
                  f = (ValaField*) _tmp40_;
                  _tmp41_ = vala_variable_get_variable_type ((ValaVariable*) f);
                  _tmp42_ = vala_data_type_get_cname (_tmp41_);
                  field_ctype = _tmp42_;
                  _tmp43_ = vala_field_get_is_volatile (f);
                  if (_tmp43_) {
                        gchar* _tmp44_;
                        _tmp44_ = g_strconcat ("volatile ", field_ctype, NULL);
                        _g_free0 (field_ctype);
                        field_ctype = _tmp44_;
                  }
                  _tmp45_ = vala_field_get_binding (f);
                  if (_tmp45_ == VALA_MEMBER_BINDING_INSTANCE) {
                        ValaDataType* _tmp46_ = NULL;
                        const gchar* _tmp47_ = NULL;
                        gboolean _tmp48_;
                        gchar* _tmp49_ = NULL;
                        gchar* _tmp50_;
                        ValaDataType* _tmp51_ = NULL;
                        gchar* _tmp52_ = NULL;
                        gchar* _tmp53_;
                        gchar* _tmp54_;
                        gchar* _tmp55_;
                        gboolean _tmp56_ = FALSE;
                        ValaDataType* _tmp57_ = NULL;
                        _tmp46_ = vala_variable_get_variable_type ((ValaVariable*) f);
                        vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp46_, decl_space);
                        _tmp48_ = vala_symbol_get_deprecated ((ValaSymbol*) f);
                        if (_tmp48_) {
                              _tmp47_ = " G_GNUC_DEPRECATED";
                        } else {
                              _tmp47_ = NULL;
                        }
                        _tmp49_ = vala_field_get_cname (f);
                        _tmp50_ = _tmp49_;
                        _tmp51_ = vala_variable_get_variable_type ((ValaVariable*) f);
                        _tmp52_ = vala_data_type_get_cdeclarator_suffix (_tmp51_);
                        _tmp53_ = _tmp52_;
                        _tmp54_ = g_strconcat (_tmp50_, _tmp53_, NULL);
                        _tmp55_ = _tmp54_;
                        vala_ccode_struct_add_field (instance_struct, field_ctype, _tmp55_, _tmp47_);
                        _g_free0 (_tmp55_);
                        _g_free0 (_tmp53_);
                        _g_free0 (_tmp50_);
                        _tmp57_ = vala_variable_get_variable_type ((ValaVariable*) f);
                        if (VALA_IS_ARRAY_TYPE (_tmp57_)) {
                              gboolean _tmp58_;
                              _tmp58_ = vala_variable_get_no_array_length ((ValaVariable*) f);
                              _tmp56_ = !_tmp58_;
                        } else {
                              _tmp56_ = FALSE;
                        }
                        if (_tmp56_) {
                              ValaDataType* _tmp59_ = NULL;
                              ValaArrayType* _tmp60_;
                              ValaArrayType* array_type;
                              gboolean _tmp61_;
                              _tmp59_ = vala_variable_get_variable_type ((ValaVariable*) f);
                              _tmp60_ = _vala_code_node_ref0 (VALA_ARRAY_TYPE (_tmp59_));
                              array_type = _tmp60_;
                              _tmp61_ = vala_array_type_get_fixed_length (array_type);
                              if (!_tmp61_) {
                                    ValaDataType* _tmp62_ = NULL;
                                    ValaDataType* len_type;
                                    gboolean _tmp71_ = FALSE;
                                    gint _tmp72_;
                                    _tmp62_ = vala_data_type_copy (((ValaCCodeBaseModule*) self)->int_type);
                                    len_type = _tmp62_;
                                    {
                                          gint dim;
                                          dim = 1;
                                          {
                                                gboolean _tmp63_;
                                                _tmp63_ = TRUE;
                                                while (TRUE) {
                                                      gint _tmp64_;
                                                      gchar* length_cname = NULL;
                                                      gboolean _tmp65_;
                                                      gchar* _tmp69_ = NULL;
                                                      gchar* _tmp70_;
                                                      if (!_tmp63_) {
                                                            dim++;
                                                      }
                                                      _tmp63_ = FALSE;
                                                      _tmp64_ = vala_array_type_get_rank (array_type);
                                                      if (!(dim <= _tmp64_)) {
                                                            break;
                                                      }
                                                      _tmp65_ = vala_variable_get_has_array_length_cname ((ValaVariable*) f);
                                                      if (_tmp65_) {
                                                            gchar* _tmp66_ = NULL;
                                                            _tmp66_ = vala_variable_get_array_length_cname ((ValaVariable*) f);
                                                            _g_free0 (length_cname);
                                                            length_cname = _tmp66_;
                                                      } else {
                                                            const gchar* _tmp67_ = NULL;
                                                            gchar* _tmp68_ = NULL;
                                                            _tmp67_ = vala_symbol_get_name ((ValaSymbol*) f);
                                                            _tmp68_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, _tmp67_, dim);
                                                            _g_free0 (length_cname);
                                                            length_cname = _tmp68_;
                                                      }
                                                      _tmp69_ = vala_data_type_get_cname (len_type);
                                                      _tmp70_ = _tmp69_;
                                                      vala_ccode_struct_add_field (instance_struct, _tmp70_, length_cname, NULL);
                                                      _g_free0 (_tmp70_);
                                                      _g_free0 (length_cname);
                                                }
                                          }
                                    }
                                    _tmp72_ = vala_array_type_get_rank (array_type);
                                    if (_tmp72_ == 1) {
                                          gboolean _tmp73_;
                                          _tmp73_ = vala_symbol_is_internal_symbol ((ValaSymbol*) f);
                                          _tmp71_ = _tmp73_;
                                    } else {
                                          _tmp71_ = FALSE;
                                    }
                                    if (_tmp71_) {
                                          gchar* _tmp74_ = NULL;
                                          gchar* _tmp75_;
                                          const gchar* _tmp76_ = NULL;
                                          gchar* _tmp77_ = NULL;
                                          gchar* _tmp78_;
                                          _tmp74_ = vala_data_type_get_cname (len_type);
                                          _tmp75_ = _tmp74_;
                                          _tmp76_ = vala_symbol_get_name ((ValaSymbol*) f);
                                          _tmp77_ = vala_ccode_base_module_get_array_size_cname ((ValaCCodeBaseModule*) self, _tmp76_);
                                          _tmp78_ = _tmp77_;
                                          vala_ccode_struct_add_field (instance_struct, _tmp75_, _tmp78_, NULL);
                                          _g_free0 (_tmp78_);
                                          _g_free0 (_tmp75_);
                                    }
                                    _vala_code_node_unref0 (len_type);
                              }
                              _vala_code_node_unref0 (array_type);
                        } else {
                              ValaDataType* _tmp79_ = NULL;
                              _tmp79_ = vala_variable_get_variable_type ((ValaVariable*) f);
                              if (VALA_IS_DELEGATE_TYPE (_tmp79_)) {
                                    ValaDataType* _tmp80_ = NULL;
                                    ValaDelegateType* _tmp81_;
                                    ValaDelegateType* delegate_type;
                                    ValaDelegate* _tmp82_ = NULL;
                                    gboolean _tmp83_;
                                    _tmp80_ = vala_variable_get_variable_type ((ValaVariable*) f);
                                    _tmp81_ = _vala_code_node_ref0 (VALA_DELEGATE_TYPE (_tmp80_));
                                    delegate_type = _tmp81_;
                                    _tmp82_ = vala_delegate_type_get_delegate_symbol (delegate_type);
                                    _tmp83_ = vala_delegate_get_has_target (_tmp82_);
                                    if (_tmp83_) {
                                          const gchar* _tmp84_ = NULL;
                                          gchar* _tmp85_ = NULL;
                                          gchar* _tmp86_;
                                          gboolean _tmp87_;
                                          _tmp84_ = vala_symbol_get_name ((ValaSymbol*) f);
                                          _tmp85_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, _tmp84_);
                                          _tmp86_ = _tmp85_;
                                          vala_ccode_struct_add_field (instance_struct, "gpointer", _tmp86_, NULL);
                                          _g_free0 (_tmp86_);
                                          _tmp87_ = vala_data_type_get_value_owned ((ValaDataType*) delegate_type);
                                          if (_tmp87_) {
                                                const gchar* _tmp88_ = NULL;
                                                gchar* _tmp89_ = NULL;
                                                gchar* _tmp90_;
                                                _tmp88_ = vala_symbol_get_name ((ValaSymbol*) f);
                                                _tmp89_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, _tmp88_);
                                                _tmp90_ = _tmp89_;
                                                vala_ccode_struct_add_field (instance_struct, "GDestroyNotify", _tmp90_, NULL);
                                                _g_free0 (_tmp90_);
                                          }
                                    }
                                    _vala_code_node_unref0 (delegate_type);
                              }
                        }
                  }
                  _g_free0 (field_ctype);
                  _vala_code_node_unref0 (f);
            }
            _vala_iterable_unref0 (_f_list);
      }
      _tmp91_ = vala_struct_get_base_struct (st);
      if (_tmp91_ == NULL) {
            gchar* _tmp92_ = NULL;
            gchar* _tmp93_;
            gchar* _tmp94_ = NULL;
            gchar* _tmp95_;
            gchar* _tmp96_ = NULL;
            gchar* _tmp97_;
            ValaCCodeVariableDeclarator* _tmp98_ = NULL;
            ValaCCodeVariableDeclarator* _tmp99_;
            ValaCCodeTypeDefinition* _tmp100_ = NULL;
            ValaCCodeTypeDefinition* _tmp101_;
            _tmp92_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
            _tmp93_ = _tmp92_;
            _tmp94_ = g_strdup_printf ("struct _%s", _tmp93_);
            _tmp95_ = _tmp94_;
            _tmp96_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
            _tmp97_ = _tmp96_;
            _tmp98_ = vala_ccode_variable_declarator_new (_tmp97_, NULL, NULL);
            _tmp99_ = _tmp98_;
            _tmp100_ = vala_ccode_type_definition_new (_tmp95_, (ValaCCodeDeclarator*) _tmp99_);
            _tmp101_ = _tmp100_;
            vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp101_);
            _vala_ccode_node_unref0 (_tmp101_);
            _vala_ccode_node_unref0 (_tmp99_);
            _g_free0 (_tmp97_);
            _g_free0 (_tmp95_);
            _g_free0 (_tmp93_);
            vala_ccode_file_add_type_definition (decl_space, (ValaCCodeNode*) instance_struct);
      } else {
            ValaStruct* _tmp102_ = NULL;
            gchar* _tmp103_ = NULL;
            gchar* _tmp104_;
            gchar* _tmp105_ = NULL;
            gchar* _tmp106_;
            ValaCCodeVariableDeclarator* _tmp107_ = NULL;
            ValaCCodeVariableDeclarator* _tmp108_;
            ValaCCodeTypeDefinition* _tmp109_ = NULL;
            ValaCCodeTypeDefinition* _tmp110_;
            _tmp102_ = vala_struct_get_base_struct (st);
            _tmp103_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) _tmp102_, FALSE);
            _tmp104_ = _tmp103_;
            _tmp105_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
            _tmp106_ = _tmp105_;
            _tmp107_ = vala_ccode_variable_declarator_new (_tmp106_, NULL, NULL);
            _tmp108_ = _tmp107_;
            _tmp109_ = vala_ccode_type_definition_new (_tmp104_, (ValaCCodeDeclarator*) _tmp108_);
            _tmp110_ = _tmp109_;
            vala_ccode_file_add_type_declaration (decl_space, (ValaCCodeNode*) _tmp110_);
            _vala_ccode_node_unref0 (_tmp110_);
            _vala_ccode_node_unref0 (_tmp108_);
            _g_free0 (_tmp106_);
            _g_free0 (_tmp104_);
      }
      _tmp111_ = vala_typesymbol_get_dup_function ((ValaTypeSymbol*) st);
      _tmp112_ = _tmp111_;
      _tmp113_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp114_ = _tmp113_;
      _tmp115_ = g_strconcat (_tmp114_, "*", NULL);
      _tmp116_ = _tmp115_;
      _tmp117_ = vala_ccode_function_new (_tmp112_, _tmp116_);
      _tmp118_ = _tmp117_;
      _g_free0 (_tmp116_);
      _g_free0 (_tmp114_);
      _g_free0 (_tmp112_);
      function = _tmp118_;
      _tmp119_ = vala_symbol_is_private_symbol ((ValaSymbol*) st);
      if (_tmp119_) {
            vala_ccode_function_set_modifiers (function, VALA_CCODE_MODIFIERS_STATIC);
      }
      _tmp120_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp121_ = _tmp120_;
      _tmp122_ = g_strconcat ("const ", _tmp121_, NULL);
      _tmp123_ = _tmp122_;
      _tmp124_ = g_strconcat (_tmp123_, "*", NULL);
      _tmp125_ = _tmp124_;
      _tmp126_ = vala_ccode_parameter_new ("self", _tmp125_);
      _tmp127_ = _tmp126_;
      vala_ccode_function_add_parameter (function, _tmp127_);
      _vala_ccode_node_unref0 (_tmp127_);
      _g_free0 (_tmp125_);
      _g_free0 (_tmp123_);
      _g_free0 (_tmp121_);
      vala_ccode_file_add_function_declaration (decl_space, function);
      _tmp128_ = vala_typesymbol_get_free_function ((ValaTypeSymbol*) st);
      _tmp129_ = _tmp128_;
      _tmp130_ = vala_ccode_function_new (_tmp129_, "void");
      _vala_ccode_node_unref0 (function);
      function = _tmp130_;
      _g_free0 (_tmp129_);
      _tmp131_ = vala_symbol_is_private_symbol ((ValaSymbol*) st);
      if (_tmp131_) {
            vala_ccode_function_set_modifiers (function, VALA_CCODE_MODIFIERS_STATIC);
      }
      _tmp132_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp133_ = _tmp132_;
      _tmp134_ = g_strconcat (_tmp133_, "*", NULL);
      _tmp135_ = _tmp134_;
      _tmp136_ = vala_ccode_parameter_new ("self", _tmp135_);
      _tmp137_ = _tmp136_;
      vala_ccode_function_add_parameter (function, _tmp137_);
      _vala_ccode_node_unref0 (_tmp137_);
      _g_free0 (_tmp135_);
      _g_free0 (_tmp133_);
      vala_ccode_file_add_function_declaration (decl_space, function);
      _tmp138_ = vala_struct_is_disposable (st);
      if (_tmp138_) {
            gchar* _tmp139_ = NULL;
            gchar* _tmp140_;
            ValaCCodeFunction* _tmp141_ = NULL;
            gboolean _tmp142_;
            gchar* _tmp143_ = NULL;
            gchar* _tmp144_;
            gchar* _tmp145_;
            gchar* _tmp146_;
            gchar* _tmp147_;
            gchar* _tmp148_;
            ValaCCodeParameter* _tmp149_ = NULL;
            ValaCCodeParameter* _tmp150_;
            gchar* _tmp151_ = NULL;
            gchar* _tmp152_;
            gchar* _tmp153_;
            gchar* _tmp154_;
            ValaCCodeParameter* _tmp155_ = NULL;
            ValaCCodeParameter* _tmp156_;
            gchar* _tmp157_ = NULL;
            gchar* _tmp158_;
            ValaCCodeFunction* _tmp159_ = NULL;
            gboolean _tmp160_;
            gchar* _tmp161_ = NULL;
            gchar* _tmp162_;
            gchar* _tmp163_;
            gchar* _tmp164_;
            ValaCCodeParameter* _tmp165_ = NULL;
            ValaCCodeParameter* _tmp166_;
            _tmp139_ = vala_typesymbol_get_copy_function ((ValaTypeSymbol*) st);
            _tmp140_ = _tmp139_;
            _tmp141_ = vala_ccode_function_new (_tmp140_, "void");
            _vala_ccode_node_unref0 (function);
            function = _tmp141_;
            _g_free0 (_tmp140_);
            _tmp142_ = vala_symbol_is_private_symbol ((ValaSymbol*) st);
            if (_tmp142_) {
                  vala_ccode_function_set_modifiers (function, VALA_CCODE_MODIFIERS_STATIC);
            }
            _tmp143_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
            _tmp144_ = _tmp143_;
            _tmp145_ = g_strconcat ("const ", _tmp144_, NULL);
            _tmp146_ = _tmp145_;
            _tmp147_ = g_strconcat (_tmp146_, "*", NULL);
            _tmp148_ = _tmp147_;
            _tmp149_ = vala_ccode_parameter_new ("self", _tmp148_);
            _tmp150_ = _tmp149_;
            vala_ccode_function_add_parameter (function, _tmp150_);
            _vala_ccode_node_unref0 (_tmp150_);
            _g_free0 (_tmp148_);
            _g_free0 (_tmp146_);
            _g_free0 (_tmp144_);
            _tmp151_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
            _tmp152_ = _tmp151_;
            _tmp153_ = g_strconcat (_tmp152_, "*", NULL);
            _tmp154_ = _tmp153_;
            _tmp155_ = vala_ccode_parameter_new ("dest", _tmp154_);
            _tmp156_ = _tmp155_;
            vala_ccode_function_add_parameter (function, _tmp156_);
            _vala_ccode_node_unref0 (_tmp156_);
            _g_free0 (_tmp154_);
            _g_free0 (_tmp152_);
            vala_ccode_file_add_function_declaration (decl_space, function);
            _tmp157_ = vala_typesymbol_get_destroy_function ((ValaTypeSymbol*) st);
            _tmp158_ = _tmp157_;
            _tmp159_ = vala_ccode_function_new (_tmp158_, "void");
            _vala_ccode_node_unref0 (function);
            function = _tmp159_;
            _g_free0 (_tmp158_);
            _tmp160_ = vala_symbol_is_private_symbol ((ValaSymbol*) st);
            if (_tmp160_) {
                  vala_ccode_function_set_modifiers (function, VALA_CCODE_MODIFIERS_STATIC);
            }
            _tmp161_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
            _tmp162_ = _tmp161_;
            _tmp163_ = g_strconcat (_tmp162_, "*", NULL);
            _tmp164_ = _tmp163_;
            _tmp165_ = vala_ccode_parameter_new ("self", _tmp164_);
            _tmp166_ = _tmp165_;
            vala_ccode_function_add_parameter (function, _tmp166_);
            _vala_ccode_node_unref0 (_tmp166_);
            _g_free0 (_tmp164_);
            _g_free0 (_tmp162_);
            vala_ccode_file_add_function_declaration (decl_space, function);
      }
      _vala_ccode_node_unref0 (function);
      _vala_ccode_node_unref0 (instance_struct);
}


static gpointer _vala_ccode_base_module_emit_context_ref0 (gpointer self) {
      return self ? vala_ccode_base_module_emit_context_ref (self) : NULL;
}


static void vala_ccode_struct_module_real_visit_struct (ValaCodeVisitor* base, ValaStruct* st) {
      ValaCCodeStructModule * self;
      ValaCCodeBaseModuleEmitContext* _tmp0_ = NULL;
      ValaCCodeBaseModuleEmitContext* _tmp1_;
      ValaCCodeBaseModuleEmitContext* _tmp2_;
      ValaCCodeBaseModuleEmitContext* old_instance_finalize_context;
      ValaCCodeBaseModuleEmitContext* _tmp3_ = NULL;
      gboolean _tmp4_;
      gboolean _tmp5_;
      gboolean _tmp6_ = FALSE;
      gboolean _tmp7_ = FALSE;
      gboolean _tmp8_ = FALSE;
      ValaCodeContext* _tmp9_ = NULL;
      ValaProfile _tmp10_;
      gboolean _tmp15_ = FALSE;
      gboolean _tmp16_ = FALSE;
      gboolean _tmp17_ = FALSE;
      ValaCodeContext* _tmp18_ = NULL;
      ValaProfile _tmp19_;
      ValaCCodeBaseModuleEmitContext* _tmp24_;
      self = (ValaCCodeStructModule*) base;
      g_return_if_fail (st != NULL);
      _tmp0_ = vala_ccode_base_module_emit_context_new ((ValaSymbol*) st);
      _tmp1_ = _tmp0_;
      vala_ccode_base_module_push_context ((ValaCCodeBaseModule*) self, _tmp1_);
      _vala_ccode_base_module_emit_context_unref0 (_tmp1_);
      _tmp2_ = _vala_ccode_base_module_emit_context_ref0 (((ValaCCodeBaseModule*) self)->instance_finalize_context);
      old_instance_finalize_context = _tmp2_;
      _tmp3_ = vala_ccode_base_module_emit_context_new (NULL);
      _vala_ccode_base_module_emit_context_unref0 (((ValaCCodeBaseModule*) self)->instance_finalize_context);
      ((ValaCCodeBaseModule*) self)->instance_finalize_context = _tmp3_;
      vala_ccode_base_module_generate_struct_declaration ((ValaCCodeBaseModule*) self, st, ((ValaCCodeBaseModule*) self)->cfile);
      _tmp4_ = vala_symbol_is_internal_symbol ((ValaSymbol*) st);
      if (!_tmp4_) {
            vala_ccode_base_module_generate_struct_declaration ((ValaCCodeBaseModule*) self, st, ((ValaCCodeBaseModule*) self)->header_file);
      }
      _tmp5_ = vala_symbol_is_private_symbol ((ValaSymbol*) st);
      if (!_tmp5_) {
            vala_ccode_base_module_generate_struct_declaration ((ValaCCodeBaseModule*) self, st, ((ValaCCodeBaseModule*) self)->internal_header_file);
      }
      _tmp9_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
      _tmp10_ = vala_code_context_get_profile (_tmp9_);
      if (_tmp10_ == VALA_PROFILE_GOBJECT) {
            gboolean _tmp11_;
            _tmp11_ = vala_struct_is_boolean_type (st);
            _tmp8_ = !_tmp11_;
      } else {
            _tmp8_ = FALSE;
      }
      if (_tmp8_) {
            gboolean _tmp12_;
            _tmp12_ = vala_struct_is_integer_type (st);
            _tmp7_ = !_tmp12_;
      } else {
            _tmp7_ = FALSE;
      }
      if (_tmp7_) {
            gboolean _tmp13_;
            _tmp13_ = vala_struct_is_floating_type (st);
            _tmp6_ = !_tmp13_;
      } else {
            _tmp6_ = FALSE;
      }
      if (_tmp6_) {
            gboolean _tmp14_;
            _tmp14_ = vala_struct_is_disposable (st);
            if (_tmp14_) {
                  vala_ccode_struct_module_begin_struct_destroy_function (self, st);
            }
      }
      vala_code_node_accept_children ((ValaCodeNode*) st, (ValaCodeVisitor*) self);
      _tmp18_ = vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self);
      _tmp19_ = vala_code_context_get_profile (_tmp18_);
      if (_tmp19_ == VALA_PROFILE_GOBJECT) {
            gboolean _tmp20_;
            _tmp20_ = vala_struct_is_boolean_type (st);
            _tmp17_ = !_tmp20_;
      } else {
            _tmp17_ = FALSE;
      }
      if (_tmp17_) {
            gboolean _tmp21_;
            _tmp21_ = vala_struct_is_integer_type (st);
            _tmp16_ = !_tmp21_;
      } else {
            _tmp16_ = FALSE;
      }
      if (_tmp16_) {
            gboolean _tmp22_;
            _tmp22_ = vala_struct_is_floating_type (st);
            _tmp15_ = !_tmp22_;
      } else {
            _tmp15_ = FALSE;
      }
      if (_tmp15_) {
            gboolean _tmp23_;
            _tmp23_ = vala_struct_is_disposable (st);
            if (_tmp23_) {
                  vala_ccode_struct_module_add_struct_copy_function (self, st);
                  vala_ccode_struct_module_add_struct_destroy_function (self, st);
            }
            vala_ccode_struct_module_add_struct_dup_function (self, st);
            vala_ccode_struct_module_add_struct_free_function (self, st);
      }
      _tmp24_ = _vala_ccode_base_module_emit_context_ref0 (old_instance_finalize_context);
      _vala_ccode_base_module_emit_context_unref0 (((ValaCCodeBaseModule*) self)->instance_finalize_context);
      ((ValaCCodeBaseModule*) self)->instance_finalize_context = _tmp24_;
      vala_ccode_base_module_pop_context ((ValaCCodeBaseModule*) self);
      _vala_ccode_base_module_emit_context_unref0 (old_instance_finalize_context);
}


static void vala_ccode_struct_module_add_struct_dup_function (ValaCCodeStructModule* self, ValaStruct* st) {
      gchar* _tmp0_ = NULL;
      gchar* _tmp1_;
      gchar* _tmp2_ = NULL;
      gchar* _tmp3_;
      gchar* _tmp4_;
      gchar* _tmp5_;
      ValaCCodeFunction* _tmp6_ = NULL;
      ValaCCodeFunction* _tmp7_;
      ValaCCodeFunction* function;
      ValaSymbolAccessibility _tmp8_;
      gchar* _tmp9_ = NULL;
      gchar* _tmp10_;
      gchar* _tmp11_;
      gchar* _tmp12_;
      gchar* _tmp13_;
      gchar* _tmp14_;
      ValaCCodeParameter* _tmp15_ = NULL;
      ValaCCodeParameter* _tmp16_;
      ValaCCodeFunction* _tmp17_ = NULL;
      gchar* _tmp18_ = NULL;
      gchar* _tmp19_;
      gchar* _tmp20_;
      gchar* _tmp21_;
      ValaCCodeVariableDeclarator* _tmp22_ = NULL;
      ValaCCodeVariableDeclarator* _tmp23_;
      ValaCCodeIdentifier* _tmp24_ = NULL;
      ValaCCodeIdentifier* _tmp25_;
      ValaCCodeFunctionCall* _tmp26_ = NULL;
      ValaCCodeFunctionCall* _tmp27_;
      ValaCCodeFunctionCall* creation_call;
      gchar* _tmp28_ = NULL;
      gchar* _tmp29_;
      ValaCCodeConstant* _tmp30_ = NULL;
      ValaCCodeConstant* _tmp31_;
      ValaCCodeConstant* _tmp32_ = NULL;
      ValaCCodeConstant* _tmp33_;
      ValaCCodeFunction* _tmp34_ = NULL;
      ValaCCodeIdentifier* _tmp35_ = NULL;
      ValaCCodeIdentifier* _tmp36_;
      gboolean _tmp37_;
      ValaCCodeFunction* _tmp66_ = NULL;
      ValaCCodeIdentifier* _tmp67_ = NULL;
      ValaCCodeIdentifier* _tmp68_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (st != NULL);
      _tmp0_ = vala_typesymbol_get_dup_function ((ValaTypeSymbol*) st);
      _tmp1_ = _tmp0_;
      _tmp2_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp3_ = _tmp2_;
      _tmp4_ = g_strconcat (_tmp3_, "*", NULL);
      _tmp5_ = _tmp4_;
      _tmp6_ = vala_ccode_function_new (_tmp1_, _tmp5_);
      _tmp7_ = _tmp6_;
      _g_free0 (_tmp5_);
      _g_free0 (_tmp3_);
      _g_free0 (_tmp1_);
      function = _tmp7_;
      _tmp8_ = vala_symbol_get_access ((ValaSymbol*) st);
      if (_tmp8_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
            vala_ccode_function_set_modifiers (function, VALA_CCODE_MODIFIERS_STATIC);
      }
      _tmp9_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp10_ = _tmp9_;
      _tmp11_ = g_strconcat ("const ", _tmp10_, NULL);
      _tmp12_ = _tmp11_;
      _tmp13_ = g_strconcat (_tmp12_, "*", NULL);
      _tmp14_ = _tmp13_;
      _tmp15_ = vala_ccode_parameter_new ("self", _tmp14_);
      _tmp16_ = _tmp15_;
      vala_ccode_function_add_parameter (function, _tmp16_);
      _vala_ccode_node_unref0 (_tmp16_);
      _g_free0 (_tmp14_);
      _g_free0 (_tmp12_);
      _g_free0 (_tmp10_);
      vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, function);
      _tmp17_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
      _tmp18_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp19_ = _tmp18_;
      _tmp20_ = g_strconcat (_tmp19_, "*", NULL);
      _tmp21_ = _tmp20_;
      _tmp22_ = vala_ccode_variable_declarator_new ("dup", NULL, NULL);
      _tmp23_ = _tmp22_;
      vala_ccode_function_add_declaration (_tmp17_, _tmp21_, (ValaCCodeDeclarator*) _tmp23_, 0);
      _vala_ccode_node_unref0 (_tmp23_);
      _g_free0 (_tmp21_);
      _g_free0 (_tmp19_);
      _tmp24_ = vala_ccode_identifier_new ("g_new0");
      _tmp25_ = _tmp24_;
      _tmp26_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp25_);
      _tmp27_ = _tmp26_;
      _vala_ccode_node_unref0 (_tmp25_);
      creation_call = _tmp27_;
      _tmp28_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp29_ = _tmp28_;
      _tmp30_ = vala_ccode_constant_new (_tmp29_);
      _tmp31_ = _tmp30_;
      vala_ccode_function_call_add_argument (creation_call, (ValaCCodeExpression*) _tmp31_);
      _vala_ccode_node_unref0 (_tmp31_);
      _g_free0 (_tmp29_);
      _tmp32_ = vala_ccode_constant_new ("1");
      _tmp33_ = _tmp32_;
      vala_ccode_function_call_add_argument (creation_call, (ValaCCodeExpression*) _tmp33_);
      _vala_ccode_node_unref0 (_tmp33_);
      _tmp34_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
      _tmp35_ = vala_ccode_identifier_new ("dup");
      _tmp36_ = _tmp35_;
      vala_ccode_function_add_assignment (_tmp34_, (ValaCCodeExpression*) _tmp36_, (ValaCCodeExpression*) creation_call);
      _vala_ccode_node_unref0 (_tmp36_);
      _tmp37_ = vala_struct_is_disposable (st);
      if (_tmp37_) {
            gchar* _tmp38_ = NULL;
            gchar* _tmp39_;
            ValaCCodeIdentifier* _tmp40_ = NULL;
            ValaCCodeIdentifier* _tmp41_;
            ValaCCodeFunctionCall* _tmp42_ = NULL;
            ValaCCodeFunctionCall* _tmp43_;
            ValaCCodeFunctionCall* copy_call;
            ValaCCodeIdentifier* _tmp44_ = NULL;
            ValaCCodeIdentifier* _tmp45_;
            ValaCCodeIdentifier* _tmp46_ = NULL;
            ValaCCodeIdentifier* _tmp47_;
            ValaCCodeFunction* _tmp48_ = NULL;
            _tmp38_ = vala_typesymbol_get_copy_function ((ValaTypeSymbol*) st);
            _tmp39_ = _tmp38_;
            _tmp40_ = vala_ccode_identifier_new (_tmp39_);
            _tmp41_ = _tmp40_;
            _tmp42_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp41_);
            _tmp43_ = _tmp42_;
            _vala_ccode_node_unref0 (_tmp41_);
            _g_free0 (_tmp39_);
            copy_call = _tmp43_;
            _tmp44_ = vala_ccode_identifier_new ("self");
            _tmp45_ = _tmp44_;
            vala_ccode_function_call_add_argument (copy_call, (ValaCCodeExpression*) _tmp45_);
            _vala_ccode_node_unref0 (_tmp45_);
            _tmp46_ = vala_ccode_identifier_new ("dup");
            _tmp47_ = _tmp46_;
            vala_ccode_function_call_add_argument (copy_call, (ValaCCodeExpression*) _tmp47_);
            _vala_ccode_node_unref0 (_tmp47_);
            _tmp48_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
            vala_ccode_function_add_expression (_tmp48_, (ValaCCodeExpression*) copy_call);
            _vala_ccode_node_unref0 (copy_call);
      } else {
            ValaCCodeIdentifier* _tmp49_ = NULL;
            ValaCCodeIdentifier* _tmp50_;
            ValaCCodeFunctionCall* _tmp51_ = NULL;
            ValaCCodeFunctionCall* _tmp52_;
            ValaCCodeFunctionCall* sizeof_call;
            gchar* _tmp53_ = NULL;
            gchar* _tmp54_;
            ValaCCodeConstant* _tmp55_ = NULL;
            ValaCCodeConstant* _tmp56_;
            ValaCCodeIdentifier* _tmp57_ = NULL;
            ValaCCodeIdentifier* _tmp58_;
            ValaCCodeFunctionCall* _tmp59_ = NULL;
            ValaCCodeFunctionCall* _tmp60_;
            ValaCCodeFunctionCall* copy_call;
            ValaCCodeIdentifier* _tmp61_ = NULL;
            ValaCCodeIdentifier* _tmp62_;
            ValaCCodeIdentifier* _tmp63_ = NULL;
            ValaCCodeIdentifier* _tmp64_;
            ValaCCodeFunction* _tmp65_ = NULL;
            vala_ccode_file_add_include (((ValaCCodeBaseModule*) self)->cfile, "string.h", FALSE);
            _tmp49_ = vala_ccode_identifier_new ("sizeof");
            _tmp50_ = _tmp49_;
            _tmp51_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp50_);
            _tmp52_ = _tmp51_;
            _vala_ccode_node_unref0 (_tmp50_);
            sizeof_call = _tmp52_;
            _tmp53_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
            _tmp54_ = _tmp53_;
            _tmp55_ = vala_ccode_constant_new (_tmp54_);
            _tmp56_ = _tmp55_;
            vala_ccode_function_call_add_argument (sizeof_call, (ValaCCodeExpression*) _tmp56_);
            _vala_ccode_node_unref0 (_tmp56_);
            _g_free0 (_tmp54_);
            _tmp57_ = vala_ccode_identifier_new ("memcpy");
            _tmp58_ = _tmp57_;
            _tmp59_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp58_);
            _tmp60_ = _tmp59_;
            _vala_ccode_node_unref0 (_tmp58_);
            copy_call = _tmp60_;
            _tmp61_ = vala_ccode_identifier_new ("dup");
            _tmp62_ = _tmp61_;
            vala_ccode_function_call_add_argument (copy_call, (ValaCCodeExpression*) _tmp62_);
            _vala_ccode_node_unref0 (_tmp62_);
            _tmp63_ = vala_ccode_identifier_new ("self");
            _tmp64_ = _tmp63_;
            vala_ccode_function_call_add_argument (copy_call, (ValaCCodeExpression*) _tmp64_);
            _vala_ccode_node_unref0 (_tmp64_);
            vala_ccode_function_call_add_argument (copy_call, (ValaCCodeExpression*) sizeof_call);
            _tmp65_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
            vala_ccode_function_add_expression (_tmp65_, (ValaCCodeExpression*) copy_call);
            _vala_ccode_node_unref0 (copy_call);
            _vala_ccode_node_unref0 (sizeof_call);
      }
      _tmp66_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
      _tmp67_ = vala_ccode_identifier_new ("dup");
      _tmp68_ = _tmp67_;
      vala_ccode_function_add_return (_tmp66_, (ValaCCodeExpression*) _tmp68_);
      _vala_ccode_node_unref0 (_tmp68_);
      vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
      vala_ccode_file_add_function (((ValaCCodeBaseModule*) self)->cfile, function);
      _vala_ccode_node_unref0 (creation_call);
      _vala_ccode_node_unref0 (function);
}


static void vala_ccode_struct_module_add_struct_free_function (ValaCCodeStructModule* self, ValaStruct* st) {
      gchar* _tmp0_ = NULL;
      gchar* _tmp1_;
      ValaCCodeFunction* _tmp2_ = NULL;
      ValaCCodeFunction* _tmp3_;
      ValaCCodeFunction* function;
      ValaSymbolAccessibility _tmp4_;
      gchar* _tmp5_ = NULL;
      gchar* _tmp6_;
      gchar* _tmp7_;
      gchar* _tmp8_;
      ValaCCodeParameter* _tmp9_ = NULL;
      ValaCCodeParameter* _tmp10_;
      gboolean _tmp11_;
      ValaCCodeIdentifier* _tmp21_ = NULL;
      ValaCCodeIdentifier* _tmp22_;
      ValaCCodeFunctionCall* _tmp23_ = NULL;
      ValaCCodeFunctionCall* _tmp24_;
      ValaCCodeFunctionCall* free_call;
      ValaCCodeIdentifier* _tmp25_ = NULL;
      ValaCCodeIdentifier* _tmp26_;
      ValaCCodeFunction* _tmp27_ = NULL;
      g_return_if_fail (self != NULL);
      g_return_if_fail (st != NULL);
      _tmp0_ = vala_typesymbol_get_free_function ((ValaTypeSymbol*) st);
      _tmp1_ = _tmp0_;
      _tmp2_ = vala_ccode_function_new (_tmp1_, "void");
      _tmp3_ = _tmp2_;
      _g_free0 (_tmp1_);
      function = _tmp3_;
      _tmp4_ = vala_symbol_get_access ((ValaSymbol*) st);
      if (_tmp4_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
            vala_ccode_function_set_modifiers (function, VALA_CCODE_MODIFIERS_STATIC);
      }
      _tmp5_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp6_ = _tmp5_;
      _tmp7_ = g_strconcat (_tmp6_, "*", NULL);
      _tmp8_ = _tmp7_;
      _tmp9_ = vala_ccode_parameter_new ("self", _tmp8_);
      _tmp10_ = _tmp9_;
      vala_ccode_function_add_parameter (function, _tmp10_);
      _vala_ccode_node_unref0 (_tmp10_);
      _g_free0 (_tmp8_);
      _g_free0 (_tmp6_);
      vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, function);
      _tmp11_ = vala_struct_is_disposable (st);
      if (_tmp11_) {
            gchar* _tmp12_ = NULL;
            gchar* _tmp13_;
            ValaCCodeIdentifier* _tmp14_ = NULL;
            ValaCCodeIdentifier* _tmp15_;
            ValaCCodeFunctionCall* _tmp16_ = NULL;
            ValaCCodeFunctionCall* _tmp17_;
            ValaCCodeFunctionCall* destroy_call;
            ValaCCodeIdentifier* _tmp18_ = NULL;
            ValaCCodeIdentifier* _tmp19_;
            ValaCCodeFunction* _tmp20_ = NULL;
            _tmp12_ = vala_typesymbol_get_destroy_function ((ValaTypeSymbol*) st);
            _tmp13_ = _tmp12_;
            _tmp14_ = vala_ccode_identifier_new (_tmp13_);
            _tmp15_ = _tmp14_;
            _tmp16_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp15_);
            _tmp17_ = _tmp16_;
            _vala_ccode_node_unref0 (_tmp15_);
            _g_free0 (_tmp13_);
            destroy_call = _tmp17_;
            _tmp18_ = vala_ccode_identifier_new ("self");
            _tmp19_ = _tmp18_;
            vala_ccode_function_call_add_argument (destroy_call, (ValaCCodeExpression*) _tmp19_);
            _vala_ccode_node_unref0 (_tmp19_);
            _tmp20_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
            vala_ccode_function_add_expression (_tmp20_, (ValaCCodeExpression*) destroy_call);
            _vala_ccode_node_unref0 (destroy_call);
      }
      _tmp21_ = vala_ccode_identifier_new ("g_free");
      _tmp22_ = _tmp21_;
      _tmp23_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp22_);
      _tmp24_ = _tmp23_;
      _vala_ccode_node_unref0 (_tmp22_);
      free_call = _tmp24_;
      _tmp25_ = vala_ccode_identifier_new ("self");
      _tmp26_ = _tmp25_;
      vala_ccode_function_call_add_argument (free_call, (ValaCCodeExpression*) _tmp26_);
      _vala_ccode_node_unref0 (_tmp26_);
      _tmp27_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
      vala_ccode_function_add_expression (_tmp27_, (ValaCCodeExpression*) free_call);
      vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
      vala_ccode_file_add_function (((ValaCCodeBaseModule*) self)->cfile, function);
      _vala_ccode_node_unref0 (free_call);
      _vala_ccode_node_unref0 (function);
}


static void vala_ccode_struct_module_add_struct_copy_function (ValaCCodeStructModule* self, ValaStruct* st) {
      gchar* _tmp0_ = NULL;
      gchar* _tmp1_;
      ValaCCodeFunction* _tmp2_ = NULL;
      ValaCCodeFunction* _tmp3_;
      ValaCCodeFunction* function;
      ValaSymbolAccessibility _tmp4_;
      gchar* _tmp5_ = NULL;
      gchar* _tmp6_;
      gchar* _tmp7_;
      gchar* _tmp8_;
      gchar* _tmp9_;
      gchar* _tmp10_;
      ValaCCodeParameter* _tmp11_ = NULL;
      ValaCCodeParameter* _tmp12_;
      gchar* _tmp13_ = NULL;
      gchar* _tmp14_;
      gchar* _tmp15_;
      gchar* _tmp16_;
      ValaCCodeParameter* _tmp17_ = NULL;
      ValaCCodeParameter* _tmp18_;
      ValaDataType* _tmp19_ = NULL;
      ValaDataType* _tmp20_;
      ValaCCodeIdentifier* _tmp21_ = NULL;
      ValaCCodeIdentifier* _tmp22_;
      ValaGLibValue* _tmp23_ = NULL;
      ValaGLibValue* _tmp24_;
      ValaGLibValue* dest_struct;
      g_return_if_fail (self != NULL);
      g_return_if_fail (st != NULL);
      _tmp0_ = vala_typesymbol_get_copy_function ((ValaTypeSymbol*) st);
      _tmp1_ = _tmp0_;
      _tmp2_ = vala_ccode_function_new (_tmp1_, "void");
      _tmp3_ = _tmp2_;
      _g_free0 (_tmp1_);
      function = _tmp3_;
      _tmp4_ = vala_symbol_get_access ((ValaSymbol*) st);
      if (_tmp4_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
            vala_ccode_function_set_modifiers (function, VALA_CCODE_MODIFIERS_STATIC);
      }
      _tmp5_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp6_ = _tmp5_;
      _tmp7_ = g_strconcat ("const ", _tmp6_, NULL);
      _tmp8_ = _tmp7_;
      _tmp9_ = g_strconcat (_tmp8_, "*", NULL);
      _tmp10_ = _tmp9_;
      _tmp11_ = vala_ccode_parameter_new ("self", _tmp10_);
      _tmp12_ = _tmp11_;
      vala_ccode_function_add_parameter (function, _tmp12_);
      _vala_ccode_node_unref0 (_tmp12_);
      _g_free0 (_tmp10_);
      _g_free0 (_tmp8_);
      _g_free0 (_tmp6_);
      _tmp13_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp14_ = _tmp13_;
      _tmp15_ = g_strconcat (_tmp14_, "*", NULL);
      _tmp16_ = _tmp15_;
      _tmp17_ = vala_ccode_parameter_new ("dest", _tmp16_);
      _tmp18_ = _tmp17_;
      vala_ccode_function_add_parameter (function, _tmp18_);
      _vala_ccode_node_unref0 (_tmp18_);
      _g_free0 (_tmp16_);
      _g_free0 (_tmp14_);
      vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, function);
      _tmp19_ = vala_ccode_base_module_get_data_type_for_symbol ((ValaTypeSymbol*) st);
      _tmp20_ = _tmp19_;
      _tmp21_ = vala_ccode_identifier_new ("(*dest)");
      _tmp22_ = _tmp21_;
      _tmp23_ = vala_glib_value_new (_tmp20_, (ValaCCodeExpression*) _tmp22_);
      _tmp24_ = _tmp23_;
      _vala_ccode_node_unref0 (_tmp22_);
      _vala_code_node_unref0 (_tmp20_);
      dest_struct = _tmp24_;
      {
            ValaList* _tmp25_ = NULL;
            ValaList* _f_list;
            gint _tmp26_;
            gint _f_size;
            gint _f_index;
            _tmp25_ = vala_struct_get_fields (st);
            _f_list = _tmp25_;
            _tmp26_ = vala_collection_get_size ((ValaCollection*) _f_list);
            _f_size = _tmp26_;
            _f_index = -1;
            while (TRUE) {
                  gpointer _tmp27_ = NULL;
                  ValaField* f;
                  ValaMemberBinding _tmp28_;
                  _f_index = _f_index + 1;
                  if (!(_f_index < _f_size)) {
                        break;
                  }
                  _tmp27_ = vala_list_get (_f_list, _f_index);
                  f = (ValaField*) _tmp27_;
                  _tmp28_ = vala_field_get_binding (f);
                  if (_tmp28_ == VALA_MEMBER_BINDING_INSTANCE) {
                        ValaTargetValue* _tmp29_ = NULL;
                        ValaTargetValue* _tmp30_;
                        ValaTargetValue* _tmp31_ = NULL;
                        ValaTargetValue* _tmp32_;
                        ValaTargetValue* value;
                        ValaDataType* _tmp33_ = NULL;
                        gboolean _tmp34_;
                        _tmp29_ = vala_ccode_base_module_load_this_parameter ((ValaCCodeBaseModule*) self, VALA_TYPESYMBOL (st));
                        _tmp30_ = _tmp29_;
                        _tmp31_ = vala_code_generator_load_field ((ValaCodeGenerator*) self, f, _tmp30_);
                        _tmp32_ = _tmp31_;
                        _vala_target_value_unref0 (_tmp30_);
                        value = _tmp32_;
                        _tmp33_ = vala_variable_get_variable_type ((ValaVariable*) f);
                        _tmp34_ = vala_ccode_base_module_requires_copy ((ValaCCodeBaseModule*) self, _tmp33_);
                        if (_tmp34_) {
                              ValaTargetValue* _tmp35_ = NULL;
                              _tmp35_ = vala_ccode_base_module_copy_value ((ValaCCodeBaseModule*) self, value, (ValaCodeNode*) f);
                              _vala_target_value_unref0 (value);
                              value = _tmp35_;
                              if (value == NULL) {
                                    _vala_target_value_unref0 (value);
                                    _vala_code_node_unref0 (f);
                                    continue;
                              }
                        }
                        vala_code_generator_store_field ((ValaCodeGenerator*) self, f, (ValaTargetValue*) dest_struct, value);
                        _vala_target_value_unref0 (value);
                  }
                  _vala_code_node_unref0 (f);
            }
            _vala_iterable_unref0 (_f_list);
      }
      vala_ccode_base_module_pop_function ((ValaCCodeBaseModule*) self);
      vala_ccode_file_add_function (((ValaCCodeBaseModule*) self)->cfile, function);
      _vala_target_value_unref0 (dest_struct);
      _vala_ccode_node_unref0 (function);
}


static void vala_ccode_struct_module_begin_struct_destroy_function (ValaCCodeStructModule* self, ValaStruct* st) {
      gchar* _tmp0_ = NULL;
      gchar* _tmp1_;
      ValaCCodeFunction* _tmp2_ = NULL;
      ValaCCodeFunction* _tmp3_;
      ValaCCodeFunction* function;
      ValaSymbolAccessibility _tmp4_;
      gchar* _tmp5_ = NULL;
      gchar* _tmp6_;
      gchar* _tmp7_;
      gchar* _tmp8_;
      ValaCCodeParameter* _tmp9_ = NULL;
      ValaCCodeParameter* _tmp10_;
      g_return_if_fail (self != NULL);
      g_return_if_fail (st != NULL);
      vala_ccode_base_module_push_context ((ValaCCodeBaseModule*) self, ((ValaCCodeBaseModule*) self)->instance_finalize_context);
      _tmp0_ = vala_typesymbol_get_destroy_function ((ValaTypeSymbol*) st);
      _tmp1_ = _tmp0_;
      _tmp2_ = vala_ccode_function_new (_tmp1_, "void");
      _tmp3_ = _tmp2_;
      _g_free0 (_tmp1_);
      function = _tmp3_;
      _tmp4_ = vala_symbol_get_access ((ValaSymbol*) st);
      if (_tmp4_ == VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
            vala_ccode_function_set_modifiers (function, VALA_CCODE_MODIFIERS_STATIC);
      }
      _tmp5_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) st, FALSE);
      _tmp6_ = _tmp5_;
      _tmp7_ = g_strconcat (_tmp6_, "*", NULL);
      _tmp8_ = _tmp7_;
      _tmp9_ = vala_ccode_parameter_new ("self", _tmp8_);
      _tmp10_ = _tmp9_;
      vala_ccode_function_add_parameter (function, _tmp10_);
      _vala_ccode_node_unref0 (_tmp10_);
      _g_free0 (_tmp8_);
      _g_free0 (_tmp6_);
      vala_ccode_base_module_push_function ((ValaCCodeBaseModule*) self, function);
      vala_ccode_base_module_pop_context ((ValaCCodeBaseModule*) self);
      _vala_ccode_node_unref0 (function);
}


static void vala_ccode_struct_module_add_struct_destroy_function (ValaCCodeStructModule* self, ValaStruct* st) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (st != NULL);
      vala_ccode_file_add_function (((ValaCCodeBaseModule*) self)->cfile, ((ValaCCodeBaseModule*) self)->instance_finalize_context->ccode);
}


ValaCCodeStructModule* vala_ccode_struct_module_construct (GType object_type) {
      ValaCCodeStructModule* self = NULL;
      self = (ValaCCodeStructModule*) vala_ccode_base_module_construct (object_type);
      return self;
}


static void vala_ccode_struct_module_class_init (ValaCCodeStructModuleClass * klass) {
      vala_ccode_struct_module_parent_class = g_type_class_peek_parent (klass);
      VALA_CCODE_BASE_MODULE_CLASS (klass)->generate_struct_declaration = vala_ccode_struct_module_real_generate_struct_declaration;
      VALA_CODE_VISITOR_CLASS (klass)->visit_struct = vala_ccode_struct_module_real_visit_struct;
}


static void vala_ccode_struct_module_instance_init (ValaCCodeStructModule * self) {
}


GType vala_ccode_struct_module_get_type (void) {
      static volatile gsize vala_ccode_struct_module_type_id__volatile = 0;
      if (g_once_init_enter (&vala_ccode_struct_module_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeStructModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_struct_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeStructModule), 0, (GInstanceInitFunc) vala_ccode_struct_module_instance_init, NULL };
            GType vala_ccode_struct_module_type_id;
            vala_ccode_struct_module_type_id = g_type_register_static (VALA_TYPE_CCODE_BASE_MODULE, "ValaCCodeStructModule", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
            g_once_init_leave (&vala_ccode_struct_module_type_id__volatile, vala_ccode_struct_module_type_id);
      }
      return vala_ccode_struct_module_type_id__volatile;
}




Generated by  Doxygen 1.6.0   Back to index