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

/*
 * Copyright (c) 2024-2025 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "ft_core.h"
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gobject/gvaluecollector.h>
#include <glib/gi18n-lib.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

#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _FtParamSpecVariableSpec FtParamSpecVariableSpec;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _ft_variable_spec_unref0(var) ((var == NULL) ? NULL : (var = (ft_variable_spec_unref (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 _FtParamSpecVariableSpec {
	GParamSpec parent_instance;
};

static gpointer ft_variable_spec_parent_class = NULL;
VALA_EXTERN FtVariableSpec** ft_variable_specs;
VALA_EXTERN gint ft_variable_specs_length1;
FtVariableSpec** ft_variable_specs = NULL;
gint ft_variable_specs_length1 = 0;
static gint _ft_variable_specs_size_ = 0;
VALA_EXTERN GHashTable* ft_variable_spec_by_name;
GHashTable* ft_variable_spec_by_name = NULL;

static void ft_variable_spec_finalize (FtVariableSpec * obj);
static GType ft_variable_spec_get_type_once (void);
VALA_EXTERN FtValue* ft_variables_get_timestamp (FtContext* context);
VALA_EXTERN FtStateValue* ft_variables_get_state (FtContext* context);
VALA_EXTERN FtStatusValue* ft_variables_get_status (FtContext* context);
VALA_EXTERN FtBooleanValue* ft_variables_get_is_started (FtContext* context);
VALA_EXTERN FtBooleanValue* ft_variables_get_is_paused (FtContext* context);
VALA_EXTERN FtBooleanValue* ft_variables_get_is_finished (FtContext* context);
VALA_EXTERN FtBooleanValue* ft_variables_get_is_running (FtContext* context);
VALA_EXTERN FtIntervalValue* ft_variables_get_duration (FtContext* context);
VALA_EXTERN FtIntervalValue* ft_variables_get_offset (FtContext* context);
VALA_EXTERN FtIntervalValue* ft_variables_get_elapsed (FtContext* context);
VALA_EXTERN FtIntervalValue* ft_variables_get_remaining (FtContext* context);
VALA_EXTERN FtTimestampValue* ft_variables_get_start_time (FtContext* context);
VALA_EXTERN void ft_variables_initialize (void);
static void _g_free0_ (gpointer var);
static FtValue* _ft_variables_get_timestamp_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_state_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_status_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_is_started_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_is_paused_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_is_finished_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_is_running_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_duration_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_offset_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_elapsed_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_remaining_ft_evaluate_func (FtContext* context);
static FtValue* _ft_variables_get_start_time_ft_evaluate_func (FtContext* context);
VALA_EXTERN void ft_variables_ensure_initialized (void);
static void _vala_array_add36 (FtVariableSpec** * array,
                        gint* length,
                        gint* size,
                        FtVariableSpec* value);
static FtVariableSpec** _vala_array_dup26 (FtVariableSpec** self,
                                    gssize length);
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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

FtVariableSpec*
ft_variable_spec_construct (GType object_type,
                            const gchar* name,
                            const gchar* description,
                            GType value_type,
                            FtEvaluateFunc evaluate_func)
{
	FtVariableSpec* self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (description != NULL, NULL);
	self = (FtVariableSpec*) g_type_create_instance (object_type);
	_tmp0_ = g_strdup (name);
	_g_free0 (self->name);
	self->name = _tmp0_;
	_tmp1_ = g_strdup (description);
	_g_free0 (self->description);
	self->description = _tmp1_;
	self->value_type = value_type;
	self->evaluate_func = evaluate_func;
	return self;
}

FtVariableSpec*
ft_variable_spec_new (const gchar* name,
                      const gchar* description,
                      GType value_type,
                      FtEvaluateFunc evaluate_func)
{
	return ft_variable_spec_construct (FT_TYPE_VARIABLE_SPEC, name, description, value_type, evaluate_func);
}

inline FtValue*
ft_variable_spec_evaluate (FtVariableSpec* self,
                           FtContext* context)
{
	FtEvaluateFunc _tmp0_;
	FtEvaluateFunc _tmp1_;
	FtValue* _tmp2_;
	FtValue* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = self->evaluate_func;
	_vala_return_val_if_fail (_tmp0_ != NULL, "this.evaluate_func != null", NULL);
	_tmp1_ = self->evaluate_func;
	_tmp2_ = _tmp1_ (context);
	result = _tmp2_;
	return result;
}

static void
ft_value_variable_spec_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
ft_value_variable_spec_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		ft_variable_spec_unref (value->data[0].v_pointer);
	}
}

static void
ft_value_variable_spec_copy_value (const GValue* src_value,
                                   GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = ft_variable_spec_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
ft_value_variable_spec_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
ft_value_variable_spec_collect_value (GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		FtVariableSpec * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = ft_variable_spec_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
ft_value_variable_spec_lcopy_value (const GValue* value,
                                    guint n_collect_values,
                                    GTypeCValue* collect_values,
                                    guint collect_flags)
{
	FtVariableSpec ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = ft_variable_spec_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
ft_param_spec_variable_spec (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags)
{
	FtParamSpecVariableSpec* spec;
	g_return_val_if_fail (g_type_is_a (object_type, FT_TYPE_VARIABLE_SPEC), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
ft_value_get_variable_spec (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FT_TYPE_VARIABLE_SPEC), NULL);
	return value->data[0].v_pointer;
}

void
ft_value_set_variable_spec (GValue* value,
                            gpointer v_object)
{
	FtVariableSpec * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FT_TYPE_VARIABLE_SPEC));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FT_TYPE_VARIABLE_SPEC));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		ft_variable_spec_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		ft_variable_spec_unref (old);
	}
}

void
ft_value_take_variable_spec (GValue* value,
                             gpointer v_object)
{
	FtVariableSpec * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FT_TYPE_VARIABLE_SPEC));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FT_TYPE_VARIABLE_SPEC));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		ft_variable_spec_unref (old);
	}
}

static void
ft_variable_spec_class_init (FtVariableSpecClass * klass,
                             gpointer klass_data)
{
	ft_variable_spec_parent_class = g_type_class_peek_parent (klass);
	((FtVariableSpecClass *) klass)->finalize = ft_variable_spec_finalize;
}

static void
ft_variable_spec_instance_init (FtVariableSpec * self,
                                gpointer klass)
{
	self->ref_count = 1;
}

static void
ft_variable_spec_finalize (FtVariableSpec * obj)
{
	FtVariableSpec * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_VARIABLE_SPEC, FtVariableSpec);
	g_signal_handlers_destroy (self);
	_g_free0 (self->name);
	_g_free0 (self->description);
}

static GType
ft_variable_spec_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { ft_value_variable_spec_init, ft_value_variable_spec_free_value, ft_value_variable_spec_copy_value, ft_value_variable_spec_peek_pointer, "p", ft_value_variable_spec_collect_value, "p", ft_value_variable_spec_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (FtVariableSpecClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_variable_spec_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtVariableSpec), 0, (GInstanceInitFunc) ft_variable_spec_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType ft_variable_spec_type_id;
	ft_variable_spec_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FtVariableSpec", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return ft_variable_spec_type_id;
}

GType
ft_variable_spec_get_type (void)
{
	static volatile gsize ft_variable_spec_type_id__once = 0;
	if (g_once_init_enter (&ft_variable_spec_type_id__once)) {
		GType ft_variable_spec_type_id;
		ft_variable_spec_type_id = ft_variable_spec_get_type_once ();
		g_once_init_leave (&ft_variable_spec_type_id__once, ft_variable_spec_type_id);
	}
	return ft_variable_spec_type_id__once;
}

gpointer
ft_variable_spec_ref (gpointer instance)
{
	FtVariableSpec * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
ft_variable_spec_unref (gpointer instance)
{
	FtVariableSpec * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		FT_VARIABLE_SPEC_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

FtValue*
ft_variables_get_timestamp (FtContext* context)
{
	FtTimestampValue* _tmp0_;
	FtValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = ft_timestamp_value_new (context->timestamp);
	result = (FtValue*) _tmp0_;
	return result;
}

FtStateValue*
ft_variables_get_state (FtContext* context)
{
	FtState _tmp0_ = 0;
	FtTimeBlock* _tmp1_;
	FtStateValue* _tmp5_;
	FtStateValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp1_ = context->time_block;
	if (_tmp1_ != NULL) {
		FtTimeBlock* _tmp2_;
		FtState _tmp3_;
		FtState _tmp4_;
		_tmp2_ = context->time_block;
		_tmp3_ = ft_time_block_get_state (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = FT_STATE_STOPPED;
	}
	_tmp5_ = ft_state_value_new (_tmp0_);
	result = _tmp5_;
	return result;
}

FtStatusValue*
ft_variables_get_status (FtContext* context)
{
	FtTimeBlockStatus _tmp0_ = 0;
	FtTimeBlock* _tmp1_;
	FtStatusValue* _tmp3_;
	FtStatusValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp1_ = context->time_block;
	if (_tmp1_ != NULL) {
		FtTimeBlock* _tmp2_;
		_tmp2_ = context->time_block;
		_tmp0_ = ft_time_block_get_status (_tmp2_);
	} else {
		_tmp0_ = FT_TIME_BLOCK_STATUS_SCHEDULED;
	}
	_tmp3_ = ft_status_value_new (_tmp0_);
	result = _tmp3_;
	return result;
}

FtBooleanValue*
ft_variables_get_is_started (FtContext* context)
{
	FtBooleanValue* _tmp0_;
	FtBooleanValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = ft_boolean_value_new (ft_timer_state_is_started (&context->timer_state));
	result = _tmp0_;
	return result;
}

FtBooleanValue*
ft_variables_get_is_paused (FtContext* context)
{
	FtBooleanValue* _tmp0_;
	FtBooleanValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = ft_boolean_value_new (ft_timer_state_is_paused (&context->timer_state));
	result = _tmp0_;
	return result;
}

FtBooleanValue*
ft_variables_get_is_finished (FtContext* context)
{
	FtBooleanValue* _tmp0_;
	FtBooleanValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = ft_boolean_value_new (ft_timer_state_is_finished (&context->timer_state));
	result = _tmp0_;
	return result;
}

FtBooleanValue*
ft_variables_get_is_running (FtContext* context)
{
	FtBooleanValue* _tmp0_;
	FtBooleanValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = ft_boolean_value_new (ft_timer_state_is_running (&context->timer_state));
	result = _tmp0_;
	return result;
}

FtIntervalValue*
ft_variables_get_duration (FtContext* context)
{
	FtTimerState _tmp0_;
	FtIntervalValue* _tmp1_;
	FtIntervalValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = context->timer_state;
	_tmp1_ = ft_interval_value_new (_tmp0_.duration);
	result = _tmp1_;
	return result;
}

FtIntervalValue*
ft_variables_get_offset (FtContext* context)
{
	FtTimerState _tmp0_;
	FtIntervalValue* _tmp1_;
	FtIntervalValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = context->timer_state;
	_tmp1_ = ft_interval_value_new (_tmp0_.offset);
	result = _tmp1_;
	return result;
}

FtIntervalValue*
ft_variables_get_elapsed (FtContext* context)
{
	FtIntervalValue* _tmp0_;
	FtIntervalValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = ft_interval_value_new (ft_timer_state_calculate_elapsed (&context->timer_state, context->timestamp));
	result = _tmp0_;
	return result;
}

FtIntervalValue*
ft_variables_get_remaining (FtContext* context)
{
	FtIntervalValue* _tmp0_;
	FtIntervalValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = ft_interval_value_new (ft_timer_state_calculate_remaining (&context->timer_state, context->timestamp));
	result = _tmp0_;
	return result;
}

FtTimestampValue*
ft_variables_get_start_time (FtContext* context)
{
	FtTimerState _tmp0_;
	FtTimestampValue* _tmp1_;
	FtTimestampValue* result;
	g_return_val_if_fail (context != NULL, NULL);
	_tmp0_ = context->timer_state;
	_tmp1_ = ft_timestamp_value_new (_tmp0_.started_time);
	result = _tmp1_;
	return result;
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static FtValue*
_ft_variables_get_timestamp_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_timestamp (context);
	return result;
}

static FtValue*
_ft_variables_get_state_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_state (context);
	return result;
}

static FtValue*
_ft_variables_get_status_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_status (context);
	return result;
}

static FtValue*
_ft_variables_get_is_started_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_is_started (context);
	return result;
}

static FtValue*
_ft_variables_get_is_paused_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_is_paused (context);
	return result;
}

static FtValue*
_ft_variables_get_is_finished_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_is_finished (context);
	return result;
}

static FtValue*
_ft_variables_get_is_running_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_is_running (context);
	return result;
}

static FtValue*
_ft_variables_get_duration_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_duration (context);
	return result;
}

static FtValue*
_ft_variables_get_offset_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_offset (context);
	return result;
}

static FtValue*
_ft_variables_get_elapsed_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_elapsed (context);
	return result;
}

static FtValue*
_ft_variables_get_remaining_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_remaining (context);
	return result;
}

static FtValue*
_ft_variables_get_start_time_ft_evaluate_func (FtContext* context)
{
	FtValue* result;
	result = ft_variables_get_start_time (context);
	return result;
}

void
ft_variables_initialize (void)
{
	FtVariableSpec** _tmp0_;
	GHashFunc _tmp1_;
	GEqualFunc _tmp2_;
	GHashTable* _tmp3_;
	FtVariableSpec* _tmp4_;
	FtVariableSpec* _tmp5_;
	FtVariableSpec* _tmp6_;
	FtVariableSpec* _tmp7_;
	FtVariableSpec* _tmp8_;
	FtVariableSpec* _tmp9_;
	FtVariableSpec* _tmp10_;
	FtVariableSpec* _tmp11_;
	FtVariableSpec* _tmp12_;
	FtVariableSpec* _tmp13_;
	FtVariableSpec* _tmp14_;
	FtVariableSpec* _tmp15_;
	FtVariableSpec* _tmp16_;
	FtVariableSpec* _tmp17_;
	FtVariableSpec* _tmp18_;
	FtVariableSpec* _tmp19_;
	FtVariableSpec* _tmp20_;
	FtVariableSpec* _tmp21_;
	FtVariableSpec* _tmp22_;
	FtVariableSpec* _tmp23_;
	FtVariableSpec* _tmp24_;
	FtVariableSpec* _tmp25_;
	FtVariableSpec* _tmp26_;
	FtVariableSpec* _tmp27_;
	_tmp0_ = g_new0 (FtVariableSpec*, 0 + 1);
	ft_variable_specs = (_vala_array_free (ft_variable_specs, ft_variable_specs_length1, (GDestroyNotify) ft_variable_spec_unref), NULL);
	ft_variable_specs = _tmp0_;
	ft_variable_specs_length1 = 0;
	_ft_variable_specs_size_ = ft_variable_specs_length1;
	_tmp1_ = g_str_hash;
	_tmp2_ = g_str_equal;
	_tmp3_ = g_hash_table_new_full (_tmp1_, _tmp2_, _g_free0_, NULL);
	_g_hash_table_unref0 (ft_variable_spec_by_name);
	ft_variable_spec_by_name = _tmp3_;
	_tmp4_ = ft_variable_spec_new ("timestamp", _ ("The exact time of the current event."), FT_TYPE_TIMESTAMP_VALUE, _ft_variables_get_timestamp_ft_evaluate_func);
	_tmp5_ = _tmp4_;
	ft_install_variable (_tmp5_);
	_ft_variable_spec_unref0 (_tmp5_);
	_tmp6_ = ft_variable_spec_new ("state", _ ("The current phase of the Pomodoro cycle. Possible values: <tt>stopped<" \
"/tt>, <tt>pomodoro</tt>, <tt>break</tt>, <tt>short-break</tt>, <tt>lon" \
"g-break</tt>."), FT_TYPE_STATE_VALUE, _ft_variables_get_state_ft_evaluate_func);
	_tmp7_ = _tmp6_;
	ft_install_variable (_tmp7_);
	_ft_variable_spec_unref0 (_tmp7_);
	_tmp8_ = ft_variable_spec_new ("status", _ ("Status of the current time-block. Possible values: <tt>scheduled</tt>," \
" <tt>in-progress</tt>, <tt>completed</tt>, <tt>uncompleted</tt>."), FT_TYPE_STATUS_VALUE, _ft_variables_get_status_ft_evaluate_func);
	_tmp9_ = _tmp8_;
	ft_install_variable (_tmp9_);
	_ft_variable_spec_unref0 (_tmp9_);
	_tmp10_ = ft_variable_spec_new ("is-started", _ ("A flag indicating whether countdown has begun."), FT_TYPE_BOOLEAN_VALUE, _ft_variables_get_is_started_ft_evaluate_func);
	_tmp11_ = _tmp10_;
	ft_install_variable (_tmp11_);
	_ft_variable_spec_unref0 (_tmp11_);
	_tmp12_ = ft_variable_spec_new ("is-paused", _ ("A flag indicating whether countdown is paused."), FT_TYPE_BOOLEAN_VALUE, _ft_variables_get_is_paused_ft_evaluate_func);
	_tmp13_ = _tmp12_;
	ft_install_variable (_tmp13_);
	_ft_variable_spec_unref0 (_tmp13_);
	_tmp14_ = ft_variable_spec_new ("is-finished", _ ("A flag indicating whether countdown has finished."), FT_TYPE_BOOLEAN_VALUE, _ft_variables_get_is_finished_ft_evaluate_func);
	_tmp15_ = _tmp14_;
	ft_install_variable (_tmp15_);
	_ft_variable_spec_unref0 (_tmp15_);
	_tmp16_ = ft_variable_spec_new ("is-running", _ ("A flag indicating whether the timer is actively counting down."), FT_TYPE_BOOLEAN_VALUE, _ft_variables_get_is_running_ft_evaluate_func);
	_tmp17_ = _tmp16_;
	ft_install_variable (_tmp17_);
	_ft_variable_spec_unref0 (_tmp17_);
	_tmp18_ = ft_variable_spec_new ("duration", _ ("Duration of the current countdown."), FT_TYPE_INTERVAL_VALUE, _ft_variables_get_duration_ft_evaluate_func);
	_tmp19_ = _tmp18_;
	ft_install_variable (_tmp19_);
	_ft_variable_spec_unref0 (_tmp19_);
	_tmp20_ = ft_variable_spec_new ("offset", _ ("Discrepancy between elapsed time and the time passed."), FT_TYPE_INTERVAL_VALUE, _ft_variables_get_offset_ft_evaluate_func);
	_tmp21_ = _tmp20_;
	ft_install_variable (_tmp21_);
	_ft_variable_spec_unref0 (_tmp21_);
	_tmp22_ = ft_variable_spec_new ("elapsed", _ ("The amount of time spent on the countdown."), FT_TYPE_INTERVAL_VALUE, _ft_variables_get_elapsed_ft_evaluate_func);
	_tmp23_ = _tmp22_;
	ft_install_variable (_tmp23_);
	_ft_variable_spec_unref0 (_tmp23_);
	_tmp24_ = ft_variable_spec_new ("remaining", _ ("The amount of time left before the countdown ends."), FT_TYPE_INTERVAL_VALUE, _ft_variables_get_remaining_ft_evaluate_func);
	_tmp25_ = _tmp24_;
	ft_install_variable (_tmp25_);
	_ft_variable_spec_unref0 (_tmp25_);
	_tmp26_ = ft_variable_spec_new ("start-time", _ ("Time when the countdown has started."), FT_TYPE_TIMESTAMP_VALUE, _ft_variables_get_start_time_ft_evaluate_func);
	_tmp27_ = _tmp26_;
	ft_install_variable (_tmp27_);
	_ft_variable_spec_unref0 (_tmp27_);
}

inline void
ft_variables_ensure_initialized (void)
{
	GHashTable* _tmp0_;
	_tmp0_ = ft_variable_spec_by_name;
	if (_tmp0_ == NULL) {
		ft_variables_initialize ();
	}
}

static gpointer
_ft_variable_spec_ref0 (gpointer self)
{
	return self ? ft_variable_spec_ref (self) : NULL;
}

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

void
ft_install_variable (FtVariableSpec* variable_spec)
{
	FtVariableSpec* _tmp0_;
	GHashTable* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (variable_spec != NULL);
	_tmp0_ = _ft_variable_spec_ref0 (variable_spec);
	_vala_array_add36 (&ft_variable_specs, &ft_variable_specs_length1, &_ft_variable_specs_size_, _tmp0_);
	_tmp1_ = ft_variable_spec_by_name;
	_tmp2_ = variable_spec->name;
	_tmp3_ = g_strdup (_tmp2_);
	g_hash_table_insert (_tmp1_, _tmp3_, variable_spec);
}

FtVariableSpec*
ft_find_variable (const gchar* variable_name)
{
	GHashTable* _tmp0_;
	gconstpointer _tmp1_;
	FtVariableSpec* result;
	g_return_val_if_fail (variable_name != NULL, NULL);
	ft_variables_ensure_initialized ();
	_tmp0_ = ft_variable_spec_by_name;
	_tmp1_ = g_hash_table_lookup (_tmp0_, variable_name);
	result = (FtVariableSpec*) _tmp1_;
	return result;
}

static FtVariableSpec**
_vala_array_dup26 (FtVariableSpec** self,
                   gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (FtVariableSpec*));
	}
	return NULL;
}

FtVariableSpec**
ft_list_variables (gint* result_length1)
{
	FtVariableSpec** _tmp0_;
	gint _tmp0__length1;
	FtVariableSpec** _tmp1_;
	gint _tmp1__length1;
	FtVariableSpec** _tmp2_;
	gint _tmp2__length1;
	FtVariableSpec** result;
	ft_variables_ensure_initialized ();
	_tmp0_ = ft_variable_specs;
	_tmp0__length1 = ft_variable_specs_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup26 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

gboolean
ft_find_variable_format (const gchar* variable_name,
                         const gchar* variable_format)
{
	FtVariableSpec* variable_spec = NULL;
	FtVariableSpec* _tmp0_;
	FtVariableSpec* _tmp1_;
	FtVariableSpec* _tmp2_;
	gboolean result;
	g_return_val_if_fail (variable_name != NULL, FALSE);
	g_return_val_if_fail (variable_format != NULL, FALSE);
	if (g_strcmp0 (variable_format, "") == 0) {
		result = TRUE;
		return result;
	}
	_tmp0_ = ft_find_variable (variable_name);
	_tmp1_ = _ft_variable_spec_ref0 (_tmp0_);
	variable_spec = _tmp1_;
	_tmp2_ = variable_spec;
	if (_tmp2_ != NULL) {
		FtVariableSpec* _tmp3_;
		gint _tmp4_ = 0;
		gchar** _tmp5_;
		_tmp3_ = variable_spec;
		_tmp5_ = ft_list_value_formats (_tmp3_->value_type, &_tmp4_);
		{
			gchar** format_collection = NULL;
			gint format_collection_length1 = 0;
			gint _format_collection_size_ = 0;
			gint format_it = 0;
			format_collection = _tmp5_;
			format_collection_length1 = _tmp4_;
			for (format_it = 0; format_it < format_collection_length1; format_it = format_it + 1) {
				gchar* _tmp6_;
				gchar* format = NULL;
				_tmp6_ = g_strdup (format_collection[format_it]);
				format = _tmp6_;
				{
					const gchar* _tmp7_;
					_tmp7_ = format;
					if (g_strcmp0 (variable_format, _tmp7_) == 0) {
						result = TRUE;
						_g_free0 (format);
						format_collection = (_vala_array_free (format_collection, format_collection_length1, (GDestroyNotify) g_free), NULL);
						_ft_variable_spec_unref0 (variable_spec);
						return result;
					}
					_g_free0 (format);
				}
			}
			format_collection = (_vala_array_free (format_collection, format_collection_length1, (GDestroyNotify) g_free), NULL);
		}
	}
	result = FALSE;
	_ft_variable_spec_unref0 (variable_spec);
	return result;
}

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 inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

