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


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>


#define TYPE_FUNCTION (function_get_type ())
#define FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FUNCTION, Function))
#define FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FUNCTION, FunctionClass))
#define IS_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FUNCTION))
#define IS_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FUNCTION))
#define FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FUNCTION, FunctionClass))

typedef struct _Function Function;
typedef struct _FunctionClass FunctionClass;
typedef struct _FunctionPrivate FunctionPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_DECIMALS_FUNCTION (decimals_function_get_type ())
#define DECIMALS_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DECIMALS_FUNCTION, DecimalsFunction))
#define DECIMALS_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DECIMALS_FUNCTION, DecimalsFunctionClass))
#define IS_DECIMALS_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DECIMALS_FUNCTION))
#define IS_DECIMALS_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DECIMALS_FUNCTION))
#define DECIMALS_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DECIMALS_FUNCTION, DecimalsFunctionClass))

typedef struct _DecimalsFunction DecimalsFunction;
typedef struct _DecimalsFunctionClass DecimalsFunctionClass;
typedef struct _DecimalsFunctionPrivate DecimalsFunctionPrivate;

#define TYPE_SIZE_FUNCTION (size_function_get_type ())
#define SIZE_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIZE_FUNCTION, SizeFunction))
#define SIZE_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SIZE_FUNCTION, SizeFunctionClass))
#define IS_SIZE_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SIZE_FUNCTION))
#define IS_SIZE_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SIZE_FUNCTION))
#define SIZE_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SIZE_FUNCTION, SizeFunctionClass))

typedef struct _SizeFunction SizeFunction;
typedef struct _SizeFunctionClass SizeFunctionClass;
typedef struct _SizeFunctionPrivate SizeFunctionPrivate;

#define TYPE_SPEED_FUNCTION (speed_function_get_type ())
#define SPEED_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SPEED_FUNCTION, SpeedFunction))
#define SPEED_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SPEED_FUNCTION, SpeedFunctionClass))
#define IS_SPEED_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SPEED_FUNCTION))
#define IS_SPEED_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SPEED_FUNCTION))
#define SPEED_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SPEED_FUNCTION, SpeedFunctionClass))

typedef struct _SpeedFunction SpeedFunction;
typedef struct _SpeedFunctionClass SpeedFunctionClass;
typedef struct _SpeedFunctionPrivate SpeedFunctionPrivate;

#define TYPE_FREQUENCY_FUNCTION (frequency_function_get_type ())
#define FREQUENCY_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREQUENCY_FUNCTION, FrequencyFunction))
#define FREQUENCY_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FREQUENCY_FUNCTION, FrequencyFunctionClass))
#define IS_FREQUENCY_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREQUENCY_FUNCTION))
#define IS_FREQUENCY_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FREQUENCY_FUNCTION))
#define FREQUENCY_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FREQUENCY_FUNCTION, FrequencyFunctionClass))

typedef struct _FrequencyFunction FrequencyFunction;
typedef struct _FrequencyFunctionClass FrequencyFunctionClass;
typedef struct _FrequencyFunctionPrivate FrequencyFunctionPrivate;

#define TYPE_PERCENT_FUNCTION (percent_function_get_type ())
#define PERCENT_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PERCENT_FUNCTION, PercentFunction))
#define PERCENT_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PERCENT_FUNCTION, PercentFunctionClass))
#define IS_PERCENT_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PERCENT_FUNCTION))
#define IS_PERCENT_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PERCENT_FUNCTION))
#define PERCENT_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PERCENT_FUNCTION, PercentFunctionClass))

typedef struct _PercentFunction PercentFunction;
typedef struct _PercentFunctionClass PercentFunctionClass;
typedef struct _PercentFunctionPrivate PercentFunctionPrivate;

struct _Function {
	GObject parent_instance;
	FunctionPrivate * priv;
};

struct _FunctionClass {
	GObjectClass parent_class;
	gchar* (*call) (Function* self, gchar** parameters, int parameters_length1, gboolean widest, GError** error);
};

