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

/*
* Copyright (C) 2015 The Lemon Man
*
* 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 2, 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.
*/

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>


#define GEDIT_FIND_IN_FILES_PLUGIN_TYPE_IMATCHER (gedit_find_in_files_plugin_imatcher_get_type ())
#define GEDIT_FIND_IN_FILES_PLUGIN_IMATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_IMATCHER, GeditFindInFilesPluginIMatcher))
#define GEDIT_FIND_IN_FILES_PLUGIN_IS_IMATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_IMATCHER))
#define GEDIT_FIND_IN_FILES_PLUGIN_IMATCHER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_IMATCHER, GeditFindInFilesPluginIMatcherIface))

typedef struct _GeditFindInFilesPluginIMatcher GeditFindInFilesPluginIMatcher;
typedef struct _GeditFindInFilesPluginIMatcherIface GeditFindInFilesPluginIMatcherIface;

#define GEDIT_FIND_IN_FILES_PLUGIN_TYPE_RANGE (gedit_find_in_files_plugin_range_get_type ())
typedef struct _GeditFindInFilesPluginRange GeditFindInFilesPluginRange;

#define GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND (gedit_find_in_files_plugin_regex_find_get_type ())
#define GEDIT_FIND_IN_FILES_PLUGIN_REGEX_FIND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND, GeditFindInFilesPluginRegexFind))
#define GEDIT_FIND_IN_FILES_PLUGIN_REGEX_FIND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND, GeditFindInFilesPluginRegexFindClass))
#define GEDIT_FIND_IN_FILES_PLUGIN_IS_REGEX_FIND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND))
#define GEDIT_FIND_IN_FILES_PLUGIN_IS_REGEX_FIND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND))
#define GEDIT_FIND_IN_FILES_PLUGIN_REGEX_FIND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND, GeditFindInFilesPluginRegexFindClass))

typedef struct _GeditFindInFilesPluginRegexFind GeditFindInFilesPluginRegexFind;
typedef struct _GeditFindInFilesPluginRegexFindClass GeditFindInFilesPluginRegexFindClass;
typedef struct _GeditFindInFilesPluginRegexFindPrivate GeditFindInFilesPluginRegexFindPrivate;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL (gedit_find_in_files_plugin_boyer_moore_horspool_get_type ())
#define GEDIT_FIND_IN_FILES_PLUGIN_BOYER_MOORE_HORSPOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL, GeditFindInFilesPluginBoyerMooreHorspool))
#define GEDIT_FIND_IN_FILES_PLUGIN_BOYER_MOORE_HORSPOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL, GeditFindInFilesPluginBoyerMooreHorspoolClass))
#define GEDIT_FIND_IN_FILES_PLUGIN_IS_BOYER_MOORE_HORSPOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL))
#define GEDIT_FIND_IN_FILES_PLUGIN_IS_BOYER_MOORE_HORSPOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL))
#define GEDIT_FIND_IN_FILES_PLUGIN_BOYER_MOORE_HORSPOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL, GeditFindInFilesPluginBoyerMooreHorspoolClass))

typedef struct _GeditFindInFilesPluginBoyerMooreHorspool GeditFindInFilesPluginBoyerMooreHorspool;
typedef struct _GeditFindInFilesPluginBoyerMooreHorspoolClass GeditFindInFilesPluginBoyerMooreHorspoolClass;
typedef struct _GeditFindInFilesPluginBoyerMooreHorspoolPrivate GeditFindInFilesPluginBoyerMooreHorspoolPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GeditFindInFilesPluginRange {
	gsize from;
	gsize to;
};

struct _GeditFindInFilesPluginIMatcherIface {
	GTypeInterface parent_iface;
	gboolean (*has_match) (GeditFindInFilesPluginIMatcher* self, guint8* text, gsize text_length, gsize pos, GeditFindInFilesPluginRange* match);
};

struct _GeditFindInFilesPluginRegexFind {
	GObject parent_instance;
	GeditFindInFilesPluginRegexFindPrivate * priv;
};

struct _GeditFindInFilesPluginRegexFindClass {
	GObjectClass parent_class;
};

struct _GeditFindInFilesPluginRegexFindPrivate {
	GRegex* re;
};

struct _GeditFindInFilesPluginBoyerMooreHorspool {
	GObject parent_instance;
	GeditFindInFilesPluginBoyerMooreHorspoolPrivate * priv;
};

