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

/*
Copyright (C) 2012 2015 Johan Mattsson

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 3 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.
*/

#include "birdfont.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <stdio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	BIRD_FONT_ARGUMENT_0_PROPERTY,
	BIRD_FONT_ARGUMENT_NUM_PROPERTIES
};
static GParamSpec* bird_font_argument_properties[BIRD_FONT_ARGUMENT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _BirdFontArgumentPrivate {
	GeeArrayList* args;
};

static gint BirdFontArgument_private_offset;
static gpointer bird_font_argument_parent_class = NULL;

static void bird_font_argument_set_argument (BirdFontArgument* self,
                                      const gchar* arg);
static gchar* bird_font_argument_expand_param (BirdFontArgument* self,
                                        const gchar* param);
static void bird_font_argument_print_padded (BirdFontArgument* self,
                                      const gchar* cmd,
                                      const gchar* desc);
static void bird_font_argument_finalize (GObject * obj);
static GType bird_font_argument_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
bird_font_argument_get_instance_private (BirdFontArgument* self)
{
	return G_STRUCT_MEMBER_P (self, BirdFontArgument_private_offset);
}

BirdFontArgument*
bird_font_argument_construct (GType object_type,
                              const gchar* line)
{
	BirdFontArgument * self = NULL;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (line != NULL, NULL);
	self = (BirdFontArgument*) g_object_new (object_type, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->args);
	self->priv->args = _tmp0_;
	bird_font_argument_set_argument (self, line);
	return self;
}

BirdFontArgument*
bird_font_argument_new (const gchar* line)
{
	return bird_font_argument_construct (BIRD_FONT_TYPE_ARGUMENT, line);
}

BirdFontArgument*
bird_font_argument_construct_command_line (GType object_type,
                                           gchar** arg,
                                           gint arg_length1)
{
	BirdFontArgument * self = NULL;
	GeeArrayList* _tmp0_;
	self = (BirdFontArgument*) g_object_new (object_type, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->args);
	self->priv->args = _tmp0_;
	{
		gchar** a_collection = NULL;
		gint a_collection_length1 = 0;
		gint _a_collection_size_ = 0;
		gint a_it = 0;
		a_collection = arg;
		a_collection_length1 = arg_length1;
		for (a_it = 0; a_it < a_collection_length1; a_it = a_it + 1) {
			gchar* _tmp1_;
			gchar* a = NULL;
			_tmp1_ = g_strdup (a_collection[a_it]);
			a = _tmp1_;
			{
				GeeArrayList* _tmp2_;
				const gchar* _tmp3_;
				_tmp2_ = self->priv->args;
				_tmp3_ = a;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp2_, _tmp3_);
				_g_free0 (a);
			}
		}
	}
	return self;
}

BirdFontArgument*
bird_font_argument_new_command_line (gchar** arg,
                                     gint arg_length1)
{
	return bird_font_argument_construct_command_line (BIRD_FONT_TYPE_ARGUMENT, arg, arg_length1);
}

/** returns 0 if all arguments are valid or index of the invalid parameter. */
static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (needle != NULL, 0);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