struct _FunctionPrivate {
	gchar* _id;
	gchar** _parameterdescs;
	gint _parameterdescs_length1;
	gint __parameterdescs_size_;
};

struct _DecimalsFunction {
	Function parent_instance;
	DecimalsFunctionPrivate * priv;
};

struct _DecimalsFunctionClass {
	FunctionClass parent_class;
};

struct _SizeFunction {
	Function parent_instance;
	SizeFunctionPrivate * priv;
};

struct _SizeFunctionClass {
	FunctionClass parent_class;
};

struct _SpeedFunction {
	Function parent_instance;
	SpeedFunctionPrivate * priv;
};

struct _SpeedFunctionClass {
	FunctionClass parent_class;
};

struct _FrequencyFunction {
	Function parent_instance;
	FrequencyFunctionPrivate * priv;
};

struct _FrequencyFunctionClass {
	FunctionClass parent_class;
};

struct _PercentFunction {
	Function parent_instance;
	PercentFunctionPrivate * priv;
};

struct _PercentFunctionClass {
	FunctionClass parent_class;
};


static gpointer function_parent_class = NULL;
static gpointer decimals_function_parent_class = NULL;
static gpointer size_function_parent_class = NULL;
static gpointer speed_function_parent_class = NULL;
static gpointer frequency_function_parent_class = NULL;
static gpointer percent_function_parent_class = NULL;

GType function_get_type (void) G_GNUC_CONST;
#define FUNCTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_FUNCTION, FunctionPrivate))
enum  {
	FUNCTION_DUMMY_PROPERTY,
	FUNCTION_ID,
	FUNCTION_PARAMETERDESCS
};
Function* function_construct (GType object_type, const gchar* id, gchar** parameterdescs, int parameterdescs_length1);
GError* function_error (const gchar* message);
gchar* function_call (Function* self, gchar** parameters, int parameters_length1, gboolean widest, GError** error);
static gchar* function_real_call (Function* self, gchar** parameters, int parameters_length1, gboolean widest, GError** error);
const gchar* function_get_id (Function* self);
static void function_set_id (Function* self, const gchar* value);
gchar** function_get_parameterdescs (Function* self, int* result_length1);
static void function_set_parameterdescs (Function* self, gchar** value, int value_length1);
static gchar** _vala_array_dup8 (gchar** self, int length);
static void function_finalize (GObject* obj);
static void _vala_function_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_function_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
GType decimals_function_get_type (void) G_GNUC_CONST;
enum  {
	DECIMALS_FUNCTION_DUMMY_PROPERTY
};
DecimalsFunction* decimals_function_new (void);
DecimalsFunction* decimals_function_construct (GType object_type);
static gchar* decimals_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error);
GType size_function_get_type (void) G_GNUC_CONST;
enum  {
	SIZE_FUNCTION_DUMMY_PROPERTY
};
SizeFunction* size_function_new (void);
SizeFunction* size_function_construct (GType object_type);
static gchar* size_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error);
gchar* utils_format_size (gdouble val);
GType speed_function_get_type (void) G_GNUC_CONST;
enum  {
	SPEED_FUNCTION_DUMMY_PROPERTY
};
SpeedFunction* speed_function_new (void);
SpeedFunction* speed_function_construct (GType object_type);
static gchar* speed_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error);
gchar* utils_format_speed (gdouble val);
GType frequency_function_get_type (void) G_GNUC_CONST;
enum  {
	FREQUENCY_FUNCTION_DUMMY_PROPERTY
};
FrequencyFunction* frequency_function_new (void);
FrequencyFunction* frequency_function_construct (GType object_type);
static gchar* frequency_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error);
gchar* utils_format_frequency (gdouble val);
GType percent_function_get_type (void) G_GNUC_CONST;
enum  {
	PERCENT_FUNCTION_DUMMY_PROPERTY
};
PercentFunction* percent_function_new (void);
PercentFunction* percent_function_construct (GType object_type);
static gchar* percent_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, 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);