struct _GeditFindInFilesPluginBoyerMooreHorspoolClass {
	GObjectClass parent_class;
};

struct _GeditFindInFilesPluginBoyerMooreHorspoolPrivate {
	gchar* pattern;
	gint bad_char_shift[256];
	gboolean ignore_case;
};


static gpointer gedit_find_in_files_plugin_regex_find_parent_class = NULL;
static GeditFindInFilesPluginIMatcherIface* gedit_find_in_files_plugin_regex_find_gedit_find_in_files_plugin_imatcher_parent_iface = NULL;
static GType gedit_find_in_files_plugin_regex_find_type_id = 0;
static gpointer gedit_find_in_files_plugin_boyer_moore_horspool_parent_class = NULL;
static GeditFindInFilesPluginIMatcherIface* gedit_find_in_files_plugin_boyer_moore_horspool_gedit_find_in_files_plugin_imatcher_parent_iface = NULL;
static GType gedit_find_in_files_plugin_boyer_moore_horspool_type_id = 0;

GType gedit_find_in_files_plugin_range_get_type (void) G_GNUC_CONST;
GeditFindInFilesPluginRange* gedit_find_in_files_plugin_range_dup (const GeditFindInFilesPluginRange* self);
void gedit_find_in_files_plugin_range_free (GeditFindInFilesPluginRange* self);
GType gedit_find_in_files_plugin_imatcher_get_type (void) G_GNUC_CONST;
GType gedit_find_in_files_plugin_imatcher_register_type (GTypeModule * module);
GType gedit_find_in_files_plugin_regex_find_get_type (void) G_GNUC_CONST;
GType gedit_find_in_files_plugin_regex_find_register_type (GTypeModule * module);
#define GEDIT_FIND_IN_FILES_PLUGIN_REGEX_FIND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND, GeditFindInFilesPluginRegexFindPrivate))
enum  {
	GEDIT_FIND_IN_FILES_PLUGIN_REGEX_FIND_DUMMY_PROPERTY
};
GeditFindInFilesPluginRegexFind* gedit_find_in_files_plugin_regex_find_new (const gchar* pattern, gboolean ignore_case, GError** error);
GeditFindInFilesPluginRegexFind* gedit_find_in_files_plugin_regex_find_construct (GType object_type, const gchar* pattern, gboolean ignore_case, GError** error);
static gboolean gedit_find_in_files_plugin_regex_find_real_has_match (GeditFindInFilesPluginIMatcher* base, guint8* text, gsize text_length, gsize pos, GeditFindInFilesPluginRange* match);
static void gedit_find_in_files_plugin_regex_find_finalize (GObject* obj);
GType gedit_find_in_files_plugin_boyer_moore_horspool_get_type (void) G_GNUC_CONST;
GType gedit_find_in_files_plugin_boyer_moore_horspool_register_type (GTypeModule * module);
#define GEDIT_FIND_IN_FILES_PLUGIN_BOYER_MOORE_HORSPOOL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL, GeditFindInFilesPluginBoyerMooreHorspoolPrivate))
enum  {
	GEDIT_FIND_IN_FILES_PLUGIN_BOYER_MOORE_HORSPOOL_DUMMY_PROPERTY
};
GeditFindInFilesPluginBoyerMooreHorspool* gedit_find_in_files_plugin_boyer_moore_horspool_new (const gchar* pattern_, gboolean ignore_case_);
GeditFindInFilesPluginBoyerMooreHorspool* gedit_find_in_files_plugin_boyer_moore_horspool_construct (GType object_type, const gchar* pattern_, gboolean ignore_case_);
static gboolean gedit_find_in_files_plugin_boyer_moore_horspool_real_has_match (GeditFindInFilesPluginIMatcher* base, guint8* text, gsize text_length, gsize pos, GeditFindInFilesPluginRange* match);
static void gedit_find_in_files_plugin_boyer_moore_horspool_finalize (GObject* obj);


