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


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <config.h>
#include <stdio.h>
#include "wixl.h"
#include <gio/gio.h>


#define WIXL_TYPE_ARCH (wixl_arch_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))

#define WIXL_TYPE_WIX_BUILDER (wixl_wix_builder_get_type ())
#define WIXL_WIX_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIXL_TYPE_WIX_BUILDER, WixlWixBuilder))
#define WIXL_WIX_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIXL_TYPE_WIX_BUILDER, WixlWixBuilderClass))
#define WIXL_IS_WIX_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIXL_TYPE_WIX_BUILDER))
#define WIXL_IS_WIX_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIXL_TYPE_WIX_BUILDER))
#define WIXL_WIX_BUILDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIXL_TYPE_WIX_BUILDER, WixlWixBuilderClass))

typedef struct _WixlWixBuilder WixlWixBuilder;
typedef struct _WixlWixBuilderClass WixlWixBuilderClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define WIXL_TYPE_MSI_DATABASE (wixl_msi_database_get_type ())
#define WIXL_MSI_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIXL_TYPE_MSI_DATABASE, WixlMsiDatabase))
#define WIXL_MSI_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIXL_TYPE_MSI_DATABASE, WixlMsiDatabaseClass))
#define WIXL_IS_MSI_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIXL_TYPE_MSI_DATABASE))
#define WIXL_IS_MSI_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIXL_TYPE_MSI_DATABASE))
#define WIXL_MSI_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIXL_TYPE_MSI_DATABASE, WixlMsiDatabaseClass))

typedef struct _WixlMsiDatabase WixlMsiDatabase;
typedef struct _WixlMsiDatabaseClass WixlMsiDatabaseClass;

typedef enum  {
	WIXL_ARCH_X86 = 0,
	WIXL_ARCH_INTEL = 0,
	WIXL_ARCH_IA64 = 1,
	WIXL_ARCH_INTEL64 = 1,
	WIXL_ARCH_X64
} WixlArch;


extern gboolean wixl_version;
gboolean wixl_version = FALSE;
extern gboolean wixl_verbose;
gboolean wixl_verbose = FALSE;
extern gboolean wixl_preproc;
gboolean wixl_preproc = FALSE;
extern gchar* wixl_output;
gchar* wixl_output = NULL;
extern gchar** wixl_files;
gchar** wixl_files = NULL;
extern gchar** wixl_defines;
gchar** wixl_defines = NULL;
extern gchar** wixl_opt_includedirs;
gchar** wixl_opt_includedirs = NULL;
extern gchar** wixl_includedirs;
extern gint wixl_includedirs_length1;
gchar** wixl_includedirs = NULL;
gint wixl_includedirs_length1 = 0;
static gint _wixl_includedirs_size_ = 0;
extern gchar* wixl_wxidir;
gchar* wixl_wxidir = NULL;
extern WixlArch wixl_arch;
WixlArch wixl_arch = WIXL_ARCH_X86;

GType wixl_arch_get_type (void) G_GNUC_CONST;
gboolean wixl_parse_arch (const gchar* option_name, const gchar* value, void* data, GError** error);
WixlArch wixl_arch_from_string (const gchar* s, GError** error);
gint wixl_main (gchar** args, int args_length1);
static gchar** _vala_array_dup5 (gchar** self, int length);
static void _vala_array_add9 (gchar*** array, int* length, int* size, gchar* value);
GType wixl_wix_builder_get_type (void) G_GNUC_CONST;
WixlWixBuilder* wixl_wix_builder_new (gchar** includedirs, int includedirs_length1, WixlArch arch);
WixlWixBuilder* wixl_wix_builder_construct (GType object_type, gchar** includedirs, int includedirs_length1, WixlArch arch);
void wixl_wix_builder_define_variable (WixlWixBuilder* self, const gchar* name, const gchar* value);
void wixl_wix_builder_load_file (WixlWixBuilder* self, GFile* file, gboolean preproc_only, GError** error);
void wixl_wix_builder_add_path (WixlWixBuilder* self, const gchar* p);
GType wixl_msi_database_get_type (void) G_GNUC_CONST;
WixlMsiDatabase* wixl_wix_builder_build (WixlWixBuilder* self, GError** error);
void wixl_msi_database_build (WixlMsiDatabase* self, const gchar* filename, GError** error);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);