Function* function_construct (GType object_type, const gchar* id, gchar** parameterdescs, int parameterdescs_length1) {
	Function * self = NULL;
	const gchar* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	g_return_val_if_fail (id != NULL, NULL);
	_tmp0_ = id;
	_tmp1_ = parameterdescs;
	_tmp1__length1 = parameterdescs_length1;
	self = (Function*) g_object_new (object_type, "id", _tmp0_, "parameterdescs", _tmp1_, NULL);
	return self;
}


GError* function_error (const gchar* message) {
	GError* result = NULL;
	GQuark _tmp0_ = 0U;
	const gchar* _tmp1_ = NULL;
	GError* _tmp2_ = NULL;
	g_return_val_if_fail (message != NULL, NULL);
	_tmp0_ = g_quark_from_string ("function-error-quark");
	_tmp1_ = message;
	_tmp2_ = g_error_new (_tmp0_, 0, "%s", _tmp1_);
	result = _tmp2_;
	return result;
}


static gchar* function_real_call (Function* self, gchar** parameters, int parameters_length1, gboolean widest, GError** error) {
	g_critical ("Type `%s' does not implement abstract method `function_call'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}


gchar* function_call (Function* self, gchar** parameters, int parameters_length1, gboolean widest, GError** error) {
	g_return_val_if_fail (IS_FUNCTION (self), NULL);
	return FUNCTION_GET_CLASS (self)->call (self, parameters, parameters_length1, widest, error);
}


const gchar* function_get_id (Function* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (IS_FUNCTION (self), NULL);
	_tmp0_ = self->priv->_id;
	result = _tmp0_;
	return result;
}


static void function_set_id (Function* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_if_fail (IS_FUNCTION (self));
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_id);
	self->priv->_id = _tmp1_;
	g_object_notify ((GObject *) self, "id");
}


gchar** function_get_parameterdescs (Function* self, int* result_length1) {
	gchar** result;
	gchar** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gchar** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	g_return_val_if_fail (IS_FUNCTION (self), NULL);
	_tmp0_ = self->priv->_parameterdescs;
	_tmp0__length1 = self->priv->_parameterdescs_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}


static gchar** _vala_array_dup8 (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 function_set_parameterdescs (Function* self, gchar** value, int value_length1) {
	gchar** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gchar** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	g_return_if_fail (IS_FUNCTION (self));
	_tmp0_ = value;
	_tmp0__length1 = value_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup8 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	self->priv->_parameterdescs = (_vala_array_free (self->priv->_parameterdescs, self->priv->_parameterdescs_length1, (GDestroyNotify) g_free), NULL);
	self->priv->_parameterdescs = _tmp1_;
	self->priv->_parameterdescs_length1 = _tmp1__length1;
	self->priv->__parameterdescs_size_ = self->priv->_parameterdescs_length1;
	g_object_notify ((GObject *) self, "parameterdescs");
}


static void function_class_init (FunctionClass * klass) {
	function_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FunctionPrivate));
	FUNCTION_CLASS (klass)->call = function_real_call;
	G_OBJECT_CLASS (klass)->get_property = _vala_function_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_function_set_property;
	G_OBJECT_CLASS (klass)->finalize = function_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FUNCTION_ID, g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FUNCTION_PARAMETERDESCS, g_param_spec_boxed ("parameterdescs", "parameterdescs", "parameterdescs", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void function_instance_init (Function * self) {
	self->priv = FUNCTION_GET_PRIVATE (self);
}


static void function_finalize (GObject* obj) {
	Function * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FUNCTION, Function);
	_g_free0 (self->priv->_id);
	self->priv->_parameterdescs = (_vala_array_free (self->priv->_parameterdescs, self->priv->_parameterdescs_length1, (GDestroyNotify) g_free), NULL);
	G_OBJECT_CLASS (function_parent_class)->finalize (obj);
}


/******************************************************************************
 * Copyright (C) 2011-2013  Michael Hofmann <mh21@mh21.de>                    *
 *                                                                            *
 * This program is free software; you can redistribute it and/or modify       *
 * it under the terms of the GNU General Public License as published by       *
 * the Free Software Foundation; either version 3 of the License, or          *
 * (at your option) any later version.                                        *
 *                                                                            *
 * This program 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 General Public License for more details.                               *
 *                                                                            *
 * You should have received a copy of the GNU General Public License along    *
 * with this program; if not, write to the Free Software Foundation, Inc.,    *
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                *
 ******************************************************************************/
GType function_get_type (void) {
	static volatile gsize function_type_id__volatile = 0;
	if (g_once_init_enter (&function_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Function), 0, (GInstanceInitFunc) function_instance_init, NULL };
		GType function_type_id;
		function_type_id = g_type_register_static (G_TYPE_OBJECT, "Function", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&function_type_id__volatile, function_type_id);
	}
	return function_type_id__volatile;
}