GeditFindInFilesPluginRegexFind* gedit_find_in_files_plugin_regex_find_construct (GType object_type, const gchar* pattern, gboolean ignore_case, GError** error) {
	GeditFindInFilesPluginRegexFind * self = NULL;
	GRegexCompileFlags flags = 0;
	gboolean _tmp0_ = FALSE;
	GRegex* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	GRegexCompileFlags _tmp4_ = 0;
	GRegex* _tmp5_ = NULL;
	GRegex* _tmp6_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (pattern != NULL, NULL);
	self = (GeditFindInFilesPluginRegexFind*) g_object_new (object_type, NULL);
	flags = G_REGEX_OPTIMIZE;
	_tmp0_ = ignore_case;
	if (_tmp0_) {
		GRegexCompileFlags _tmp1_ = 0;
		_tmp1_ = flags;
		flags = _tmp1_ | G_REGEX_CASELESS;
	}
	_tmp3_ = pattern;
	_tmp4_ = flags;
	_tmp5_ = g_regex_new (_tmp3_, _tmp4_, 0, &_inner_error_);
	_tmp2_ = _tmp5_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp6_ = _tmp2_;
	_tmp2_ = NULL;
	_g_regex_unref0 (self->priv->re);
	self->priv->re = _tmp6_;
	_g_regex_unref0 (_tmp2_);
	return self;
}


GeditFindInFilesPluginRegexFind* gedit_find_in_files_plugin_regex_find_new (const gchar* pattern, gboolean ignore_case, GError** error) {
	return gedit_find_in_files_plugin_regex_find_construct (GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND, pattern, ignore_case, error);
}


static gboolean gedit_find_in_files_plugin_regex_find_real_has_match (GeditFindInFilesPluginIMatcher* base, guint8* text, gsize text_length, gsize pos, GeditFindInFilesPluginRange* match) {
	GeditFindInFilesPluginRegexFind * self;
	gboolean result = FALSE;
	GMatchInfo* info = NULL;
	gint casted_pos = 0;
	gsize _tmp0_ = 0UL;
	const gchar* str = NULL;
	guint8* _tmp4_ = NULL;
	gint _tmp13_ = 0;
	gint _tmp14_ = 0;
	GError * _inner_error_ = NULL;
	self = (GeditFindInFilesPluginRegexFind*) base;
	g_return_val_if_fail (match != NULL, FALSE);
	_tmp0_ = pos;
	if (_tmp0_ > ((gsize) G_MAXINT)) {
		guint8* _tmp1_ = NULL;
		gsize _tmp2_ = 0UL;
		casted_pos = 0;
		_tmp1_ = text;
		_tmp2_ = pos;
		text = _tmp1_ + _tmp2_;
	} else {
		gsize _tmp3_ = 0UL;
		_tmp3_ = pos;
		casted_pos = (gint) _tmp3_;
	}
	_tmp4_ = text;
	str = (const gchar*) _tmp4_;
	{
		gboolean _tmp5_ = FALSE;
		GRegex* _tmp6_ = NULL;
		gsize _tmp7_ = 0UL;
		gint _tmp8_ = 0;
		GMatchInfo* _tmp9_ = NULL;
		gboolean _tmp10_ = FALSE;
		_tmp6_ = self->priv->re;
		_tmp7_ = text_length;
		_tmp8_ = casted_pos;
		_tmp10_ = g_regex_match_full (_tmp6_, str, (gssize) _tmp7_, _tmp8_, 0, &_tmp9_, &_inner_error_);
		_g_match_info_unref0 (info);
		info = _tmp9_;
		_tmp5_ = _tmp10_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch3_g_regex_error;
			}
			_g_match_info_unref0 (info);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return FALSE;
		}
		if (!_tmp5_) {
			result = FALSE;
			_g_match_info_unref0 (info);
			return result;
		}
	}
	goto __finally3;
	__catch3_g_regex_error:
	{
		GError* err = NULL;
		GError* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp11_ = err;
		_tmp12_ = _tmp11_->message;
		g_warning ("matcher.vala:55: %s", _tmp12_);
		result = FALSE;
		_g_error_free0 (err);
		_g_match_info_unref0 (info);
		return result;
	}
	__finally3:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_match_info_unref0 (info);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return FALSE;
	}
	g_match_info_fetch_pos (info, 0, &_tmp13_, &_tmp14_);
	(*match).from = (gsize) _tmp13_;
	(*match).to = (gsize) _tmp14_;
	result = TRUE;
	_g_match_info_unref0 (info);
	return result;
}


