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

/* SPDX-License-Identifier: GPL-3.0-or-later*/

#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "graphs.h"
#include <gtk/gtk.h>
#include <glib-object.h>
#include <gio/gio.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

typedef struct _GraphsColumn GraphsColumn;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	GRAPHS_COLUMNS_PARSER_0_PROPERTY,
	GRAPHS_COLUMNS_PARSER_NUM_PROPERTIES
};
static GParamSpec* graphs_columns_parser_properties[GRAPHS_COLUMNS_PARSER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _gtk_bitset_unref0(var) ((var == NULL) ? NULL : (var = (gtk_bitset_unref (var), NULL)))
typedef enum  {
	GRAPHS_COLUMNS_SEPARATOR_COMMA,
	GRAPHS_COLUMNS_SEPARATOR_PERIOD
} GraphsColumnsSeparator;

#define GRAPHS_TYPE_COLUMNS_SEPARATOR (graphs_columns_separator_get_type ())
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _graphs_column_free0(var) ((var == NULL) ? NULL : (var = (graphs_column_free (var), NULL)))
typedef enum  {
	GRAPHS_COLUMNS_DELIMITER_WHITESPACE,
	GRAPHS_COLUMNS_DELIMITER_TAB,
	GRAPHS_COLUMNS_DELIMITER_COLON,
	GRAPHS_COLUMNS_DELIMITER_SEMICOLON,
	GRAPHS_COLUMNS_DELIMITER_COMMA,
	GRAPHS_COLUMNS_DELIMITER_PERIOD,
	GRAPHS_COLUMNS_DELIMITER_CUSTOM
} GraphsColumnsDelimiter;

#define GRAPHS_TYPE_COLUMNS_DELIMITER (graphs_columns_delimiter_get_type ())
#define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GraphsColumn {
	gdouble* data;
	gint data_length1;
	gint _data_size_;
	gchar* header;
	guint requests;
};

struct _GraphsColumnsParserPrivate {
	GraphsImportSettings* settings;
	gunichar separator;
	GRegex* delimiter_regex;
	GraphsColumnsItemSettings* items;
	gint items_length1;
	gint _items_size_;
	GtkBitset* used_indices;
	guint64 n_used_indices;
	GraphsColumn** columns;
	gint columns_length1;
	gint _columns_size_;
	gint value_size;
};

static gint GraphsColumnsParser_private_offset;
static gpointer graphs_columns_parser_parent_class = NULL;

VALA_EXTERN void graphs_column_free (GraphsColumn * self);
static void graphs_column_instance_init (GraphsColumn * self);
VALA_EXTERN gdouble* graphs_column_get_data (GraphsColumn* self,
                                 gint* result_length1);
static gdouble* _vala_array_dup1 (gdouble* self,
                           gssize length);
VALA_EXTERN GraphsColumn* graphs_column_new (void);
static void _vala_GraphsColumnsItemSettings_array_free (GraphsColumnsItemSettings * array,
                                                 gssize array_length);
VALA_EXTERN GType graphs_columns_separator_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GraphsColumnsSeparator graphs_columns_separator_parse (const gchar* separator);
VALA_EXTERN gunichar graphs_columns_separator_as_unichar (GraphsColumnsSeparator self);
static guint graphs_columns_parser_get_rank (GraphsColumnsParser* self,
                                      guint val);
VALA_EXTERN GType graphs_columns_delimiter_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GraphsColumnsDelimiter graphs_columns_delimiter_parse (const gchar* delimiter);
VALA_EXTERN gchar* graphs_columns_delimiter_to_regex_pattern (GraphsColumnsDelimiter self,
                                                  const gchar* custom_delimiter,
                                                  GError** error);
static void graphs_columns_parser_finalize (GObject * obj);
static GType graphs_columns_parser_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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

gdouble*
graphs_column_get_data (GraphsColumn* self,
                        gint* result_length1)
{
	guint _tmp0_;
	gdouble* _tmp3_;
	gint _tmp3__length1;
	gdouble* _tmp4_;
	gint _tmp4__length1;
	gdouble* _tmp5_;
	gint _tmp5__length1;
	gdouble* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (self->requests == ((guint) 0)) {
		g_assert_not_reached ();
	}
	_tmp0_ = self->requests;
	self->requests = _tmp0_ - 1;
	if (_tmp0_ == ((guint) 1)) {
		gdouble* _tmp1_;
		gint _tmp1__length1;
		gdouble* _tmp2_;
		gint _tmp2__length1;
		_tmp1_ = self->data;
		_tmp1__length1 = self->data_length1;
		self->data = NULL;
		self->data_length1 = 0;
		_tmp2_ = _tmp1_;
		_tmp2__length1 = _tmp1__length1;
		if (result_length1) {
			*result_length1 = _tmp2__length1;
		}
		result = _tmp2_;
		return result;
	}
	_tmp3_ = self->data;
	_tmp3__length1 = self->data_length1;
	_tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup1 (_tmp3_, _tmp3__length1) : _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	_tmp5_ = _tmp4_;
	_tmp5__length1 = _tmp4__length1;
	if (result_length1) {
		*result_length1 = _tmp5__length1;
	}
	result = _tmp5_;
	return result;
}

GraphsColumn*
graphs_column_new (void)
{
	GraphsColumn* self;
	self = g_slice_new0 (GraphsColumn);
	graphs_column_instance_init (self);
	return self;
}

static void
graphs_column_instance_init (GraphsColumn * self)
{
	gdouble* _tmp0_;
	gchar* _tmp1_;
	_tmp0_ = g_new0 (gdouble, 64);
	self->data = _tmp0_;
	self->data_length1 = 64;
	self->_data_size_ = self->data_length1;
	_tmp1_ = g_strdup ("");
	self->header = _tmp1_;
	self->requests = (guint) 0;
}

void
graphs_column_free (GraphsColumn * self)
{
	self->data = (g_free (self->data), NULL);
	_g_free0 (self->header);
	g_slice_free (GraphsColumn, self);
}

static inline gpointer
graphs_columns_parser_get_instance_private (GraphsColumnsParser* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsColumnsParser_private_offset);
}

static void
_vala_GraphsColumnsItemSettings_array_free (GraphsColumnsItemSettings * array,
                                            gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			graphs_columns_item_settings_destroy (&array[i]);
		}
	}
	g_free (array);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