static void _vala_function_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	Function * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FUNCTION, Function);
	switch (property_id) {
		case FUNCTION_ID:
		g_value_set_string (value, function_get_id (self));
		break;
		case FUNCTION_PARAMETERDESCS:
		{
			int length;
			g_value_set_boxed (value, function_get_parameterdescs (self, &length));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_function_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	Function * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FUNCTION, Function);
	switch (property_id) {
		case FUNCTION_ID:
		function_set_id (self, g_value_get_string (value));
		break;
		case FUNCTION_PARAMETERDESCS:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			function_set_parameterdescs (self, boxed, g_strv_length (boxed));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


DecimalsFunction* decimals_function_construct (GType object_type) {
	DecimalsFunction * self = NULL;
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	_tmp0_ = g_strdup ("value");
	_tmp1_ = g_strdup ("decimals");
	_tmp2_ = g_new0 (gchar*, 2 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp3__length1 = 2;
	self = (DecimalsFunction*) function_construct (object_type, "decimals", _tmp3_, 2);
	_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
	return self;
}


DecimalsFunction* decimals_function_new (void) {
	return decimals_function_construct (TYPE_DECIMALS_FUNCTION);
}


static gdouble double_parse (const gchar* str) {
	gdouble result = 0.0;
	const gchar* _tmp0_ = NULL;
	gdouble _tmp1_ = 0.0;
	g_return_val_if_fail (str != NULL, 0.0);
	_tmp0_ = str;
	_tmp1_ = g_ascii_strtod (_tmp0_, NULL);
	result = _tmp1_;
	return result;
}


static gchar* decimals_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error) {
	DecimalsFunction * self;
	gchar* result = NULL;
	gchar** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gboolean _tmp2_ = FALSE;
	gchar** _tmp6_ = NULL;
	gint _tmp6__length1 = 0;
	const gchar* _tmp7_ = NULL;
	gint _tmp8_ = 0;
	gchar** _tmp9_ = NULL;
	gint _tmp9__length1 = 0;
	const gchar* _tmp10_ = NULL;
	gdouble _tmp11_ = 0.0;
	gchar* _tmp12_ = NULL;
	GError * _inner_error_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DECIMALS_FUNCTION, DecimalsFunction);
	_tmp0_ = parameters;
	_tmp0__length1 = parameters_length1;
	if (_tmp0__length1 != 2) {
		GError* _tmp1_ = NULL;
		_tmp1_ = function_error ("two parameters expected");
		_inner_error_ = _tmp1_;
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	_tmp2_ = widest;
	if (_tmp2_) {
		gchar** _tmp3_ = NULL;
		gint _tmp3__length1 = 0;
		gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		_tmp3_ = parameters;
		_tmp3__length1 = parameters_length1;
		_tmp4_ = g_strdup ("8");
		_g_free0 (_tmp3_[0]);
		_tmp3_[0] = _tmp4_;
		_tmp5_ = _tmp3_[0];
	}
	_tmp6_ = parameters;
	_tmp6__length1 = parameters_length1;
	_tmp7_ = _tmp6_[1];
	_tmp8_ = atoi (_tmp7_);
	_tmp9_ = parameters;
	_tmp9__length1 = parameters_length1;
	_tmp10_ = _tmp9_[0];
	_tmp11_ = double_parse (_tmp10_);
	_tmp12_ = g_strdup_printf ("%.*f", _tmp8_, _tmp11_);
	result = _tmp12_;
	return result;
}


static void decimals_function_class_init (DecimalsFunctionClass * klass) {
	decimals_function_parent_class = g_type_class_peek_parent (klass);
	FUNCTION_CLASS (klass)->call = decimals_function_real_call;
}


static void decimals_function_instance_init (DecimalsFunction * self) {
}


GType decimals_function_get_type (void) {
	static volatile gsize decimals_function_type_id__volatile = 0;
	if (g_once_init_enter (&decimals_function_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DecimalsFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) decimals_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DecimalsFunction), 0, (GInstanceInitFunc) decimals_function_instance_init, NULL };
		GType decimals_function_type_id;
		decimals_function_type_id = g_type_register_static (TYPE_FUNCTION, "DecimalsFunction", &g_define_type_info, 0);
		g_once_init_leave (&decimals_function_type_id__volatile, decimals_function_type_id);
	}
	return decimals_function_type_id__volatile;
}