static void gedit_find_in_files_plugin_regex_find_class_init (GeditFindInFilesPluginRegexFindClass * klass) {
	gedit_find_in_files_plugin_regex_find_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GeditFindInFilesPluginRegexFindPrivate));
	G_OBJECT_CLASS (klass)->finalize = gedit_find_in_files_plugin_regex_find_finalize;
}


static void gedit_find_in_files_plugin_regex_find_gedit_find_in_files_plugin_imatcher_interface_init (GeditFindInFilesPluginIMatcherIface * iface) {
	gedit_find_in_files_plugin_regex_find_gedit_find_in_files_plugin_imatcher_parent_iface = g_type_interface_peek_parent (iface);
	iface->has_match = (gboolean (*)(GeditFindInFilesPluginIMatcher*, guint8*, gsize, gsize, GeditFindInFilesPluginRange*)) gedit_find_in_files_plugin_regex_find_real_has_match;
}


static void gedit_find_in_files_plugin_regex_find_instance_init (GeditFindInFilesPluginRegexFind * self) {
	self->priv = GEDIT_FIND_IN_FILES_PLUGIN_REGEX_FIND_GET_PRIVATE (self);
}


static void gedit_find_in_files_plugin_regex_find_finalize (GObject* obj) {
	GeditFindInFilesPluginRegexFind * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEDIT_FIND_IN_FILES_PLUGIN_TYPE_REGEX_FIND, GeditFindInFilesPluginRegexFind);
	_g_regex_unref0 (self->priv->re);
	G_OBJECT_CLASS (gedit_find_in_files_plugin_regex_find_parent_class)->finalize (obj);
}


GType gedit_find_in_files_plugin_regex_find_get_type (void) {
	return gedit_find_in_files_plugin_regex_find_type_id;
}