gint
bird_font_argument_validate (BirdFontArgument* self)
{
	gchar* prev = NULL;
	gchar* _tmp0_;
	gint i = 0;
	gchar** p = NULL;
	gint p_length1 = 0;
	gint _p_size_ = 0;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = g_strdup ("");
	prev = _tmp0_;
	i = 0;
	{
		GeeArrayList* _a_list = NULL;
		GeeArrayList* _tmp1_;
		gint _a_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _a_index = 0;
		_tmp1_ = self->priv->args;
		_a_list = _tmp1_;
		_tmp2_ = _a_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_a_size = _tmp4_;
		_a_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gchar* a = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			const gchar* _tmp9_;
			gboolean _tmp13_ = FALSE;
			const gchar* _tmp18_;
			gboolean _tmp25_ = FALSE;
			const gchar* _tmp26_;
			gboolean _tmp30_ = FALSE;
			gboolean _tmp31_ = FALSE;
			gboolean _tmp32_ = FALSE;
			gboolean _tmp33_ = FALSE;
			gboolean _tmp34_ = FALSE;
			gboolean _tmp35_ = FALSE;
			gboolean _tmp36_ = FALSE;
			gboolean _tmp37_ = FALSE;
			gboolean _tmp38_ = FALSE;
			gboolean _tmp39_ = FALSE;
			gboolean _tmp40_ = FALSE;
			gboolean _tmp41_ = FALSE;
			gboolean _tmp42_ = FALSE;
			const gchar* _tmp43_;
			const gchar* _tmp61_;
			const gchar* _tmp62_;
			gchar* _tmp63_;
			gint _tmp64_;
			_a_index = _a_index + 1;
			_tmp5_ = _a_index;
			_tmp6_ = _a_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _a_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _a_index);
			a = (gchar*) _tmp8_;
			_tmp9_ = a;
			if (g_strcmp0 (_tmp9_, "") == 0) {
				_g_free0 (a);
				continue;
			}
			if (i == 0) {
				const gchar* _tmp10_;
				gchar* _tmp11_;
				gint _tmp12_;
				_tmp10_ = a;
				_tmp11_ = g_strdup (_tmp10_);
				_g_free0 (prev);
				prev = _tmp11_;
				_tmp12_ = i;
				i = _tmp12_ + 1;
				_g_free0 (a);
				continue;
			}
			if (i == 1) {
				const gchar* _tmp14_;
				_tmp14_ = a;
				_tmp13_ = !g_str_has_prefix (_tmp14_, "-");
			} else {
				_tmp13_ = FALSE;
			}
			if (_tmp13_) {
				const gchar* _tmp15_;
				gchar* _tmp16_;
				gint _tmp17_;
				_tmp15_ = a;
				_tmp16_ = g_strdup (_tmp15_);
				_g_free0 (prev);
				prev = _tmp16_;
				_tmp17_ = i;
				i = _tmp17_ + 1;
				_g_free0 (a);
				continue;
			}
			_tmp18_ = a;
			if (string_index_of (_tmp18_, "=", 0) > -1) {
				const gchar* _tmp19_;
				gchar** _tmp20_;
				gchar** _tmp21_;
				gchar** _tmp22_;
				gint _tmp22__length1;
				const gchar* _tmp23_;
				gchar* _tmp24_;
				_tmp19_ = a;
				_tmp21_ = _tmp20_ = g_strsplit (_tmp19_, "=", 0);
				p = (_vala_array_free (p, p_length1, (GDestroyNotify) g_free), NULL);
				p = _tmp21_;
				p_length1 = _vala_array_length (_tmp20_);
				_p_size_ = p_length1;
				_tmp22_ = p;
				_tmp22__length1 = p_length1;
				_tmp23_ = _tmp22_[0];
				_tmp24_ = g_strdup (_tmp23_);
				_g_free0 (a);
				a = _tmp24_;
			}
			_tmp26_ = a;
			if (!g_str_has_prefix (_tmp26_, "--")) {
				const gchar* _tmp27_;
				_tmp27_ = a;
				_tmp25_ = g_str_has_prefix (_tmp27_, "-");
			} else {
				_tmp25_ = FALSE;
			}
			if (_tmp25_) {
				const gchar* _tmp28_;
				gchar* _tmp29_;
				_tmp28_ = a;
				_tmp29_ = bird_font_argument_expand_param (self, _tmp28_);
				_g_free0 (a);
				a = _tmp29_;
			}
			_tmp43_ = a;
			if (g_strcmp0 (_tmp43_, "--exit") == 0) {
				_tmp42_ = TRUE;
			} else {
				const gchar* _tmp44_;
				_tmp44_ = a;
				_tmp42_ = g_strcmp0 (_tmp44_, "--slow") == 0;
			}
			if (_tmp42_) {
				_tmp41_ = TRUE;
			} else {
				const gchar* _tmp45_;
				_tmp45_ = a;
				_tmp41_ = g_strcmp0 (_tmp45_, "--help") == 0;
			}
			if (_tmp41_) {
				_tmp40_ = TRUE;
			} else {
				const gchar* _tmp46_;
				_tmp46_ = a;
				_tmp40_ = g_strcmp0 (_tmp46_, "--test") == 0;
			}
			if (_tmp40_) {
				_tmp39_ = TRUE;
			} else {
				const gchar* _tmp47_;
				_tmp47_ = a;
				_tmp39_ = g_strcmp0 (_tmp47_, "--fatal-warning") == 0;
			}
			if (_tmp39_) {
				_tmp38_ = TRUE;
			} else {
				const gchar* _tmp48_;
				_tmp48_ = a;
				_tmp38_ = g_strcmp0 (_tmp48_, "--show-coordinates") == 0;
			}
			if (_tmp38_) {
				_tmp37_ = TRUE;
			} else {
				const gchar* _tmp49_;
				_tmp49_ = a;
				_tmp37_ = g_strcmp0 (_tmp49_, "--no-translation") == 0;
			}
			if (_tmp37_) {
				_tmp36_ = TRUE;
			} else {
				const gchar* _tmp50_;
				_tmp50_ = a;
				_tmp36_ = g_strcmp0 (_tmp50_, "--mac") == 0;
			}
			if (_tmp36_) {
				_tmp35_ = TRUE;
			} else {
				const gchar* _tmp51_;
				_tmp51_ = a;
				_tmp35_ = g_strcmp0 (_tmp51_, "--android") == 0;
			}
			if (_tmp35_) {
				_tmp34_ = TRUE;
			} else {
				const gchar* _tmp52_;
				_tmp52_ = a;
				_tmp34_ = g_strcmp0 (_tmp52_, "--log") == 0;
			}
			if (_tmp34_) {
				_tmp33_ = TRUE;
			} else {
				const gchar* _tmp53_;
				_tmp53_ = a;
				_tmp33_ = g_strcmp0 (_tmp53_, "--windows") == 0;
			}
			if (_tmp33_) {
				_tmp32_ = TRUE;
			} else {
				const gchar* _tmp54_;
				_tmp54_ = a;
				_tmp32_ = g_strcmp0 (_tmp54_, "--parse-ucd") == 0;
			}
			if (_tmp32_) {
				_tmp31_ = TRUE;
			} else {
				const gchar* _tmp55_;
				_tmp55_ = a;
				_tmp31_ = g_strcmp0 (_tmp55_, "--fuzz") == 0;
			}
			if (_tmp31_) {
				_tmp30_ = TRUE;
			} else {
				const gchar* _tmp56_;
				_tmp56_ = a;
				_tmp30_ = g_strcmp0 (_tmp56_, "--codepages") == 0;
			}
			if (_tmp30_) {
				const gchar* _tmp57_;
				gchar* _tmp58_;
				gint _tmp59_;
				_tmp57_ = a;
				_tmp58_ = g_strdup (_tmp57_);
				_g_free0 (prev);
				prev = _tmp58_;
				_tmp59_ = i;
				i = _tmp59_ + 1;
				_g_free0 (a);
				continue;
			} else {
				const gchar* _tmp60_;
				_tmp60_ = a;
				if (g_str_has_prefix (_tmp60_, "--")) {
					result = i;
					_g_free0 (a);
					p = (_vala_array_free (p, p_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (prev);
					return result;
				}
			}
			_tmp61_ = prev;
			if (!(g_strcmp0 (_tmp61_, "--test") == 0)) {
				result = i;
				_g_free0 (a);
				p = (_vala_array_free (p, p_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (prev);
				return result;
			}
			_tmp62_ = a;
			_tmp63_ = g_strdup (_tmp62_);
			_g_free0 (prev);
			prev = _tmp63_;
			_tmp64_ = i;
			i = _tmp64_ + 1;
			_g_free0 (a);
		}
	}
	result = 0;
	p = (_vala_array_free (p, p_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (prev);
	return result;
}

/** Return the font file parameter. */
gchar*
bird_font_argument_get_file (BirdFontArgument* self)
{
	gchar* f = NULL;
	gchar* _tmp0_;
	GeeArrayList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	const gchar* _tmp6_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	f = _tmp0_;
	_tmp1_ = self->priv->args;
	_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ >= 2) {
		GeeArrayList* _tmp4_;
		gpointer _tmp5_;
		_tmp4_ = self->priv->args;
		_tmp5_ = gee_abstract_list_get ((GeeAbstractList*) _tmp4_, 1);
		_g_free0 (f);
		f = (gchar*) _tmp5_;
	}
	_tmp6_ = f;
	if (g_str_has_prefix (_tmp6_, "-")) {
		gchar* _tmp7_;
		_tmp7_ = g_strdup ("");
		result = _tmp7_;
		_g_free0 (f);
		return result;
	}
	result = f;
	return result;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

void
bird_font_argument_print_all (BirdFontArgument* self)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->args;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("%i", _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strconcat (_tmp4_, " arguments:\n", NULL);
	_tmp6_ = _tmp5_;
	g_print ("%s", _tmp6_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	{
		GeeArrayList* _p_list = NULL;
		GeeArrayList* _tmp7_;
		gint _p_size = 0;
		GeeArrayList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _p_index = 0;
		_tmp7_ = self->priv->args;
		_p_list = _tmp7_;
		_tmp8_ = _p_list;
		_tmp9_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_p_size = _tmp10_;
		_p_index = -1;
		while (TRUE) {
			gint _tmp11_;
			gint _tmp12_;
			gchar* p = NULL;
			GeeArrayList* _tmp13_;
			gpointer _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			gchar* _tmp17_;
			gchar* _tmp18_;
			_p_index = _p_index + 1;
			_tmp11_ = _p_index;
			_tmp12_ = _p_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _p_list;
			_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp13_, _p_index);
			p = (gchar*) _tmp14_;
			_tmp15_ = p;
			_tmp16_ = string_to_string (_tmp15_);
			_tmp17_ = g_strconcat (_tmp16_, "\n", NULL);
			_tmp18_ = _tmp17_;
			g_print ("%s", _tmp18_);
			_g_free0 (_tmp18_);
			_g_free0 (p);
		}
	}
}

gboolean
bird_font_argument_has_argument (BirdFontArgument* self,
                                 const gchar* param)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (param != NULL, FALSE);
	_tmp0_ = bird_font_argument_get_argument (self, param);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_ != NULL;
	_g_free0 (_tmp1_);
	result = _tmp2_;
	return result;
}

/** Get commandline argument. */
static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

gchar*
bird_font_argument_get_argument (BirdFontArgument* self,
                                 const gchar* param)
{
	gint i = 0;
	gchar* n = NULL;
	gchar* p = NULL;
	gchar* v = NULL;
	gchar* _tmp0_;
	gchar** pm = NULL;
	gint pm_length1 = 0;
	gint _pm_size_ = 0;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (param != NULL, NULL);
	i = 0;
	_tmp0_ = g_strdup ("");
	v = _tmp0_;
	_tmp1_ = string_substring (param, (glong) 0, (glong) 1);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strcmp0 (_tmp2_, "-") != 0;
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = string_to_string (param);
		_tmp5_ = g_strconcat ("parameters must begin with \"-\" got ", _tmp4_, NULL);
		_tmp6_ = _tmp5_;
		g_warning ("Argument.vala:139: %s", _tmp6_);
		_g_free0 (_tmp6_);
		result = NULL;
		pm = (_vala_array_free (pm, pm_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (v);
		_g_free0 (p);
		_g_free0 (n);
		return result;
	}
	{
		GeeArrayList* _s_list = NULL;
		GeeArrayList* _tmp7_;
		gint _s_size = 0;
		GeeArrayList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _s_index = 0;
		_tmp7_ = self->priv->args;
		_s_list = _tmp7_;
		_tmp8_ = _s_list;
		_tmp9_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_s_size = _tmp10_;
		_s_index = -1;
		while (TRUE) {
			gint _tmp11_;
			gint _tmp12_;
			gchar* s = NULL;
			GeeArrayList* _tmp13_;
			gpointer _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp26_;
			gchar* _tmp27_;
			gchar* _tmp28_;
			gboolean _tmp29_;
			const gchar* _tmp30_;
			gchar* _tmp31_;
			gchar* _tmp32_;
			gboolean _tmp33_;
			const gchar* _tmp38_;
			gint _tmp57_;
			_s_index = _s_index + 1;
			_tmp11_ = _s_index;
			_tmp12_ = _s_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _s_list;
			_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp13_, _s_index);
			s = (gchar*) _tmp14_;
			_tmp15_ = s;
			if (string_index_of (_tmp15_, "=", 0) > -1) {
				const gchar* _tmp16_;
				gchar** _tmp17_;
				gchar** _tmp18_;
				gchar** _tmp19_;
				gint _tmp19__length1;
				gchar** _tmp23_;
				gint _tmp23__length1;
				const gchar* _tmp24_;
				gchar* _tmp25_;
				_tmp16_ = s;
				_tmp18_ = _tmp17_ = g_strsplit (_tmp16_, "=", 0);
				pm = (_vala_array_free (pm, pm_length1, (GDestroyNotify) g_free), NULL);
				pm = _tmp18_;
				pm_length1 = _vala_array_length (_tmp17_);
				_pm_size_ = pm_length1;
				_tmp19_ = pm;
				_tmp19__length1 = pm_length1;
				if (_tmp19__length1 > 1) {
					gchar** _tmp20_;
					gint _tmp20__length1;
					const gchar* _tmp21_;
					gchar* _tmp22_;
					_tmp20_ = pm;
					_tmp20__length1 = pm_length1;
					_tmp21_ = _tmp20_[1];
					_tmp22_ = g_strdup (_tmp21_);
					_g_free0 (v);
					v = _tmp22_;
				}
				_tmp23_ = pm;
				_tmp23__length1 = pm_length1;
				_tmp24_ = _tmp23_[0];
				_tmp25_ = g_strdup (_tmp24_);
				_g_free0 (s);
				s = _tmp25_;
			}
			_tmp26_ = s;
			_tmp27_ = string_substring (_tmp26_, (glong) 0, (glong) 1);
			_tmp28_ = _tmp27_;
			_tmp29_ = g_strcmp0 (_tmp28_, "-") != 0;
			_g_free0 (_tmp28_);
			if (_tmp29_) {
				_g_free0 (s);
				continue;
			}
			_tmp30_ = s;
			_tmp31_ = string_substring (_tmp30_, (glong) 0, (glong) 2);
			_tmp32_ = _tmp31_;
			_tmp33_ = g_strcmp0 (_tmp32_, "--") != 0;
			_g_free0 (_tmp32_);
			if (_tmp33_) {
				const gchar* _tmp34_;
				gchar* _tmp35_;
				_tmp34_ = s;
				_tmp35_ = bird_font_argument_expand_param (self, _tmp34_);
				_g_free0 (p);
				p = _tmp35_;
			} else {
				const gchar* _tmp36_;
				gchar* _tmp37_;
				_tmp36_ = s;
				_tmp37_ = g_strdup (_tmp36_);
				_g_free0 (p);
				p = _tmp37_;
			}
			_tmp38_ = p;
			if (g_strcmp0 (param, _tmp38_) == 0) {
				const gchar* _tmp39_;
				GeeArrayList* _tmp40_;
				gint _tmp41_;
				gint _tmp42_;
				GeeArrayList* _tmp44_;
				gpointer _tmp45_;
				const gchar* _tmp46_;
				GeeArrayList* _tmp48_;
				gpointer _tmp49_;
				gchar* _tmp50_;
				gchar* _tmp51_;
				gchar* _tmp52_;
				gboolean _tmp53_;
				GeeArrayList* _tmp55_;
				gpointer _tmp56_;
				_tmp39_ = v;
				if (g_strcmp0 (_tmp39_, "") != 0) {
					result = v;
					_g_free0 (s);
					pm = (_vala_array_free (pm, pm_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (p);
					_g_free0 (n);
					return result;
				}
				_tmp40_ = self->priv->args;
				_tmp41_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp40_);
				_tmp42_ = _tmp41_;
				if ((i + 2) >= _tmp42_) {
					gchar* _tmp43_;
					_tmp43_ = g_strdup ("");
					result = _tmp43_;
					_g_free0 (s);
					pm = (_vala_array_free (pm, pm_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (v);
					_g_free0 (p);
					_g_free0 (n);
					return result;
				}
				_tmp44_ = self->priv->args;
				_tmp45_ = gee_abstract_list_get ((GeeAbstractList*) _tmp44_, i + 2);
				_g_free0 (n);
				n = (gchar*) _tmp45_;
				_tmp46_ = n;
				if (_tmp46_ == NULL) {
					gchar* _tmp47_;
					_tmp47_ = g_strdup ("");
					result = _tmp47_;
					_g_free0 (s);
					pm = (_vala_array_free (pm, pm_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (v);
					_g_free0 (p);
					_g_free0 (n);
					return result;
				}
				_tmp48_ = self->priv->args;
				_tmp49_ = gee_abstract_list_get ((GeeAbstractList*) _tmp48_, i + 2);
				_tmp50_ = (gchar*) _tmp49_;
				_tmp51_ = string_substring (_tmp50_, (glong) 0, (glong) 1);
				_tmp52_ = _tmp51_;
				_tmp53_ = g_strcmp0 (_tmp52_, "-") == 0;
				_g_free0 (_tmp52_);
				_g_free0 (_tmp50_);
				if (_tmp53_) {
					gchar* _tmp54_;
					_tmp54_ = g_strdup ("");
					result = _tmp54_;
					_g_free0 (s);
					pm = (_vala_array_free (pm, pm_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (v);
					_g_free0 (p);
					_g_free0 (n);
					return result;
				}
				_tmp55_ = self->priv->args;
				_tmp56_ = gee_abstract_list_get ((GeeAbstractList*) _tmp55_, i + 2);
				result = (gchar*) _tmp56_;
				_g_free0 (s);
				pm = (_vala_array_free (pm, pm_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (v);
				_g_free0 (p);
				_g_free0 (n);
				return result;
			}
			_tmp57_ = i;
			i = _tmp57_ + 1;
			_g_free0 (s);
		}
	}
	result = NULL;
	pm = (_vala_array_free (pm, pm_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (v);
	_g_free0 (p);
	_g_free0 (n);
	return result;
}

static void
bird_font_argument_print_padded (BirdFontArgument* self,
                                 const gchar* cmd,
                                 const gchar* desc)
{
	gint l = 0;
	FILE* _tmp0_;
	FILE* _tmp4_;
	FILE* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cmd != NULL);
	g_return_if_fail (desc != NULL);
	l = 25 - g_utf8_strlen (cmd, (gssize) -1);
	_tmp0_ = stdout;
	fprintf (_tmp0_, "%s", cmd);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				FILE* _tmp3_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < l)) {
					break;
				}
				_tmp3_ = stdout;
				fprintf (_tmp3_, " ");
			}
		}
	}
	_tmp4_ = stdout;
	fprintf (_tmp4_, "%s", desc);
	_tmp5_ = stdout;
	fprintf (_tmp5_, "\n");
}

/** Return full command line parameter for the abbrevation.
 * -t becomes --test.
 */
static gunichar
string_get_char (const gchar* self,
                 glong index)
{
	gunichar result;
	g_return_val_if_fail (self != NULL, 0U);
	result = g_utf8_get_char (((gchar*) self) + index);
	return result;
}

static gchar*
bird_font_argument_expand_param (BirdFontArgument* self,
                                 const gchar* param)
{
	gchar* p = NULL;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp4_;
	const gchar* _tmp6_;
	gchar* _tmp18_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (param == NULL) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("");
		result = _tmp0_;
		return result;
	}
	_tmp1_ = g_strdup ((const gchar*) param);
	p = _tmp1_;
	_tmp2_ = p;
	if (string_get_char (_tmp2_, (glong) 0) != ((gunichar) '-')) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("");
		result = _tmp3_;
		_g_free0 (p);
		return result;
	}
	_tmp4_ = p;
	if (g_utf8_strlen (_tmp4_, (gssize) -1) != 2) {
		gchar* _tmp5_;
		_tmp5_ = g_strdup ("");
		result = _tmp5_;
		_g_free0 (p);
		return result;
	}
	_tmp6_ = p;
	switch (string_get_char (_tmp6_, (glong) 1)) {
		case 'c':
		{
			gchar* _tmp7_;
			_tmp7_ = g_strdup ("--show-coordinates");
			result = _tmp7_;
			_g_free0 (p);
			return result;
		}
		case 'e':
		{
			gchar* _tmp8_;
			_tmp8_ = g_strdup ("--exit");
			result = _tmp8_;
			_g_free0 (p);
			return result;
		}
		case 'f':
		{
			gchar* _tmp9_;
			_tmp9_ = g_strdup ("--fatal-warning");
			result = _tmp9_;
			_g_free0 (p);
			return result;
		}
		case 'h':
		{
			gchar* _tmp10_;
			_tmp10_ = g_strdup ("--help");
			result = _tmp10_;
			_g_free0 (p);
			return result;
		}
		case 'm':
		{
			gchar* _tmp11_;
			_tmp11_ = g_strdup ("--mac");
			result = _tmp11_;
			_g_free0 (p);
			return result;
		}
		case 'n':
		{
			gchar* _tmp12_;
			_tmp12_ = g_strdup ("--no-translation");
			result = _tmp12_;
			_g_free0 (p);
			return result;
		}
		case 's':
		{
			gchar* _tmp13_;
			_tmp13_ = g_strdup ("--slow");
			result = _tmp13_;
			_g_free0 (p);
			return result;
		}
		case 't':
		{
			gchar* _tmp14_;
			_tmp14_ = g_strdup ("--test");
			result = _tmp14_;
			_g_free0 (p);
			return result;
		}
		case 'a':
		{
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("--android");
			result = _tmp15_;
			_g_free0 (p);
			return result;
		}
		case 'l':
		{
			gchar* _tmp16_;
			_tmp16_ = g_strdup ("--log");
			result = _tmp16_;
			_g_free0 (p);
			return result;
		}
		case 'w':
		{
			gchar* _tmp17_;
			_tmp17_ = g_strdup ("--windows");
			result = _tmp17_;
			_g_free0 (p);
			return result;
		}
		default:
		break;
	}
	_tmp18_ = g_strdup ("");
	result = _tmp18_;
	_g_free0 (p);
	return result;
}

static void
bird_font_argument_set_argument (BirdFontArgument* self,
                                 const gchar* arg)
{
	gint i = 0;
	gint a = 0;
	gchar* n = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (arg != NULL);
	i = 0;
	if (g_utf8_strlen (arg, (gssize) -1) <= 1) {
		_g_free0 (n);
		return;
	}
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			gchar* _tmp1_;
			const gchar* _tmp2_;
			GeeArrayList* _tmp4_;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			if (!_tmp0_) {
				if (!(i < g_utf8_strlen (arg, (gssize) -1))) {
					break;
				}
			}
			_tmp0_ = FALSE;
			a = string_index_of (arg, " ", i + 1);
			_tmp1_ = string_substring (arg, (glong) i, (glong) (a - i));
			_g_free0 (n);
			n = _tmp1_;
			_tmp2_ = n;
			if (string_index_of (_tmp2_, "\"", 0) == 0) {
				gchar* _tmp3_;
				a = string_index_of (arg, "\"", i + 1);
				_tmp3_ = string_substring (arg, (glong) i, (glong) ((a - i) + 1));
				_g_free0 (n);
				n = _tmp3_;
			}
			_tmp4_ = self->priv->args;
			_tmp5_ = n;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, _tmp5_);
			_tmp6_ = n;
			i += g_utf8_strlen (_tmp6_, (gssize) -1) + 1;
		}
	}
	_g_free0 (n);
}

void
bird_font_argument_print_help (BirdFontArgument* self)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	FILE* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	FILE* _tmp8_;
	GeeArrayList* _tmp9_;
	gpointer _tmp10_;
	gchar* _tmp11_;
	FILE* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	FILE* _tmp47_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->args;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	_vala_return_if_fail (_tmp2_ > 0, "args.size > 0");
	_tmp3_ = stdout;
	_tmp4_ = bird_font_t_ ("Usage");
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strconcat (_tmp5_, ": ", NULL);
	_tmp7_ = _tmp6_;
	fprintf (_tmp3_, "%s", _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_tmp8_ = stdout;
	_tmp9_ = self->priv->args;
	_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, 0);
	_tmp11_ = (gchar*) _tmp10_;
	fprintf (_tmp8_, "%s", _tmp11_);
	_g_free0 (_tmp11_);
	_tmp12_ = stdout;
	_tmp13_ = bird_font_t_ ("FILE");
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strconcat (" [", _tmp14_, NULL);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strconcat (_tmp16_, "] [", NULL);
	_tmp18_ = _tmp17_;
	_tmp19_ = bird_font_t_ ("OPTION");
	_tmp20_ = _tmp19_;
	_tmp21_ = g_strconcat (_tmp18_, _tmp20_, NULL);
	_tmp22_ = _tmp21_;
	_tmp23_ = g_strconcat (_tmp22_, " ...]\n", NULL);
	_tmp24_ = _tmp23_;
	fprintf (_tmp12_, "%s", _tmp24_);
	_g_free0 (_tmp24_);
	_g_free0 (_tmp22_);
	_g_free0 (_tmp20_);
	_g_free0 (_tmp18_);
	_g_free0 (_tmp16_);
	_g_free0 (_tmp14_);
	_tmp25_ = bird_font_t_ ("enable Android customizations");
	_tmp26_ = _tmp25_;
	bird_font_argument_print_padded (self, "-a, --android", _tmp26_);
	_g_free0 (_tmp26_);
	_tmp27_ = bird_font_t_ ("show coordinate in glyph view");
	_tmp28_ = _tmp27_;
	bird_font_argument_print_padded (self, "-c, --show-coordinates", _tmp28_);
	_g_free0 (_tmp28_);
	_tmp29_ = bird_font_t_ ("exit if a test case fails");
	_tmp30_ = _tmp29_;
	bird_font_argument_print_padded (self, "-e, --exit", _tmp30_);
	_g_free0 (_tmp30_);
	_tmp31_ = bird_font_t_ ("treat warnings as fatal");
	_tmp32_ = _tmp31_;
	bird_font_argument_print_padded (self, "-f, --fatal-warning", _tmp32_);
	_g_free0 (_tmp32_);
	_tmp33_ = bird_font_t_ ("show this message");
	_tmp34_ = _tmp33_;
	bird_font_argument_print_padded (self, "-h, --help", _tmp34_);
	_g_free0 (_tmp34_);
	_tmp35_ = bird_font_t_ ("write a log file");
	_tmp36_ = _tmp35_;
	bird_font_argument_print_padded (self, "-l, --log", _tmp36_);
	_g_free0 (_tmp36_);
	_tmp37_ = bird_font_t_ ("enable Machintosh customizations");
	_tmp38_ = _tmp37_;
	bird_font_argument_print_padded (self, "-m, --mac", _tmp38_);
	_g_free0 (_tmp38_);
	_tmp39_ = bird_font_t_ ("enable Windows customizations");
	_tmp40_ = _tmp39_;
	bird_font_argument_print_padded (self, "-w, --windows", _tmp40_);
	_g_free0 (_tmp40_);
	_tmp41_ = bird_font_t_ ("don't translate");
	_tmp42_ = _tmp41_;
	bird_font_argument_print_padded (self, "-n, --no-translation", _tmp42_);
	_g_free0 (_tmp42_);
	_tmp43_ = bird_font_t_ ("sleep between each command in test suite");
	_tmp44_ = _tmp43_;
	bird_font_argument_print_padded (self, "-s, --slow", _tmp44_);
	_g_free0 (_tmp44_);
	_tmp45_ = bird_font_t_ ("run test case");
	_tmp46_ = _tmp45_;
	bird_font_argument_print_padded (self, "-t --test [TEST]", _tmp46_);
	_g_free0 (_tmp46_);
	_tmp47_ = stdout;
	fprintf (_tmp47_, "\n");
}

static void
bird_font_argument_class_init (BirdFontArgumentClass * klass,
                               gpointer klass_data)
{
	bird_font_argument_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BirdFontArgument_private_offset);
	G_OBJECT_CLASS (klass)->finalize = bird_font_argument_finalize;
}

static void
bird_font_argument_instance_init (BirdFontArgument * self,
                                  gpointer klass)
{
	self->priv = bird_font_argument_get_instance_private (self);
}

static void
bird_font_argument_finalize (GObject * obj)
{
	BirdFontArgument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_ARGUMENT, BirdFontArgument);
	_g_object_unref0 (self->priv->args);
	G_OBJECT_CLASS (bird_font_argument_parent_class)->finalize (obj);
}

static GType
bird_font_argument_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontArgumentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_argument_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontArgument), 0, (GInstanceInitFunc) bird_font_argument_instance_init, NULL };
	GType bird_font_argument_type_id;
	bird_font_argument_type_id = g_type_register_static (G_TYPE_OBJECT, "BirdFontArgument", &g_define_type_info, 0);
	BirdFontArgument_private_offset = g_type_add_instance_private (bird_font_argument_type_id, sizeof (BirdFontArgumentPrivate));
	return bird_font_argument_type_id;
}

GType
bird_font_argument_get_type (void)
{
	static volatile gsize bird_font_argument_type_id__once = 0;
	if (g_once_init_enter (&bird_font_argument_type_id__once)) {
		GType bird_font_argument_type_id;
		bird_font_argument_type_id = bird_font_argument_get_type_once ();
		g_once_init_leave (&bird_font_argument_type_id__once, bird_font_argument_type_id);
	}
	return bird_font_argument_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