SizeFunction* size_function_construct (GType object_type) {
	SizeFunction * self = NULL;
	gchar* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	_tmp0_ = g_strdup ("value");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	self = (SizeFunction*) function_construct (object_type, "size", _tmp2_, 1);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	return self;
}


SizeFunction* size_function_new (void) {
	return size_function_construct (TYPE_SIZE_FUNCTION);
}


static gchar* size_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error) {
	SizeFunction * self;
	gchar* result = NULL;
	gchar** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gboolean _tmp2_ = FALSE;
	gchar** _tmp6_ = NULL;
	gint _tmp6__length1 = 0;
	const gchar* _tmp7_ = NULL;
	gdouble _tmp8_ = 0.0;
	gchar* _tmp9_ = NULL;
	GError * _inner_error_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_SIZE_FUNCTION, SizeFunction);
	_tmp0_ = parameters;
	_tmp0__length1 = parameters_length1;
	if (_tmp0__length1 != 1) {
		GError* _tmp1_ = NULL;
		_tmp1_ = function_error ("one parameter expected");
		_inner_error_ = _tmp1_;
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	_tmp2_ = widest;
	if (_tmp2_) {
		gchar** _tmp3_ = NULL;
		gint _tmp3__length1 = 0;
		gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		_tmp3_ = parameters;
		_tmp3__length1 = parameters_length1;
		_tmp4_ = g_strdup ("999000000");
		_g_free0 (_tmp3_[0]);
		_tmp3_[0] = _tmp4_;
		_tmp5_ = _tmp3_[0];
	}
	_tmp6_ = parameters;
	_tmp6__length1 = parameters_length1;
	_tmp7_ = _tmp6_[0];
	_tmp8_ = double_parse (_tmp7_);
	_tmp9_ = utils_format_size (_tmp8_);
	result = _tmp9_;
	return result;
}


static void size_function_class_init (SizeFunctionClass * klass) {
	size_function_parent_class = g_type_class_peek_parent (klass);
	FUNCTION_CLASS (klass)->call = size_function_real_call;
}


static void size_function_instance_init (SizeFunction * self) {
}


GType size_function_get_type (void) {
	static volatile gsize size_function_type_id__volatile = 0;
	if (g_once_init_enter (&size_function_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SizeFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) size_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SizeFunction), 0, (GInstanceInitFunc) size_function_instance_init, NULL };
		GType size_function_type_id;
		size_function_type_id = g_type_register_static (TYPE_FUNCTION, "SizeFunction", &g_define_type_info, 0);
		g_once_init_leave (&size_function_type_id__volatile, size_function_type_id);
	}
	return size_function_type_id__volatile;
}


SpeedFunction* speed_function_construct (GType object_type) {
	SpeedFunction * self = NULL;
	gchar* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	_tmp0_ = g_strdup ("value");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	self = (SpeedFunction*) function_construct (object_type, "speed", _tmp2_, 1);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	return self;
}


SpeedFunction* speed_function_new (void) {
	return speed_function_construct (TYPE_SPEED_FUNCTION);
}