const GOptionEntry WIXL_options[10] = {{"version", (gchar) 0, 0, G_OPTION_ARG_NONE, &wixl_version, "Display version number", NULL}, {"verbose", 'v', 0, G_OPTION_ARG_NONE, &wixl_verbose, "Verbose output", NULL}, {"output", 'o', 0, G_OPTION_ARG_FILENAME, &wixl_output, "Output file", NULL}, {"define", 'D', 0, G_OPTION_ARG_STRING_ARRAY, &wixl_defines, "Define variable", NULL}, {"arch", 'a', 0, G_OPTION_ARG_CALLBACK, (void*) wixl_parse_arch, "Target architecture", NULL}, {"includedir", 'I', 0, G_OPTION_ARG_STRING_ARRAY, &wixl_opt_includedirs, "Include directory", NULL}, {"wxidir", (gchar) 0, 0, G_OPTION_ARG_STRING, &wixl_wxidir, "System include directory", NULL}, {"only-preproc", 'E', 0, G_OPTION_ARG_NONE, &wixl_preproc, "Stop after the preprocessing stage", NULL}, {"", (gchar) 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &wixl_files, NULL, "INPUT_FILE..."}, {NULL}};

gboolean wixl_parse_arch (const gchar* option_name, const gchar* value, void* data, GError** error) {
	gboolean result = FALSE;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (option_name != NULL, FALSE);
	g_return_val_if_fail (value != NULL, FALSE);
	{
		WixlArch _tmp0_ = 0;
		const gchar* _tmp1_ = NULL;
		WixlArch _tmp2_ = 0;
		_tmp1_ = value;
		_tmp2_ = wixl_arch_from_string (_tmp1_, &_inner_error_);
		_tmp0_ = _tmp2_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch8_g_error;
		}
		wixl_arch = _tmp0_;
	}
	goto __finally8;
	__catch8_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp3_ = NULL;
		const gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		GError* _tmp7_ = NULL;
		GError* _tmp8_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = _ ("arch of type '%s' is not supported");
		_tmp4_ = value;
		_tmp5_ = g_strdup_printf (_tmp3_, _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_error_new_literal (G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, _tmp6_);
		_tmp8_ = _tmp7_;
		_g_free0 (_tmp6_);
		_inner_error_ = _tmp8_;
		_g_error_free0 (e);
		goto __finally8;
	}
	__finally8:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		if (_inner_error_->domain == G_OPTION_ERROR) {
			gboolean _tmp9_ = FALSE;
			g_propagate_error (error, _inner_error_);
			return _tmp9_;
		} else {
			gboolean _tmp10_ = FALSE;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return _tmp10_;
		}
	}
	result = TRUE;
	return result;
}


