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

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

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

#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;

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,
                gint 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,
                                      gint includedirs_length1,
                                      WixlArch arch);
WixlWixBuilder* wixl_wix_builder_construct (GType object_type,
                                            gchar** includedirs,
                                            gint 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, N_ ("Display version number"), NULL}, {"verbose", 'v', 0, G_OPTION_ARG_NONE, &wixl_verbose, N_ ("Verbose output"), NULL}, {"output", 'o', 0, G_OPTION_ARG_FILENAME, &wixl_output, N_ ("Output file"), NULL}, {"define", 'D', 0, G_OPTION_ARG_STRING_ARRAY, &wixl_defines, N_ ("Define variable"), NULL}, {"arch", 'a', 0, G_OPTION_ARG_CALLBACK, (void*) wixl_parse_arch, N_ ("Target architecture"), NULL}, {"includedir", 'I', 0, G_OPTION_ARG_STRING_ARRAY, &wixl_opt_includedirs, N_ ("Include directory"), NULL}, {"wxidir", (gchar) 0, 0, G_OPTION_ARG_STRING, &wixl_wxidir, N_ ("System include directory"), NULL}, {"only-preproc", 'E', 0, G_OPTION_ARG_NONE, &wixl_preproc, N_ ("Stop after the preprocessing stage"), NULL}, {"", (gchar) 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &wixl_files, NULL, N_ ("INPUT_FILE1 [INPUT_FILE2]...")}, {NULL}};

gboolean
wixl_parse_arch (const gchar* option_name,
                 const gchar* value,
                 void* data,
                 GError** error)
{
	GError* _inner_error0_ = NULL;
	gboolean result = FALSE;
	g_return_val_if_fail (option_name != NULL, FALSE);
	g_return_val_if_fail (value != NULL, FALSE);
	{
		WixlArch _tmp0_ = 0;
		_tmp0_ = wixl_arch_from_string (value, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch8_g_error;
		}
		wixl_arch = _tmp0_;
	}
	goto __finally8;
	__catch8_g_error:
	{
		GError* e = NULL;
		gchar* _tmp1_;
		gchar* _tmp2_;
		GError* _tmp3_;
		GError* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = g_strdup_printf (_ ("arch of type '%s' is not supported"), value);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_error_new_literal (G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, _tmp2_);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp2_);
		_inner_error0_ = _tmp4_;
		_g_error_free0 (e);
		goto __finally8;
	}
	__finally8:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_OPTION_ERROR) {
			gboolean _tmp5_ = FALSE;
			g_propagate_error (error, _inner_error0_);
			return _tmp5_;
		} else {
			gboolean _tmp6_ = FALSE;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp6_;
		}
	}
	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_;
		_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)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

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

int
main (int argc,
      char ** argv)
{
	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;
}