static gchar* speed_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error) {
	SpeedFunction * self;
	gchar* result = NULL;
	gchar** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gboolean _tmp2_ = FALSE;
	gchar** _tmp6_ = NULL;
	gint _tmp6__length1 = 0;
	const gchar* _tmp7_ = NULL;
	gdouble _tmp8_ = 0.0;
	gchar* _tmp9_ = NULL;
	GError * _inner_error_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_SPEED_FUNCTION, SpeedFunction);
	_tmp0_ = parameters;
	_tmp0__length1 = parameters_length1;
	if (_tmp0__length1 != 1) {
		GError* _tmp1_ = NULL;
		_tmp1_ = function_error ("one parameter expected");
		_inner_error_ = _tmp1_;
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	_tmp2_ = widest;
	if (_tmp2_) {
		gchar** _tmp3_ = NULL;
		gint _tmp3__length1 = 0;
		gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		_tmp3_ = parameters;
		_tmp3__length1 = parameters_length1;
		_tmp4_ = g_strdup ("999000000");
		_g_free0 (_tmp3_[0]);
		_tmp3_[0] = _tmp4_;
		_tmp5_ = _tmp3_[0];
	}
	_tmp6_ = parameters;
	_tmp6__length1 = parameters_length1;
	_tmp7_ = _tmp6_[0];
	_tmp8_ = double_parse (_tmp7_);
	_tmp9_ = utils_format_speed (_tmp8_);
	result = _tmp9_;
	return result;
}


static void speed_function_class_init (SpeedFunctionClass * klass) {
	speed_function_parent_class = g_type_class_peek_parent (klass);
	FUNCTION_CLASS (klass)->call = speed_function_real_call;
}


static void speed_function_instance_init (SpeedFunction * self) {
}


GType speed_function_get_type (void) {
	static volatile gsize speed_function_type_id__volatile = 0;
	if (g_once_init_enter (&speed_function_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SpeedFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) speed_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SpeedFunction), 0, (GInstanceInitFunc) speed_function_instance_init, NULL };
		GType speed_function_type_id;
		speed_function_type_id = g_type_register_static (TYPE_FUNCTION, "SpeedFunction", &g_define_type_info, 0);
		g_once_init_leave (&speed_function_type_id__volatile, speed_function_type_id);
	}
	return speed_function_type_id__volatile;
}


FrequencyFunction* frequency_function_construct (GType object_type) {
	FrequencyFunction * self = NULL;
	gchar* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	_tmp0_ = g_strdup ("value");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	self = (FrequencyFunction*) function_construct (object_type, "frequency", _tmp2_, 1);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	return self;
}


FrequencyFunction* frequency_function_new (void) {
	return frequency_function_construct (TYPE_FREQUENCY_FUNCTION);
}


static gchar* frequency_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error) {
	FrequencyFunction * self;
	gchar* result = NULL;
	gchar** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gboolean _tmp2_ = FALSE;
	gchar** _tmp6_ = NULL;
	gint _tmp6__length1 = 0;
	const gchar* _tmp7_ = NULL;
	gdouble _tmp8_ = 0.0;
	gchar* _tmp9_ = NULL;
	GError * _inner_error_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FREQUENCY_FUNCTION, FrequencyFunction);
	_tmp0_ = parameters;
	_tmp0__length1 = parameters_length1;
	if (_tmp0__length1 != 1) {
		GError* _tmp1_ = NULL;
		_tmp1_ = function_error ("one parameter expected");
		_inner_error_ = _tmp1_;
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	_tmp2_ = widest;
	if (_tmp2_) {
		gchar** _tmp3_ = NULL;
		gint _tmp3__length1 = 0;
		gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		_tmp3_ = parameters;
		_tmp3__length1 = parameters_length1;
		_tmp4_ = g_strdup ("999000000");
		_g_free0 (_tmp3_[0]);
		_tmp3_[0] = _tmp4_;
		_tmp5_ = _tmp3_[0];
	}
	_tmp6_ = parameters;
	_tmp6__length1 = parameters_length1;
	_tmp7_ = _tmp6_[0];
	_tmp8_ = double_parse (_tmp7_);
	_tmp9_ = utils_format_frequency (_tmp8_);
	result = _tmp9_;
	return result;
}