static gchar** _vala_array_dup5 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static void _vala_array_add9 (gchar*** array, int* length, int* size, gchar* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static gchar* string_slice (const gchar* self, glong start, glong end) {
	gchar* result = NULL;
	glong string_length = 0L;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	glong _tmp2_ = 0L;
	glong _tmp5_ = 0L;
	gboolean _tmp8_ = FALSE;
	glong _tmp9_ = 0L;
	gboolean _tmp12_ = FALSE;
	glong _tmp13_ = 0L;
	glong _tmp16_ = 0L;
	glong _tmp17_ = 0L;
	glong _tmp18_ = 0L;
	glong _tmp19_ = 0L;
	glong _tmp20_ = 0L;
	gchar* _tmp21_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	_tmp2_ = start;
	if (_tmp2_ < ((glong) 0)) {
		glong _tmp3_ = 0L;
		glong _tmp4_ = 0L;
		_tmp3_ = string_length;
		_tmp4_ = start;
		start = _tmp3_ + _tmp4_;
	}
	_tmp5_ = end;
	if (_tmp5_ < ((glong) 0)) {
		glong _tmp6_ = 0L;
		glong _tmp7_ = 0L;
		_tmp6_ = string_length;
		_tmp7_ = end;
		end = _tmp6_ + _tmp7_;
	}
	_tmp9_ = start;
	if (_tmp9_ >= ((glong) 0)) {
		glong _tmp10_ = 0L;
		glong _tmp11_ = 0L;
		_tmp10_ = start;
		_tmp11_ = string_length;
		_tmp8_ = _tmp10_ <= _tmp11_;
	} else {
		_tmp8_ = FALSE;
	}
	g_return_val_if_fail (_tmp8_, NULL);
	_tmp13_ = end;
	if (_tmp13_ >= ((glong) 0)) {
		glong _tmp14_ = 0L;
		glong _tmp15_ = 0L;
		_tmp14_ = end;
		_tmp15_ = string_length;
		_tmp12_ = _tmp14_ <= _tmp15_;
	} else {
		_tmp12_ = FALSE;
	}
	g_return_val_if_fail (_tmp12_, NULL);
	_tmp16_ = start;
	_tmp17_ = end;
	g_return_val_if_fail (_tmp16_ <= _tmp17_, NULL);
	_tmp18_ = start;
	_tmp19_ = end;
	_tmp20_ = start;
	_tmp21_ = g_strndup (((gchar*) self) + _tmp18_, (gsize) (_tmp19_ - _tmp20_));
	result = _tmp21_;
	return result;
}


gint wixl_main (gchar** args, int args_length1) {
	gint result = 0;
	gchar* parameter_string = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	GOptionContext* opt_context = NULL;
	const gchar* _tmp2_ = NULL;
	GOptionContext* _tmp3_ = NULL;
	GOptionContext* _tmp4_ = NULL;
	GOptionContext* _tmp5_ = NULL;
	gchar* _tmp6_ = NULL;
	gchar** _tmp17_ = NULL;
	gint _tmp17__length1 = 0;
	gchar** _tmp18_ = NULL;
	gint _tmp18__length1 = 0;
	gchar** _tmp19_ = NULL;
	gint _tmp19__length1 = 0;
	const gchar* _tmp20_ = NULL;
	gchar* _tmp21_ = NULL;
	gboolean _tmp22_ = FALSE;
	gchar** _tmp24_ = NULL;
	gint _tmp24__length1 = 0;
	gboolean _tmp27_ = FALSE;
	const gchar* _tmp28_ = NULL;
	GError * _inner_error_ = NULL;
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	g_set_application_name ("wixl");
	_tmp0_ = _ ("- a msi building tool");
	_tmp1_ = g_strdup (_tmp0_);
	parameter_string = _tmp1_;
	_tmp2_ = parameter_string;
	_tmp3_ = g_option_context_new (_tmp2_);
	opt_context = _tmp3_;
	_tmp4_ = opt_context;
	g_option_context_set_help_enabled (_tmp4_, TRUE);
	_tmp5_ = opt_context;
	g_option_context_add_main_entries (_tmp5_, WIXL_options, NULL);
	_tmp6_ = g_strdup (PKGDATADIR "/include");
	_g_free0 (wixl_wxidir);
	wixl_wxidir = _tmp6_;
	{
		GOptionContext* _tmp7_ = NULL;
		_tmp7_ = opt_context;
		g_option_context_parse (_tmp7_, &args_length1, &args, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			gint _tmp8_ = 0;
			if (g_error_matches (_inner_error_, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE)) {
				goto __catch9_g_option_error_bad_value;
			}
			if (_inner_error_->domain == G_OPTION_ERROR) {
				goto __catch9_g_option_error;
			}
			_g_option_context_free0 (opt_context);
			_g_free0 (parameter_string);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return _tmp8_;
		}
	}
	goto __finally9;
	__catch9_g_option_error_bad_value:
	{
		GError* err = NULL;
		FILE* _tmp9_ = NULL;
		GError* _tmp10_ = NULL;
		const gchar* _tmp11_ = NULL;
		gchar* _tmp12_ = NULL;
		gchar* _tmp13_ = NULL;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp9_ = stderr;
		_tmp10_ = err;
		_tmp11_ = _tmp10_->message;
		_tmp12_ = g_strconcat (_tmp11_, "\n", NULL);
		_tmp13_ = _tmp12_;
		fprintf (_tmp9_, "%s", _tmp13_);
		_g_free0 (_tmp13_);
		exit (1);
		_g_error_free0 (err);
	}
	goto __finally9;
	__catch9_g_option_error:
	{
		GError* _error_ = NULL;
		GError* _tmp14_ = NULL;
		const gchar* _tmp15_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_tmp14_ = _error_;
		_tmp15_ = _tmp14_->message;
		g_warning ("wixl.vala:62: %s", _tmp15_);
		_g_error_free0 (_error_);
	}
	__finally9:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		gint _tmp16_ = 0;
		_g_option_context_free0 (opt_context);
		_g_free0 (parameter_string);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return _tmp16_;
	}
	_tmp17_ = wixl_opt_includedirs;
	_tmp17__length1 = _vala_array_length (wixl_opt_includedirs);
	_tmp18_ = (_tmp17_ != NULL) ? _vala_array_dup5 (_tmp17_, _tmp17__length1) : ((gpointer) _tmp17_);
	_tmp18__length1 = _tmp17__length1;
	wixl_includedirs = (_vala_array_free (wixl_includedirs, wixl_includedirs_length1, (GDestroyNotify) g_free), NULL);
	wixl_includedirs = _tmp18_;
	wixl_includedirs_length1 = _tmp18__length1;
	_wixl_includedirs_size_ = wixl_includedirs_length1;
	_tmp19_ = wixl_includedirs;
	_tmp19__length1 = wixl_includedirs_length1;
	_tmp20_ = wixl_wxidir;
	_tmp21_ = g_strdup (_tmp20_);
	_vala_array_add9 (&wixl_includedirs, &wixl_includedirs_length1, &_wixl_includedirs_size_, _tmp21_);
	_tmp22_ = wixl_version;
	if (_tmp22_) {
		FILE* _tmp23_ = NULL;
		_tmp23_ = stdout;
		fprintf (_tmp23_, "%s\n", PACKAGE_VERSION);
		exit (0);
	}
	_tmp24_ = wixl_files;
	_tmp24__length1 = _vala_array_length (wixl_files);
	if (_tmp24__length1 < 1) {
		FILE* _tmp25_ = NULL;
		const gchar* _tmp26_ = NULL;
		_tmp25_ = stderr;
		_tmp26_ = _ ("Please specify input files.\n");
		fprintf (_tmp25_, "%s", _tmp26_);
		exit (1);
	}
	_tmp28_ = wixl_output;
	if (_tmp28_ == NULL) {
		gboolean _tmp29_ = FALSE;
		_tmp29_ = wixl_preproc;
		_tmp27_ = !_tmp29_;
	} else {
		_tmp27_ = FALSE;
	}
	if (_tmp27_) {
		gchar** _tmp30_ = NULL;
		gint _tmp30__length1 = 0;
		const gchar* _tmp31_ = NULL;
		gboolean _tmp32_ = FALSE;
		_tmp30_ = wixl_files;
		_tmp30__length1 = _vala_array_length (wixl_files);
		_tmp31_ = _tmp30_[0];
		_tmp32_ = g_str_has_suffix (_tmp31_, ".wxs");
		if (_tmp32_) {
			gchar** _tmp33_ = NULL;
			gint _tmp33__length1 = 0;
			const gchar* _tmp34_ = NULL;
			gchar* _tmp35_ = NULL;
			gchar* _tmp36_ = NULL;
			gchar* _tmp37_ = NULL;
			_tmp33_ = wixl_files;
			_tmp33__length1 = _vala_array_length (wixl_files);
			_tmp34_ = _tmp33_[0];
			_tmp35_ = string_slice (_tmp34_, (glong) 0, (glong) -4);
			_tmp36_ = _tmp35_;
			_tmp37_ = g_strconcat (_tmp36_, ".msi", NULL);
			_g_free0 (wixl_output);
			wixl_output = _tmp37_;
			_g_free0 (_tmp36_);
		} else {
			FILE* _tmp38_ = NULL;
			const gchar* _tmp39_ = NULL;
			_tmp38_ = stderr;
			_tmp39_ = _ ("Please specify the output file.\n");
			fprintf (_tmp38_, "%s", _tmp39_);
			exit (1);
		}
	}
	{
		WixlWixBuilder* builder = NULL;
		gchar** _tmp40_ = NULL;
		gint _tmp40__length1 = 0;
		WixlArch _tmp41_ = 0;
		WixlWixBuilder* _tmp42_ = NULL;
		gchar** _tmp43_ = NULL;
		gint _tmp43__length1 = 0;
		gchar** _tmp59_ = NULL;
		gint _tmp59__length1 = 0;
		gboolean _tmp75_ = FALSE;
		gboolean _tmp76_ = FALSE;
		WixlMsiDatabase* msi = NULL;
		WixlWixBuilder* _tmp79_ = NULL;
		WixlMsiDatabase* _tmp80_ = NULL;
		gboolean _tmp81_ = FALSE;
		WixlMsiDatabase* _tmp84_ = NULL;
		const gchar* _tmp85_ = NULL;
		_tmp40_ = wixl_includedirs;
		_tmp40__length1 = wixl_includedirs_length1;
		_tmp41_ = wixl_arch;
		_tmp42_ = wixl_wix_builder_new (_tmp40_, _tmp40__length1, _tmp41_);
		builder = _tmp42_;
		_tmp43_ = wixl_defines;
		_tmp43__length1 = _vala_array_length (wixl_defines);
		{
			gchar** d_collection = NULL;
			gint d_collection_length1 = 0;
			gint _d_collection_size_ = 0;
			gint d_it = 0;
			d_collection = _tmp43_;
			d_collection_length1 = _tmp43__length1;
			for (d_it = 0; d_it < _tmp43__length1; d_it = d_it + 1) {
				gchar* _tmp44_ = NULL;
				gchar* d = NULL;
				_tmp44_ = g_strdup (d_collection[d_it]);
				d = _tmp44_;
				{
					gchar** def = NULL;
					const gchar* _tmp45_ = NULL;
					gchar** _tmp46_ = NULL;
					gchar** _tmp47_ = NULL;
					gint def_length1 = 0;
					gint _def_size_ = 0;
					gchar* name = NULL;
					gchar** _tmp48_ = NULL;
					gint _tmp48__length1 = 0;
					const gchar* _tmp49_ = NULL;
					gchar* _tmp50_ = NULL;
					const gchar* _tmp51_ = NULL;
					gchar** _tmp52_ = NULL;
					gint _tmp52__length1 = 0;
					gchar* value = NULL;
					gchar* _tmp55_ = NULL;
					WixlWixBuilder* _tmp56_ = NULL;
					const gchar* _tmp57_ = NULL;
					const gchar* _tmp58_ = NULL;
					_tmp45_ = d;
					_tmp47_ = _tmp46_ = g_strsplit (_tmp45_, "=", 2);
					def = _tmp47_;
					def_length1 = _vala_array_length (_tmp46_);
					_def_size_ = def_length1;
					_tmp48_ = def;
					_tmp48__length1 = def_length1;
					_tmp49_ = _tmp48_[0];
					_tmp50_ = g_strdup (_tmp49_);
					name = _tmp50_;
					_tmp52_ = def;
					_tmp52__length1 = def_length1;
					if (_tmp52__length1 == 2) {
						gchar** _tmp53_ = NULL;
						gint _tmp53__length1 = 0;
						const gchar* _tmp54_ = NULL;
						_tmp53_ = def;
						_tmp53__length1 = def_length1;
						_tmp54_ = _tmp53_[1];
						_tmp51_ = _tmp54_;
					} else {
						_tmp51_ = "1";
					}
					_tmp55_ = g_strdup (_tmp51_);
					value = _tmp55_;
					_tmp56_ = builder;
					_tmp57_ = name;
					_tmp58_ = value;
					wixl_wix_builder_define_variable (_tmp56_, _tmp57_, _tmp58_);
					_g_free0 (value);
					_g_free0 (name);
					def = (_vala_array_free (def, def_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (d);
				}
			}
		}
		_tmp59_ = wixl_files;
		_tmp59__length1 = _vala_array_length (wixl_files);
		{
			gchar** arg_collection = NULL;
			gint arg_collection_length1 = 0;
			gint _arg_collection_size_ = 0;
			gint arg_it = 0;
			arg_collection = _tmp59_;
			arg_collection_length1 = _tmp59__length1;
			for (arg_it = 0; arg_it < _tmp59__length1; arg_it = arg_it + 1) {
				gchar* _tmp60_ = NULL;
				gchar* arg = NULL;
				_tmp60_ = g_strdup (arg_collection[arg_it]);
				arg = _tmp60_;
				{
					gboolean _tmp61_ = FALSE;
					GFile* file = NULL;
					const gchar* _tmp64_ = NULL;
					GFile* _tmp65_ = NULL;
					WixlWixBuilder* _tmp66_ = NULL;
					GFile* _tmp67_ = NULL;
					gboolean _tmp68_ = FALSE;
					WixlWixBuilder* _tmp69_ = NULL;
					GFile* _tmp70_ = NULL;
					GFile* _tmp71_ = NULL;
					GFile* _tmp72_ = NULL;
					gchar* _tmp73_ = NULL;
					gchar* _tmp74_ = NULL;
					_tmp61_ = wixl_verbose;
					if (_tmp61_) {
						const gchar* _tmp62_ = NULL;
						const gchar* _tmp63_ = NULL;
						_tmp62_ = _ ("Loading %s...\n");
						_tmp63_ = arg;
						g_print (_tmp62_, _tmp63_);
					}
					_tmp64_ = arg;
					_tmp65_ = g_file_new_for_commandline_arg (_tmp64_);
					file = _tmp65_;
					_tmp66_ = builder;
					_tmp67_ = file;
					_tmp68_ = wixl_preproc;
					wixl_wix_builder_load_file (_tmp66_, _tmp67_, _tmp68_, &_inner_error_);
					if (G_UNLIKELY (_inner_error_ != NULL)) {
						_g_object_unref0 (file);
						_g_free0 (arg);
						_g_object_unref0 (builder);
						goto __catch10_g_error;
					}
					_tmp69_ = builder;
					_tmp70_ = file;
					_tmp71_ = g_file_get_parent (_tmp70_);
					_tmp72_ = _tmp71_;
					_tmp73_ = g_file_get_path (_tmp72_);
					_tmp74_ = _tmp73_;
					wixl_wix_builder_add_path (_tmp69_, _tmp74_);
					_g_free0 (_tmp74_);
					_g_object_unref0 (_tmp72_);
					_g_object_unref0 (file);
					_g_free0 (arg);
				}
			}
		}
		_tmp75_ = wixl_preproc;
		if (_tmp75_) {
			result = 0;
			_g_object_unref0 (builder);
			_g_option_context_free0 (opt_context);
			_g_free0 (parameter_string);
			return result;
		}
		_tmp76_ = wixl_verbose;
		if (_tmp76_) {
			const gchar* _tmp77_ = NULL;
			const gchar* _tmp78_ = NULL;
			_tmp77_ = _ ("Building %s...\n");
			_tmp78_ = wixl_output;
			g_print (_tmp77_, _tmp78_);
		}
		_tmp79_ = builder;
		_tmp80_ = wixl_wix_builder_build (_tmp79_, &_inner_error_);
		msi = _tmp80_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (builder);
			goto __catch10_g_error;
		}
		_tmp81_ = wixl_verbose;
		if (_tmp81_) {
			const gchar* _tmp82_ = NULL;
			const gchar* _tmp83_ = NULL;
			_tmp82_ = _ ("Writing %s...\n");
			_tmp83_ = wixl_output;
			g_print (_tmp82_, _tmp83_);
		}
		_tmp84_ = msi;
		_tmp85_ = wixl_output;
		wixl_msi_database_build (_tmp84_, _tmp85_, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (msi);
			_g_object_unref0 (builder);
			goto __catch10_g_error;
		}
		_g_object_unref0 (msi);
		_g_object_unref0 (builder);
	}
	goto __finally10;
	__catch10_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp86_ = NULL;
		const gchar* _tmp87_ = NULL;
		gchar* _tmp88_ = NULL;
		gchar* _tmp89_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_tmp86_ = _error_;
		_tmp87_ = _tmp86_->message;
		_tmp88_ = g_strconcat (_tmp87_, "\n", NULL);
		_tmp89_ = _tmp88_;
		g_printerr ("%s", _tmp89_);
		_g_free0 (_tmp89_);
		result = 1;
		_g_error_free0 (_error_);
		_g_option_context_free0 (opt_context);
		_g_free0 (parameter_string);
		return result;
	}
	__finally10:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		gint _tmp90_ = 0;
		_g_option_context_free0 (opt_context);
		_g_free0 (parameter_string);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return _tmp90_;
	}
	result = 0;
	_g_option_context_free0 (opt_context);
	_g_free0 (parameter_string);
	return result;
}


int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
	g_type_init ();
#endif
	return wixl_main (argv, argc);
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