GraphsColumnsParser*
graphs_columns_parser_construct (GType object_type,
                                 GraphsImportSettings* settings,
                                 GError** error)
{
	GraphsColumnsParser * self = NULL;
	GraphsImportSettings* _tmp0_;
	GraphsColumnsSeparator separator = 0;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GraphsColumnsSeparator _tmp3_;
	GVariantIter* iter = NULL;
	GVariant* _tmp4_;
	GVariant* _tmp5_;
	GVariantIter* _tmp6_;
	GVariantIter* _tmp7_;
	GVariantIter* _tmp8_;
	GraphsColumnsItemSettings* _tmp9_;
	GtkBitset* _tmp31_;
	GraphsColumn** _tmp32_;
	GraphsColumnsItemSettings* _tmp37_;
	gint _tmp37__length1;
	GraphsColumnsDelimiter delimiter_enum = 0;
	gchar* _tmp59_;
	gchar* _tmp60_;
	GraphsColumnsDelimiter _tmp61_;
	gchar* pattern = NULL;
	gchar* _tmp62_;
	gchar* _tmp63_;
	gchar* _tmp64_;
	gchar* _tmp65_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (settings != NULL, NULL);
	self = (GraphsColumnsParser*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (settings);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp0_;
	_tmp1_ = graphs_import_settings_get_string (settings, "separator");
	_tmp2_ = _tmp1_;
	_tmp3_ = graphs_columns_separator_parse (_tmp2_);
	_g_free0 (_tmp2_);
	separator = _tmp3_;
	self->priv->separator = graphs_columns_separator_as_unichar (separator);
	_tmp4_ = graphs_import_settings_get_value (settings, "items");
	_tmp5_ = _tmp4_;
	_tmp6_ = g_variant_iter_new (_tmp5_);
	_tmp7_ = _tmp6_;
	_g_variant_unref0 (_tmp5_);
	iter = _tmp7_;
	_tmp8_ = iter;
	_tmp9_ = g_new0 (GraphsColumnsItemSettings, g_variant_iter_n_children (_tmp8_));
	self->priv->items = (_vala_GraphsColumnsItemSettings_array_free (self->priv->items, self->priv->items_length1), NULL);
	self->priv->items = _tmp9_;
	self->priv->items_length1 = g_variant_iter_n_children (_tmp8_);
	self->priv->_items_size_ = self->priv->items_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp10_ = FALSE;
			_tmp10_ = TRUE;
			while (TRUE) {
				GraphsColumnsItemSettings* _tmp12_;
				gint _tmp12__length1;
				GraphsColumnsItemSettings item_settings = {0};
				GVariantIter* _tmp13_;
				GVariant* _tmp14_;
				GVariant* _tmp15_;
				GraphsColumnsItemSettings* _tmp16_;
				gint _tmp16__length1;
				GraphsColumnsItemSettings _tmp17_;
				GraphsColumnsItemSettings _tmp18_;
				GraphsColumnsItemSettings _tmp19_ = {0};
				GraphsColumnsItemSettings _tmp20_;
				GtkBitset* _tmp23_;
				GraphsColumnsItemSettings _tmp24_;
				GraphsColumnsItemSettings _tmp25_;
				GraphsColumnsItemSettings _tmp28_;
				if (!_tmp10_) {
					gint _tmp11_;
					_tmp11_ = i;
					i = _tmp11_ + 1;
				}
				_tmp10_ = FALSE;
				_tmp12_ = self->priv->items;
				_tmp12__length1 = self->priv->items_length1;
				if (!(i < _tmp12__length1)) {
					break;
				}
				memset (&item_settings, 0, sizeof (GraphsColumnsItemSettings));
				_tmp13_ = iter;
				_tmp14_ = g_variant_iter_next_value (_tmp13_);
				_tmp15_ = _tmp14_;
				graphs_columns_item_settings_load_from_variant (&item_settings, _tmp15_);
				_g_variant_unref0 (_tmp15_);
				_tmp16_ = self->priv->items;
				_tmp16__length1 = self->priv->items_length1;
				_tmp17_ = item_settings;
				_tmp18_ = _tmp17_;
				graphs_columns_item_settings_copy (&_tmp18_, &_tmp19_);
				graphs_columns_item_settings_destroy (&_tmp16_[i]);
				_tmp16_[i] = _tmp19_;
				_tmp20_ = item_settings;
				if (!_tmp20_.single_column) {
					GtkBitset* _tmp21_;
					GraphsColumnsItemSettings _tmp22_;
					_tmp21_ = self->priv->used_indices;
					_tmp22_ = item_settings;
					gtk_bitset_add (_tmp21_, (guint) _tmp22_.column_x);
				}
				_tmp23_ = self->priv->used_indices;
				_tmp24_ = item_settings;
				gtk_bitset_add (_tmp23_, (guint) _tmp24_.column_y);
				_tmp25_ = item_settings;
				if (_tmp25_.use_yerr) {
					GtkBitset* _tmp26_;
					GraphsColumnsItemSettings _tmp27_;
					_tmp26_ = self->priv->used_indices;
					_tmp27_ = item_settings;
					gtk_bitset_add (_tmp26_, (guint) _tmp27_.yerr_index);
				}
				_tmp28_ = item_settings;
				if (_tmp28_.use_xerr) {
					GtkBitset* _tmp29_;
					GraphsColumnsItemSettings _tmp30_;
					_tmp29_ = self->priv->used_indices;
					_tmp30_ = item_settings;
					gtk_bitset_add (_tmp29_, (guint) _tmp30_.xerr_index);
				}
				graphs_columns_item_settings_destroy (&item_settings);
			}
		}
	}
	_tmp31_ = self->priv->used_indices;
	self->priv->n_used_indices = gtk_bitset_get_size (_tmp31_);
	_tmp32_ = g_new0 (GraphsColumn*, self->priv->n_used_indices + 1);
	self->priv->columns = (_vala_array_free (self->priv->columns, self->priv->columns_length1, (GDestroyNotify) graphs_column_free), NULL);
	self->priv->columns = _tmp32_;
	self->priv->columns_length1 = self->priv->n_used_indices;
	self->priv->_columns_size_ = self->priv->columns_length1;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp33_ = FALSE;
			_tmp33_ = TRUE;
			while (TRUE) {
				GraphsColumn** _tmp35_;
				gint _tmp35__length1;
				GraphsColumn* _tmp36_;
				if (!_tmp33_) {
					guint _tmp34_;
					_tmp34_ = i;
					i = _tmp34_ + 1;
				}
				_tmp33_ = FALSE;
				if (!(((guint64) i) < self->priv->n_used_indices)) {
					break;
				}
				_tmp35_ = self->priv->columns;
				_tmp35__length1 = self->priv->columns_length1;
				_tmp36_ = graphs_column_new ();
				_graphs_column_free0 (_tmp35_[i]);
				_tmp35_[i] = _tmp36_;
			}
		}
	}
	_tmp37_ = self->priv->items;
	_tmp37__length1 = self->priv->items_length1;
	{
		GraphsColumnsItemSettings* item_settings_collection = NULL;
		gint item_settings_collection_length1 = 0;
		gint _item_settings_collection_size_ = 0;
		gint item_settings_it = 0;
		item_settings_collection = _tmp37_;
		item_settings_collection_length1 = _tmp37__length1;
		for (item_settings_it = 0; item_settings_it < item_settings_collection_length1; item_settings_it = item_settings_it + 1) {
			GraphsColumnsItemSettings _tmp38_;
			GraphsColumnsItemSettings _tmp39_ = {0};
			GraphsColumnsItemSettings item_settings = {0};
			_tmp38_ = item_settings_collection[item_settings_it];
			graphs_columns_item_settings_copy (&_tmp38_, &_tmp39_);
			item_settings = _tmp39_;
			{
				GraphsColumnsItemSettings _tmp40_;
				GraphsColumn** _tmp45_;
				gint _tmp45__length1;
				GraphsColumnsItemSettings _tmp46_;
				GraphsColumn* _tmp47_;
				guint _tmp48_;
				GraphsColumnsItemSettings _tmp49_;
				GraphsColumnsItemSettings _tmp54_;
				_tmp40_ = item_settings;
				if (!_tmp40_.single_column) {
					GraphsColumn** _tmp41_;
					gint _tmp41__length1;
					GraphsColumnsItemSettings _tmp42_;
					GraphsColumn* _tmp43_;
					guint _tmp44_;
					_tmp41_ = self->priv->columns;
					_tmp41__length1 = self->priv->columns_length1;
					_tmp42_ = item_settings;
					_tmp43_ = _tmp41_[graphs_columns_parser_get_rank (self, (guint) _tmp42_.column_x)];
					_tmp44_ = _tmp43_->requests;
					_tmp43_->requests = _tmp44_ + 1;
				}
				_tmp45_ = self->priv->columns;
				_tmp45__length1 = self->priv->columns_length1;
				_tmp46_ = item_settings;
				_tmp47_ = _tmp45_[graphs_columns_parser_get_rank (self, (guint) _tmp46_.column_y)];
				_tmp48_ = _tmp47_->requests;
				_tmp47_->requests = _tmp48_ + 1;
				_tmp49_ = item_settings;
				if (_tmp49_.use_xerr) {
					GraphsColumn** _tmp50_;
					gint _tmp50__length1;
					GraphsColumnsItemSettings _tmp51_;
					GraphsColumn* _tmp52_;
					guint _tmp53_;
					_tmp50_ = self->priv->columns;
					_tmp50__length1 = self->priv->columns_length1;
					_tmp51_ = item_settings;
					_tmp52_ = _tmp50_[graphs_columns_parser_get_rank (self, (guint) _tmp51_.xerr_index)];
					_tmp53_ = _tmp52_->requests;
					_tmp52_->requests = _tmp53_ + 1;
				}
				_tmp54_ = item_settings;
				if (_tmp54_.use_yerr) {
					GraphsColumn** _tmp55_;
					gint _tmp55__length1;
					GraphsColumnsItemSettings _tmp56_;
					GraphsColumn* _tmp57_;
					guint _tmp58_;
					_tmp55_ = self->priv->columns;
					_tmp55__length1 = self->priv->columns_length1;
					_tmp56_ = item_settings;
					_tmp57_ = _tmp55_[graphs_columns_parser_get_rank (self, (guint) _tmp56_.yerr_index)];
					_tmp58_ = _tmp57_->requests;
					_tmp57_->requests = _tmp58_ + 1;
				}
				graphs_columns_item_settings_destroy (&item_settings);
			}
		}
	}
	_tmp59_ = graphs_import_settings_get_string (settings, "delimiter");
	_tmp60_ = _tmp59_;
	_tmp61_ = graphs_columns_delimiter_parse (_tmp60_);
	_g_free0 (_tmp60_);
	delimiter_enum = _tmp61_;
	_tmp62_ = graphs_import_settings_get_string (settings, "custom-delimiter");
	_tmp63_ = _tmp62_;
	_tmp64_ = graphs_columns_delimiter_to_regex_pattern (delimiter_enum, _tmp63_, &_inner_error0_);
	_tmp65_ = _tmp64_;
	_g_free0 (_tmp63_);
	pattern = _tmp65_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_variant_iter_free0 (iter);
		_g_object_unref0 (self);
		return NULL;
	}
	{
		GRegex* _tmp66_ = NULL;
		const gchar* _tmp67_;
		GRegex* _tmp68_;
		GRegex* _tmp69_;
		_tmp67_ = pattern;
		_tmp68_ = g_regex_new (_tmp67_, 0, 0, &_inner_error0_);
		_tmp66_ = _tmp68_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (pattern);
			_g_variant_iter_free0 (iter);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp69_ = _tmp66_;
		_tmp66_ = NULL;
		_g_regex_unref0 (self->priv->delimiter_regex);
		self->priv->delimiter_regex = _tmp69_;
		_g_regex_unref0 (_tmp66_);
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		GError* e = NULL;
		GError* _tmp70_;
		const gchar* _tmp71_;
		GError* _tmp72_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp70_ = e;
		_tmp71_ = _tmp70_->message;
		_tmp72_ = g_error_new_literal (GRAPHS_COLUMNS_PARSE_ERROR, GRAPHS_COLUMNS_PARSE_ERROR_INVALID_CONFIGURATION, _tmp71_);
		_inner_error0_ = _tmp72_;
		_g_error_free0 (e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (pattern);
		_g_variant_iter_free0 (iter);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_free0 (pattern);
	_g_variant_iter_free0 (iter);
	return self;
}

GraphsColumnsParser*
graphs_columns_parser_new (GraphsImportSettings* settings,
                           GError** error)
{
	return graphs_columns_parser_construct (GRAPHS_TYPE_COLUMNS_PARSER, settings, error);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

void
graphs_columns_parser_parse (GraphsColumnsParser* self,
                             GError** error)
{
	gint skip_rows = 0;
	GraphsImportSettings* _tmp0_;
	gint max_index = 0;
	GtkBitset* _tmp1_;
	GFileInputStream* _tmp2_ = NULL;
	GraphsImportSettings* _tmp3_;
	GFile* _tmp4_;
	GFile* _tmp5_;
	GFileInputStream* _tmp6_;
	GDataInputStream* stream = NULL;
	GDataInputStream* _tmp7_;
	gchar* line = NULL;
	gint line_number = 0;
	GtkBitsetIter bitset_iter = {0};
	guint column_index = 0U;
	guint column_rank = 0U;
	gdouble val = 0.0;
	gint array_size = 0;
	GraphsColumn** _tmp8_;
	gint _tmp8__length1;
	GraphsColumn* _tmp9_;
	gdouble* _tmp10_;
	gint _tmp10__length1;
	GraphsColumn** _tmp69_;
	gint _tmp69__length1;
	GDataInputStream* _tmp72_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	skip_rows = graphs_import_settings_get_int (_tmp0_, "skip-rows");
	_tmp1_ = self->priv->used_indices;
	max_index = (gint) gtk_bitset_get_maximum (_tmp1_);
	_tmp3_ = self->priv->settings;
	_tmp4_ = graphs_import_settings_get_file (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_file_read (_tmp5_, NULL, &_inner_error0_);
	_tmp2_ = _tmp6_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp7_ = g_data_input_stream_new ((GInputStream*) _tmp2_);
	stream = _tmp7_;
	line_number = 0;
	memset (&bitset_iter, 0, sizeof (GtkBitsetIter));
	_tmp8_ = self->priv->columns;
	_tmp8__length1 = self->priv->columns_length1;
	_tmp9_ = _tmp8_[0];
	_tmp10_ = _tmp9_->data;
	_tmp10__length1 = _tmp9_->data_length1;
	array_size = _tmp10__length1;
	while (TRUE) {
		gchar* _tmp11_ = NULL;
		GDataInputStream* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		const gchar* _tmp15_;
		gboolean _tmp16_ = FALSE;
		gint _tmp17_;
		gint _tmp18_;
		gchar** str_values = NULL;
		GRegex* _tmp24_;
		const gchar* _tmp25_;
		gchar** _tmp26_;
		gchar** _tmp27_;
		gint str_values_length1;
		gint _str_values_size_;
		gboolean _tmp28_ = FALSE;
		gchar** _tmp29_;
		gint _tmp29__length1;
		GtkBitset* _tmp41_;
		guint _tmp42_ = 0U;
		gint _tmp68_;
		_tmp12_ = stream;
		_tmp13_ = g_data_input_stream_read_line (_tmp12_, NULL, NULL, &_inner_error0_);
		_tmp11_ = _tmp13_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (line);
			_g_object_unref0 (stream);
			_g_object_unref0 (_tmp2_);
			return;
		}
		_tmp14_ = _tmp11_;
		_tmp11_ = NULL;
		_g_free0 (line);
		line = _tmp14_;
		_tmp15_ = line;
		if (!(_tmp15_ != NULL)) {
			_g_free0 (_tmp11_);
			break;
		}
		line_number = line_number + 1;
		_tmp17_ = line_number;
		_tmp18_ = skip_rows;
		if (_tmp17_ <= _tmp18_) {
			_tmp16_ = TRUE;
		} else {
			const gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			gint _tmp22_;
			gint _tmp23_;
			_tmp19_ = line;
			_tmp20_ = string_strip (_tmp19_);
			_tmp21_ = _tmp20_;
			_tmp22_ = strlen (_tmp21_);
			_tmp23_ = _tmp22_;
			_tmp16_ = _tmp23_ == 0;
			_g_free0 (_tmp21_);
		}
		if (_tmp16_) {
			_g_free0 (_tmp11_);
			continue;
		}
		_tmp24_ = self->priv->delimiter_regex;
		_tmp25_ = line;
		_tmp27_ = _tmp26_ = g_regex_split_full (_tmp24_, _tmp25_, (gssize) -1, 0, 0, ((gint) max_index) + 2, &_inner_error0_);
		str_values = _tmp27_;
		str_values_length1 = _vala_array_length (_tmp26_);
		_str_values_size_ = str_values_length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (_tmp11_);
			_g_free0 (line);
			_g_object_unref0 (stream);
			_g_object_unref0 (_tmp2_);
			return;
		}
		_tmp29_ = str_values;
		_tmp29__length1 = str_values_length1;
		if (_tmp29__length1 < (max_index + 1)) {
			_tmp28_ = self->priv->value_size > 0;
		} else {
			_tmp28_ = FALSE;
		}
		if (_tmp28_) {
			GraphsImportSettings* _tmp30_;
			const gchar* _tmp31_;
			const gchar* _tmp32_;
			gchar** _tmp33_;
			gint _tmp33__length1;
			gchar* _tmp34_;
			gchar* _tmp35_;
			GError* _tmp36_;
			GError* _tmp37_;
			_tmp30_ = self->priv->settings;
			_tmp31_ = graphs_import_settings_get_filename (_tmp30_);
			_tmp32_ = _tmp31_;
			_tmp33_ = str_values;
			_tmp33__length1 = str_values_length1;
			_tmp34_ = g_strdup_printf (_ ("Index error in %s, cannot access index %d on line %d, only %d columns " \
"were found"), _tmp32_, max_index, line_number, _tmp33__length1);
			_tmp35_ = _tmp34_;
			_tmp36_ = g_error_new_literal (GRAPHS_COLUMNS_PARSE_ERROR, GRAPHS_COLUMNS_PARSE_ERROR_INDEX_ERROR, _tmp35_);
			_tmp37_ = _tmp36_;
			_g_free0 (_tmp35_);
			_inner_error0_ = _tmp37_;
			g_propagate_error (error, _inner_error0_);
			str_values = (_vala_array_free (str_values, str_values_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (_tmp11_);
			_g_free0 (line);
			_g_object_unref0 (stream);
			_g_object_unref0 (_tmp2_);
			return;
		}
		if (self->priv->value_size == array_size) {
			GraphsColumn** _tmp38_;
			gint _tmp38__length1;
			array_size *= 2;
			_tmp38_ = self->priv->columns;
			_tmp38__length1 = self->priv->columns_length1;
			{
				GraphsColumn** column_collection = NULL;
				gint column_collection_length1 = 0;
				gint _column_collection_size_ = 0;
				gint column_it = 0;
				column_collection = _tmp38_;
				column_collection_length1 = _tmp38__length1;
				for (column_it = 0; column_it < column_collection_length1; column_it = column_it + 1) {
					GraphsColumn* column = NULL;
					column = column_collection[column_it];
					{
						GraphsColumn* _tmp39_;
						gint _tmp40_;
						_tmp39_ = column;
						_tmp40_ = array_size;
						_tmp39_->data = g_renew (gdouble, _tmp39_->data, array_size);
						(_tmp40_ > _tmp39_->data_length1) ? memset (_tmp39_->data + _tmp39_->data_length1, 0, sizeof (gdouble) * (_tmp40_ - _tmp39_->data_length1)) : NULL;
						_tmp39_->data_length1 = _tmp40_;
						_tmp39_->_data_size_ = _tmp40_;
					}
				}
			}
		}
		_tmp41_ = self->priv->used_indices;
		gtk_bitset_iter_init_first (&bitset_iter, _tmp41_, &_tmp42_);
		column_index = _tmp42_;
		column_rank = (guint) 0;
		{
			gboolean _tmp43_ = FALSE;
			_tmp43_ = TRUE;
			while (TRUE) {
				gchar** _tmp46_;
				gint _tmp46__length1;
				gchar** _tmp47_;
				gint _tmp47__length1;
				const gchar* _tmp48_;
				gdouble* _tmp49_ = NULL;
				gboolean _tmp50_;
				gdouble* _tmp51_;
				gboolean _tmp52_;
				GraphsColumn** _tmp62_;
				gint _tmp62__length1;
				guint _tmp63_;
				GraphsColumn* _tmp64_;
				gchar** _tmp65_;
				gint _tmp65__length1;
				const gchar* _tmp66_;
				gchar* _tmp67_;
				if (!_tmp43_) {
					guint _tmp44_ = 0U;
					gboolean _tmp45_;
					_tmp45_ = gtk_bitset_iter_next (&bitset_iter, &_tmp44_);
					column_index = _tmp44_;
					if (!_tmp45_) {
						break;
					}
				}
				_tmp43_ = FALSE;
				_tmp46_ = str_values;
				_tmp46__length1 = str_values_length1;
				if (column_index >= ((guint) _tmp46__length1)) {
					break;
				}
				_tmp47_ = str_values;
				_tmp47__length1 = str_values_length1;
				_tmp48_ = _tmp47_[column_index];
				_tmp50_ = graphs_try_evaluate_string (_tmp48_, &_tmp49_, self->priv->separator);
				_tmp51_ = _tmp49_;
				val = *_tmp51_;
				_tmp52_ = _tmp50_;
				_g_free0 (_tmp51_);
				if (_tmp52_) {
					GraphsColumn** _tmp53_;
					gint _tmp53__length1;
					guint _tmp54_;
					GraphsColumn* _tmp55_;
					gdouble* _tmp56_;
					gint _tmp56__length1;
					gdouble _tmp57_;
					_tmp53_ = self->priv->columns;
					_tmp53__length1 = self->priv->columns_length1;
					_tmp54_ = column_rank;
					column_rank = _tmp54_ + 1;
					_tmp55_ = _tmp53_[_tmp54_];
					_tmp56_ = _tmp55_->data;
					_tmp56__length1 = _tmp55_->data_length1;
					_tmp57_ = val;
					_tmp56_[self->priv->value_size] = _tmp57_;
					continue;
				}
				if (self->priv->value_size > 0) {
					gchar* _tmp58_;
					gchar* _tmp59_;
					GError* _tmp60_;
					GError* _tmp61_;
					_tmp58_ = g_strdup_printf (_ ("Cannot import from file, bad value on line %d"), line_number);
					_tmp59_ = _tmp58_;
					_tmp60_ = g_error_new_literal (GRAPHS_COLUMNS_PARSE_ERROR, GRAPHS_COLUMNS_PARSE_ERROR_IMPORT_ERROR, _tmp59_);
					_tmp61_ = _tmp60_;
					_g_free0 (_tmp59_);
					_inner_error0_ = _tmp61_;
					g_propagate_error (error, _inner_error0_);
					str_values = (_vala_array_free (str_values, str_values_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (_tmp11_);
					_g_free0 (line);
					_g_object_unref0 (stream);
					_g_object_unref0 (_tmp2_);
					return;
				}
				_tmp62_ = self->priv->columns;
				_tmp62__length1 = self->priv->columns_length1;
				_tmp63_ = column_rank;
				column_rank = _tmp63_ + 1;
				_tmp64_ = _tmp62_[_tmp63_];
				_tmp65_ = str_values;
				_tmp65__length1 = str_values_length1;
				_tmp66_ = _tmp65_[column_index];
				_tmp67_ = g_strdup (_tmp66_);
				_g_free0 (_tmp64_->header);
				_tmp64_->header = _tmp67_;
				self->priv->value_size = -1;
			}
		}
		_tmp68_ = self->priv->value_size;
		self->priv->value_size = _tmp68_ + 1;
		str_values = (_vala_array_free (str_values, str_values_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_tmp11_);
	}
	_tmp69_ = self->priv->columns;
	_tmp69__length1 = self->priv->columns_length1;
	{
		GraphsColumn** column_collection = NULL;
		gint column_collection_length1 = 0;
		gint _column_collection_size_ = 0;
		gint column_it = 0;
		column_collection = _tmp69_;
		column_collection_length1 = _tmp69__length1;
		for (column_it = 0; column_it < column_collection_length1; column_it = column_it + 1) {
			GraphsColumn* column = NULL;
			column = column_collection[column_it];
			{
				GraphsColumn* _tmp70_;
				gint _tmp71_;
				_tmp70_ = column;
				_tmp71_ = self->priv->value_size;
				_tmp70_->data = g_renew (gdouble, _tmp70_->data, self->priv->value_size);
				(_tmp71_ > _tmp70_->data_length1) ? memset (_tmp70_->data + _tmp70_->data_length1, 0, sizeof (gdouble) * (_tmp71_ - _tmp70_->data_length1)) : NULL;
				_tmp70_->data_length1 = _tmp71_;
				_tmp70_->_data_size_ = _tmp71_;
			}
		}
	}
	_tmp72_ = stream;
	g_input_stream_close ((GInputStream*) _tmp72_, NULL, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (line);
		_g_object_unref0 (stream);
		_g_object_unref0 (_tmp2_);
		return;
	}
	_g_free0 (line);
	_g_object_unref0 (stream);
	_g_object_unref0 (_tmp2_);
}

void
graphs_columns_parser_add_items (GraphsColumnsParser* self,
                                 GraphsData* data,
                                 GraphsItemList* itemlist,
                                 GError** error)
{
	GraphsColumnsItemSettings* _tmp0_;
	gint _tmp0__length1;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (data != NULL);
	g_return_if_fail (itemlist != NULL);
	_tmp0_ = self->priv->items;
	_tmp0__length1 = self->priv->items_length1;
	{
		GraphsColumnsItemSettings* item_settings_collection = NULL;
		gint item_settings_collection_length1 = 0;
		gint _item_settings_collection_size_ = 0;
		gint item_settings_it = 0;
		item_settings_collection = _tmp0_;
		item_settings_collection_length1 = _tmp0__length1;
		for (item_settings_it = 0; item_settings_it < item_settings_collection_length1; item_settings_it = item_settings_it + 1) {
			GraphsColumnsItemSettings _tmp1_;
			GraphsColumnsItemSettings _tmp2_ = {0};
			GraphsColumnsItemSettings item_settings = {0};
			_tmp1_ = item_settings_collection[item_settings_it];
			graphs_columns_item_settings_copy (&_tmp1_, &_tmp2_);
			item_settings = _tmp2_;
			{
				guint yrank = 0U;
				GraphsColumnsItemSettings _tmp3_;
				gchar* ylabel = NULL;
				GraphsColumn** _tmp4_;
				gint _tmp4__length1;
				GraphsColumn* _tmp5_;
				const gchar* _tmp6_;
				gchar* _tmp7_;
				gdouble* ydata = NULL;
				GraphsColumn** _tmp8_;
				gint _tmp8__length1;
				GraphsColumn* _tmp9_;
				gint _tmp10_ = 0;
				gdouble* _tmp11_;
				gint ydata_length1;
				gint _ydata_size_;
				gdouble* _tmp12_ = NULL;
				gint _tmp12__length1 = 0;
				gint __tmp12__size_ = 0;
				GraphsColumnsItemSettings _tmp13_;
				gdouble* xerr = NULL;
				gdouble* _tmp19_;
				gint _tmp19__length1;
				gint xerr_length1;
				gint _xerr_size_;
				gdouble* _tmp20_ = NULL;
				gint _tmp20__length1 = 0;
				gint __tmp20__size_ = 0;
				GraphsColumnsItemSettings _tmp21_;
				gdouble* yerr = NULL;
				gdouble* _tmp27_;
				gint _tmp27__length1;
				gint yerr_length1;
				gint _yerr_size_;
				gchar* xlabel = NULL;
				gdouble* xdata = NULL;
				gint xdata_length1 = 0;
				gint _xdata_size_ = 0;
				GraphsColumnsItemSettings _tmp28_;
				GraphsItem* item = NULL;
				gdouble* _tmp51_;
				gint _tmp51__length1;
				gdouble* _tmp52_;
				gint _tmp52__length1;
				gdouble* _tmp53_;
				gint _tmp53__length1;
				gdouble* _tmp54_;
				gint _tmp54__length1;
				GraphsDataItem* _tmp55_;
				GraphsItem* _tmp56_;
				const gchar* _tmp57_;
				GraphsItem* _tmp58_;
				const gchar* _tmp59_;
				GraphsItem* _tmp60_;
				GraphsImportSettings* _tmp61_;
				const gchar* _tmp62_;
				const gchar* _tmp63_;
				GraphsItem* _tmp64_;
				_tmp3_ = item_settings;
				yrank = graphs_columns_parser_get_rank (self, (guint) _tmp3_.column_y);
				_tmp4_ = self->priv->columns;
				_tmp4__length1 = self->priv->columns_length1;
				_tmp5_ = _tmp4_[yrank];
				_tmp6_ = _tmp5_->header;
				_tmp7_ = g_strdup (_tmp6_);
				ylabel = _tmp7_;
				_tmp8_ = self->priv->columns;
				_tmp8__length1 = self->priv->columns_length1;
				_tmp9_ = _tmp8_[yrank];
				_tmp11_ = graphs_column_get_data (_tmp9_, &_tmp10_);
				ydata = _tmp11_;
				ydata_length1 = _tmp10_;
				_ydata_size_ = ydata_length1;
				_tmp13_ = item_settings;
				if (_tmp13_.use_xerr) {
					GraphsColumn** _tmp14_;
					gint _tmp14__length1;
					GraphsColumnsItemSettings _tmp15_;
					GraphsColumn* _tmp16_;
					gint _tmp17_ = 0;
					gdouble* _tmp18_;
					_tmp14_ = self->priv->columns;
					_tmp14__length1 = self->priv->columns_length1;
					_tmp15_ = item_settings;
					_tmp16_ = _tmp14_[graphs_columns_parser_get_rank (self, (guint) _tmp15_.xerr_index)];
					_tmp18_ = graphs_column_get_data (_tmp16_, &_tmp17_);
					_tmp12_ = (g_free (_tmp12_), NULL);
					_tmp12_ = _tmp18_;
					_tmp12__length1 = _tmp17_;
					__tmp12__size_ = _tmp12__length1;
				} else {
					_tmp12_ = (g_free (_tmp12_), NULL);
					_tmp12_ = NULL;
					_tmp12__length1 = 0;
					__tmp12__size_ = _tmp12__length1;
				}
				_tmp19_ = _tmp12_;
				_tmp19__length1 = _tmp12__length1;
				_tmp12_ = NULL;
				_tmp12__length1 = 0;
				xerr = _tmp19_;
				xerr_length1 = _tmp19__length1;
				_xerr_size_ = xerr_length1;
				_tmp21_ = item_settings;
				if (_tmp21_.use_yerr) {
					GraphsColumn** _tmp22_;
					gint _tmp22__length1;
					GraphsColumnsItemSettings _tmp23_;
					GraphsColumn* _tmp24_;
					gint _tmp25_ = 0;
					gdouble* _tmp26_;
					_tmp22_ = self->priv->columns;
					_tmp22__length1 = self->priv->columns_length1;
					_tmp23_ = item_settings;
					_tmp24_ = _tmp22_[graphs_columns_parser_get_rank (self, (guint) _tmp23_.yerr_index)];
					_tmp26_ = graphs_column_get_data (_tmp24_, &_tmp25_);
					_tmp20_ = (g_free (_tmp20_), NULL);
					_tmp20_ = _tmp26_;
					_tmp20__length1 = _tmp25_;
					__tmp20__size_ = _tmp20__length1;
				} else {
					_tmp20_ = (g_free (_tmp20_), NULL);
					_tmp20_ = NULL;
					_tmp20__length1 = 0;
					__tmp20__size_ = _tmp20__length1;
				}
				_tmp27_ = _tmp20_;
				_tmp27__length1 = _tmp20__length1;
				_tmp20_ = NULL;
				_tmp20__length1 = 0;
				yerr = _tmp27_;
				yerr_length1 = _tmp27__length1;
				_yerr_size_ = yerr_length1;
				_tmp28_ = item_settings;
				if (_tmp28_.single_column) {
					gchar* _tmp29_;
					_tmp29_ = g_strdup ("");
					_g_free0 (xlabel);
					xlabel = _tmp29_;
					{
						gchar* equation = NULL;
						GraphsColumnsItemSettings _tmp30_;
						const gchar* _tmp31_;
						gchar* _tmp32_;
						gdouble* _tmp33_ = NULL;
						const gchar* _tmp34_;
						gdouble* _tmp35_;
						gint _tmp35__length1;
						gint _tmp36_ = 0;
						gdouble* _tmp37_;
						gint _tmp33__length1;
						gint __tmp33__size_;
						gdouble* _tmp38_;
						gint _tmp38__length1;
						_tmp30_ = item_settings;
						_tmp31_ = _tmp30_.equation;
						_tmp32_ = graphs_preprocess_equation (_tmp31_, &_inner_error0_);
						equation = _tmp32_;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								goto __catch0_graphs_math_error;
							}
							xdata = (g_free (xdata), NULL);
							_g_free0 (xlabel);
							yerr = (g_free (yerr), NULL);
							_tmp20_ = (g_free (_tmp20_), NULL);
							xerr = (g_free (xerr), NULL);
							_tmp12_ = (g_free (_tmp12_), NULL);
							ydata = (g_free (ydata), NULL);
							_g_free0 (ylabel);
							graphs_columns_item_settings_destroy (&item_settings);
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
						_tmp34_ = equation;
						_tmp35_ = ydata;
						_tmp35__length1 = ydata_length1;
						_tmp37_ = graphs_python_helper_evaluate_expression (_tmp34_, _tmp35__length1, "n", &_tmp36_, &_inner_error0_);
						_tmp33_ = _tmp37_;
						_tmp33__length1 = _tmp36_;
						__tmp33__size_ = _tmp33__length1;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							_g_free0 (equation);
							if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
								goto __catch0_graphs_math_error;
							}
							xdata = (g_free (xdata), NULL);
							_g_free0 (xlabel);
							yerr = (g_free (yerr), NULL);
							_tmp20_ = (g_free (_tmp20_), NULL);
							xerr = (g_free (xerr), NULL);
							_tmp12_ = (g_free (_tmp12_), NULL);
							ydata = (g_free (ydata), NULL);
							_g_free0 (ylabel);
							graphs_columns_item_settings_destroy (&item_settings);
							g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return;
						}
						_tmp38_ = _tmp33_;
						_tmp38__length1 = _tmp33__length1;
						_tmp33_ = NULL;
						_tmp33__length1 = 0;
						xdata = (g_free (xdata), NULL);
						xdata = _tmp38_;
						xdata_length1 = _tmp38__length1;
						_xdata_size_ = xdata_length1;
						_tmp33_ = (g_free (_tmp33_), NULL);
						_g_free0 (equation);
					}
					goto __finally0;
					__catch0_graphs_math_error:
					{
						GError* e = NULL;
						GError* _tmp39_;
						const gchar* _tmp40_;
						GError* _tmp41_;
						e = _inner_error0_;
						_inner_error0_ = NULL;
						_tmp39_ = e;
						_tmp40_ = _tmp39_->message;
						_tmp41_ = g_error_new_literal (GRAPHS_COLUMNS_PARSE_ERROR, GRAPHS_COLUMNS_PARSE_ERROR_INVALID_CONFIGURATION, _tmp40_);
						_inner_error0_ = _tmp41_;
						_g_error_free0 (e);
						goto __finally0;
					}
					__finally0:
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						g_propagate_error (error, _inner_error0_);
						xdata = (g_free (xdata), NULL);
						_g_free0 (xlabel);
						yerr = (g_free (yerr), NULL);
						_tmp20_ = (g_free (_tmp20_), NULL);
						xerr = (g_free (xerr), NULL);
						_tmp12_ = (g_free (_tmp12_), NULL);
						ydata = (g_free (ydata), NULL);
						_g_free0 (ylabel);
						graphs_columns_item_settings_destroy (&item_settings);
						return;
					}
				} else {
					guint xrank = 0U;
					GraphsColumnsItemSettings _tmp42_;
					GraphsColumn** _tmp43_;
					gint _tmp43__length1;
					GraphsColumn* _tmp44_;
					const gchar* _tmp45_;
					gchar* _tmp46_;
					GraphsColumn** _tmp47_;
					gint _tmp47__length1;
					GraphsColumn* _tmp48_;
					gint _tmp49_ = 0;
					gdouble* _tmp50_;
					_tmp42_ = item_settings;
					xrank = graphs_columns_parser_get_rank (self, (guint) _tmp42_.column_x);
					_tmp43_ = self->priv->columns;
					_tmp43__length1 = self->priv->columns_length1;
					_tmp44_ = _tmp43_[xrank];
					_tmp45_ = _tmp44_->header;
					_tmp46_ = g_strdup (_tmp45_);
					_g_free0 (xlabel);
					xlabel = _tmp46_;
					_tmp47_ = self->priv->columns;
					_tmp47__length1 = self->priv->columns_length1;
					_tmp48_ = _tmp47_[xrank];
					_tmp50_ = graphs_column_get_data (_tmp48_, &_tmp49_);
					xdata = (g_free (xdata), NULL);
					xdata = _tmp50_;
					xdata_length1 = _tmp49_;
					_xdata_size_ = xdata_length1;
				}
				_tmp51_ = xdata;
				_tmp51__length1 = xdata_length1;
				_tmp52_ = ydata;
				_tmp52__length1 = ydata_length1;
				_tmp53_ = xerr;
				_tmp53__length1 = xerr_length1;
				_tmp54_ = yerr;
				_tmp54__length1 = yerr_length1;
				_tmp55_ = graphs_item_factory_new_data_item (data, _tmp51_, (gint) _tmp51__length1, _tmp52_, (gint) _tmp52__length1, _tmp53_, (gint) _tmp53__length1, _tmp54_, (gint) _tmp54__length1);
				item = (GraphsItem*) _tmp55_;
				_tmp56_ = item;
				_tmp57_ = xlabel;
				graphs_item_set_xlabel (_tmp56_, _tmp57_);
				_tmp58_ = item;
				_tmp59_ = ylabel;
				graphs_item_set_ylabel (_tmp58_, _tmp59_);
				_tmp60_ = item;
				_tmp61_ = self->priv->settings;
				_tmp62_ = graphs_import_settings_get_filename (_tmp61_);
				_tmp63_ = _tmp62_;
				graphs_item_set_name (_tmp60_, _tmp63_);
				_tmp64_ = item;
				graphs_item_list_add (itemlist, _tmp64_);
				_g_object_unref0 (item);
				xdata = (g_free (xdata), NULL);
				_g_free0 (xlabel);
				yerr = (g_free (yerr), NULL);
				_tmp20_ = (g_free (_tmp20_), NULL);
				xerr = (g_free (xerr), NULL);
				_tmp12_ = (g_free (_tmp12_), NULL);
				ydata = (g_free (ydata), NULL);
				_g_free0 (ylabel);
				graphs_columns_item_settings_destroy (&item_settings);
			}
		}
	}
}

static guint
graphs_columns_parser_get_rank (GraphsColumnsParser* self,
                                guint val)
{
	guint current = 0U;
	guint rank = 0U;
	GtkBitsetIter bitset_iter = {0};
	GtkBitset* _tmp0_;
	guint _tmp1_ = 0U;
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	rank = (guint) 0;
	memset (&bitset_iter, 0, sizeof (GtkBitsetIter));
	_tmp0_ = self->priv->used_indices;
	gtk_bitset_iter_init_first (&bitset_iter, _tmp0_, &_tmp1_);
	current = _tmp1_;
	{
		gboolean _tmp2_ = FALSE;
		_tmp2_ = TRUE;
		while (TRUE) {
			guint _tmp5_;
			if (!_tmp2_) {
				guint _tmp3_ = 0U;
				gboolean _tmp4_;
				_tmp4_ = gtk_bitset_iter_next (&bitset_iter, &_tmp3_);
				current = _tmp3_;
				if (!_tmp4_) {
					break;
				}
			}
			_tmp2_ = FALSE;
			if (current == val) {
				result = rank;
				return result;
			}
			_tmp5_ = rank;
			rank = _tmp5_ + 1;
		}
	}
	g_assert_not_reached ();
}

static void
graphs_columns_parser_class_init (GraphsColumnsParserClass * klass,
                                  gpointer klass_data)
{
	graphs_columns_parser_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsColumnsParser_private_offset);
	G_OBJECT_CLASS (klass)->finalize = graphs_columns_parser_finalize;
}

static void
graphs_columns_parser_instance_init (GraphsColumnsParser * self,
                                     gpointer klass)
{
	GtkBitset* _tmp0_;
	self->priv = graphs_columns_parser_get_instance_private (self);
	_tmp0_ = gtk_bitset_new_empty ();
	self->priv->used_indices = _tmp0_;
	self->priv->value_size = 0;
}

static void
graphs_columns_parser_finalize (GObject * obj)
{
	GraphsColumnsParser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_COLUMNS_PARSER, GraphsColumnsParser);
	_g_object_unref0 (self->priv->settings);
	_g_regex_unref0 (self->priv->delimiter_regex);
	self->priv->items = (_vala_GraphsColumnsItemSettings_array_free (self->priv->items, self->priv->items_length1), NULL);
	_gtk_bitset_unref0 (self->priv->used_indices);
	self->priv->columns = (_vala_array_free (self->priv->columns, self->priv->columns_length1, (GDestroyNotify) graphs_column_free), NULL);
	G_OBJECT_CLASS (graphs_columns_parser_parent_class)->finalize (obj);
}

/**
     * Reader class for parsing column-based text files
     */
static GType
graphs_columns_parser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsColumnsParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_columns_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsColumnsParser), 0, (GInstanceInitFunc) graphs_columns_parser_instance_init, NULL };
	GType graphs_columns_parser_type_id;
	graphs_columns_parser_type_id = g_type_register_static (G_TYPE_OBJECT, "GraphsColumnsParser", &g_define_type_info, 0);
	GraphsColumnsParser_private_offset = g_type_add_instance_private (graphs_columns_parser_type_id, sizeof (GraphsColumnsParserPrivate));
	return graphs_columns_parser_type_id;
}

GType
graphs_columns_parser_get_type (void)
{
	static volatile gsize graphs_columns_parser_type_id__once = 0;
	if (g_once_init_enter (&graphs_columns_parser_type_id__once)) {
		GType graphs_columns_parser_type_id;
		graphs_columns_parser_type_id = graphs_columns_parser_get_type_once ();
		g_once_init_leave (&graphs_columns_parser_type_id__once, graphs_columns_parser_type_id);
	}
	return graphs_columns_parser_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;
}

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