static void frequency_function_class_init (FrequencyFunctionClass * klass) {
	frequency_function_parent_class = g_type_class_peek_parent (klass);
	FUNCTION_CLASS (klass)->call = frequency_function_real_call;
}


static void frequency_function_instance_init (FrequencyFunction * self) {
}


GType frequency_function_get_type (void) {
	static volatile gsize frequency_function_type_id__volatile = 0;
	if (g_once_init_enter (&frequency_function_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FrequencyFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) frequency_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FrequencyFunction), 0, (GInstanceInitFunc) frequency_function_instance_init, NULL };
		GType frequency_function_type_id;
		frequency_function_type_id = g_type_register_static (TYPE_FUNCTION, "FrequencyFunction", &g_define_type_info, 0);
		g_once_init_leave (&frequency_function_type_id__volatile, frequency_function_type_id);
	}
	return frequency_function_type_id__volatile;
}


PercentFunction* percent_function_construct (GType object_type) {
	PercentFunction * self = NULL;
	gchar* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	_tmp0_ = g_strdup ("value");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	self = (PercentFunction*) function_construct (object_type, "percent", _tmp2_, 1);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	return self;
}


PercentFunction* percent_function_new (void) {
	return percent_function_construct (TYPE_PERCENT_FUNCTION);
}


static gchar* percent_function_real_call (Function* base, gchar** parameters, int parameters_length1, gboolean widest, GError** error) {
	PercentFunction * self;
	gchar* result = NULL;
	gchar** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp6_ = NULL;
	gchar** _tmp7_ = NULL;
	gint _tmp7__length1 = 0;
	const gchar* _tmp8_ = NULL;
	gdouble _tmp9_ = 0.0;
	gdouble _tmp10_ = 0.0;
	gchar* _tmp11_ = NULL;
	GError * _inner_error_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_PERCENT_FUNCTION, PercentFunction);
	_tmp0_ = parameters;
	_tmp0__length1 = parameters_length1;
	if (_tmp0__length1 != 1) {
		GError* _tmp1_ = NULL;
		_tmp1_ = function_error ("one parameter expected");
		_inner_error_ = _tmp1_;
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	_tmp2_ = widest;
	if (_tmp2_) {
		gchar** _tmp3_ = NULL;
		gint _tmp3__length1 = 0;
		gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		_tmp3_ = parameters;
		_tmp3__length1 = parameters_length1;
		_tmp4_ = g_strdup ("1");
		_g_free0 (_tmp3_[0]);
		_tmp3_[0] = _tmp4_;
		_tmp5_ = _tmp3_[0];
	}
	_tmp6_ = _ ("%u%%");
	_tmp7_ = parameters;
	_tmp7__length1 = parameters_length1;
	_tmp8_ = _tmp7_[0];
	_tmp9_ = double_parse (_tmp8_);
	_tmp10_ = round (100 * _tmp9_);
	_tmp11_ = g_strdup_printf (_tmp6_, (guint) _tmp10_);
	result = _tmp11_;
	return result;
}


static void percent_function_class_init (PercentFunctionClass * klass) {
	percent_function_parent_class = g_type_class_peek_parent (klass);
	FUNCTION_CLASS (klass)->call = percent_function_real_call;
}


static void percent_function_instance_init (PercentFunction * self) {
}


GType percent_function_get_type (void) {
	static volatile gsize percent_function_type_id__volatile = 0;
	if (g_once_init_enter (&percent_function_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PercentFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) percent_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PercentFunction), 0, (GInstanceInitFunc) percent_function_instance_init, NULL };
		GType percent_function_type_id;
		percent_function_type_id = g_type_register_static (TYPE_FUNCTION, "PercentFunction", &g_define_type_info, 0);
		g_once_init_leave (&percent_function_type_id__volatile, percent_function_type_id);
	}
	return percent_function_type_id__volatile;
}


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);
}