GType gedit_find_in_files_plugin_regex_find_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GeditFindInFilesPluginRegexFindClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gedit_find_in_files_plugin_regex_find_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeditFindInFilesPluginRegexFind), 0, (GInstanceInitFunc) gedit_find_in_files_plugin_regex_find_instance_init, NULL };
	static const GInterfaceInfo gedit_find_in_files_plugin_imatcher_info = { (GInterfaceInitFunc) gedit_find_in_files_plugin_regex_find_gedit_find_in_files_plugin_imatcher_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	gedit_find_in_files_plugin_regex_find_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GeditFindInFilesPluginRegexFind", &g_define_type_info, 0);
	g_type_module_add_interface (module, gedit_find_in_files_plugin_regex_find_type_id, GEDIT_FIND_IN_FILES_PLUGIN_TYPE_IMATCHER, &gedit_find_in_files_plugin_imatcher_info);
	return gedit_find_in_files_plugin_regex_find_type_id;
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_ = 0L;
	gchar _tmp1_ = '\0';
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


GeditFindInFilesPluginBoyerMooreHorspool* gedit_find_in_files_plugin_boyer_moore_horspool_construct (GType object_type, const gchar* pattern_, gboolean ignore_case_) {
	GeditFindInFilesPluginBoyerMooreHorspool * self = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_val_if_fail (pattern_ != NULL, NULL);
	self = (GeditFindInFilesPluginBoyerMooreHorspool*) g_object_new (object_type, NULL);
	_tmp0_ = pattern_;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->pattern);
	self->priv->pattern = _tmp1_;
	_tmp2_ = ignore_case_;
	self->priv->ignore_case = _tmp2_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gint _tmp5_ = 0;
				gint _tmp6_ = 0;
				const gchar* _tmp7_ = NULL;
				gint _tmp8_ = 0;
				gint _tmp9_ = 0;
				gint _tmp10_ = 0;
				if (!_tmp3_) {
					gint _tmp4_ = 0;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = i;
				if (!(_tmp5_ < 256)) {
					break;
				}
				_tmp6_ = i;
				_tmp7_ = self->priv->pattern;
				_tmp8_ = strlen (_tmp7_);
				_tmp9_ = _tmp8_;
				self->priv->bad_char_shift[_tmp6_] = _tmp9_;
				_tmp10_ = self->priv->bad_char_shift[_tmp6_];
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp11_ = FALSE;
			_tmp11_ = TRUE;
			while (TRUE) {
				gint _tmp13_ = 0;
				const gchar* _tmp14_ = NULL;
				gint _tmp15_ = 0;
				gint _tmp16_ = 0;
				gboolean _tmp17_ = FALSE;
				if (!_tmp11_) {
					gint _tmp12_ = 0;
					_tmp12_ = i;
					i = _tmp12_ + 1;
				}
				_tmp11_ = FALSE;
				_tmp13_ = i;
				_tmp14_ = self->priv->pattern;
				_tmp15_ = strlen (_tmp14_);
				_tmp16_ = _tmp15_;
				if (!(_tmp13_ < (_tmp16_ - 1))) {
					break;
				}
				_tmp17_ = self->priv->ignore_case;
				if (_tmp17_) {
					const gchar* _tmp18_ = NULL;
					gint _tmp19_ = 0;
					gchar _tmp20_ = '\0';
					gint _tmp21_ = 0;
					const gchar* _tmp22_ = NULL;
					gint _tmp23_ = 0;
					gint _tmp24_ = 0;
					gint _tmp25_ = 0;
					gint _tmp26_ = 0;
					const gchar* _tmp27_ = NULL;
					gint _tmp28_ = 0;
					gchar _tmp29_ = '\0';
					gint _tmp30_ = 0;
					const gchar* _tmp31_ = NULL;
					gint _tmp32_ = 0;
					gint _tmp33_ = 0;
					gint _tmp34_ = 0;
					gint _tmp35_ = 0;
					_tmp18_ = self->priv->pattern;
					_tmp19_ = i;
					_tmp20_ = string_get (_tmp18_, (glong) _tmp19_);
					_tmp21_ = toupper ((gint) _tmp20_);
					_tmp22_ = self->priv->pattern;
					_tmp23_ = strlen (_tmp22_);
					_tmp24_ = _tmp23_;
					_tmp25_ = i;
					self->priv->bad_char_shift[_tmp21_] = (_tmp24_ - 1) - _tmp25_;
					_tmp26_ = self->priv->bad_char_shift[_tmp21_];
					_tmp27_ = self->priv->pattern;
					_tmp28_ = i;
					_tmp29_ = string_get (_tmp27_, (glong) _tmp28_);
					_tmp30_ = tolower ((gint) _tmp29_);
					_tmp31_ = self->priv->pattern;
					_tmp32_ = strlen (_tmp31_);
					_tmp33_ = _tmp32_;
					_tmp34_ = i;
					self->priv->bad_char_shift[_tmp30_] = (_tmp33_ - 1) - _tmp34_;
					_tmp35_ = self->priv->bad_char_shift[_tmp30_];
				} else {
					const gchar* _tmp36_ = NULL;
					gint _tmp37_ = 0;
					gchar _tmp38_ = '\0';
					const gchar* _tmp39_ = NULL;
					gint _tmp40_ = 0;
					gint _tmp41_ = 0;
					gint _tmp42_ = 0;
					gint _tmp43_ = 0;
					_tmp36_ = self->priv->pattern;
					_tmp37_ = i;
					_tmp38_ = string_get (_tmp36_, (glong) _tmp37_);
					_tmp39_ = self->priv->pattern;
					_tmp40_ = strlen (_tmp39_);
					_tmp41_ = _tmp40_;
					_tmp42_ = i;
					self->priv->bad_char_shift[_tmp38_] = (_tmp41_ - 1) - _tmp42_;
					_tmp43_ = self->priv->bad_char_shift[_tmp38_];
				}
			}
		}
	}
	return self;
}


GeditFindInFilesPluginBoyerMooreHorspool* gedit_find_in_files_plugin_boyer_moore_horspool_new (const gchar* pattern_, gboolean ignore_case_) {
	return gedit_find_in_files_plugin_boyer_moore_horspool_construct (GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL, pattern_, ignore_case_);
}


static gboolean gedit_find_in_files_plugin_boyer_moore_horspool_real_has_match (GeditFindInFilesPluginIMatcher* base, guint8* text, gsize text_length, gsize pos, GeditFindInFilesPluginRange* match) {
	GeditFindInFilesPluginBoyerMooreHorspool * self;
	gboolean result = FALSE;
	guint i = 0U;
	guint8* _tmp0_ = NULL;
	gsize _tmp1_ = 0UL;
	gsize _tmp2_ = 0UL;
	gsize _tmp3_ = 0UL;
	gsize _tmp4_ = 0UL;
	const gchar* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gint _tmp7_ = 0;
	self = (GeditFindInFilesPluginBoyerMooreHorspool*) base;
	g_return_val_if_fail (match != NULL, FALSE);
	i = (guint) 0;
	_tmp0_ = text;
	_tmp1_ = pos;
	text = _tmp0_ + _tmp1_;
	_tmp2_ = text_length;
	_tmp3_ = pos;
	text_length = _tmp2_ - _tmp3_;
	_tmp4_ = text_length;
	_tmp5_ = self->priv->pattern;
	_tmp6_ = strlen (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp4_ < ((gsize) _tmp7_)) {
		result = FALSE;
		return result;
	}
	while (TRUE) {
		guint _tmp8_ = 0U;
		gsize _tmp9_ = 0UL;
		const gchar* _tmp10_ = NULL;
		gint _tmp11_ = 0;
		gint _tmp12_ = 0;
		guint _tmp44_ = 0U;
		guint8* _tmp45_ = NULL;
		guint _tmp46_ = 0U;
		const gchar* _tmp47_ = NULL;
		gint _tmp48_ = 0;
		gint _tmp49_ = 0;
		guint8 _tmp50_ = 0U;
		gint _tmp51_ = 0;
		_tmp8_ = i;
		_tmp9_ = text_length;
		_tmp10_ = self->priv->pattern;
		_tmp11_ = strlen (_tmp10_);
		_tmp12_ = _tmp11_;
		if (!(((gsize) _tmp8_) <= (_tmp9_ - _tmp12_))) {
			break;
		}
		{
			gint j = 0;
			const gchar* _tmp13_ = NULL;
			gint _tmp14_ = 0;
			gint _tmp15_ = 0;
			_tmp13_ = self->priv->pattern;
			_tmp14_ = strlen (_tmp13_);
			_tmp15_ = _tmp14_;
			j = _tmp15_ - 1;
			{
				gboolean _tmp16_ = FALSE;
				_tmp16_ = TRUE;
				while (TRUE) {
					gint _tmp18_ = 0;
					gboolean _tmp19_ = FALSE;
					gint _tmp36_ = 0;
					if (!_tmp16_) {
						gint _tmp17_ = 0;
						_tmp17_ = j;
						j = _tmp17_ - 1;
					}
					_tmp16_ = FALSE;
					_tmp18_ = j;
					if (!(_tmp18_ >= 0)) {
						break;
					}
					_tmp19_ = self->priv->ignore_case;
					if (_tmp19_) {
						guint8* _tmp20_ = NULL;
						guint _tmp21_ = 0U;
						gint _tmp22_ = 0;
						guint8 _tmp23_ = 0U;
						gint _tmp24_ = 0;
						const gchar* _tmp25_ = NULL;
						gint _tmp26_ = 0;
						gchar _tmp27_ = '\0';
						gint _tmp28_ = 0;
						_tmp20_ = text;
						_tmp21_ = i;
						_tmp22_ = j;
						_tmp23_ = _tmp20_[_tmp21_ + _tmp22_];
						_tmp24_ = tolower ((gint) _tmp23_);
						_tmp25_ = self->priv->pattern;
						_tmp26_ = j;
						_tmp27_ = string_get (_tmp25_, (glong) _tmp26_);
						_tmp28_ = tolower ((gint) _tmp27_);
						if (_tmp24_ != _tmp28_) {
							break;
						}
					} else {
						guint8* _tmp29_ = NULL;
						guint _tmp30_ = 0U;
						gint _tmp31_ = 0;
						guint8 _tmp32_ = 0U;
						const gchar* _tmp33_ = NULL;
						gint _tmp34_ = 0;
						gchar _tmp35_ = '\0';
						_tmp29_ = text;
						_tmp30_ = i;
						_tmp31_ = j;
						_tmp32_ = _tmp29_[_tmp30_ + _tmp31_];
						_tmp33_ = self->priv->pattern;
						_tmp34_ = j;
						_tmp35_ = string_get (_tmp33_, (glong) _tmp34_);
						if (_tmp32_ != ((guint8) _tmp35_)) {
							break;
						}
					}
					_tmp36_ = j;
					if (_tmp36_ == 0) {
						gsize _tmp37_ = 0UL;
						guint _tmp38_ = 0U;
						GeditFindInFilesPluginRange _tmp39_ = {0};
						gsize _tmp40_ = 0UL;
						const gchar* _tmp41_ = NULL;
						gint _tmp42_ = 0;
						gint _tmp43_ = 0;
						_tmp37_ = pos;
						_tmp38_ = i;
						(*match).from = _tmp37_ + _tmp38_;
						_tmp39_ = *match;
						_tmp40_ = _tmp39_.from;
						_tmp41_ = self->priv->pattern;
						_tmp42_ = strlen (_tmp41_);
						_tmp43_ = _tmp42_;
						(*match).to = _tmp40_ + _tmp43_;
						result = TRUE;
						return result;
					}
				}
			}
		}
		_tmp44_ = i;
		_tmp45_ = text;
		_tmp46_ = i;
		_tmp47_ = self->priv->pattern;
		_tmp48_ = strlen (_tmp47_);
		_tmp49_ = _tmp48_;
		_tmp50_ = _tmp45_[(_tmp46_ + _tmp49_) - 1];
		_tmp51_ = self->priv->bad_char_shift[_tmp50_];
		i = _tmp44_ + _tmp51_;
	}
	result = FALSE;
	return result;
}


static void gedit_find_in_files_plugin_boyer_moore_horspool_class_init (GeditFindInFilesPluginBoyerMooreHorspoolClass * klass) {
	gedit_find_in_files_plugin_boyer_moore_horspool_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GeditFindInFilesPluginBoyerMooreHorspoolPrivate));
	G_OBJECT_CLASS (klass)->finalize = gedit_find_in_files_plugin_boyer_moore_horspool_finalize;
}


static void gedit_find_in_files_plugin_boyer_moore_horspool_gedit_find_in_files_plugin_imatcher_interface_init (GeditFindInFilesPluginIMatcherIface * iface) {
	gedit_find_in_files_plugin_boyer_moore_horspool_gedit_find_in_files_plugin_imatcher_parent_iface = g_type_interface_peek_parent (iface);
	iface->has_match = (gboolean (*)(GeditFindInFilesPluginIMatcher*, guint8*, gsize, gsize, GeditFindInFilesPluginRange*)) gedit_find_in_files_plugin_boyer_moore_horspool_real_has_match;
}


static void gedit_find_in_files_plugin_boyer_moore_horspool_instance_init (GeditFindInFilesPluginBoyerMooreHorspool * self) {
	self->priv = GEDIT_FIND_IN_FILES_PLUGIN_BOYER_MOORE_HORSPOOL_GET_PRIVATE (self);
}


static void gedit_find_in_files_plugin_boyer_moore_horspool_finalize (GObject* obj) {
	GeditFindInFilesPluginBoyerMooreHorspool * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEDIT_FIND_IN_FILES_PLUGIN_TYPE_BOYER_MOORE_HORSPOOL, GeditFindInFilesPluginBoyerMooreHorspool);
	_g_free0 (self->priv->pattern);
	G_OBJECT_CLASS (gedit_find_in_files_plugin_boyer_moore_horspool_parent_class)->finalize (obj);
}


GType gedit_find_in_files_plugin_boyer_moore_horspool_get_type (void) {
	return gedit_find_in_files_plugin_boyer_moore_horspool_type_id;
}


GType gedit_find_in_files_plugin_boyer_moore_horspool_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GeditFindInFilesPluginBoyerMooreHorspoolClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gedit_find_in_files_plugin_boyer_moore_horspool_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeditFindInFilesPluginBoyerMooreHorspool), 0, (GInstanceInitFunc) gedit_find_in_files_plugin_boyer_moore_horspool_instance_init, NULL };
	static const GInterfaceInfo gedit_find_in_files_plugin_imatcher_info = { (GInterfaceInitFunc) gedit_find_in_files_plugin_boyer_moore_horspool_gedit_find_in_files_plugin_imatcher_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	gedit_find_in_files_plugin_boyer_moore_horspool_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GeditFindInFilesPluginBoyerMooreHorspool", &g_define_type_info, 0);
	g_type_module_add_interface (module, gedit_find_in_files_plugin_boyer_moore_horspool_type_id, GEDIT_FIND_IN_FILES_PLUGIN_TYPE_IMATCHER, &gedit_find_in_files_plugin_imatcher_info);
	return gedit_find_in_files_plugin_boyer_moore_horspool_type_id;
}



