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

/* -*- coding: utf-8 -*-*/
/*
 * Copyright (C) 2011-2018 Daiki Ueno <ueno@gnu.org>
 * Copyright (C) 2011-2018 Red Hat, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


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


#define SKK_TYPE_STATE (skk_state_get_type ())
#define SKK_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_STATE, SkkState))
#define SKK_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_STATE, SkkStateClass))
#define SKK_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_STATE))
#define SKK_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_STATE))
#define SKK_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_STATE, SkkStateClass))

typedef struct _SkkState SkkState;
typedef struct _SkkStateClass SkkStateClass;
typedef struct _SkkStatePrivate SkkStatePrivate;

#define SKK_TYPE_DICT (skk_dict_get_type ())
#define SKK_DICT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_DICT, SkkDict))
#define SKK_DICT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_DICT, SkkDictClass))
#define SKK_IS_DICT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_DICT))
#define SKK_IS_DICT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_DICT))
#define SKK_DICT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_DICT, SkkDictClass))

typedef struct _SkkDict SkkDict;
typedef struct _SkkDictClass SkkDictClass;

#define SKK_TYPE_CANDIDATE_LIST (skk_candidate_list_get_type ())
#define SKK_CANDIDATE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_CANDIDATE_LIST, SkkCandidateList))
#define SKK_CANDIDATE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_CANDIDATE_LIST, SkkCandidateListClass))
#define SKK_IS_CANDIDATE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_CANDIDATE_LIST))
#define SKK_IS_CANDIDATE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_CANDIDATE_LIST))
#define SKK_CANDIDATE_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_CANDIDATE_LIST, SkkCandidateListClass))

typedef struct _SkkCandidateList SkkCandidateList;
typedef struct _SkkCandidateListClass SkkCandidateListClass;

#define SKK_TYPE_ROM_KANA_CONVERTER (skk_rom_kana_converter_get_type ())
#define SKK_ROM_KANA_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_ROM_KANA_CONVERTER, SkkRomKanaConverter))
#define SKK_ROM_KANA_CONVERTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_ROM_KANA_CONVERTER, SkkRomKanaConverterClass))
#define SKK_IS_ROM_KANA_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_ROM_KANA_CONVERTER))
#define SKK_IS_ROM_KANA_CONVERTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_ROM_KANA_CONVERTER))
#define SKK_ROM_KANA_CONVERTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_ROM_KANA_CONVERTER, SkkRomKanaConverterClass))

typedef struct _SkkRomKanaConverter SkkRomKanaConverter;
typedef struct _SkkRomKanaConverterClass SkkRomKanaConverterClass;

#define SKK_TYPE_UNICODE_STRING (skk_unicode_string_get_type ())
#define SKK_UNICODE_STRING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_UNICODE_STRING, SkkUnicodeString))
#define SKK_UNICODE_STRING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_UNICODE_STRING, SkkUnicodeStringClass))
#define SKK_IS_UNICODE_STRING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_UNICODE_STRING))
#define SKK_IS_UNICODE_STRING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_UNICODE_STRING))
#define SKK_UNICODE_STRING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_UNICODE_STRING, SkkUnicodeStringClass))

typedef struct _SkkUnicodeString SkkUnicodeString;
typedef struct _SkkUnicodeStringClass SkkUnicodeStringClass;

#define SKK_TYPE_KANA_MODE (skk_kana_mode_get_type ())

#define SKK_TYPE_INPUT_MODE (skk_input_mode_get_type ())

#define SKK_TYPE_RULE (skk_rule_get_type ())
#define SKK_RULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_RULE, SkkRule))
#define SKK_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_RULE, SkkRuleClass))
#define SKK_IS_RULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_RULE))
#define SKK_IS_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_RULE))
#define SKK_RULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_RULE, SkkRuleClass))

typedef struct _SkkRule SkkRule;
typedef struct _SkkRuleClass SkkRuleClass;
enum  {
	SKK_STATE_0_PROPERTY,
	SKK_STATE_INPUT_MODE_PROPERTY,
	SKK_STATE_PERIOD_STYLE_PROPERTY,
	SKK_STATE_TYPING_RULE_PROPERTY,
	SKK_STATE_NUM_PROPERTIES
};
static GParamSpec* skk_state_properties[SKK_STATE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#define SKK_TYPE_KEY_EVENT (skk_key_event_get_type ())
#define SKK_KEY_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_KEY_EVENT, SkkKeyEvent))
#define SKK_KEY_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_KEY_EVENT, SkkKeyEventClass))
#define SKK_IS_KEY_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_KEY_EVENT))
#define SKK_IS_KEY_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_KEY_EVENT))
#define SKK_KEY_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_KEY_EVENT, SkkKeyEventClass))

typedef struct _SkkKeyEvent SkkKeyEvent;
typedef struct _SkkKeyEventClass SkkKeyEventClass;

#define SKK_TYPE_KEYMAP (skk_keymap_get_type ())
#define SKK_KEYMAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_KEYMAP, SkkKeymap))
#define SKK_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_KEYMAP, SkkKeymapClass))
#define SKK_IS_KEYMAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_KEYMAP))
#define SKK_IS_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_KEYMAP))
#define SKK_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_KEYMAP, SkkKeymapClass))

typedef struct _SkkKeymap SkkKeymap;
typedef struct _SkkKeymapClass SkkKeymapClass;
typedef struct _SkkRulePrivate SkkRulePrivate;

#define SKK_TYPE_MAP_FILE (skk_map_file_get_type ())
#define SKK_MAP_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_MAP_FILE, SkkMapFile))
#define SKK_MAP_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_MAP_FILE, SkkMapFileClass))
#define SKK_IS_MAP_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_MAP_FILE))
#define SKK_IS_MAP_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_MAP_FILE))
#define SKK_MAP_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_MAP_FILE, SkkMapFileClass))

typedef struct _SkkMapFile SkkMapFile;
typedef struct _SkkMapFileClass SkkMapFileClass;

#define SKK_TYPE_KEYMAP_MAP_FILE (skk_keymap_map_file_get_type ())
#define SKK_KEYMAP_MAP_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_KEYMAP_MAP_FILE, SkkKeymapMapFile))
#define SKK_KEYMAP_MAP_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_KEYMAP_MAP_FILE, SkkKeymapMapFileClass))
#define SKK_IS_KEYMAP_MAP_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_KEYMAP_MAP_FILE))
#define SKK_IS_KEYMAP_MAP_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_KEYMAP_MAP_FILE))
#define SKK_KEYMAP_MAP_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_KEYMAP_MAP_FILE, SkkKeymapMapFileClass))

typedef struct _SkkKeymapMapFile SkkKeymapMapFile;
typedef struct _SkkKeymapMapFileClass SkkKeymapMapFileClass;

#define SKK_TYPE_ROM_KANA_MAP_FILE (skk_rom_kana_map_file_get_type ())
#define SKK_ROM_KANA_MAP_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_ROM_KANA_MAP_FILE, SkkRomKanaMapFile))
#define SKK_ROM_KANA_MAP_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_ROM_KANA_MAP_FILE, SkkRomKanaMapFileClass))
#define SKK_IS_ROM_KANA_MAP_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_ROM_KANA_MAP_FILE))
#define SKK_IS_ROM_KANA_MAP_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_ROM_KANA_MAP_FILE))
#define SKK_ROM_KANA_MAP_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_ROM_KANA_MAP_FILE, SkkRomKanaMapFileClass))

typedef struct _SkkRomKanaMapFile SkkRomKanaMapFile;
typedef struct _SkkRomKanaMapFileClass SkkRomKanaMapFileClass;
typedef struct _SkkMapFilePrivate SkkMapFilePrivate;
typedef struct _SkkKeymapMapFilePrivate SkkKeymapMapFilePrivate;

#define SKK_TYPE_SIMPLE_CANDIDATE_LIST (skk_simple_candidate_list_get_type ())
#define SKK_SIMPLE_CANDIDATE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_SIMPLE_CANDIDATE_LIST, SkkSimpleCandidateList))
#define SKK_SIMPLE_CANDIDATE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_SIMPLE_CANDIDATE_LIST, SkkSimpleCandidateListClass))
#define SKK_IS_SIMPLE_CANDIDATE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_SIMPLE_CANDIDATE_LIST))
#define SKK_IS_SIMPLE_CANDIDATE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_SIMPLE_CANDIDATE_LIST))
#define SKK_SIMPLE_CANDIDATE_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_SIMPLE_CANDIDATE_LIST, SkkSimpleCandidateListClass))

typedef struct _SkkSimpleCandidateList SkkSimpleCandidateList;
typedef struct _SkkSimpleCandidateListClass SkkSimpleCandidateListClass;

#define SKK_TYPE_CANDIDATE (skk_candidate_get_type ())
#define SKK_CANDIDATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_CANDIDATE, SkkCandidate))
#define SKK_CANDIDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_CANDIDATE, SkkCandidateClass))
#define SKK_IS_CANDIDATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_CANDIDATE))
#define SKK_IS_CANDIDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_CANDIDATE))
#define SKK_CANDIDATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_CANDIDATE, SkkCandidateClass))

typedef struct _SkkCandidate SkkCandidate;
typedef struct _SkkCandidateClass SkkCandidateClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define SKK_TYPE_STATE_HANDLER (skk_state_handler_get_type ())
#define SKK_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_STATE_HANDLER, SkkStateHandler))
#define SKK_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_STATE_HANDLER, SkkStateHandlerClass))
#define SKK_IS_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_STATE_HANDLER))
#define SKK_IS_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_STATE_HANDLER))
#define SKK_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_STATE_HANDLER, SkkStateHandlerClass))

typedef struct _SkkStateHandler SkkStateHandler;
typedef struct _SkkStateHandlerClass SkkStateHandlerClass;

#define SKK_TYPE_NONE_STATE_HANDLER (skk_none_state_handler_get_type ())
#define SKK_NONE_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_NONE_STATE_HANDLER, SkkNoneStateHandler))
#define SKK_NONE_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_NONE_STATE_HANDLER, SkkNoneStateHandlerClass))
#define SKK_IS_NONE_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_NONE_STATE_HANDLER))
#define SKK_IS_NONE_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_NONE_STATE_HANDLER))
#define SKK_NONE_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_NONE_STATE_HANDLER, SkkNoneStateHandlerClass))

typedef struct _SkkNoneStateHandler SkkNoneStateHandler;
typedef struct _SkkNoneStateHandlerClass SkkNoneStateHandlerClass;

#define SKK_TYPE_KEY_EVENT_FILTER (skk_key_event_filter_get_type ())
#define SKK_KEY_EVENT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_KEY_EVENT_FILTER, SkkKeyEventFilter))
#define SKK_KEY_EVENT_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_KEY_EVENT_FILTER, SkkKeyEventFilterClass))
#define SKK_IS_KEY_EVENT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_KEY_EVENT_FILTER))
#define SKK_IS_KEY_EVENT_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_KEY_EVENT_FILTER))
#define SKK_KEY_EVENT_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_KEY_EVENT_FILTER, SkkKeyEventFilterClass))

typedef struct _SkkKeyEventFilter SkkKeyEventFilter;
typedef struct _SkkKeyEventFilterClass SkkKeyEventFilterClass;
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))

#define SKK_TYPE_EXPR_READER (skk_expr_reader_get_type ())
#define SKK_EXPR_READER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_EXPR_READER, SkkExprReader))
#define SKK_EXPR_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_EXPR_READER, SkkExprReaderClass))
#define SKK_IS_EXPR_READER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_EXPR_READER))
#define SKK_IS_EXPR_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_EXPR_READER))
#define SKK_EXPR_READER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_EXPR_READER, SkkExprReaderClass))

typedef struct _SkkExprReader SkkExprReader;
typedef struct _SkkExprReaderClass SkkExprReaderClass;

#define SKK_TYPE_EXPR_NODE (skk_expr_node_get_type ())

#define SKK_TYPE_EXPR_NODE_TYPE (skk_expr_node_type_get_type ())
typedef struct _SkkExprNode SkkExprNode;

#define SKK_TYPE_EXPR_EVALUATOR (skk_expr_evaluator_get_type ())
#define SKK_EXPR_EVALUATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_EXPR_EVALUATOR, SkkExprEvaluator))
#define SKK_EXPR_EVALUATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_EXPR_EVALUATOR, SkkExprEvaluatorClass))
#define SKK_IS_EXPR_EVALUATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_EXPR_EVALUATOR))
#define SKK_IS_EXPR_EVALUATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_EXPR_EVALUATOR))
#define SKK_EXPR_EVALUATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_EXPR_EVALUATOR, SkkExprEvaluatorClass))

typedef struct _SkkExprEvaluator SkkExprEvaluator;
typedef struct _SkkExprEvaluatorClass SkkExprEvaluatorClass;
#define _skk_expr_node_free0(var) ((var == NULL) ? NULL : (var = (skk_expr_node_free (var), NULL)))

#define SKK_TYPE_NUMERIC_CONVERSION_TYPE (skk_numeric_conversion_type_get_type ())

#define SKK_TYPE_PERIOD_STYLE (skk_period_style_get_type ())
enum  {
	SKK_STATE_RECURSIVE_EDIT_ABORT_SIGNAL,
	SKK_STATE_RECURSIVE_EDIT_END_SIGNAL,
	SKK_STATE_RECURSIVE_EDIT_START_SIGNAL,
	SKK_STATE_RETRIEVE_SURROUNDING_TEXT_SIGNAL,
	SKK_STATE_DELETE_SURROUNDING_TEXT_SIGNAL,
	SKK_STATE_NUM_SIGNALS
};
static guint skk_state_signals[SKK_STATE_NUM_SIGNALS] = {0};
typedef struct _SkkStateHandlerPrivate SkkStateHandlerPrivate;
enum  {
	SKK_STATE_HANDLER_0_PROPERTY,
	SKK_STATE_HANDLER_NUM_PROPERTIES
};
static GParamSpec* skk_state_handler_properties[SKK_STATE_HANDLER_NUM_PROPERTIES];

#define SKK_TYPE_INPUT_MODE_COMMAND_ENTRY (skk_input_mode_command_entry_get_type ())
typedef struct _SkkInputModeCommandEntry SkkInputModeCommandEntry;
typedef struct _SkkNoneStateHandlerPrivate SkkNoneStateHandlerPrivate;
enum  {
	SKK_NONE_STATE_HANDLER_0_PROPERTY,
	SKK_NONE_STATE_HANDLER_NUM_PROPERTIES
};
static GParamSpec* skk_none_state_handler_properties[SKK_NONE_STATE_HANDLER_NUM_PROPERTIES];
typedef struct _SkkUnicodeStringPrivate SkkUnicodeStringPrivate;

#define SKK_TYPE_START_STATE_HANDLER (skk_start_state_handler_get_type ())
#define SKK_START_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_START_STATE_HANDLER, SkkStartStateHandler))
#define SKK_START_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_START_STATE_HANDLER, SkkStartStateHandlerClass))
#define SKK_IS_START_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_START_STATE_HANDLER))
#define SKK_IS_START_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_START_STATE_HANDLER))
#define SKK_START_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_START_STATE_HANDLER, SkkStartStateHandlerClass))

typedef struct _SkkStartStateHandler SkkStartStateHandler;
typedef struct _SkkStartStateHandlerClass SkkStartStateHandlerClass;

#define SKK_TYPE_MODIFIER_TYPE (skk_modifier_type_get_type ())

#define SKK_TYPE_ABBREV_STATE_HANDLER (skk_abbrev_state_handler_get_type ())
#define SKK_ABBREV_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_ABBREV_STATE_HANDLER, SkkAbbrevStateHandler))
#define SKK_ABBREV_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_ABBREV_STATE_HANDLER, SkkAbbrevStateHandlerClass))
#define SKK_IS_ABBREV_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_ABBREV_STATE_HANDLER))
#define SKK_IS_ABBREV_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_ABBREV_STATE_HANDLER))
#define SKK_ABBREV_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_ABBREV_STATE_HANDLER, SkkAbbrevStateHandlerClass))

typedef struct _SkkAbbrevStateHandler SkkAbbrevStateHandler;
typedef struct _SkkAbbrevStateHandlerClass SkkAbbrevStateHandlerClass;

#define SKK_TYPE_KUTEN_STATE_HANDLER (skk_kuten_state_handler_get_type ())
#define SKK_KUTEN_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_KUTEN_STATE_HANDLER, SkkKutenStateHandler))
#define SKK_KUTEN_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_KUTEN_STATE_HANDLER, SkkKutenStateHandlerClass))
#define SKK_IS_KUTEN_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_KUTEN_STATE_HANDLER))
#define SKK_IS_KUTEN_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_KUTEN_STATE_HANDLER))
#define SKK_KUTEN_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_KUTEN_STATE_HANDLER, SkkKutenStateHandlerClass))

typedef struct _SkkKutenStateHandler SkkKutenStateHandler;
typedef struct _SkkKutenStateHandlerClass SkkKutenStateHandlerClass;
typedef struct _SkkKutenStateHandlerPrivate SkkKutenStateHandlerPrivate;

#define SKK_TYPE_ENCODING_CONVERTER (skk_encoding_converter_get_type ())
#define SKK_ENCODING_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_ENCODING_CONVERTER, SkkEncodingConverter))
#define SKK_ENCODING_CONVERTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_ENCODING_CONVERTER, SkkEncodingConverterClass))
#define SKK_IS_ENCODING_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_ENCODING_CONVERTER))
#define SKK_IS_ENCODING_CONVERTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_ENCODING_CONVERTER))
#define SKK_ENCODING_CONVERTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_ENCODING_CONVERTER, SkkEncodingConverterClass))

typedef struct _SkkEncodingConverter SkkEncodingConverter;
typedef struct _SkkEncodingConverterClass SkkEncodingConverterClass;
enum  {
	SKK_KUTEN_STATE_HANDLER_0_PROPERTY,
	SKK_KUTEN_STATE_HANDLER_NUM_PROPERTIES
};
static GParamSpec* skk_kuten_state_handler_properties[SKK_KUTEN_STATE_HANDLER_NUM_PROPERTIES];
typedef struct _SkkAbbrevStateHandlerPrivate SkkAbbrevStateHandlerPrivate;
enum  {
	SKK_ABBREV_STATE_HANDLER_0_PROPERTY,
	SKK_ABBREV_STATE_HANDLER_NUM_PROPERTIES
};
static GParamSpec* skk_abbrev_state_handler_properties[SKK_ABBREV_STATE_HANDLER_NUM_PROPERTIES];

#define SKK_TYPE_SELECT_STATE_HANDLER (skk_select_state_handler_get_type ())
#define SKK_SELECT_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_SELECT_STATE_HANDLER, SkkSelectStateHandler))
#define SKK_SELECT_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_SELECT_STATE_HANDLER, SkkSelectStateHandlerClass))
#define SKK_IS_SELECT_STATE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_SELECT_STATE_HANDLER))
#define SKK_IS_SELECT_STATE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_SELECT_STATE_HANDLER))
#define SKK_SELECT_STATE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_SELECT_STATE_HANDLER, SkkSelectStateHandlerClass))

typedef struct _SkkSelectStateHandler SkkSelectStateHandler;
typedef struct _SkkSelectStateHandlerClass SkkSelectStateHandlerClass;
typedef struct _SkkStartStateHandlerPrivate SkkStartStateHandlerPrivate;
enum  {
	SKK_START_STATE_HANDLER_0_PROPERTY,
	SKK_START_STATE_HANDLER_NUM_PROPERTIES
};
static GParamSpec* skk_start_state_handler_properties[SKK_START_STATE_HANDLER_NUM_PROPERTIES];
typedef struct _SkkSelectStateHandlerPrivate SkkSelectStateHandlerPrivate;
enum  {
	SKK_SELECT_STATE_HANDLER_0_PROPERTY,
	SKK_SELECT_STATE_HANDLER_NUM_PROPERTIES
};
static GParamSpec* skk_select_state_handler_properties[SKK_SELECT_STATE_HANDLER_NUM_PROPERTIES];

struct _SkkState {
	GObject parent_instance;
	SkkStatePrivate * priv;
	GType handler_type;
	GeeList* dictionaries;
	SkkCandidateList* candidates;
	SkkRomKanaConverter* rom_kana_converter;
	SkkRomKanaConverter* okuri_rom_kana_converter;
	gboolean okuri;
	gchar* midasi;
	GString* output;
	GString* abbrev;
	GString* kuten;
	GeeBidirListIterator* completion_iterator;
	gchar** auto_start_henkan_keywords;
	gint auto_start_henkan_keywords_length1;
	gint _auto_start_henkan_keywords_size_;
	gchar* auto_start_henkan_keyword;
	gboolean egg_like_newline;
	SkkUnicodeString* surrounding_text;
	guint surrounding_end;
};

struct _SkkStateClass {
	GObjectClass parent_class;
};

typedef enum  {
	SKK_KANA_MODE_HIRAGANA,
	SKK_KANA_MODE_KATAKANA,
	SKK_KANA_MODE_HANKAKU_KATAKANA
} SkkKanaMode;

typedef enum  {
	SKK_INPUT_MODE_HIRAGANA = SKK_KANA_MODE_HIRAGANA,
	SKK_INPUT_MODE_KATAKANA = SKK_KANA_MODE_KATAKANA,
	SKK_INPUT_MODE_HANKAKU_KATAKANA = SKK_KANA_MODE_HANKAKU_KATAKANA,
	SKK_INPUT_MODE_LATIN,
	SKK_INPUT_MODE_WIDE_LATIN,
	SKK_INPUT_MODE_LAST,
	SKK_INPUT_MODE_DEFAULT = SKK_INPUT_MODE_HIRAGANA
} SkkInputMode;

struct _SkkStatePrivate {
	SkkInputMode _input_mode;
	GeeArrayList* completion;
	SkkRule* _typing_rule;
	GRegex* numeric_regex;
	GRegex* numeric_ref_regex;
};

struct _SkkRule {
	GObject parent_instance;
	SkkRulePrivate * priv;
	SkkKeymapMapFile** keymaps;
	gint keymaps_length1;
	gint _keymaps_size_;
	SkkRomKanaMapFile* rom_kana;
};

struct _SkkRuleClass {
	GObjectClass parent_class;
};

struct _SkkMapFile {
	GObject parent_instance;
	SkkMapFilePrivate * priv;
};

struct _SkkMapFileClass {
	GObjectClass parent_class;
};

struct _SkkKeymapMapFile {
	SkkMapFile parent_instance;
	SkkKeymapMapFilePrivate * priv;
	SkkKeymap* keymap;
};

struct _SkkKeymapMapFileClass {
	SkkMapFileClass parent_class;
};

typedef enum  {
	SKK_RULE_PARSE_ERROR_FAILED
} SkkRuleParseError;
#define SKK_RULE_PARSE_ERROR skk_rule_parse_error_quark ()
typedef enum  {
	SKK_EXPR_NODE_TYPE_ARRAY,
	SKK_EXPR_NODE_TYPE_SYMBOL,
	SKK_EXPR_NODE_TYPE_STRING
} SkkExprNodeType;

struct _SkkExprNode {
	SkkExprNodeType type;
	GeeLinkedList* nodes;
	gchar* data;
};

typedef enum  {
	SKK_NUMERIC_CONVERSION_TYPE_LATIN,
	SKK_NUMERIC_CONVERSION_TYPE_WIDE_LATIN,
	SKK_NUMERIC_CONVERSION_TYPE_KANJI_NUMERAL,
	SKK_NUMERIC_CONVERSION_TYPE_KANJI,
	SKK_NUMERIC_CONVERSION_TYPE_RECONVERT,
	SKK_NUMERIC_CONVERSION_TYPE_DAIJI,
	SKK_NUMERIC_CONVERSION_TYPE_SHOGI
} SkkNumericConversionType;

typedef enum  {
	SKK_PERIOD_STYLE_JA_JA,
	SKK_PERIOD_STYLE_EN_EN,
	SKK_PERIOD_STYLE_JA_EN,
	SKK_PERIOD_STYLE_EN_JA
} SkkPeriodStyle;

typedef gboolean (*SkkCommandHandler) (SkkState* state, gpointer user_data);
struct _SkkStateHandler {
	GObject parent_instance;
	SkkStateHandlerPrivate * priv;
};

struct _SkkStateHandlerClass {
	GObjectClass parent_class;
	gboolean (*process_key_event) (SkkStateHandler* self, SkkState* state, SkkKeyEvent* * key);
	gchar* (*get_preedit) (SkkStateHandler* self, SkkState* state, guint* underline_offset, guint* underline_nchars);
	gchar* (*get_output) (SkkStateHandler* self, SkkState* state);
};

struct _SkkInputModeCommandEntry {
	gchar* key;
	SkkInputMode value;
};

struct _SkkNoneStateHandler {
	SkkStateHandler parent_instance;
	SkkNoneStateHandlerPrivate * priv;
};

struct _SkkNoneStateHandlerClass {
	SkkStateHandlerClass parent_class;
};

struct _SkkUnicodeString {
	GObject parent_instance;
	SkkUnicodeStringPrivate * priv;
	gint length;
};

struct _SkkUnicodeStringClass {
	GObjectClass parent_class;
};

typedef enum  {
	SKK_MODIFIER_TYPE_NONE = 0,
	SKK_MODIFIER_TYPE_SHIFT_MASK = 1 << 0,
	SKK_MODIFIER_TYPE_LOCK_MASK = 1 << 1,
	SKK_MODIFIER_TYPE_CONTROL_MASK = 1 << 2,
	SKK_MODIFIER_TYPE_MOD1_MASK = 1 << 3,
	SKK_MODIFIER_TYPE_MOD2_MASK = 1 << 4,
	SKK_MODIFIER_TYPE_MOD3_MASK = 1 << 5,
	SKK_MODIFIER_TYPE_MOD4_MASK = 1 << 6,
	SKK_MODIFIER_TYPE_MOD5_MASK = 1 << 7,
	SKK_MODIFIER_TYPE_LSHIFT_MASK = 1 << 22,
	SKK_MODIFIER_TYPE_RSHIFT_MASK = 1 << 23,
	SKK_MODIFIER_TYPE_USLEEP_MASK = 1 << 24,
	SKK_MODIFIER_TYPE_SUPER_MASK = 1 << 26,
	SKK_MODIFIER_TYPE_HYPER_MASK = 1 << 27,
	SKK_MODIFIER_TYPE_META_MASK = 1 << 28,
	SKK_MODIFIER_TYPE_RELEASE_MASK = 1 << 30
} SkkModifierType;

struct _SkkKutenStateHandler {
	SkkStateHandler parent_instance;
	SkkKutenStateHandlerPrivate * priv;
};

struct _SkkKutenStateHandlerClass {
	SkkStateHandlerClass parent_class;
};

struct _SkkKutenStateHandlerPrivate {
	SkkEncodingConverter* converter;
};

struct _SkkAbbrevStateHandler {
	SkkStateHandler parent_instance;
	SkkAbbrevStateHandlerPrivate * priv;
};

struct _SkkAbbrevStateHandlerClass {
	SkkStateHandlerClass parent_class;
};

struct _SkkStartStateHandler {
	SkkStateHandler parent_instance;
	SkkStartStateHandlerPrivate * priv;
};

struct _SkkStartStateHandlerClass {
	SkkStateHandlerClass parent_class;
};

struct _SkkSelectStateHandler {
	SkkStateHandler parent_instance;
	SkkSelectStateHandlerPrivate * priv;
};

struct _SkkSelectStateHandlerClass {
	SkkStateHandlerClass parent_class;
};


static gpointer skk_state_parent_class = NULL;
static gpointer skk_state_handler_parent_class = NULL;
static gpointer skk_none_state_handler_parent_class = NULL;
static gpointer skk_kuten_state_handler_parent_class = NULL;
static gpointer skk_abbrev_state_handler_parent_class = NULL;
static gpointer skk_start_state_handler_parent_class = NULL;
static gpointer skk_select_state_handler_parent_class = NULL;

GType skk_state_get_type (void) G_GNUC_CONST;
GType skk_dict_get_type (void) G_GNUC_CONST;
GType skk_candidate_list_get_type (void) G_GNUC_CONST;
GType skk_rom_kana_converter_get_type (void) G_GNUC_CONST;
GType skk_unicode_string_get_type (void) G_GNUC_CONST;
GType skk_kana_mode_get_type (void) G_GNUC_CONST;
GType skk_input_mode_get_type (void) G_GNUC_CONST;
GType skk_rule_get_type (void) G_GNUC_CONST;
#define SKK_STATE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SKK_TYPE_STATE, SkkStatePrivate))
void skk_state_reset (SkkState* self);
GType skk_key_event_get_type (void) G_GNUC_CONST;
gchar* skk_state_lookup_key (SkkState* self,
                             SkkKeyEvent* key);
GType skk_keymap_get_type (void) G_GNUC_CONST;
GType skk_map_file_get_type (void) G_GNUC_CONST;
GType skk_keymap_map_file_get_type (void) G_GNUC_CONST;
GType skk_rom_kana_map_file_get_type (void) G_GNUC_CONST;
SkkInputMode skk_state_get_input_mode (SkkState* self);
gchar* skk_keymap_lookup_key (SkkKeymap* self,
                              SkkKeyEvent* key);
SkkKeyEvent* skk_state_where_is (SkkState* self,
                                 const gchar* command);
SkkKeyEvent* skk_keymap_where_is (SkkKeymap* self,
                                  const gchar* command);
gboolean skk_state_isupper (SkkState* self,
                            SkkKeyEvent* key,
                            gunichar* lower_code);
gunichar skk_key_event_get_code (SkkKeyEvent* self);
SkkState* skk_state_new (GeeList* dictionaries);
SkkState* skk_state_construct (GType object_type,
                               GeeList* dictionaries);
SkkSimpleCandidateList* skk_simple_candidate_list_new (guint page_start,
                                                       guint page_size);
SkkSimpleCandidateList* skk_simple_candidate_list_construct (GType object_type,
                                                             guint page_start,
                                                             guint page_size);
GType skk_simple_candidate_list_get_type (void) G_GNUC_CONST;
GType skk_candidate_get_type (void) G_GNUC_CONST;
static void skk_state_candidate_selected (SkkState* self,
                                   SkkCandidate* c);
static void _skk_state_candidate_selected_skk_candidate_list_selected (SkkCandidateList* _sender,
                                                                SkkCandidate* candidate,
                                                                gpointer self);
SkkRomKanaConverter* skk_rom_kana_converter_new (void);
SkkRomKanaConverter* skk_rom_kana_converter_construct (GType object_type);
static gchar** _vala_array_dup3 (gchar** self,
                          int length);
GQuark skk_rule_parse_error_quark (void);
SkkRule* skk_rule_new (const gchar* name,
                       GError** error);
SkkRule* skk_rule_construct (GType object_type,
                             const gchar* name,
                             GError** error);
const gchar* skk_candidate_get_output (SkkCandidate* self);
const gchar* skk_rom_kana_converter_get_output (SkkRomKanaConverter* self);
void skk_state_output_surrounding_text (SkkState* self);
gchar* skk_unicode_string_substring (SkkUnicodeString* self,
                                     glong offset,
                                     glong len);
GType skk_state_handler_get_type (void) G_GNUC_CONST;
GType skk_none_state_handler_get_type (void) G_GNUC_CONST;
void skk_rom_kana_converter_reset (SkkRomKanaConverter* self);
GType skk_key_event_filter_get_type (void) G_GNUC_CONST;
SkkKeyEventFilter* skk_rule_get_filter (SkkRule* self);
void skk_key_event_filter_reset (SkkKeyEventFilter* self);
void skk_candidate_list_clear (SkkCandidateList* self);
void skk_state_cancel_okuri (SkkState* self);
void skk_rom_kana_converter_set_output (SkkRomKanaConverter* self,
                                        const gchar* value);
static gchar* skk_state_extract_numerics (SkkState* self,
                                   const gchar* midasi,
                                   gint** numerics,
                                   int* numerics_length1);
static void _vala_array_add2 (gint* * array,
                       int* length,
                       int* size,
                       gint value);
static gint* _vala_array_dup4 (gint* self,
                        int length);
static gchar* skk_state_expand_expr (SkkState* self,
                              const gchar* text);
GType skk_expr_reader_get_type (void) G_GNUC_CONST;
SkkExprReader* skk_expr_reader_new (void);
SkkExprReader* skk_expr_reader_construct (GType object_type);
GType skk_expr_node_get_type (void) G_GNUC_CONST;
GType skk_expr_node_type_get_type (void) G_GNUC_CONST;
SkkExprNode* skk_expr_node_dup (const SkkExprNode* self);
void skk_expr_node_free (SkkExprNode* self);
void skk_expr_node_copy (const SkkExprNode* self,
                         SkkExprNode* dest);
void skk_expr_node_destroy (SkkExprNode* self);
SkkExprNode* skk_expr_reader_read_expr (SkkExprReader* self,
                                        const gchar* expr,
                                        gint* index);
GType skk_expr_evaluator_get_type (void) G_GNUC_CONST;
SkkExprEvaluator* skk_expr_evaluator_new (void);
SkkExprEvaluator* skk_expr_evaluator_construct (GType object_type);
gchar* skk_expr_evaluator_eval (SkkExprEvaluator* self,
                                SkkExprNode* node);
static gchar* skk_state_expand_numeric_references (SkkState* self,
                                            const gchar* text,
                                            gint* numerics,
                                            int numerics_length1);
GType skk_numeric_conversion_type_get_type (void) G_GNUC_CONST;
gchar* skk_util_get_numeric (gint numeric,
                             SkkNumericConversionType type);
void skk_state_lookup (SkkState* self,
                       const gchar* midasi,
                       gboolean okuri);
static void skk_state_lookup_internal (SkkState* self,
                                const gchar* midasi,
                                gint* numerics,
                                int numerics_length1,
                                gboolean okuri);
void skk_candidate_list_add_candidates_end (SkkCandidateList* self);
SkkCandidate** skk_dict_lookup (SkkDict* self,
                                const gchar* midasi,
                                gboolean okuri,
                                int* result_length1);
const gchar* skk_candidate_get_text (SkkCandidate* self);
void skk_candidate_set_output (SkkCandidate* self,
                               const gchar* value);
const gchar* skk_candidate_get_annotation (SkkCandidate* self);
void skk_candidate_set_annotation (SkkCandidate* self,
                                   const gchar* value);
void skk_candidate_list_add_candidates (SkkCandidateList* self,
                                        SkkCandidate** array,
                                        int array_length1);
void skk_state_purge_candidate (SkkState* self,
                                SkkCandidate* candidate);
gboolean skk_dict_get_read_only (SkkDict* self);
gboolean skk_dict_purge_candidate (SkkDict* self,
                                   SkkCandidate* candidate);
void skk_state_completion_start (SkkState* self,
                                 const gchar* midasi);
gchar** skk_dict_complete (SkkDict* self,
                           const gchar* midasi,
                           int* result_length1);
gchar* skk_state_get_yomi (SkkState* self);
const gchar* skk_rom_kana_converter_get_preedit (SkkRomKanaConverter* self);
void skk_state_set_input_mode (SkkState* self,
                               SkkInputMode value);
void skk_rom_kana_converter_set_kana_mode (SkkRomKanaConverter* self,
                                           SkkKanaMode value);
GType skk_period_style_get_type (void) G_GNUC_CONST;
SkkPeriodStyle skk_state_get_period_style (SkkState* self);
SkkPeriodStyle skk_rom_kana_converter_get_period_style (SkkRomKanaConverter* self);
void skk_state_set_period_style (SkkState* self,
                                 SkkPeriodStyle value);
void skk_rom_kana_converter_set_period_style (SkkRomKanaConverter* self,
                                              SkkPeriodStyle value);
SkkRule* skk_state_get_typing_rule (SkkState* self);
void skk_state_set_typing_rule (SkkState* self,
                                SkkRule* value);
void skk_rom_kana_converter_set_rule (SkkRomKanaConverter* self,
                                      SkkRomKanaMapFile* value);
static void g_cclosure_user_marshal_BOOLEAN__VOID (GClosure * closure,
                                            GValue * return_value,
                                            guint n_param_values,
                                            const GValue * param_values,
                                            gpointer invocation_hint,
                                            gpointer marshal_data);
static void g_cclosure_user_marshal_BOOLEAN__STRING (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__STRING_BOOLEAN (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static void g_cclosure_user_marshal_BOOLEAN__POINTER_POINTER (GClosure * closure,
                                                       GValue * return_value,
                                                       guint n_param_values,
                                                       const GValue * param_values,
                                                       gpointer invocation_hint,
                                                       gpointer marshal_data);
static void g_cclosure_user_marshal_BOOLEAN__INT_UINT (GClosure * closure,
                                                GValue * return_value,
                                                guint n_param_values,
                                                const GValue * param_values,
                                                gpointer invocation_hint,
                                                gpointer marshal_data);
static void skk_state_finalize (GObject * obj);
static void _vala_skk_state_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec);
static void _vala_skk_state_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec);
gboolean skk_state_handler_process_key_event (SkkStateHandler* self,
                                              SkkState* state,
                                              SkkKeyEvent* * key);
static gboolean skk_state_handler_real_process_key_event (SkkStateHandler* self,
                                                   SkkState* state,
                                                   SkkKeyEvent* * key);
gchar* skk_state_handler_get_preedit (SkkStateHandler* self,
                                      SkkState* state,
                                      guint* underline_offset,
                                      guint* underline_nchars);
static gchar* skk_state_handler_real_get_preedit (SkkStateHandler* self,
                                           SkkState* state,
                                           guint* underline_offset,
                                           guint* underline_nchars);
gchar* skk_state_handler_get_output (SkkStateHandler* self,
                                     SkkState* state);
static gchar* skk_state_handler_real_get_output (SkkStateHandler* self,
                                          SkkState* state);
SkkStateHandler* skk_state_handler_construct (GType object_type);
GType skk_input_mode_command_entry_get_type (void) G_GNUC_CONST;
SkkInputModeCommandEntry* skk_input_mode_command_entry_dup (const SkkInputModeCommandEntry* self);
void skk_input_mode_command_entry_free (SkkInputModeCommandEntry* self);
void skk_input_mode_command_entry_copy (const SkkInputModeCommandEntry* self,
                                        SkkInputModeCommandEntry* dest);
void skk_input_mode_command_entry_destroy (SkkInputModeCommandEntry* self);
static gboolean skk_none_state_handler_real_process_key_event (SkkStateHandler* base,
                                                        SkkState* state,
                                                        SkkKeyEvent* * key);
SkkUnicodeString* skk_unicode_string_new (const gchar* str);
SkkUnicodeString* skk_unicode_string_construct (GType object_type,
                                                const gchar* str);
GType skk_start_state_handler_get_type (void) G_GNUC_CONST;
GType skk_modifier_type_get_type (void) G_GNUC_CONST;
SkkModifierType skk_key_event_get_modifiers (SkkKeyEvent* self);
gboolean skk_rom_kana_converter_can_consume (SkkRomKanaConverter* self,
                                             gunichar uc,
                                             gboolean preedit_only,
                                             gboolean no_carryover);
gboolean skk_rom_kana_converter_output_nn_if_any (SkkRomKanaConverter* self);
gboolean skk_rom_kana_converter_delete (SkkRomKanaConverter* self);
gboolean skk_rom_kana_converter_is_valid (SkkRomKanaConverter* self,
                                          gunichar uc);
GType skk_abbrev_state_handler_get_type (void) G_GNUC_CONST;
GType skk_kuten_state_handler_get_type (void) G_GNUC_CONST;
gchar* skk_util_convert_by_input_mode (const gchar* str,
                                       SkkInputMode input_mode);
gboolean skk_rom_kana_converter_append (SkkRomKanaConverter* self,
                                        gunichar uc);
gunichar skk_util_get_wide_latin_char (gchar c);
static gchar* skk_none_state_handler_real_get_preedit (SkkStateHandler* base,
                                                SkkState* state,
                                                guint* underline_offset,
                                                guint* underline_nchars);
SkkNoneStateHandler* skk_none_state_handler_new (void);
SkkNoneStateHandler* skk_none_state_handler_construct (GType object_type);
GType skk_encoding_converter_get_type (void) G_GNUC_CONST;
#define SKK_KUTEN_STATE_HANDLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SKK_TYPE_KUTEN_STATE_HANDLER, SkkKutenStateHandlerPrivate))
SkkKutenStateHandler* skk_kuten_state_handler_new (void);
SkkKutenStateHandler* skk_kuten_state_handler_construct (GType object_type);
SkkEncodingConverter* skk_encoding_converter_new (const gchar* encoding,
                                                  GError** error);
SkkEncodingConverter* skk_encoding_converter_construct (GType object_type,
                                                        const gchar* encoding,
                                                        GError** error);
static gint skk_kuten_state_handler_hex_char_to_int (SkkKutenStateHandler* self,
                                              gchar hex);
static gchar* skk_kuten_state_handler_parse_hex (SkkKutenStateHandler* self,
                                          const gchar* hex);
static gboolean skk_kuten_state_handler_real_process_key_event (SkkStateHandler* base,
                                                         SkkState* state,
                                                         SkkKeyEvent* * key);
gchar* skk_encoding_converter_decode (SkkEncodingConverter* self,
                                      const gchar* external_str,
                                      GError** error);
static gchar* skk_kuten_state_handler_real_get_preedit (SkkStateHandler* base,
                                                 SkkState* state,
                                                 guint* underline_offset,
                                                 guint* underline_nchars);
static void skk_kuten_state_handler_finalize (GObject * obj);
static gboolean skk_abbrev_state_handler_real_process_key_event (SkkStateHandler* base,
                                                          SkkState* state,
                                                          SkkKeyEvent* * key);
GType skk_select_state_handler_get_type (void) G_GNUC_CONST;
gchar* skk_util_get_wide_latin (const gchar* latin);
static gchar* skk_abbrev_state_handler_real_get_preedit (SkkStateHandler* base,
                                                  SkkState* state,
                                                  guint* underline_offset,
                                                  guint* underline_nchars);
SkkAbbrevStateHandler* skk_abbrev_state_handler_new (void);
SkkAbbrevStateHandler* skk_abbrev_state_handler_construct (GType object_type);
static gboolean skk_start_state_handler_real_process_key_event (SkkStateHandler* base,
                                                         SkkState* state,
                                                         SkkKeyEvent* * key);
static gboolean skk_start_state_handler_check_auto_conversion (SkkStartStateHandler* self,
                                                        SkkState* state,
                                                        SkkKeyEvent* key);
static gchar* skk_start_state_handler_real_get_preedit (SkkStateHandler* base,
                                                 SkkState* state,
                                                 guint* underline_offset,
                                                 guint* underline_nchars);
SkkStartStateHandler* skk_start_state_handler_new (void);
SkkStartStateHandler* skk_start_state_handler_construct (GType object_type);
static gboolean skk_select_state_handler_real_process_key_event (SkkStateHandler* base,
                                                          SkkState* state,
                                                          SkkKeyEvent* * key);
gboolean skk_candidate_list_previous (SkkCandidateList* self);
SkkCandidate* skk_candidate_list_get (SkkCandidateList* self,
                                      gint index);
gint skk_candidate_list_get_cursor_pos (SkkCandidateList* self);
gchar* skk_util_get_okurigana_prefix (const gchar* okurigana);
gchar* skk_util_get_hiragana (const gchar* kana);
gint skk_candidate_list_get_size (SkkCandidateList* self);
gboolean skk_candidate_list_next (SkkCandidateList* self);
void skk_candidate_list_select (SkkCandidateList* self);
static gchar* skk_select_state_handler_real_get_preedit (SkkStateHandler* base,
                                                  SkkState* state,
                                                  guint* underline_offset,
                                                  guint* underline_nchars);
SkkSelectStateHandler* skk_select_state_handler_new (void);
SkkSelectStateHandler* skk_select_state_handler_construct (GType object_type);
static void _vala_array_destroy (gpointer array,
                          gint array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gint array_length,
                       GDestroyNotify destroy_func);

const gchar* SKK_AUTO_START_HENKAN_KEYWORDS[33] = {"を", "ヲ", "、", "。", "．", "，", "？", "」", "ｦ", "､", "｡", "｣", "！", "；", "：", ")", ";", ":", "）", "”", "】", "』", "》", "〉", "｝", "］", "〕", "}", "]", "?", ".", ",", "!"};
static const SkkInputModeCommandEntry SKK_NONE_STATE_HANDLER_input_mode_commands[5] = {{"set-input-mode-hiragana", SKK_INPUT_MODE_HIRAGANA}, {"set-input-mode-katakana", SKK_INPUT_MODE_KATAKANA}, {"set-input-mode-hankaku-katakana", SKK_INPUT_MODE_HANKAKU_KATAKANA}, {"set-input-mode-latin", SKK_INPUT_MODE_LATIN}, {"set-input-mode-wide-latin", SKK_INPUT_MODE_WIDE_LATIN}};
static const SkkInputModeCommandEntry SKK_START_STATE_HANDLER_end_preedit_commands[3] = {{"set-input-mode-hiragana", SKK_INPUT_MODE_HIRAGANA}, {"set-input-mode-katakana", SKK_INPUT_MODE_KATAKANA}, {"set-input-mode-hankaku-katakana", SKK_INPUT_MODE_HANKAKU_KATAKANA}};

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


gchar*
skk_state_lookup_key (SkkState* self,
                      SkkKeyEvent* key)
{
	gchar* result = NULL;
	SkkKeymap* keymap = NULL;
	SkkRule* _tmp0_;
	SkkKeymapMapFile** _tmp1_;
	gint _tmp1__length1;
	SkkInputMode _tmp2_;
	SkkInputMode _tmp3_;
	SkkKeymapMapFile* _tmp4_;
	SkkKeymap* _tmp5_;
	SkkKeymap* _tmp6_;
	gchar* _tmp7_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (key != NULL, NULL);
	_tmp0_ = self->priv->_typing_rule;
	_tmp1_ = _tmp0_->keymaps;
	_tmp1__length1 = _tmp0_->keymaps_length1;
	_tmp2_ = skk_state_get_input_mode (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp1_[_tmp3_];
	_tmp5_ = _tmp4_->keymap;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	keymap = _tmp6_;
	g_return_val_if_fail (keymap != NULL, NULL);
	_tmp7_ = skk_keymap_lookup_key (keymap, key);
	result = _tmp7_;
	_g_object_unref0 (keymap);
	return result;
}


SkkKeyEvent*
skk_state_where_is (SkkState* self,
                    const gchar* command)
{
	SkkKeyEvent* result = NULL;
	SkkKeymap* keymap = NULL;
	SkkRule* _tmp0_;
	SkkKeymapMapFile** _tmp1_;
	gint _tmp1__length1;
	SkkInputMode _tmp2_;
	SkkInputMode _tmp3_;
	SkkKeymapMapFile* _tmp4_;
	SkkKeymap* _tmp5_;
	SkkKeymap* _tmp6_;
	SkkKeyEvent* _tmp7_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (command != NULL, NULL);
	_tmp0_ = self->priv->_typing_rule;
	_tmp1_ = _tmp0_->keymaps;
	_tmp1__length1 = _tmp0_->keymaps_length1;
	_tmp2_ = skk_state_get_input_mode (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp1_[_tmp3_];
	_tmp5_ = _tmp4_->keymap;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	keymap = _tmp6_;
	g_return_val_if_fail (keymap != NULL, NULL);
	_tmp7_ = skk_keymap_where_is (keymap, command);
	result = _tmp7_;
	_g_object_unref0 (keymap);
	return result;
}


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


gboolean
skk_state_isupper (SkkState* self,
                   SkkKeyEvent* key,
                   gunichar* lower_code)
{
	gunichar _vala_lower_code = 0U;
	gboolean result = FALSE;
	gchar* command = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gunichar _tmp9_;
	gunichar _tmp10_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = skk_state_lookup_key (self, key);
	command = _tmp0_;
	_tmp2_ = command;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		_tmp3_ = command;
		_tmp1_ = g_str_has_prefix (_tmp3_, "upper-");
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp4_;
		_tmp4_ = command;
		_vala_lower_code = (gunichar) string_get (_tmp4_, (glong) 6);
		result = TRUE;
		_g_free0 (command);
		if (lower_code) {
			*lower_code = _vala_lower_code;
		}
		return result;
	} else {
		gunichar _tmp5_;
		gunichar _tmp6_;
		_tmp5_ = skk_key_event_get_code (key);
		_tmp6_ = _tmp5_;
		if (g_unichar_isupper (_tmp6_)) {
			gunichar _tmp7_;
			gunichar _tmp8_;
			_tmp7_ = skk_key_event_get_code (key);
			_tmp8_ = _tmp7_;
			_vala_lower_code = g_unichar_tolower (_tmp8_);
			result = TRUE;
			_g_free0 (command);
			if (lower_code) {
				*lower_code = _vala_lower_code;
			}
			return result;
		}
	}
	_tmp9_ = skk_key_event_get_code (key);
	_tmp10_ = _tmp9_;
	_vala_lower_code = _tmp10_;
	result = FALSE;
	_g_free0 (command);
	if (lower_code) {
		*lower_code = _vala_lower_code;
	}
	return result;
}


static void
_skk_state_candidate_selected_skk_candidate_list_selected (SkkCandidateList* _sender,
                                                           SkkCandidate* candidate,
                                                           gpointer self)
{
	skk_state_candidate_selected ((SkkState*) self, candidate);
}


static gchar**
_vala_array_dup3 (gchar** self,
                  int length)
{
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


SkkState*
skk_state_construct (GType object_type,
                     GeeList* dictionaries)
{
	SkkState * self = NULL;
	GeeList* _tmp0_;
	SkkSimpleCandidateList* _tmp1_;
	SkkCandidateList* _tmp2_;
	SkkRomKanaConverter* _tmp3_;
	SkkRomKanaConverter* _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (dictionaries != NULL, NULL);
	self = (SkkState*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (dictionaries);
	_g_object_unref0 (self->dictionaries);
	self->dictionaries = _tmp0_;
	_tmp1_ = skk_simple_candidate_list_new ((guint) 4, (guint) 7);
	_g_object_unref0 (self->candidates);
	self->candidates = (SkkCandidateList*) _tmp1_;
	_tmp2_ = self->candidates;
	g_signal_connect_object (_tmp2_, "selected", (GCallback) _skk_state_candidate_selected_skk_candidate_list_selected, self, 0);
	_tmp3_ = skk_rom_kana_converter_new ();
	_g_object_unref0 (self->rom_kana_converter);
	self->rom_kana_converter = _tmp3_;
	_tmp4_ = skk_rom_kana_converter_new ();
	_g_object_unref0 (self->okuri_rom_kana_converter);
	self->okuri_rom_kana_converter = _tmp4_;
	_tmp5_ = (SKK_AUTO_START_HENKAN_KEYWORDS != NULL) ? _vala_array_dup3 (SKK_AUTO_START_HENKAN_KEYWORDS, G_N_ELEMENTS (SKK_AUTO_START_HENKAN_KEYWORDS)) : ((gpointer) SKK_AUTO_START_HENKAN_KEYWORDS);
	_tmp5__length1 = G_N_ELEMENTS (SKK_AUTO_START_HENKAN_KEYWORDS);
	self->auto_start_henkan_keywords = (_vala_array_free (self->auto_start_henkan_keywords, self->auto_start_henkan_keywords_length1, (GDestroyNotify) g_free), NULL);
	self->auto_start_henkan_keywords = _tmp5_;
	self->auto_start_henkan_keywords_length1 = _tmp5__length1;
	self->_auto_start_henkan_keywords_size_ = self->auto_start_henkan_keywords_length1;
	{
		SkkRule* _tmp6_ = NULL;
		SkkRule* _tmp7_;
		SkkRule* _tmp8_;
		_tmp7_ = skk_rule_new ("default", &_inner_error_);
		_tmp6_ = _tmp7_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
				goto __catch29_skk_rule_parse_error;
			}
			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 NULL;
		}
		_tmp8_ = _tmp6_;
		_tmp6_ = NULL;
		_g_object_unref0 (self->priv->_typing_rule);
		self->priv->_typing_rule = _tmp8_;
		_g_object_unref0 (_tmp6_);
	}
	goto __finally29;
	__catch29_skk_rule_parse_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (e);
	}
	__finally29:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		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 NULL;
	}
	{
		GRegex* _tmp9_ = NULL;
		GRegex* _tmp10_;
		GRegex* _tmp11_;
		_tmp10_ = g_regex_new ("[0-9]+", 0, 0, &_inner_error_);
		_tmp9_ = _tmp10_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch30_g_regex_error;
			}
			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 NULL;
		}
		_tmp11_ = _tmp9_;
		_tmp9_ = NULL;
		_g_regex_unref0 (self->priv->numeric_regex);
		self->priv->numeric_regex = _tmp11_;
		_g_regex_unref0 (_tmp9_);
	}
	goto __finally30;
	__catch30_g_regex_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (e);
	}
	__finally30:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		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 NULL;
	}
	{
		GRegex* _tmp12_ = NULL;
		GRegex* _tmp13_;
		GRegex* _tmp14_;
		_tmp13_ = g_regex_new ("#([0-9])", 0, 0, &_inner_error_);
		_tmp12_ = _tmp13_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch31_g_regex_error;
			}
			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 NULL;
		}
		_tmp14_ = _tmp12_;
		_tmp12_ = NULL;
		_g_regex_unref0 (self->priv->numeric_ref_regex);
		self->priv->numeric_ref_regex = _tmp14_;
		_g_regex_unref0 (_tmp12_);
	}
	goto __finally31;
	__catch31_g_regex_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (e);
	}
	__finally31:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		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 NULL;
	}
	skk_state_reset (self);
	return self;
}


SkkState*
skk_state_new (GeeList* dictionaries)
{
	return skk_state_construct (SKK_TYPE_STATE, dictionaries);
}


static void
skk_state_candidate_selected (SkkState* self,
                              SkkCandidate* c)
{
	GString* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	SkkInputMode _mode = 0;
	SkkInputMode _tmp11_;
	SkkInputMode _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	_tmp0_ = self->output;
	_tmp1_ = skk_candidate_get_output (c);
	_tmp2_ = _tmp1_;
	g_string_append (_tmp0_, _tmp2_);
	_tmp3_ = self->auto_start_henkan_keyword;
	if (_tmp3_ != NULL) {
		GString* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = self->output;
		_tmp5_ = self->auto_start_henkan_keyword;
		g_string_append (_tmp4_, _tmp5_);
	} else {
		gboolean _tmp6_;
		_tmp6_ = self->okuri;
		if (_tmp6_) {
			GString* _tmp7_;
			SkkRomKanaConverter* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_tmp7_ = self->output;
			_tmp8_ = self->okuri_rom_kana_converter;
			_tmp9_ = skk_rom_kana_converter_get_output (_tmp8_);
			_tmp10_ = _tmp9_;
			g_string_append (_tmp7_, _tmp10_);
		}
	}
	_tmp11_ = skk_state_get_input_mode (self);
	_tmp12_ = _tmp11_;
	_mode = _tmp12_;
	skk_state_reset (self);
	self->priv->_input_mode = _mode;
}


void
skk_state_output_surrounding_text (SkkState* self)
{
	SkkUnicodeString* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->surrounding_text;
	if (_tmp0_ != NULL) {
		GString* _tmp1_;
		SkkUnicodeString* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp1_ = self->output;
		_tmp2_ = self->surrounding_text;
		_tmp3_ = skk_unicode_string_substring (_tmp2_, (glong) 0, (glong) -1);
		_tmp4_ = _tmp3_;
		g_string_append (_tmp1_, _tmp4_);
		_g_free0 (_tmp4_);
	}
}


void
skk_state_reset (SkkState* self)
{
	SkkRomKanaConverter* _tmp0_;
	SkkRomKanaConverter* _tmp1_;
	SkkRule* _tmp2_;
	SkkKeyEventFilter* _tmp3_;
	SkkKeyEventFilter* _tmp4_;
	GeeArrayList* _tmp5_;
	SkkCandidateList* _tmp6_;
	GString* _tmp7_;
	GString* _tmp8_;
	g_return_if_fail (self != NULL);
	self->handler_type = SKK_TYPE_NONE_STATE_HANDLER;
	_tmp0_ = self->rom_kana_converter;
	skk_rom_kana_converter_reset (_tmp0_);
	_tmp1_ = self->okuri_rom_kana_converter;
	skk_rom_kana_converter_reset (_tmp1_);
	self->okuri = FALSE;
	_tmp2_ = self->priv->_typing_rule;
	_tmp3_ = skk_rule_get_filter (_tmp2_);
	_tmp4_ = _tmp3_;
	skk_key_event_filter_reset (_tmp4_);
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (self->completion_iterator);
	self->completion_iterator = NULL;
	_tmp5_ = self->priv->completion;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp5_);
	_tmp6_ = self->candidates;
	skk_candidate_list_clear (_tmp6_);
	_tmp7_ = self->abbrev;
	g_string_erase (_tmp7_, (gssize) 0, (gssize) -1);
	_tmp8_ = self->kuten;
	g_string_erase (_tmp8_, (gssize) 0, (gssize) -1);
	_g_free0 (self->auto_start_henkan_keyword);
	self->auto_start_henkan_keyword = NULL;
	_g_object_unref0 (self->surrounding_text);
	self->surrounding_text = NULL;
	self->surrounding_end = (guint) 0;
}


void
skk_state_cancel_okuri (SkkState* self)
{
	SkkRomKanaConverter* _tmp0_;
	SkkRomKanaConverter* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	SkkRomKanaConverter* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	SkkRomKanaConverter* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->rom_kana_converter;
	_tmp1_ = self->rom_kana_converter;
	_tmp2_ = skk_rom_kana_converter_get_output (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->okuri_rom_kana_converter;
	_tmp5_ = skk_rom_kana_converter_get_output (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strconcat (_tmp3_, _tmp6_, NULL);
	_tmp8_ = _tmp7_;
	skk_rom_kana_converter_set_output (_tmp1_, _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = self->okuri_rom_kana_converter;
	skk_rom_kana_converter_reset (_tmp9_);
	self->okuri = FALSE;
}


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


static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	gchar* result = NULL;
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gchar* _tmp8_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		glong _tmp2_;
		_tmp2_ = string_length;
		start = _tmp2_ + start;
	}
	if (end < ((glong) 0)) {
		glong _tmp3_;
		_tmp3_ = string_length;
		end = _tmp3_ + end;
	}
	if (start >= ((glong) 0)) {
		glong _tmp5_;
		_tmp5_ = string_length;
		_tmp4_ = start <= _tmp5_;
	} else {
		_tmp4_ = FALSE;
	}
	g_return_val_if_fail (_tmp4_, NULL);
	if (end >= ((glong) 0)) {
		glong _tmp7_;
		_tmp7_ = string_length;
		_tmp6_ = end <= _tmp7_;
	} else {
		_tmp6_ = FALSE;
	}
	g_return_val_if_fail (_tmp6_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp8_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp8_;
	return result;
}


static gint*
_vala_array_dup4 (gint* self,
                  int length)
{
	return g_memdup (self, length * sizeof (gint));
}


static gchar*
skk_state_extract_numerics (SkkState* self,
                            const gchar* midasi,
                            gint** numerics,
                            int* numerics_length1)
{
	gint* _vala_numerics = NULL;
	int _vala_numerics_length1 = 0;
	gchar* result = NULL;
	GMatchInfo* info = NULL;
	gint start_pos = 0;
	gint* _numerics = NULL;
	gint* _tmp0_;
	gint _numerics_length1;
	gint __numerics_size_;
	GString* builder = NULL;
	GString* _tmp1_;
	gint* _tmp21_;
	gint _tmp21__length1;
	gint* _tmp22_;
	gint _tmp22__length1;
	GString* _tmp23_;
	gint _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	GString* _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (midasi != NULL, NULL);
	info = NULL;
	start_pos = 0;
	_tmp0_ = g_new0 (gint, 0);
	_numerics = _tmp0_;
	_numerics_length1 = 0;
	__numerics_size_ = _numerics_length1;
	_tmp1_ = g_string_new ("");
	builder = _tmp1_;
	while (TRUE) {
		gchar* numeric = NULL;
		GMatchInfo* _tmp7_;
		gchar* _tmp8_;
		gint match_start_pos = 0;
		gint match_end_pos = 0;
		GMatchInfo* _tmp9_;
		gint _tmp10_ = 0;
		gint _tmp11_ = 0;
		gint* _tmp12_;
		gint _tmp12__length1;
		const gchar* _tmp13_;
		GString* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		GString* _tmp19_;
		gint _tmp20_;
		{
			gboolean _tmp2_ = FALSE;
			GRegex* _tmp3_;
			gint _tmp4_;
			GMatchInfo* _tmp5_ = NULL;
			gboolean _tmp6_;
			_tmp3_ = self->priv->numeric_regex;
			_tmp4_ = start_pos;
			_tmp6_ = g_regex_match_full (_tmp3_, midasi, (gssize) -1, _tmp4_, 0, &_tmp5_, &_inner_error_);
			_g_match_info_unref0 (info);
			info = _tmp5_;
			_tmp2_ = _tmp6_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				if (_inner_error_->domain == G_REGEX_ERROR) {
					goto __catch32_g_regex_error;
				}
				_g_string_free0 (builder);
				_numerics = (g_free (_numerics), NULL);
				_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 NULL;
			}
			if (!_tmp2_) {
				break;
			}
		}
		goto __finally32;
		__catch32_g_regex_error:
		{
			GError* e = NULL;
			e = _inner_error_;
			_inner_error_ = NULL;
			g_return_val_if_reached (midasi);
			_g_error_free0 (e);
		}
		__finally32:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_string_free0 (builder);
			_numerics = (g_free (_numerics), 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 NULL;
		}
		_tmp7_ = info;
		_tmp8_ = g_match_info_fetch (_tmp7_, 0);
		numeric = _tmp8_;
		_tmp9_ = info;
		g_match_info_fetch_pos (_tmp9_, 0, &_tmp10_, &_tmp11_);
		match_start_pos = _tmp10_;
		match_end_pos = _tmp11_;
		_tmp12_ = _numerics;
		_tmp12__length1 = _numerics_length1;
		_tmp13_ = numeric;
		_vala_array_add2 (&_numerics, &_numerics_length1, &__numerics_size_, atoi (_tmp13_));
		_tmp14_ = builder;
		_tmp15_ = start_pos;
		_tmp16_ = match_start_pos;
		_tmp17_ = string_slice (midasi, (glong) _tmp15_, (glong) _tmp16_);
		_tmp18_ = _tmp17_;
		g_string_append (_tmp14_, _tmp18_);
		_g_free0 (_tmp18_);
		_tmp19_ = builder;
		g_string_append (_tmp19_, "#");
		_tmp20_ = match_end_pos;
		start_pos = _tmp20_;
		_g_free0 (numeric);
	}
	_tmp21_ = _numerics;
	_tmp21__length1 = _numerics_length1;
	_tmp22_ = (_tmp21_ != NULL) ? _vala_array_dup4 (_tmp21_, _tmp21__length1) : ((gpointer) _tmp21_);
	_tmp22__length1 = _tmp21__length1;
	_vala_numerics = (g_free (_vala_numerics), NULL);
	_vala_numerics = _tmp22_;
	_vala_numerics_length1 = _tmp22__length1;
	_tmp23_ = builder;
	_tmp24_ = start_pos;
	_tmp25_ = strlen (midasi);
	_tmp26_ = _tmp25_;
	_tmp27_ = string_slice (midasi, (glong) _tmp24_, (glong) _tmp26_);
	_tmp28_ = _tmp27_;
	g_string_append (_tmp23_, _tmp28_);
	_g_free0 (_tmp28_);
	_tmp29_ = builder;
	_tmp30_ = _tmp29_->str;
	_tmp31_ = g_strdup (_tmp30_);
	result = _tmp31_;
	_g_string_free0 (builder);
	_numerics = (g_free (_numerics), NULL);
	_g_match_info_unref0 (info);
	if (numerics) {
		*numerics = _vala_numerics;
	} else {
		_vala_numerics = (g_free (_vala_numerics), NULL);
	}
	if (numerics_length1) {
		*numerics_length1 = _vala_numerics_length1;
	}
	return result;
}


static gchar*
skk_state_expand_expr (SkkState* self,
                       const gchar* text)
{
	gchar* result = NULL;
	gchar* _tmp9_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	if (g_str_has_prefix (text, "(")) {
		SkkExprReader* reader = NULL;
		SkkExprReader* _tmp0_;
		gint index = 0;
		SkkExprNode* node = NULL;
		SkkExprReader* _tmp1_;
		SkkExprNode* _tmp2_;
		SkkExprEvaluator* evaluator = NULL;
		SkkExprEvaluator* _tmp3_;
		gchar* _text = NULL;
		SkkExprEvaluator* _tmp4_;
		SkkExprNode* _tmp5_;
		SkkExprNode _tmp6_;
		gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp0_ = skk_expr_reader_new ();
		reader = _tmp0_;
		index = 0;
		_tmp1_ = reader;
		_tmp2_ = skk_expr_reader_read_expr (_tmp1_, text, &index);
		node = _tmp2_;
		_tmp3_ = skk_expr_evaluator_new ();
		evaluator = _tmp3_;
		_tmp4_ = evaluator;
		_tmp5_ = node;
		_tmp6_ = *_tmp5_;
		_tmp7_ = skk_expr_evaluator_eval (_tmp4_, &_tmp6_);
		_text = _tmp7_;
		_tmp8_ = _text;
		if (_tmp8_ != NULL) {
			result = _text;
			_g_object_unref0 (evaluator);
			_skk_expr_node_free0 (node);
			_g_object_unref0 (reader);
			return result;
		}
		_g_free0 (_text);
		_g_object_unref0 (evaluator);
		_skk_expr_node_free0 (node);
		_g_object_unref0 (reader);
	}
	_tmp9_ = g_strdup (text);
	result = _tmp9_;
	return result;
}


static gchar*
skk_state_expand_numeric_references (SkkState* self,
                                     const gchar* text,
                                     gint* numerics,
                                     int numerics_length1)
{
	gchar* result = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	GMatchInfo* info = NULL;
	gint start_pos = 0;
	GString* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gint _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	GString* _tmp34_;
	const gchar* _tmp35_;
	gchar* _tmp36_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	info = NULL;
	start_pos = 0;
	{
		gint numeric_index = 0;
		numeric_index = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint _tmp3_;
				gint match_start_pos = 0;
				gint match_end_pos = 0;
				GMatchInfo* _tmp9_;
				gint _tmp10_ = 0;
				gint _tmp11_ = 0;
				GString* _tmp12_;
				gint _tmp13_;
				gint _tmp14_;
				gchar* _tmp15_;
				gchar* _tmp16_;
				gchar* type = NULL;
				GMatchInfo* _tmp17_;
				gchar* _tmp18_;
				const gchar* _tmp19_;
				gint _tmp27_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = numeric_index;
					numeric_index = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = numeric_index;
				if (!(_tmp3_ < numerics_length1)) {
					break;
				}
				{
					gboolean _tmp4_ = FALSE;
					GRegex* _tmp5_;
					gint _tmp6_;
					GMatchInfo* _tmp7_ = NULL;
					gboolean _tmp8_;
					_tmp5_ = self->priv->numeric_ref_regex;
					_tmp6_ = start_pos;
					_tmp8_ = g_regex_match_full (_tmp5_, text, (gssize) -1, _tmp6_, 0, &_tmp7_, &_inner_error_);
					_g_match_info_unref0 (info);
					info = _tmp7_;
					_tmp4_ = _tmp8_;
					if (G_UNLIKELY (_inner_error_ != NULL)) {
						if (_inner_error_->domain == G_REGEX_ERROR) {
							goto __catch33_g_regex_error;
						}
						_g_match_info_unref0 (info);
						_g_string_free0 (builder);
						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 NULL;
					}
					if (!_tmp4_) {
						break;
					}
				}
				goto __finally33;
				__catch33_g_regex_error:
				{
					GError* e = NULL;
					e = _inner_error_;
					_inner_error_ = NULL;
					g_return_val_if_reached (text);
					_g_error_free0 (e);
				}
				__finally33:
				if (G_UNLIKELY (_inner_error_ != NULL)) {
					_g_match_info_unref0 (info);
					_g_string_free0 (builder);
					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 NULL;
				}
				_tmp9_ = info;
				g_match_info_fetch_pos (_tmp9_, 0, &_tmp10_, &_tmp11_);
				match_start_pos = _tmp10_;
				match_end_pos = _tmp11_;
				_tmp12_ = builder;
				_tmp13_ = start_pos;
				_tmp14_ = match_start_pos;
				_tmp15_ = string_slice (text, (glong) _tmp13_, (glong) _tmp14_);
				_tmp16_ = _tmp15_;
				g_string_append (_tmp12_, _tmp16_);
				_g_free0 (_tmp16_);
				_tmp17_ = info;
				_tmp18_ = g_match_info_fetch (_tmp17_, 1);
				type = _tmp18_;
				_tmp19_ = type;
				switch (string_get (_tmp19_, (glong) 0)) {
					case '0':
					case '1':
					case '2':
					case '3':
					case '5':
					{
						GString* _tmp20_;
						gint _tmp21_;
						gint _tmp22_;
						const gchar* _tmp23_;
						gchar* _tmp24_;
						gchar* _tmp25_;
						_tmp20_ = builder;
						_tmp21_ = numeric_index;
						_tmp22_ = numerics[_tmp21_];
						_tmp23_ = type;
						_tmp24_ = skk_util_get_numeric (_tmp22_, (SkkNumericConversionType) (string_get (_tmp23_, (glong) 0) - '0'));
						_tmp25_ = _tmp24_;
						g_string_append (_tmp20_, _tmp25_);
						_g_free0 (_tmp25_);
						break;
					}
					case '4':
					case '9':
					{
						break;
					}
					default:
					{
						const gchar* _tmp26_;
						_tmp26_ = type;
						g_warning ("state.vala:299: unknown numeric conversion type: %s", _tmp26_);
						break;
					}
				}
				_tmp27_ = match_end_pos;
				start_pos = _tmp27_;
				_g_free0 (type);
			}
		}
	}
	_tmp28_ = builder;
	_tmp29_ = start_pos;
	_tmp30_ = strlen (text);
	_tmp31_ = _tmp30_;
	_tmp32_ = string_slice (text, (glong) _tmp29_, (glong) _tmp31_);
	_tmp33_ = _tmp32_;
	g_string_append (_tmp28_, _tmp33_);
	_g_free0 (_tmp33_);
	_tmp34_ = builder;
	_tmp35_ = _tmp34_->str;
	_tmp36_ = g_strdup (_tmp35_);
	result = _tmp36_;
	_g_match_info_unref0 (info);
	_g_string_free0 (builder);
	return result;
}


void
skk_state_lookup (SkkState* self,
                  const gchar* midasi,
                  gboolean okuri)
{
	SkkCandidateList* _tmp0_;
	gint* numerics = NULL;
	gint* _tmp1_;
	gint numerics_length1;
	gint _numerics_size_;
	gint* _tmp2_;
	gint _tmp2__length1;
	gchar* numeric_midasi = NULL;
	gint* _tmp3_ = NULL;
	gint _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	SkkCandidateList* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (midasi != NULL);
	_tmp0_ = self->candidates;
	skk_candidate_list_clear (_tmp0_);
	_tmp1_ = g_new0 (gint, 0);
	numerics = _tmp1_;
	numerics_length1 = 0;
	_numerics_size_ = numerics_length1;
	_tmp2_ = numerics;
	_tmp2__length1 = numerics_length1;
	skk_state_lookup_internal (self, midasi, _tmp2_, _tmp2__length1, okuri);
	_tmp5_ = skk_state_extract_numerics (self, midasi, &_tmp3_, &_tmp4_);
	numerics = (g_free (numerics), NULL);
	numerics = _tmp3_;
	numerics_length1 = _tmp4_;
	_numerics_size_ = numerics_length1;
	numeric_midasi = _tmp5_;
	_tmp6_ = numeric_midasi;
	if (g_strcmp0 (_tmp6_, midasi) != 0) {
		const gchar* _tmp7_;
		gint* _tmp8_;
		gint _tmp8__length1;
		_tmp7_ = numeric_midasi;
		_tmp8_ = numerics;
		_tmp8__length1 = numerics_length1;
		skk_state_lookup_internal (self, _tmp7_, _tmp8_, _tmp8__length1, okuri);
	}
	_tmp9_ = self->candidates;
	skk_candidate_list_add_candidates_end (_tmp9_);
	_g_free0 (numeric_midasi);
	numerics = (g_free (numerics), NULL);
}


static void
skk_state_lookup_internal (SkkState* self,
                           const gchar* midasi,
                           gint* numerics,
                           int numerics_length1,
                           gboolean okuri)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (midasi != NULL);
	{
		GeeList* _dict_list = NULL;
		GeeList* _tmp0_;
		GeeList* _tmp1_;
		gint _dict_size = 0;
		GeeList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _dict_index = 0;
		_tmp0_ = self->dictionaries;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_dict_list = _tmp1_;
		_tmp2_ = _dict_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_dict_size = _tmp4_;
		_dict_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			SkkDict* dict = NULL;
			GeeList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_;
			SkkCandidate** _candidates = NULL;
			SkkDict* _tmp11_;
			gint _tmp12_;
			SkkCandidate** _tmp13_;
			gint _candidates_length1;
			gint __candidates_size_;
			SkkCandidate** _tmp14_;
			gint _tmp14__length1;
			SkkCandidateList* _tmp35_;
			SkkCandidate** _tmp36_;
			gint _tmp36__length1;
			_tmp5_ = _dict_index;
			_dict_index = _tmp5_ + 1;
			_tmp6_ = _dict_index;
			_tmp7_ = _dict_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _dict_list;
			_tmp9_ = _dict_index;
			_tmp10_ = gee_list_get (_tmp8_, _tmp9_);
			dict = (SkkDict*) _tmp10_;
			_tmp11_ = dict;
			_tmp13_ = skk_dict_lookup (_tmp11_, midasi, okuri, &_tmp12_);
			_candidates = _tmp13_;
			_candidates_length1 = _tmp12_;
			__candidates_size_ = _candidates_length1;
			_tmp14_ = _candidates;
			_tmp14__length1 = _candidates_length1;
			{
				SkkCandidate** candidate_collection = NULL;
				gint candidate_collection_length1 = 0;
				gint _candidate_collection_size_ = 0;
				gint candidate_it = 0;
				candidate_collection = _tmp14_;
				candidate_collection_length1 = _tmp14__length1;
				for (candidate_it = 0; candidate_it < _tmp14__length1; candidate_it = candidate_it + 1) {
					SkkCandidate* _tmp15_;
					SkkCandidate* candidate = NULL;
					_tmp15_ = _g_object_ref0 (candidate_collection[candidate_it]);
					candidate = _tmp15_;
					{
						gchar* text = NULL;
						SkkCandidate* _tmp16_;
						const gchar* _tmp17_;
						const gchar* _tmp18_;
						gchar* _tmp19_;
						const gchar* _tmp20_;
						gchar* _tmp21_;
						const gchar* _tmp22_;
						gchar* _tmp23_;
						SkkCandidate* _tmp24_;
						const gchar* _tmp25_;
						SkkCandidate* _tmp26_;
						const gchar* _tmp27_;
						const gchar* _tmp28_;
						_tmp16_ = candidate;
						_tmp17_ = skk_candidate_get_text (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp19_ = g_strdup (_tmp18_);
						text = _tmp19_;
						_tmp20_ = text;
						_tmp21_ = skk_state_expand_expr (self, _tmp20_);
						_g_free0 (text);
						text = _tmp21_;
						_tmp22_ = text;
						_tmp23_ = skk_state_expand_numeric_references (self, _tmp22_, numerics, numerics_length1);
						_g_free0 (text);
						text = _tmp23_;
						_tmp24_ = candidate;
						_tmp25_ = text;
						skk_candidate_set_output (_tmp24_, _tmp25_);
						_tmp26_ = candidate;
						_tmp27_ = skk_candidate_get_annotation (_tmp26_);
						_tmp28_ = _tmp27_;
						if (_tmp28_ != NULL) {
							SkkCandidate* _tmp29_;
							SkkCandidate* _tmp30_;
							const gchar* _tmp31_;
							const gchar* _tmp32_;
							gchar* _tmp33_;
							gchar* _tmp34_;
							_tmp29_ = candidate;
							_tmp30_ = candidate;
							_tmp31_ = skk_candidate_get_annotation (_tmp30_);
							_tmp32_ = _tmp31_;
							_tmp33_ = skk_state_expand_expr (self, _tmp32_);
							_tmp34_ = _tmp33_;
							skk_candidate_set_annotation (_tmp29_, _tmp34_);
							_g_free0 (_tmp34_);
						}
						_g_free0 (text);
						_g_object_unref0 (candidate);
					}
				}
			}
			_tmp35_ = self->candidates;
			_tmp36_ = _candidates;
			_tmp36__length1 = _candidates_length1;
			skk_candidate_list_add_candidates (_tmp35_, _tmp36_, _tmp36__length1);
			_candidates = (_vala_array_free (_candidates, _candidates_length1, (GDestroyNotify) g_object_unref), NULL);
			_g_object_unref0 (dict);
		}
		_g_object_unref0 (_dict_list);
	}
}


void
skk_state_purge_candidate (SkkState* self,
                           SkkCandidate* candidate)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (candidate != NULL);
	{
		GeeList* _dict_list = NULL;
		GeeList* _tmp0_;
		GeeList* _tmp1_;
		gint _dict_size = 0;
		GeeList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _dict_index = 0;
		_tmp0_ = self->dictionaries;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_dict_list = _tmp1_;
		_tmp2_ = _dict_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_dict_size = _tmp4_;
		_dict_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			SkkDict* dict = NULL;
			GeeList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_;
			SkkDict* _tmp11_;
			gboolean _tmp12_;
			gboolean _tmp13_;
			_tmp5_ = _dict_index;
			_dict_index = _tmp5_ + 1;
			_tmp6_ = _dict_index;
			_tmp7_ = _dict_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _dict_list;
			_tmp9_ = _dict_index;
			_tmp10_ = gee_list_get (_tmp8_, _tmp9_);
			dict = (SkkDict*) _tmp10_;
			_tmp11_ = dict;
			_tmp12_ = skk_dict_get_read_only (_tmp11_);
			_tmp13_ = _tmp12_;
			if (!_tmp13_) {
				SkkDict* _tmp14_;
				_tmp14_ = dict;
				skk_dict_purge_candidate (_tmp14_, candidate);
			}
			_g_object_unref0 (dict);
		}
		_g_object_unref0 (_dict_list);
	}
}


void
skk_state_completion_start (SkkState* self,
                            const gchar* midasi)
{
	GeeArrayList* _tmp19_;
	GeeBidirListIterator* _tmp20_;
	GeeBidirListIterator* _tmp21_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (midasi != NULL);
	{
		GeeList* _dict_list = NULL;
		GeeList* _tmp0_;
		GeeList* _tmp1_;
		gint _dict_size = 0;
		GeeList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _dict_index = 0;
		_tmp0_ = self->dictionaries;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_dict_list = _tmp1_;
		_tmp2_ = _dict_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_dict_size = _tmp4_;
		_dict_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			SkkDict* dict = NULL;
			GeeList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_;
			gchar** _completion = NULL;
			SkkDict* _tmp11_;
			gint _tmp12_;
			gchar** _tmp13_;
			gint _completion_length1;
			gint __completion_size_;
			gchar** _tmp14_;
			gint _tmp14__length1;
			GeeArrayList* _tmp18_;
			_tmp5_ = _dict_index;
			_dict_index = _tmp5_ + 1;
			_tmp6_ = _dict_index;
			_tmp7_ = _dict_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _dict_list;
			_tmp9_ = _dict_index;
			_tmp10_ = gee_list_get (_tmp8_, _tmp9_);
			dict = (SkkDict*) _tmp10_;
			_tmp11_ = dict;
			_tmp13_ = skk_dict_complete (_tmp11_, midasi, &_tmp12_);
			_completion = _tmp13_;
			_completion_length1 = _tmp12_;
			__completion_size_ = _completion_length1;
			_tmp14_ = _completion;
			_tmp14__length1 = _completion_length1;
			{
				gchar** word_collection = NULL;
				gint word_collection_length1 = 0;
				gint _word_collection_size_ = 0;
				gint word_it = 0;
				word_collection = _tmp14_;
				word_collection_length1 = _tmp14__length1;
				for (word_it = 0; word_it < _tmp14__length1; word_it = word_it + 1) {
					gchar* _tmp15_;
					gchar* word = NULL;
					_tmp15_ = g_strdup (word_collection[word_it]);
					word = _tmp15_;
					{
						GeeArrayList* _tmp16_;
						const gchar* _tmp17_;
						_tmp16_ = self->priv->completion;
						_tmp17_ = word;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
						_g_free0 (word);
					}
				}
			}
			_tmp18_ = self->priv->completion;
			gee_list_sort ((GeeList*) _tmp18_, NULL, NULL, NULL);
			_completion = (_vala_array_free (_completion, _completion_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (dict);
		}
		_g_object_unref0 (_dict_list);
	}
	_tmp19_ = self->priv->completion;
	_tmp20_ = gee_abstract_bidir_list_bidir_list_iterator ((GeeAbstractBidirList*) _tmp19_);
	_g_object_unref0 (self->completion_iterator);
	self->completion_iterator = _tmp20_;
	_tmp21_ = self->completion_iterator;
	if (!gee_bidir_iterator_first ((GeeBidirIterator*) _tmp21_)) {
		_g_object_unref0 (self->completion_iterator);
		self->completion_iterator = NULL;
	}
}


gchar*
skk_state_get_yomi (SkkState* self)
{
	gchar* result = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	GString* _tmp1_;
	gssize _tmp2_;
	GString* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	_tmp1_ = self->abbrev;
	_tmp2_ = _tmp1_->len;
	if (_tmp2_ > ((gssize) 0)) {
		GString* _tmp3_;
		GString* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = builder;
		_tmp4_ = self->abbrev;
		_tmp5_ = _tmp4_->str;
		g_string_append (_tmp3_, _tmp5_);
	} else {
		gboolean _tmp6_;
		_tmp6_ = self->okuri;
		if (_tmp6_) {
			GString* _tmp7_;
			SkkRomKanaConverter* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			GString* _tmp11_;
			GString* _tmp12_;
			SkkRomKanaConverter* _tmp13_;
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			GString* _tmp16_;
			SkkRomKanaConverter* _tmp17_;
			const gchar* _tmp18_;
			const gchar* _tmp19_;
			_tmp7_ = builder;
			_tmp8_ = self->rom_kana_converter;
			_tmp9_ = skk_rom_kana_converter_get_output (_tmp8_);
			_tmp10_ = _tmp9_;
			g_string_append (_tmp7_, _tmp10_);
			_tmp11_ = builder;
			g_string_append (_tmp11_, "*");
			_tmp12_ = builder;
			_tmp13_ = self->okuri_rom_kana_converter;
			_tmp14_ = skk_rom_kana_converter_get_output (_tmp13_);
			_tmp15_ = _tmp14_;
			g_string_append (_tmp12_, _tmp15_);
			_tmp16_ = builder;
			_tmp17_ = self->okuri_rom_kana_converter;
			_tmp18_ = skk_rom_kana_converter_get_preedit (_tmp17_);
			_tmp19_ = _tmp18_;
			g_string_append (_tmp16_, _tmp19_);
		} else {
			GString* _tmp20_;
			SkkRomKanaConverter* _tmp21_;
			const gchar* _tmp22_;
			const gchar* _tmp23_;
			GString* _tmp24_;
			SkkRomKanaConverter* _tmp25_;
			const gchar* _tmp26_;
			const gchar* _tmp27_;
			_tmp20_ = builder;
			_tmp21_ = self->rom_kana_converter;
			_tmp22_ = skk_rom_kana_converter_get_output (_tmp21_);
			_tmp23_ = _tmp22_;
			g_string_append (_tmp20_, _tmp23_);
			_tmp24_ = builder;
			_tmp25_ = self->rom_kana_converter;
			_tmp26_ = skk_rom_kana_converter_get_preedit (_tmp25_);
			_tmp27_ = _tmp26_;
			g_string_append (_tmp24_, _tmp27_);
		}
	}
	_tmp28_ = builder;
	_tmp29_ = _tmp28_->str;
	_tmp30_ = g_strdup (_tmp29_);
	result = _tmp30_;
	_g_string_free0 (builder);
	return result;
}


SkkInputMode
skk_state_get_input_mode (SkkState* self)
{
	SkkInputMode result;
	SkkInputMode _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_input_mode;
	result = _tmp0_;
	return result;
}


void
skk_state_set_input_mode (SkkState* self,
                          SkkInputMode value)
{
	GString* _tmp0_;
	SkkRomKanaConverter* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	SkkInputMode last_input_mode = 0;
	SkkInputMode _tmp4_;
	SkkInputMode _tmp5_;
	SkkInputMode _tmp8_;
	SkkInputMode _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->output;
	_tmp1_ = self->rom_kana_converter;
	_tmp2_ = skk_rom_kana_converter_get_output (_tmp1_);
	_tmp3_ = _tmp2_;
	g_string_append (_tmp0_, _tmp3_);
	_tmp4_ = self->priv->_input_mode;
	last_input_mode = _tmp4_;
	skk_state_reset (self);
	self->priv->_input_mode = value;
	_tmp5_ = self->priv->_input_mode;
	switch (_tmp5_) {
		case SKK_INPUT_MODE_HIRAGANA:
		case SKK_INPUT_MODE_KATAKANA:
		case SKK_INPUT_MODE_HANKAKU_KATAKANA:
		{
			SkkRomKanaConverter* _tmp6_;
			SkkRomKanaConverter* _tmp7_;
			_tmp6_ = self->rom_kana_converter;
			skk_rom_kana_converter_set_kana_mode (_tmp6_, (SkkKanaMode) value);
			_tmp7_ = self->okuri_rom_kana_converter;
			skk_rom_kana_converter_set_kana_mode (_tmp7_, (SkkKanaMode) value);
			break;
		}
		default:
		{
			break;
		}
	}
	_tmp8_ = self->priv->_input_mode;
	_tmp9_ = last_input_mode;
	if (_tmp8_ != _tmp9_) {
		g_object_notify ((GObject*) self, "input-mode");
	}
}


SkkPeriodStyle
skk_state_get_period_style (SkkState* self)
{
	SkkPeriodStyle result;
	SkkRomKanaConverter* _tmp0_;
	SkkPeriodStyle _tmp1_;
	SkkPeriodStyle _tmp2_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->rom_kana_converter;
	_tmp1_ = skk_rom_kana_converter_get_period_style (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


void
skk_state_set_period_style (SkkState* self,
                            SkkPeriodStyle value)
{
	SkkRomKanaConverter* _tmp0_;
	SkkRomKanaConverter* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->rom_kana_converter;
	skk_rom_kana_converter_set_period_style (_tmp0_, value);
	_tmp1_ = self->okuri_rom_kana_converter;
	skk_rom_kana_converter_set_period_style (_tmp1_, value);
	g_object_notify_by_pspec ((GObject *) self, skk_state_properties[SKK_STATE_PERIOD_STYLE_PROPERTY]);
}


SkkRule*
skk_state_get_typing_rule (SkkState* self)
{
	SkkRule* result;
	SkkRule* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_typing_rule;
	result = _tmp0_;
	return result;
}


void
skk_state_set_typing_rule (SkkState* self,
                           SkkRule* value)
{
	SkkRule* _tmp0_;
	SkkRomKanaConverter* _tmp1_;
	SkkRule* _tmp2_;
	SkkRomKanaMapFile* _tmp3_;
	SkkRomKanaConverter* _tmp4_;
	SkkRule* _tmp5_;
	SkkRomKanaMapFile* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_typing_rule);
	self->priv->_typing_rule = _tmp0_;
	_tmp1_ = self->rom_kana_converter;
	_tmp2_ = self->priv->_typing_rule;
	_tmp3_ = _tmp2_->rom_kana;
	skk_rom_kana_converter_set_rule (_tmp1_, _tmp3_);
	_tmp4_ = self->okuri_rom_kana_converter;
	_tmp5_ = self->priv->_typing_rule;
	_tmp6_ = _tmp5_->rom_kana;
	skk_rom_kana_converter_set_rule (_tmp4_, _tmp6_);
	g_object_notify_by_pspec ((GObject *) self, skk_state_properties[SKK_STATE_TYPING_RULE_PROPERTY]);
}


static void
g_cclosure_user_marshal_BOOLEAN__VOID (GClosure * closure,
                                       GValue * return_value,
                                       guint n_param_values,
                                       const GValue * param_values,
                                       gpointer invocation_hint,
                                       gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__VOID) (gpointer data1, gpointer data2);
	register GMarshalFunc_BOOLEAN__VOID callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 1);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__VOID) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, data2);
	g_value_set_boolean (return_value, v_return);
}


static void
g_cclosure_user_marshal_BOOLEAN__STRING (GClosure * closure,
                                         GValue * return_value,
                                         guint n_param_values,
                                         const GValue * param_values,
                                         gpointer invocation_hint,
                                         gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__STRING) (gpointer data1, const char* arg_1, gpointer data2);
	register GMarshalFunc_BOOLEAN__STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 2);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__STRING) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_string (param_values + 1), data2);
	g_value_set_boolean (return_value, v_return);
}


static void
g_cclosure_user_marshal_VOID__STRING_BOOLEAN (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, const char* arg_1, gboolean arg_2, gpointer data2);
	register GMarshalFunc_VOID__STRING_BOOLEAN callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_boolean (param_values + 2), data2);
}


static void
g_cclosure_user_marshal_BOOLEAN__POINTER_POINTER (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_POINTER) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_BOOLEAN__POINTER_POINTER callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_pointer (param_values + 1), g_value_get_pointer (param_values + 2), data2);
	g_value_set_boolean (return_value, v_return);
}


static void
g_cclosure_user_marshal_BOOLEAN__INT_UINT (GClosure * closure,
                                           GValue * return_value,
                                           guint n_param_values,
                                           const GValue * param_values,
                                           gpointer invocation_hint,
                                           gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__INT_UINT) (gpointer data1, gint arg_1, guint arg_2, gpointer data2);
	register GMarshalFunc_BOOLEAN__INT_UINT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__INT_UINT) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_int (param_values + 1), g_value_get_uint (param_values + 2), data2);
	g_value_set_boolean (return_value, v_return);
}


static void
skk_state_class_init (SkkStateClass * klass)
{
	skk_state_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SkkStatePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_skk_state_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_skk_state_set_property;
	G_OBJECT_CLASS (klass)->finalize = skk_state_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SKK_STATE_INPUT_MODE_PROPERTY, skk_state_properties[SKK_STATE_INPUT_MODE_PROPERTY] = g_param_spec_enum ("input-mode", "input-mode", "input-mode", SKK_TYPE_INPUT_MODE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SKK_STATE_PERIOD_STYLE_PROPERTY, skk_state_properties[SKK_STATE_PERIOD_STYLE_PROPERTY] = g_param_spec_enum ("period-style", "period-style", "period-style", SKK_TYPE_PERIOD_STYLE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SKK_STATE_TYPING_RULE_PROPERTY, skk_state_properties[SKK_STATE_TYPING_RULE_PROPERTY] = g_param_spec_object ("typing-rule", "typing-rule", "typing-rule", SKK_TYPE_RULE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	skk_state_signals[SKK_STATE_RECURSIVE_EDIT_ABORT_SIGNAL] = g_signal_new ("recursive-edit-abort", SKK_TYPE_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0);
	skk_state_signals[SKK_STATE_RECURSIVE_EDIT_END_SIGNAL] = g_signal_new ("recursive-edit-end", SKK_TYPE_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
	skk_state_signals[SKK_STATE_RECURSIVE_EDIT_START_SIGNAL] = g_signal_new ("recursive-edit-start", SKK_TYPE_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN);
	skk_state_signals[SKK_STATE_RETRIEVE_SURROUNDING_TEXT_SIGNAL] = g_signal_new ("retrieve-surrounding-text", SKK_TYPE_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__POINTER_POINTER, G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_POINTER);
	skk_state_signals[SKK_STATE_DELETE_SURROUNDING_TEXT_SIGNAL] = g_signal_new ("delete-surrounding-text", SKK_TYPE_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__INT_UINT, G_TYPE_BOOLEAN, 2, G_TYPE_INT, G_TYPE_UINT);
}


static void
skk_state_instance_init (SkkState * self)
{
	GString* _tmp0_;
	GString* _tmp1_;
	GString* _tmp2_;
	GeeArrayList* _tmp3_;
	self->priv = SKK_STATE_GET_PRIVATE (self);
	_tmp0_ = g_string_new ("");
	self->output = _tmp0_;
	_tmp1_ = g_string_new ("");
	self->abbrev = _tmp1_;
	_tmp2_ = g_string_new ("");
	self->kuten = _tmp2_;
	_tmp3_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	self->priv->completion = _tmp3_;
	self->auto_start_henkan_keyword = NULL;
	self->egg_like_newline = FALSE;
}


static void
skk_state_finalize (GObject * obj)
{
	SkkState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SKK_TYPE_STATE, SkkState);
	skk_state_reset (self);
	_g_object_unref0 (self->dictionaries);
	_g_object_unref0 (self->candidates);
	_g_object_unref0 (self->rom_kana_converter);
	_g_object_unref0 (self->okuri_rom_kana_converter);
	_g_free0 (self->midasi);
	_g_string_free0 (self->output);
	_g_string_free0 (self->abbrev);
	_g_string_free0 (self->kuten);
	_g_object_unref0 (self->priv->completion);
	_g_object_unref0 (self->completion_iterator);
	self->auto_start_henkan_keywords = (_vala_array_free (self->auto_start_henkan_keywords, self->auto_start_henkan_keywords_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (self->auto_start_henkan_keyword);
	_g_object_unref0 (self->priv->_typing_rule);
	_g_regex_unref0 (self->priv->numeric_regex);
	_g_regex_unref0 (self->priv->numeric_ref_regex);
	_g_object_unref0 (self->surrounding_text);
	G_OBJECT_CLASS (skk_state_parent_class)->finalize (obj);
}


GType
skk_state_get_type (void)
{
	static volatile gsize skk_state_type_id__volatile = 0;
	if (g_once_init_enter (&skk_state_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SkkStateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) skk_state_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SkkState), 0, (GInstanceInitFunc) skk_state_instance_init, NULL };
		GType skk_state_type_id;
		skk_state_type_id = g_type_register_static (G_TYPE_OBJECT, "SkkState", &g_define_type_info, 0);
		g_once_init_leave (&skk_state_type_id__volatile, skk_state_type_id);
	}
	return skk_state_type_id__volatile;
}


static void
_vala_skk_state_get_property (GObject * object,
                              guint property_id,
                              GValue * value,
                              GParamSpec * pspec)
{
	SkkState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SKK_TYPE_STATE, SkkState);
	switch (property_id) {
		case SKK_STATE_INPUT_MODE_PROPERTY:
		g_value_set_enum (value, skk_state_get_input_mode (self));
		break;
		case SKK_STATE_PERIOD_STYLE_PROPERTY:
		g_value_set_enum (value, skk_state_get_period_style (self));
		break;
		case SKK_STATE_TYPING_RULE_PROPERTY:
		g_value_set_object (value, skk_state_get_typing_rule (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void
_vala_skk_state_set_property (GObject * object,
                              guint property_id,
                              const GValue * value,
                              GParamSpec * pspec)
{
	SkkState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SKK_TYPE_STATE, SkkState);
	switch (property_id) {
		case SKK_STATE_INPUT_MODE_PROPERTY:
		skk_state_set_input_mode (self, g_value_get_enum (value));
		break;
		case SKK_STATE_PERIOD_STYLE_PROPERTY:
		skk_state_set_period_style (self, g_value_get_enum (value));
		break;
		case SKK_STATE_TYPING_RULE_PROPERTY:
		skk_state_set_typing_rule (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static gboolean
skk_state_handler_real_process_key_event (SkkStateHandler* self,
                                          SkkState* state,
                                          SkkKeyEvent* * key)
{
	gboolean _tmp0_ = FALSE;
	g_critical ("Type `%s' does not implement abstract method `skk_state_handler_process_key_event'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return _tmp0_;
}


gboolean
skk_state_handler_process_key_event (SkkStateHandler* self,
                                     SkkState* state,
                                     SkkKeyEvent* * key)
{
	g_return_val_if_fail (self != NULL, FALSE);
	return SKK_STATE_HANDLER_GET_CLASS (self)->process_key_event (self, state, key);
}


static gchar*
skk_state_handler_real_get_preedit (SkkStateHandler* self,
                                    SkkState* state,
                                    guint* underline_offset,
                                    guint* underline_nchars)
{
	g_critical ("Type `%s' does not implement abstract method `skk_state_handler_get_preedit'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}


gchar*
skk_state_handler_get_preedit (SkkStateHandler* self,
                               SkkState* state,
                               guint* underline_offset,
                               guint* underline_nchars)
{
	g_return_val_if_fail (self != NULL, NULL);
	return SKK_STATE_HANDLER_GET_CLASS (self)->get_preedit (self, state, underline_offset, underline_nchars);
}


static gchar*
skk_state_handler_real_get_output (SkkStateHandler* self,
                                   SkkState* state)
{
	gchar* result = NULL;
	GString* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_val_if_fail (state != NULL, NULL);
	_tmp0_ = state->output;
	_tmp1_ = _tmp0_->str;
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}


gchar*
skk_state_handler_get_output (SkkStateHandler* self,
                              SkkState* state)
{
	g_return_val_if_fail (self != NULL, NULL);
	return SKK_STATE_HANDLER_GET_CLASS (self)->get_output (self, state);
}


SkkStateHandler*
skk_state_handler_construct (GType object_type)
{
	SkkStateHandler * self = NULL;
	self = (SkkStateHandler*) g_object_new (object_type, NULL);
	return self;
}


static void
skk_state_handler_class_init (SkkStateHandlerClass * klass)
{
	skk_state_handler_parent_class = g_type_class_peek_parent (klass);
	((SkkStateHandlerClass *) klass)->process_key_event = (gboolean (*) (SkkStateHandler *, SkkState*, SkkKeyEvent* *)) skk_state_handler_real_process_key_event;
	((SkkStateHandlerClass *) klass)->get_preedit = (gchar* (*) (SkkStateHandler *, SkkState*, guint*, guint*)) skk_state_handler_real_get_preedit;
	((SkkStateHandlerClass *) klass)->get_output = (gchar* (*) (SkkStateHandler *, SkkState*)) skk_state_handler_real_get_output;
}


static void
skk_state_handler_instance_init (SkkStateHandler * self)
{
}


GType
skk_state_handler_get_type (void)
{
	static volatile gsize skk_state_handler_type_id__volatile = 0;
	if (g_once_init_enter (&skk_state_handler_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SkkStateHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) skk_state_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SkkStateHandler), 0, (GInstanceInitFunc) skk_state_handler_instance_init, NULL };
		GType skk_state_handler_type_id;
		skk_state_handler_type_id = g_type_register_static (G_TYPE_OBJECT, "SkkStateHandler", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&skk_state_handler_type_id__volatile, skk_state_handler_type_id);
	}
	return skk_state_handler_type_id__volatile;
}


void
skk_input_mode_command_entry_copy (const SkkInputModeCommandEntry* self,
                                   SkkInputModeCommandEntry* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	SkkInputMode _tmp2_;
	_tmp0_ = (*self).key;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).key);
	(*dest).key = _tmp1_;
	_tmp2_ = (*self).value;
	(*dest).value = _tmp2_;
}


void
skk_input_mode_command_entry_destroy (SkkInputModeCommandEntry* self)
{
	_g_free0 ((*self).key);
}


SkkInputModeCommandEntry*
skk_input_mode_command_entry_dup (const SkkInputModeCommandEntry* self)
{
	SkkInputModeCommandEntry* dup;
	dup = g_new0 (SkkInputModeCommandEntry, 1);
	skk_input_mode_command_entry_copy (self, dup);
	return dup;
}


void
skk_input_mode_command_entry_free (SkkInputModeCommandEntry* self)
{
	skk_input_mode_command_entry_destroy (self);
	g_free (self);
}


GType
skk_input_mode_command_entry_get_type (void)
{
	static volatile gsize skk_input_mode_command_entry_type_id__volatile = 0;
	if (g_once_init_enter (&skk_input_mode_command_entry_type_id__volatile)) {
		GType skk_input_mode_command_entry_type_id;
		skk_input_mode_command_entry_type_id = g_boxed_type_register_static ("SkkInputModeCommandEntry", (GBoxedCopyFunc) skk_input_mode_command_entry_dup, (GBoxedFreeFunc) skk_input_mode_command_entry_free);
		g_once_init_leave (&skk_input_mode_command_entry_type_id__volatile, skk_input_mode_command_entry_type_id);
	}
	return skk_input_mode_command_entry_type_id__volatile;
}


static gint
string_index_of_nth_char (const gchar* self,
                          glong c)
{
	gint result = 0;
	gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = g_utf8_offset_to_pointer (self, c);
	result = (gint) (_tmp0_ - ((gchar*) self));
	return result;
}


static gboolean
skk_none_state_handler_real_process_key_event (SkkStateHandler* base,
                                               SkkState* state,
                                               SkkKeyEvent* * key)
{
	SkkNoneStateHandler * self;
	gboolean result = FALSE;
	gchar* command = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	gboolean _tmp57_ = FALSE;
	gboolean _tmp58_ = FALSE;
	const gchar* _tmp59_;
	const gchar* _tmp82_;
	SkkInputMode _tmp91_;
	SkkInputMode _tmp92_;
	self = (SkkNoneStateHandler*) base;
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (*key != NULL, FALSE);
	_tmp0_ = skk_state_lookup_key (state, *key);
	command = _tmp0_;
	_tmp3_ = command;
	if (g_strcmp0 (_tmp3_, "abort") == 0) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = command;
		_tmp2_ = g_strcmp0 (_tmp4_, "abort-to-latin") == 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = command;
		_tmp1_ = g_strcmp0 (_tmp5_, "abort-to-latin-unhandled") == 0;
	}
	if (_tmp1_) {
		gboolean something_changed = FALSE;
		gboolean event_handled = FALSE;
		SkkRomKanaConverter* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gboolean _tmp12_;
		const gchar* _tmp13_;
		SkkInputMode _tmp14_;
		SkkInputMode _tmp15_;
		gboolean _tmp16_ = FALSE;
		const gchar* _tmp17_;
		_tmp6_ = state->rom_kana_converter;
		_tmp7_ = skk_rom_kana_converter_get_preedit (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = strlen (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_ > 0) {
			something_changed = TRUE;
		} else {
			gboolean _tmp11_ = FALSE;
			g_signal_emit (state, skk_state_signals[SKK_STATE_RECURSIVE_EDIT_ABORT_SIGNAL], 0, &_tmp11_);
			something_changed = _tmp11_;
		}
		_tmp12_ = something_changed;
		event_handled = _tmp12_;
		skk_state_reset (state);
		_tmp13_ = command;
		if (g_strcmp0 (_tmp13_, "abort") == 0) {
			result = something_changed;
			_g_free0 (command);
			return result;
		}
		_tmp14_ = skk_state_get_input_mode (state);
		_tmp15_ = _tmp14_;
		if (_tmp15_ != SKK_INPUT_MODE_LATIN) {
			skk_state_set_input_mode (state, SKK_INPUT_MODE_LATIN);
			something_changed = TRUE;
		}
		_tmp17_ = command;
		if (g_strcmp0 (_tmp17_, "abort-to-latin-unhandled") == 0) {
			gboolean _tmp18_;
			_tmp18_ = event_handled;
			_tmp16_ = !_tmp18_;
		} else {
			_tmp16_ = FALSE;
		}
		if (_tmp16_) {
			result = FALSE;
			_g_free0 (command);
			return result;
		}
		result = something_changed;
		_g_free0 (command);
		return result;
	} else {
		gboolean _tmp19_ = FALSE;
		const gchar* _tmp20_;
		_tmp20_ = command;
		if (g_strcmp0 (_tmp20_, "commit") == 0) {
			_tmp19_ = TRUE;
		} else {
			const gchar* _tmp21_;
			_tmp21_ = command;
			_tmp19_ = g_strcmp0 (_tmp21_, "commit-unhandled") == 0;
		}
		if (_tmp19_) {
			gboolean retval = FALSE;
			SkkRomKanaConverter* _tmp22_;
			const gchar* _tmp23_;
			const gchar* _tmp24_;
			gint _tmp25_;
			gint _tmp26_;
			gboolean _tmp35_ = FALSE;
			const gchar* _tmp36_;
			_tmp22_ = state->rom_kana_converter;
			_tmp23_ = skk_rom_kana_converter_get_preedit (_tmp22_);
			_tmp24_ = _tmp23_;
			_tmp25_ = strlen (_tmp24_);
			_tmp26_ = _tmp25_;
			if (_tmp26_ > 0) {
				retval = TRUE;
			} else {
				GString* _tmp27_;
				const gchar* _tmp28_;
				gint _tmp29_;
				gint _tmp30_;
				_tmp27_ = state->output;
				_tmp28_ = _tmp27_->str;
				_tmp29_ = strlen (_tmp28_);
				_tmp30_ = _tmp29_;
				if (_tmp30_ == 0) {
					gboolean _tmp31_ = FALSE;
					g_signal_emit (state, skk_state_signals[SKK_STATE_RECURSIVE_EDIT_ABORT_SIGNAL], 0, &_tmp31_);
					retval = _tmp31_;
				} else {
					GString* _tmp32_;
					const gchar* _tmp33_;
					gboolean _tmp34_ = FALSE;
					_tmp32_ = state->output;
					_tmp33_ = _tmp32_->str;
					g_signal_emit (state, skk_state_signals[SKK_STATE_RECURSIVE_EDIT_END_SIGNAL], 0, _tmp33_, &_tmp34_);
					retval = _tmp34_;
				}
			}
			skk_state_reset (state);
			_tmp36_ = command;
			if (g_strcmp0 (_tmp36_, "commit") == 0) {
				_tmp35_ = TRUE;
			} else {
				gboolean _tmp37_;
				_tmp37_ = retval;
				_tmp35_ = _tmp37_;
			}
			result = _tmp35_;
			_g_free0 (command);
			return result;
		} else {
			gboolean _tmp38_ = FALSE;
			const gchar* _tmp39_;
			_tmp39_ = command;
			if (g_strcmp0 (_tmp39_, "start-preedit") == 0) {
				_tmp38_ = TRUE;
			} else {
				const gchar* _tmp40_;
				_tmp40_ = command;
				_tmp38_ = g_strcmp0 (_tmp40_, "start-preedit-kana") == 0;
			}
			if (_tmp38_) {
				gchar* text = NULL;
				guint cursor_pos = 0U;
				gchar* _tmp41_ = NULL;
				guint _tmp42_ = 0U;
				gboolean _tmp43_ = FALSE;
				g_signal_emit (state, skk_state_signals[SKK_STATE_RETRIEVE_SURROUNDING_TEXT_SIGNAL], 0, &_tmp41_, &_tmp42_, &_tmp43_);
				_g_free0 (text);
				text = _tmp41_;
				cursor_pos = _tmp42_;
				if (_tmp43_) {
					const gchar* _tmp44_;
					const gchar* _tmp45_;
					guint _tmp46_;
					const gchar* _tmp47_;
					gint _tmp48_;
					gint _tmp49_;
					gchar* _tmp50_;
					gchar* _tmp51_;
					SkkUnicodeString* _tmp52_;
					SkkUnicodeString* _tmp53_;
					gint _tmp54_;
					gboolean _tmp55_ = FALSE;
					_tmp44_ = text;
					_tmp45_ = text;
					_tmp46_ = cursor_pos;
					_tmp47_ = text;
					_tmp48_ = strlen (_tmp47_);
					_tmp49_ = _tmp48_;
					_tmp50_ = string_slice (_tmp44_, (glong) string_index_of_nth_char (_tmp45_, (glong) _tmp46_), (glong) _tmp49_);
					_tmp51_ = _tmp50_;
					_tmp52_ = skk_unicode_string_new (_tmp51_);
					_g_object_unref0 (state->surrounding_text);
					state->surrounding_text = _tmp52_;
					_g_free0 (_tmp51_);
					state->surrounding_end = (guint) 0;
					_tmp53_ = state->surrounding_text;
					_tmp54_ = _tmp53_->length;
					g_signal_emit (state, skk_state_signals[SKK_STATE_DELETE_SURROUNDING_TEXT_SIGNAL], 0, 0, (guint) _tmp54_, &_tmp55_);
				}
				state->handler_type = SKK_TYPE_START_STATE_HANDLER;
				result = TRUE;
				_g_free0 (text);
				_g_free0 (command);
				return result;
			} else {
				const gchar* _tmp56_;
				_tmp56_ = command;
				if (g_strcmp0 (_tmp56_, "start-preedit-no-delete") == 0) {
					state->handler_type = SKK_TYPE_START_STATE_HANDLER;
					result = TRUE;
					_g_free0 (command);
					return result;
				}
			}
		}
	}
	_tmp59_ = command;
	if (_tmp59_ != NULL) {
		const gchar* _tmp60_;
		_tmp60_ = command;
		_tmp58_ = g_str_has_prefix (_tmp60_, "set-input-mode-");
	} else {
		_tmp58_ = FALSE;
	}
	if (_tmp58_) {
		gboolean _tmp61_ = FALSE;
		gboolean _tmp62_ = FALSE;
		gboolean _tmp63_ = FALSE;
		gboolean _tmp64_ = FALSE;
		SkkInputMode _tmp65_;
		SkkInputMode _tmp66_;
		_tmp65_ = skk_state_get_input_mode (state);
		_tmp66_ = _tmp65_;
		if (_tmp66_ == SKK_INPUT_MODE_HIRAGANA) {
			_tmp64_ = TRUE;
		} else {
			SkkInputMode _tmp67_;
			SkkInputMode _tmp68_;
			_tmp67_ = skk_state_get_input_mode (state);
			_tmp68_ = _tmp67_;
			_tmp64_ = _tmp68_ == SKK_INPUT_MODE_KATAKANA;
		}
		if (_tmp64_) {
			_tmp63_ = TRUE;
		} else {
			SkkInputMode _tmp69_;
			SkkInputMode _tmp70_;
			_tmp69_ = skk_state_get_input_mode (state);
			_tmp70_ = _tmp69_;
			_tmp63_ = _tmp70_ == SKK_INPUT_MODE_HANKAKU_KATAKANA;
		}
		if (_tmp63_) {
			SkkModifierType _tmp71_;
			SkkModifierType _tmp72_;
			_tmp71_ = skk_key_event_get_modifiers (*key);
			_tmp72_ = _tmp71_;
			_tmp62_ = _tmp72_ == 0;
		} else {
			_tmp62_ = FALSE;
		}
		if (_tmp62_) {
			SkkRomKanaConverter* _tmp73_;
			gunichar _tmp74_;
			gunichar _tmp75_;
			_tmp73_ = state->rom_kana_converter;
			_tmp74_ = skk_key_event_get_code (*key);
			_tmp75_ = _tmp74_;
			_tmp61_ = skk_rom_kana_converter_can_consume (_tmp73_, _tmp75_, FALSE, TRUE);
		} else {
			_tmp61_ = FALSE;
		}
		_tmp57_ = !_tmp61_;
	} else {
		_tmp57_ = FALSE;
	}
	if (_tmp57_) {
		{
			SkkInputModeCommandEntry* entry_collection = NULL;
			gint entry_collection_length1 = 0;
			gint _entry_collection_size_ = 0;
			gint entry_it = 0;
			entry_collection = SKK_NONE_STATE_HANDLER_input_mode_commands;
			entry_collection_length1 = G_N_ELEMENTS (SKK_NONE_STATE_HANDLER_input_mode_commands);
			for (entry_it = 0; entry_it < G_N_ELEMENTS (SKK_NONE_STATE_HANDLER_input_mode_commands); entry_it = entry_it + 1) {
				SkkInputModeCommandEntry entry = {0};
				entry = entry_collection[entry_it];
				{
					SkkInputModeCommandEntry _tmp76_;
					const gchar* _tmp77_;
					const gchar* _tmp78_;
					_tmp76_ = entry;
					_tmp77_ = _tmp76_.key;
					_tmp78_ = command;
					if (g_strcmp0 (_tmp77_, _tmp78_) == 0) {
						SkkRomKanaConverter* _tmp79_;
						SkkInputModeCommandEntry _tmp80_;
						SkkInputMode _tmp81_;
						_tmp79_ = state->rom_kana_converter;
						skk_rom_kana_converter_output_nn_if_any (_tmp79_);
						_tmp80_ = entry;
						_tmp81_ = _tmp80_.value;
						skk_state_set_input_mode (state, _tmp81_);
						result = TRUE;
						_g_free0 (command);
						return result;
					}
				}
			}
		}
	}
	_tmp82_ = command;
	if (g_strcmp0 (_tmp82_, "delete") == 0) {
		SkkRomKanaConverter* _tmp83_;
		GString* _tmp84_;
		gssize _tmp85_;
		_tmp83_ = state->rom_kana_converter;
		if (skk_rom_kana_converter_delete (_tmp83_)) {
			result = TRUE;
			_g_free0 (command);
			return result;
		}
		_tmp84_ = state->output;
		_tmp85_ = _tmp84_->len;
		if (_tmp85_ > ((gssize) 0)) {
			GString* _tmp86_;
			GString* _tmp87_;
			const gchar* _tmp88_;
			GString* _tmp89_;
			const gchar* _tmp90_;
			_tmp86_ = state->output;
			_tmp87_ = state->output;
			_tmp88_ = _tmp87_->str;
			_tmp89_ = state->output;
			_tmp90_ = _tmp89_->str;
			g_string_truncate (_tmp86_, (gsize) string_index_of_nth_char (_tmp88_, (glong) (g_utf8_strlen (_tmp90_, (gssize) -1) - 1)));
			result = TRUE;
			_g_free0 (command);
			return result;
		}
		result = FALSE;
		_g_free0 (command);
		return result;
	}
	_tmp91_ = skk_state_get_input_mode (state);
	_tmp92_ = _tmp91_;
	switch (_tmp92_) {
		case SKK_INPUT_MODE_HIRAGANA:
		case SKK_INPUT_MODE_KATAKANA:
		case SKK_INPUT_MODE_HANKAKU_KATAKANA:
		{
			gunichar lower_code = 0U;
			gboolean _tmp93_ = FALSE;
			gunichar _tmp94_ = 0U;
			gboolean _tmp95_;
			gboolean _tmp112_ = FALSE;
			const gchar* _tmp113_;
			SkkModifierType _tmp129_;
			SkkModifierType _tmp130_;
			_tmp95_ = skk_state_isupper (state, *key, &_tmp94_);
			lower_code = _tmp94_;
			if (_tmp95_) {
				SkkRomKanaConverter* _tmp96_;
				gunichar _tmp97_;
				_tmp96_ = state->rom_kana_converter;
				_tmp97_ = lower_code;
				_tmp93_ = skk_rom_kana_converter_is_valid (_tmp96_, _tmp97_);
			} else {
				_tmp93_ = FALSE;
			}
			if (_tmp93_) {
				SkkRomKanaConverter* _tmp98_;
				GString* _tmp99_;
				SkkRomKanaConverter* _tmp100_;
				const gchar* _tmp101_;
				const gchar* _tmp102_;
				SkkRomKanaConverter* _tmp103_;
				_tmp98_ = state->rom_kana_converter;
				skk_rom_kana_converter_output_nn_if_any (_tmp98_);
				_tmp99_ = state->output;
				_tmp100_ = state->rom_kana_converter;
				_tmp101_ = skk_rom_kana_converter_get_output (_tmp100_);
				_tmp102_ = _tmp101_;
				g_string_append (_tmp99_, _tmp102_);
				_tmp103_ = state->rom_kana_converter;
				skk_rom_kana_converter_set_output (_tmp103_, "");
				state->handler_type = SKK_TYPE_START_STATE_HANDLER;
				result = FALSE;
				_g_free0 (command);
				return result;
			} else {
				gboolean _tmp104_ = FALSE;
				SkkModifierType _tmp105_;
				SkkModifierType _tmp106_;
				_tmp105_ = skk_key_event_get_modifiers (*key);
				_tmp106_ = _tmp105_;
				if (_tmp106_ == 0) {
					SkkRomKanaConverter* _tmp107_;
					gunichar _tmp108_;
					gunichar _tmp109_;
					_tmp107_ = state->rom_kana_converter;
					_tmp108_ = skk_key_event_get_code (*key);
					_tmp109_ = _tmp108_;
					_tmp104_ = !skk_rom_kana_converter_can_consume (_tmp107_, _tmp109_, TRUE, TRUE);
				} else {
					_tmp104_ = FALSE;
				}
				if (_tmp104_) {
					const gchar* _tmp110_;
					_tmp110_ = command;
					if (g_strcmp0 (_tmp110_, "abbrev") == 0) {
						state->handler_type = SKK_TYPE_ABBREV_STATE_HANDLER;
						result = TRUE;
						_g_free0 (command);
						return result;
					} else {
						const gchar* _tmp111_;
						_tmp111_ = command;
						if (g_strcmp0 (_tmp111_, "kuten") == 0) {
							state->handler_type = SKK_TYPE_KUTEN_STATE_HANDLER;
							result = TRUE;
							_g_free0 (command);
							return result;
						}
					}
				}
			}
			_tmp113_ = command;
			if (_tmp113_ != NULL) {
				const gchar* _tmp114_;
				_tmp114_ = command;
				_tmp112_ = g_str_has_prefix (_tmp114_, "insert-kana-");
			} else {
				_tmp112_ = FALSE;
			}
			if (_tmp112_) {
				gchar* kana = NULL;
				const gchar* _tmp115_;
				gint _tmp116_;
				gint _tmp117_;
				const gchar* _tmp118_;
				gint _tmp119_;
				gint _tmp120_;
				gchar* _tmp121_;
				gchar* _tmp122_;
				SkkInputMode _tmp123_;
				SkkInputMode _tmp124_;
				gchar* _tmp125_;
				gchar* _tmp126_;
				GString* _tmp127_;
				const gchar* _tmp128_;
				_tmp115_ = command;
				_tmp116_ = strlen ("insert-kana-");
				_tmp117_ = _tmp116_;
				_tmp118_ = command;
				_tmp119_ = strlen (_tmp118_);
				_tmp120_ = _tmp119_;
				_tmp121_ = string_slice (_tmp115_, (glong) _tmp117_, (glong) _tmp120_);
				_tmp122_ = _tmp121_;
				_tmp123_ = skk_state_get_input_mode (state);
				_tmp124_ = _tmp123_;
				_tmp125_ = skk_util_convert_by_input_mode (_tmp122_, _tmp124_);
				_tmp126_ = _tmp125_;
				_g_free0 (_tmp122_);
				kana = _tmp126_;
				_tmp127_ = state->output;
				_tmp128_ = kana;
				g_string_append (_tmp127_, _tmp128_);
				result = TRUE;
				_g_free0 (kana);
				_g_free0 (command);
				return result;
			}
			_tmp129_ = skk_key_event_get_modifiers (*key);
			_tmp130_ = _tmp129_;
			if (_tmp130_ == 0) {
				SkkRomKanaConverter* _tmp131_;
				gunichar _tmp132_;
				gunichar _tmp133_;
				_tmp131_ = state->rom_kana_converter;
				_tmp132_ = skk_key_event_get_code (*key);
				_tmp133_ = _tmp132_;
				if (skk_rom_kana_converter_append (_tmp131_, _tmp133_)) {
					GString* _tmp134_;
					SkkRomKanaConverter* _tmp135_;
					const gchar* _tmp136_;
					const gchar* _tmp137_;
					SkkRomKanaConverter* _tmp138_;
					_tmp134_ = state->output;
					_tmp135_ = state->rom_kana_converter;
					_tmp136_ = skk_rom_kana_converter_get_output (_tmp135_);
					_tmp137_ = _tmp136_;
					g_string_append (_tmp134_, _tmp137_);
					_tmp138_ = state->rom_kana_converter;
					skk_rom_kana_converter_set_output (_tmp138_, "");
					result = TRUE;
					_g_free0 (command);
					return result;
				} else {
					gboolean _tmp139_ = FALSE;
					gunichar _tmp140_;
					gunichar _tmp141_;
					_tmp140_ = skk_key_event_get_code (*key);
					_tmp141_ = _tmp140_;
					if (((gunichar) 0x20) <= _tmp141_) {
						gunichar _tmp142_;
						gunichar _tmp143_;
						_tmp142_ = skk_key_event_get_code (*key);
						_tmp143_ = _tmp142_;
						_tmp139_ = _tmp143_ < ((gunichar) 0x7F);
					} else {
						_tmp139_ = FALSE;
					}
					if (_tmp139_) {
						GString* _tmp144_;
						gunichar _tmp145_;
						gunichar _tmp146_;
						SkkRomKanaConverter* _tmp147_;
						_tmp144_ = state->output;
						_tmp145_ = skk_key_event_get_code (*key);
						_tmp146_ = _tmp145_;
						g_string_append_c (_tmp144_, (gchar) _tmp146_);
						_tmp147_ = state->rom_kana_converter;
						skk_rom_kana_converter_set_output (_tmp147_, "");
						result = TRUE;
						_g_free0 (command);
						return result;
					} else {
						SkkRomKanaConverter* _tmp148_;
						_tmp148_ = state->rom_kana_converter;
						skk_rom_kana_converter_set_output (_tmp148_, "");
						result = FALSE;
						_g_free0 (command);
						return result;
					}
				}
			}
			break;
		}
		case SKK_INPUT_MODE_LATIN:
		{
			gboolean _tmp149_ = FALSE;
			gboolean _tmp150_ = FALSE;
			SkkModifierType _tmp151_;
			SkkModifierType _tmp152_;
			_tmp151_ = skk_key_event_get_modifiers (*key);
			_tmp152_ = _tmp151_;
			if (_tmp152_ == 0) {
				gunichar _tmp153_;
				gunichar _tmp154_;
				_tmp153_ = skk_key_event_get_code (*key);
				_tmp154_ = _tmp153_;
				_tmp150_ = ((gunichar) 0x20) <= _tmp154_;
			} else {
				_tmp150_ = FALSE;
			}
			if (_tmp150_) {
				gunichar _tmp155_;
				gunichar _tmp156_;
				_tmp155_ = skk_key_event_get_code (*key);
				_tmp156_ = _tmp155_;
				_tmp149_ = _tmp156_ < ((gunichar) 0x7F);
			} else {
				_tmp149_ = FALSE;
			}
			if (_tmp149_) {
				GString* _tmp157_;
				gunichar _tmp158_;
				gunichar _tmp159_;
				_tmp157_ = state->output;
				_tmp158_ = skk_key_event_get_code (*key);
				_tmp159_ = _tmp158_;
				g_string_append_c (_tmp157_, (gchar) _tmp159_);
				result = TRUE;
				_g_free0 (command);
				return result;
			}
			break;
		}
		case SKK_INPUT_MODE_WIDE_LATIN:
		{
			gboolean _tmp160_ = FALSE;
			gboolean _tmp161_ = FALSE;
			SkkModifierType _tmp162_;
			SkkModifierType _tmp163_;
			_tmp162_ = skk_key_event_get_modifiers (*key);
			_tmp163_ = _tmp162_;
			if (_tmp163_ == 0) {
				gunichar _tmp164_;
				gunichar _tmp165_;
				_tmp164_ = skk_key_event_get_code (*key);
				_tmp165_ = _tmp164_;
				_tmp161_ = ((gunichar) 0x20) <= _tmp165_;
			} else {
				_tmp161_ = FALSE;
			}
			if (_tmp161_) {
				gunichar _tmp166_;
				gunichar _tmp167_;
				_tmp166_ = skk_key_event_get_code (*key);
				_tmp167_ = _tmp166_;
				_tmp160_ = _tmp167_ < ((gunichar) 0x7F);
			} else {
				_tmp160_ = FALSE;
			}
			if (_tmp160_) {
				GString* _tmp168_;
				gunichar _tmp169_;
				gunichar _tmp170_;
				_tmp168_ = state->output;
				_tmp169_ = skk_key_event_get_code (*key);
				_tmp170_ = _tmp169_;
				g_string_append_unichar (_tmp168_, skk_util_get_wide_latin_char ((gchar) _tmp170_));
				result = TRUE;
				_g_free0 (command);
				return result;
			}
			break;
		}
		default:
		break;
	}
	result = FALSE;
	_g_free0 (command);
	return result;
}


static gchar*
skk_none_state_handler_real_get_preedit (SkkStateHandler* base,
                                         SkkState* state,
                                         guint* underline_offset,
                                         guint* underline_nchars)
{
	SkkNoneStateHandler * self;
	guint _vala_underline_offset = 0U;
	guint _vala_underline_nchars = 0U;
	gchar* result = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	SkkRomKanaConverter* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	self = (SkkNoneStateHandler*) base;
	g_return_val_if_fail (state != NULL, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	_tmp1_ = state->rom_kana_converter;
	_tmp2_ = skk_rom_kana_converter_get_preedit (_tmp1_);
	_tmp3_ = _tmp2_;
	g_string_append (builder, _tmp3_);
	_vala_underline_nchars = (guint) 0;
	_vala_underline_offset = _vala_underline_nchars;
	_tmp4_ = builder->str;
	_tmp5_ = g_strdup (_tmp4_);
	result = _tmp5_;
	_g_string_free0 (builder);
	if (underline_offset) {
		*underline_offset = _vala_underline_offset;
	}
	if (underline_nchars) {
		*underline_nchars = _vala_underline_nchars;
	}
	return result;
}


SkkNoneStateHandler*
skk_none_state_handler_construct (GType object_type)
{
	SkkNoneStateHandler * self = NULL;
	self = (SkkNoneStateHandler*) skk_state_handler_construct (object_type);
	return self;
}


SkkNoneStateHandler*
skk_none_state_handler_new (void)
{
	return skk_none_state_handler_construct (SKK_TYPE_NONE_STATE_HANDLER);
}


static void
skk_none_state_handler_class_init (SkkNoneStateHandlerClass * klass)
{
	skk_none_state_handler_parent_class = g_type_class_peek_parent (klass);
	((SkkStateHandlerClass *) klass)->process_key_event = (gboolean (*) (SkkStateHandler *, SkkState*, SkkKeyEvent* *)) skk_none_state_handler_real_process_key_event;
	((SkkStateHandlerClass *) klass)->get_preedit = (gchar* (*) (SkkStateHandler *, SkkState*, guint*, guint*)) skk_none_state_handler_real_get_preedit;
}


static void
skk_none_state_handler_instance_init (SkkNoneStateHandler * self)
{
}


GType
skk_none_state_handler_get_type (void)
{
	static volatile gsize skk_none_state_handler_type_id__volatile = 0;
	if (g_once_init_enter (&skk_none_state_handler_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SkkNoneStateHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) skk_none_state_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SkkNoneStateHandler), 0, (GInstanceInitFunc) skk_none_state_handler_instance_init, NULL };
		GType skk_none_state_handler_type_id;
		skk_none_state_handler_type_id = g_type_register_static (SKK_TYPE_STATE_HANDLER, "SkkNoneStateHandler", &g_define_type_info, 0);
		g_once_init_leave (&skk_none_state_handler_type_id__volatile, skk_none_state_handler_type_id);
	}
	return skk_none_state_handler_type_id__volatile;
}


SkkKutenStateHandler*
skk_kuten_state_handler_construct (GType object_type)
{
	SkkKutenStateHandler * self = NULL;
	GError * _inner_error_ = NULL;
	self = (SkkKutenStateHandler*) skk_state_handler_construct (object_type);
	{
		SkkEncodingConverter* _tmp0_ = NULL;
		SkkEncodingConverter* _tmp1_;
		SkkEncodingConverter* _tmp2_;
		_tmp1_ = skk_encoding_converter_new ("EUC-JP", &_inner_error_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch34_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		_g_object_unref0 (self->priv->converter);
		self->priv->converter = _tmp2_;
		_g_object_unref0 (_tmp0_);
	}
	goto __finally34;
	__catch34_g_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_g_object_unref0 (self->priv->converter);
		self->priv->converter = NULL;
		g_assert_not_reached ();
		_g_error_free0 (e);
	}
	__finally34:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		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 NULL;
	}
	return self;
}


SkkKutenStateHandler*
skk_kuten_state_handler_new (void)
{
	return skk_kuten_state_handler_construct (SKK_TYPE_KUTEN_STATE_HANDLER);
}


static gint
skk_kuten_state_handler_hex_char_to_int (SkkKutenStateHandler* self,
                                         gchar hex)
{
	gint result = 0;
	gboolean _tmp0_ = FALSE;
	g_return_val_if_fail (self != NULL, 0);
	if ('0' <= hex) {
		_tmp0_ = hex <= '9';
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = (gint) (hex - '0');
		return result;
	} else {
		gboolean _tmp1_ = FALSE;
		if ('a' <= g_ascii_tolower (hex)) {
			_tmp1_ = g_ascii_tolower (hex) <= 'f';
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			result = (hex - 'a') + 10;
			return result;
		}
	}
	result = -1;
	return result;
}


static gchar*
skk_kuten_state_handler_parse_hex (SkkKutenStateHandler* self,
                                   const gchar* hex)
{
	gchar* result = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	GString* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (hex != NULL, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint c = 0;
				gint _tmp6_;
				gint _tmp7_;
				GString* _tmp8_;
				gint _tmp9_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 2;
				}
				_tmp1_ = FALSE;
				_tmp3_ = i;
				_tmp4_ = strlen (hex);
				_tmp5_ = _tmp4_;
				if (!(_tmp3_ < (_tmp5_ - 1))) {
					break;
				}
				_tmp6_ = i;
				_tmp7_ = i;
				c = (skk_kuten_state_handler_hex_char_to_int (self, string_get (hex, (glong) _tmp6_)) << 4) | skk_kuten_state_handler_hex_char_to_int (self, string_get (hex, (glong) (_tmp7_ + 1)));
				_tmp8_ = builder;
				_tmp9_ = c;
				g_string_append_c (_tmp8_, (gchar) _tmp9_);
			}
		}
	}
	_tmp10_ = builder;
	_tmp11_ = _tmp10_->str;
	_tmp12_ = g_strdup (_tmp11_);
	result = _tmp12_;
	_g_string_free0 (builder);
	return result;
}


static gboolean
skk_kuten_state_handler_real_process_key_event (SkkStateHandler* base,
                                                SkkState* state,
                                                SkkKeyEvent* * key)
{
	SkkKutenStateHandler * self;
	gboolean result = FALSE;
	gchar* command = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	GError * _inner_error_ = NULL;
	self = (SkkKutenStateHandler*) base;
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (*key != NULL, FALSE);
	_tmp0_ = skk_state_lookup_key (state, *key);
	command = _tmp0_;
	_tmp3_ = command;
	if (g_strcmp0 (_tmp3_, "abort") == 0) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = command;
		_tmp2_ = g_strcmp0 (_tmp4_, "abort-to-latin") == 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = command;
		_tmp1_ = g_strcmp0 (_tmp5_, "abort-to-latin-unhandled") == 0;
	}
	if (_tmp1_) {
		skk_state_reset (state);
		result = TRUE;
		_g_free0 (command);
		return result;
	} else {
		gboolean _tmp6_ = FALSE;
		const gchar* _tmp7_;
		_tmp7_ = command;
		if (g_strcmp0 (_tmp7_, "commit-unhandled") == 0) {
			gboolean _tmp8_ = FALSE;
			GString* _tmp9_;
			gssize _tmp10_;
			_tmp9_ = state->kuten;
			_tmp10_ = _tmp9_->len;
			if (_tmp10_ == ((gssize) 4)) {
				_tmp8_ = TRUE;
			} else {
				GString* _tmp11_;
				gssize _tmp12_;
				_tmp11_ = state->kuten;
				_tmp12_ = _tmp11_->len;
				_tmp8_ = _tmp12_ == ((gssize) 6);
			}
			_tmp6_ = _tmp8_;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			SkkEncodingConverter* _tmp13_;
			_tmp13_ = self->priv->converter;
			if (_tmp13_ != NULL) {
				gchar* euc = NULL;
				GString* _tmp14_;
				const gchar* _tmp15_;
				gchar* _tmp16_;
				_tmp14_ = state->kuten;
				_tmp15_ = _tmp14_->str;
				_tmp16_ = skk_kuten_state_handler_parse_hex (self, _tmp15_);
				euc = _tmp16_;
				{
					gchar* _tmp17_ = NULL;
					SkkEncodingConverter* _tmp18_;
					const gchar* _tmp19_;
					gchar* _tmp20_;
					GString* _tmp21_;
					_tmp18_ = self->priv->converter;
					_tmp19_ = euc;
					_tmp20_ = skk_encoding_converter_decode (_tmp18_, _tmp19_, &_inner_error_);
					_tmp17_ = _tmp20_;
					if (G_UNLIKELY (_inner_error_ != NULL)) {
						goto __catch35_g_error;
					}
					_tmp21_ = state->output;
					g_string_append (_tmp21_, _tmp17_);
					_g_free0 (_tmp17_);
				}
				goto __finally35;
				__catch35_g_error:
				{
					GError* e = NULL;
					const gchar* _tmp22_;
					GError* _tmp23_;
					const gchar* _tmp24_;
					e = _inner_error_;
					_inner_error_ = NULL;
					_tmp22_ = euc;
					_tmp23_ = e;
					_tmp24_ = _tmp23_->message;
					g_warning ("state.vala:650: can't decode %s in EUC-JP: %s", _tmp22_, _tmp24_);
					_g_error_free0 (e);
				}
				__finally35:
				if (G_UNLIKELY (_inner_error_ != NULL)) {
					gboolean _tmp25_ = FALSE;
					_g_free0 (euc);
					_g_free0 (command);
					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 _tmp25_;
				}
				_g_free0 (euc);
			}
			skk_state_reset (state);
			result = TRUE;
			_g_free0 (command);
			return result;
		} else {
			gboolean _tmp26_ = FALSE;
			const gchar* _tmp27_;
			_tmp27_ = command;
			if (g_strcmp0 (_tmp27_, "delete") == 0) {
				GString* _tmp28_;
				gssize _tmp29_;
				_tmp28_ = state->kuten;
				_tmp29_ = _tmp28_->len;
				_tmp26_ = _tmp29_ > ((gssize) 0);
			} else {
				_tmp26_ = FALSE;
			}
			if (_tmp26_) {
				GString* _tmp30_;
				GString* _tmp31_;
				gssize _tmp32_;
				_tmp30_ = state->kuten;
				_tmp31_ = state->kuten;
				_tmp32_ = _tmp31_->len;
				g_string_truncate (_tmp30_, (gsize) (_tmp32_ - 1));
				result = TRUE;
				_g_free0 (command);
				return result;
			} else {
				gboolean _tmp33_ = FALSE;
				gboolean _tmp34_ = FALSE;
				SkkModifierType _tmp35_;
				SkkModifierType _tmp36_;
				_tmp35_ = skk_key_event_get_modifiers (*key);
				_tmp36_ = _tmp35_;
				if (_tmp36_ == 0) {
					gboolean _tmp37_ = FALSE;
					gboolean _tmp38_ = FALSE;
					gboolean _tmp39_ = FALSE;
					gunichar _tmp40_;
					gunichar _tmp41_;
					_tmp40_ = skk_key_event_get_code (*key);
					_tmp41_ = _tmp40_;
					if (((gunichar) 'a') <= _tmp41_) {
						gunichar _tmp42_;
						gunichar _tmp43_;
						_tmp42_ = skk_key_event_get_code (*key);
						_tmp43_ = _tmp42_;
						_tmp39_ = _tmp43_ <= ((gunichar) 'f');
					} else {
						_tmp39_ = FALSE;
					}
					if (_tmp39_) {
						_tmp38_ = TRUE;
					} else {
						gboolean _tmp44_ = FALSE;
						gunichar _tmp45_;
						gunichar _tmp46_;
						_tmp45_ = skk_key_event_get_code (*key);
						_tmp46_ = _tmp45_;
						if (((gunichar) 'A') <= _tmp46_) {
							gunichar _tmp47_;
							gunichar _tmp48_;
							_tmp47_ = skk_key_event_get_code (*key);
							_tmp48_ = _tmp47_;
							_tmp44_ = _tmp48_ <= ((gunichar) 'F');
						} else {
							_tmp44_ = FALSE;
						}
						_tmp38_ = _tmp44_;
					}
					if (_tmp38_) {
						_tmp37_ = TRUE;
					} else {
						gboolean _tmp49_ = FALSE;
						gunichar _tmp50_;
						gunichar _tmp51_;
						_tmp50_ = skk_key_event_get_code (*key);
						_tmp51_ = _tmp50_;
						if (((gunichar) '0') <= _tmp51_) {
							gunichar _tmp52_;
							gunichar _tmp53_;
							_tmp52_ = skk_key_event_get_code (*key);
							_tmp53_ = _tmp52_;
							_tmp49_ = _tmp53_ <= ((gunichar) '9');
						} else {
							_tmp49_ = FALSE;
						}
						_tmp37_ = _tmp49_;
					}
					_tmp34_ = _tmp37_;
				} else {
					_tmp34_ = FALSE;
				}
				if (_tmp34_) {
					GString* _tmp54_;
					gssize _tmp55_;
					_tmp54_ = state->kuten;
					_tmp55_ = _tmp54_->len;
					_tmp33_ = _tmp55_ < ((gssize) 6);
				} else {
					_tmp33_ = FALSE;
				}
				if (_tmp33_) {
					GString* _tmp56_;
					gunichar _tmp57_;
					gunichar _tmp58_;
					_tmp56_ = state->kuten;
					_tmp57_ = skk_key_event_get_code (*key);
					_tmp58_ = _tmp57_;
					g_string_append_unichar (_tmp56_, _tmp58_);
					result = TRUE;
					_g_free0 (command);
					return result;
				}
			}
		}
	}
	result = TRUE;
	_g_free0 (command);
	return result;
}


static gchar*
skk_kuten_state_handler_real_get_preedit (SkkStateHandler* base,
                                          SkkState* state,
                                          guint* underline_offset,
                                          guint* underline_nchars)
{
	SkkKutenStateHandler * self;
	guint _vala_underline_offset = 0U;
	guint _vala_underline_nchars = 0U;
	gchar* result = NULL;
	GString* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	self = (SkkKutenStateHandler*) base;
	g_return_val_if_fail (state != NULL, NULL);
	_vala_underline_nchars = (guint) 0;
	_vala_underline_offset = _vala_underline_nchars;
	_tmp0_ = state->kuten;
	_tmp1_ = _tmp0_->str;
	_tmp2_ = g_strconcat (_ ("Kuten([MM]KKTT) "), _tmp1_, NULL);
	result = _tmp2_;
	if (underline_offset) {
		*underline_offset = _vala_underline_offset;
	}
	if (underline_nchars) {
		*underline_nchars = _vala_underline_nchars;
	}
	return result;
}


static void
skk_kuten_state_handler_class_init (SkkKutenStateHandlerClass * klass)
{
	skk_kuten_state_handler_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SkkKutenStateHandlerPrivate));
	((SkkStateHandlerClass *) klass)->process_key_event = (gboolean (*) (SkkStateHandler *, SkkState*, SkkKeyEvent* *)) skk_kuten_state_handler_real_process_key_event;
	((SkkStateHandlerClass *) klass)->get_preedit = (gchar* (*) (SkkStateHandler *, SkkState*, guint*, guint*)) skk_kuten_state_handler_real_get_preedit;
	G_OBJECT_CLASS (klass)->finalize = skk_kuten_state_handler_finalize;
}


static void
skk_kuten_state_handler_instance_init (SkkKutenStateHandler * self)
{
	self->priv = SKK_KUTEN_STATE_HANDLER_GET_PRIVATE (self);
}


static void
skk_kuten_state_handler_finalize (GObject * obj)
{
	SkkKutenStateHandler * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SKK_TYPE_KUTEN_STATE_HANDLER, SkkKutenStateHandler);
	_g_object_unref0 (self->priv->converter);
	G_OBJECT_CLASS (skk_kuten_state_handler_parent_class)->finalize (obj);
}


GType
skk_kuten_state_handler_get_type (void)
{
	static volatile gsize skk_kuten_state_handler_type_id__volatile = 0;
	if (g_once_init_enter (&skk_kuten_state_handler_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SkkKutenStateHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) skk_kuten_state_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SkkKutenStateHandler), 0, (GInstanceInitFunc) skk_kuten_state_handler_instance_init, NULL };
		GType skk_kuten_state_handler_type_id;
		skk_kuten_state_handler_type_id = g_type_register_static (SKK_TYPE_STATE_HANDLER, "SkkKutenStateHandler", &g_define_type_info, 0);
		g_once_init_leave (&skk_kuten_state_handler_type_id__volatile, skk_kuten_state_handler_type_id);
	}
	return skk_kuten_state_handler_type_id__volatile;
}


static gboolean
skk_abbrev_state_handler_real_process_key_event (SkkStateHandler* base,
                                                 SkkState* state,
                                                 SkkKeyEvent* * key)
{
	SkkAbbrevStateHandler * self;
	gboolean result = FALSE;
	gchar* command = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	self = (SkkAbbrevStateHandler*) base;
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (*key != NULL, FALSE);
	_tmp0_ = skk_state_lookup_key (state, *key);
	command = _tmp0_;
	_tmp3_ = command;
	if (g_strcmp0 (_tmp3_, "abort") == 0) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = command;
		_tmp2_ = g_strcmp0 (_tmp4_, "abort-to-latin") == 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = command;
		_tmp1_ = g_strcmp0 (_tmp5_, "abort-to-latin-unhandled") == 0;
	}
	if (_tmp1_) {
		skk_state_reset (state);
		result = TRUE;
		_g_free0 (command);
		return result;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = command;
		if (g_strcmp0 (_tmp6_, "next-candidate") == 0) {
			state->handler_type = SKK_TYPE_SELECT_STATE_HANDLER;
			result = FALSE;
			_g_free0 (command);
			return result;
		} else {
			gboolean _tmp7_ = FALSE;
			SkkModifierType _tmp8_;
			SkkModifierType _tmp9_;
			_tmp8_ = skk_key_event_get_modifiers (*key);
			_tmp9_ = _tmp8_;
			if ((_tmp9_ & SKK_MODIFIER_TYPE_CONTROL_MASK) != 0) {
				gunichar _tmp10_;
				gunichar _tmp11_;
				_tmp10_ = skk_key_event_get_code (*key);
				_tmp11_ = _tmp10_;
				_tmp7_ = _tmp11_ == ((gunichar) 'q');
			} else {
				_tmp7_ = FALSE;
			}
			if (_tmp7_) {
				GString* _tmp12_;
				GString* _tmp13_;
				const gchar* _tmp14_;
				gchar* _tmp15_;
				gchar* _tmp16_;
				_tmp12_ = state->output;
				_tmp13_ = state->abbrev;
				_tmp14_ = _tmp13_->str;
				_tmp15_ = skk_util_get_wide_latin (_tmp14_);
				_tmp16_ = _tmp15_;
				g_string_assign (_tmp12_, _tmp16_);
				_g_free0 (_tmp16_);
				skk_state_reset (state);
				result = TRUE;
				_g_free0 (command);
				return result;
			} else {
				const gchar* _tmp17_;
				_tmp17_ = command;
				if (g_strcmp0 (_tmp17_, "delete") == 0) {
					GString* _tmp18_;
					gssize _tmp19_;
					_tmp18_ = state->abbrev;
					_tmp19_ = _tmp18_->len;
					if (_tmp19_ > ((gssize) 0)) {
						GString* _tmp20_;
						GString* _tmp21_;
						gssize _tmp22_;
						_tmp20_ = state->abbrev;
						_tmp21_ = state->abbrev;
						_tmp22_ = _tmp21_->len;
						g_string_truncate (_tmp20_, (gsize) (_tmp22_ - 1));
					} else {
						skk_state_reset (state);
					}
					result = TRUE;
					_g_free0 (command);
					return result;
				} else {
					const gchar* _tmp23_;
					_tmp23_ = command;
					if (g_strcmp0 (_tmp23_, "commit") == 0) {
						GString* _tmp24_;
						GString* _tmp25_;
						const gchar* _tmp26_;
						_tmp24_ = state->output;
						_tmp25_ = state->abbrev;
						_tmp26_ = _tmp25_->str;
						g_string_assign (_tmp24_, _tmp26_);
						skk_state_reset (state);
						result = TRUE;
						_g_free0 (command);
						return result;
					} else {
						const gchar* _tmp27_;
						_tmp27_ = command;
						if (g_strcmp0 (_tmp27_, "commit-unhandled") == 0) {
							GString* _tmp28_;
							GString* _tmp29_;
							const gchar* _tmp30_;
							gboolean _tmp31_;
							_tmp28_ = state->output;
							_tmp29_ = state->abbrev;
							_tmp30_ = _tmp29_->str;
							g_string_assign (_tmp28_, _tmp30_);
							skk_state_reset (state);
							_tmp31_ = state->egg_like_newline;
							result = _tmp31_;
							_g_free0 (command);
							return result;
						} else {
							gboolean _tmp32_ = FALSE;
							gboolean _tmp33_ = FALSE;
							SkkModifierType _tmp34_;
							SkkModifierType _tmp35_;
							_tmp34_ = skk_key_event_get_modifiers (*key);
							_tmp35_ = _tmp34_;
							if (_tmp35_ == 0) {
								gunichar _tmp36_;
								gunichar _tmp37_;
								_tmp36_ = skk_key_event_get_code (*key);
								_tmp37_ = _tmp36_;
								_tmp33_ = ((gunichar) 0x20) <= _tmp37_;
							} else {
								_tmp33_ = FALSE;
							}
							if (_tmp33_) {
								gunichar _tmp38_;
								gunichar _tmp39_;
								_tmp38_ = skk_key_event_get_code (*key);
								_tmp39_ = _tmp38_;
								_tmp32_ = _tmp39_ <= ((gunichar) 0x7E);
							} else {
								_tmp32_ = FALSE;
							}
							if (_tmp32_) {
								GString* _tmp40_;
								gunichar _tmp41_;
								gunichar _tmp42_;
								_tmp40_ = state->abbrev;
								_tmp41_ = skk_key_event_get_code (*key);
								_tmp42_ = _tmp41_;
								g_string_append_unichar (_tmp40_, _tmp42_);
								result = TRUE;
								_g_free0 (command);
								return result;
							}
						}
					}
				}
			}
		}
	}
	result = TRUE;
	_g_free0 (command);
	return result;
}


static gchar*
skk_abbrev_state_handler_real_get_preedit (SkkStateHandler* base,
                                           SkkState* state,
                                           guint* underline_offset,
                                           guint* underline_nchars)
{
	SkkAbbrevStateHandler * self;
	guint _vala_underline_offset = 0U;
	guint _vala_underline_nchars = 0U;
	gchar* result = NULL;
	GString* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	self = (SkkAbbrevStateHandler*) base;
	g_return_val_if_fail (state != NULL, NULL);
	_vala_underline_nchars = (guint) 0;
	_vala_underline_offset = _vala_underline_nchars;
	_tmp0_ = state->abbrev;
	_tmp1_ = _tmp0_->str;
	_tmp2_ = g_strconcat ("▽", _tmp1_, NULL);
	result = _tmp2_;
	if (underline_offset) {
		*underline_offset = _vala_underline_offset;
	}
	if (underline_nchars) {
		*underline_nchars = _vala_underline_nchars;
	}
	return result;
}


SkkAbbrevStateHandler*
skk_abbrev_state_handler_construct (GType object_type)
{
	SkkAbbrevStateHandler * self = NULL;
	self = (SkkAbbrevStateHandler*) skk_state_handler_construct (object_type);
	return self;
}


SkkAbbrevStateHandler*
skk_abbrev_state_handler_new (void)
{
	return skk_abbrev_state_handler_construct (SKK_TYPE_ABBREV_STATE_HANDLER);
}


static void
skk_abbrev_state_handler_class_init (SkkAbbrevStateHandlerClass * klass)
{
	skk_abbrev_state_handler_parent_class = g_type_class_peek_parent (klass);
	((SkkStateHandlerClass *) klass)->process_key_event = (gboolean (*) (SkkStateHandler *, SkkState*, SkkKeyEvent* *)) skk_abbrev_state_handler_real_process_key_event;
	((SkkStateHandlerClass *) klass)->get_preedit = (gchar* (*) (SkkStateHandler *, SkkState*, guint*, guint*)) skk_abbrev_state_handler_real_get_preedit;
}


static void
skk_abbrev_state_handler_instance_init (SkkAbbrevStateHandler * self)
{
}


GType
skk_abbrev_state_handler_get_type (void)
{
	static volatile gsize skk_abbrev_state_handler_type_id__volatile = 0;
	if (g_once_init_enter (&skk_abbrev_state_handler_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SkkAbbrevStateHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) skk_abbrev_state_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SkkAbbrevStateHandler), 0, (GInstanceInitFunc) skk_abbrev_state_handler_instance_init, NULL };
		GType skk_abbrev_state_handler_type_id;
		skk_abbrev_state_handler_type_id = g_type_register_static (SKK_TYPE_STATE_HANDLER, "SkkAbbrevStateHandler", &g_define_type_info, 0);
		g_once_init_leave (&skk_abbrev_state_handler_type_id__volatile, skk_abbrev_state_handler_type_id);
	}
	return skk_abbrev_state_handler_type_id__volatile;
}


static gboolean
skk_start_state_handler_real_process_key_event (SkkStateHandler* base,
                                                SkkState* state,
                                                SkkKeyEvent* * key)
{
	SkkStartStateHandler * self;
	gboolean result = FALSE;
	gchar* command = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	const gchar* _tmp7_;
	const gchar* _tmp29_;
	gunichar lower_code = 0U;
	gboolean is_upper = FALSE;
	gunichar _tmp162_ = 0U;
	gboolean _tmp163_;
	SkkRomKanaConverter* _tmp164_;
	gunichar _tmp165_;
	self = (SkkStartStateHandler*) base;
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (*key != NULL, FALSE);
	_tmp0_ = skk_state_lookup_key (state, *key);
	command = _tmp0_;
	_tmp2_ = command;
	if (_tmp2_ == NULL) {
		gunichar _tmp3_;
		gunichar _tmp4_;
		_tmp3_ = skk_key_event_get_code (*key);
		_tmp4_ = _tmp3_;
		_tmp1_ = _tmp4_ == ((gunichar) 0);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		result = TRUE;
		_g_free0 (command);
		return result;
	}
	_tmp7_ = command;
	if (g_strcmp0 (_tmp7_, "abort") == 0) {
		_tmp6_ = TRUE;
	} else {
		const gchar* _tmp8_;
		_tmp8_ = command;
		_tmp6_ = g_strcmp0 (_tmp8_, "abort-to-latin") == 0;
	}
	if (_tmp6_) {
		_tmp5_ = TRUE;
	} else {
		const gchar* _tmp9_;
		_tmp9_ = command;
		_tmp5_ = g_strcmp0 (_tmp9_, "abort-to-latin-unhandled") == 0;
	}
	if (_tmp5_) {
		skk_state_reset (state);
		result = TRUE;
		_g_free0 (command);
		return result;
	}
	{
		SkkInputModeCommandEntry* entry_collection = NULL;
		gint entry_collection_length1 = 0;
		gint _entry_collection_size_ = 0;
		gint entry_it = 0;
		entry_collection = SKK_START_STATE_HANDLER_end_preedit_commands;
		entry_collection_length1 = G_N_ELEMENTS (SKK_START_STATE_HANDLER_end_preedit_commands);
		for (entry_it = 0; entry_it < G_N_ELEMENTS (SKK_START_STATE_HANDLER_end_preedit_commands); entry_it = entry_it + 1) {
			SkkInputModeCommandEntry entry = {0};
			entry = entry_collection[entry_it];
			{
				SkkInputModeCommandEntry _tmp10_;
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				_tmp10_ = entry;
				_tmp11_ = _tmp10_.key;
				_tmp12_ = command;
				if (g_strcmp0 (_tmp11_, _tmp12_) == 0) {
					SkkRomKanaConverter* _tmp13_;
					GString* _tmp14_;
					SkkRomKanaConverter* _tmp15_;
					const gchar* _tmp16_;
					const gchar* _tmp17_;
					SkkInputModeCommandEntry _tmp18_;
					SkkInputMode _tmp19_;
					gchar* _tmp20_;
					gchar* _tmp21_;
					SkkUnicodeString* _tmp22_;
					SkkRomKanaConverter* _tmp28_;
					_tmp13_ = state->rom_kana_converter;
					skk_rom_kana_converter_output_nn_if_any (_tmp13_);
					_tmp14_ = state->output;
					_tmp15_ = state->rom_kana_converter;
					_tmp16_ = skk_rom_kana_converter_get_output (_tmp15_);
					_tmp17_ = _tmp16_;
					_tmp18_ = entry;
					_tmp19_ = _tmp18_.value;
					_tmp20_ = skk_util_convert_by_input_mode (_tmp17_, _tmp19_);
					_tmp21_ = _tmp20_;
					g_string_append (_tmp14_, _tmp21_);
					_g_free0 (_tmp21_);
					_tmp22_ = state->surrounding_text;
					if (_tmp22_ != NULL) {
						GString* _tmp23_;
						SkkUnicodeString* _tmp24_;
						guint _tmp25_;
						gchar* _tmp26_;
						gchar* _tmp27_;
						_tmp23_ = state->output;
						_tmp24_ = state->surrounding_text;
						_tmp25_ = state->surrounding_end;
						_tmp26_ = skk_unicode_string_substring (_tmp24_, (glong) _tmp25_, (glong) -1);
						_tmp27_ = _tmp26_;
						g_string_append (_tmp23_, _tmp27_);
						_g_free0 (_tmp27_);
					}
					_tmp28_ = state->rom_kana_converter;
					skk_rom_kana_converter_reset (_tmp28_);
					state->handler_type = SKK_TYPE_NONE_STATE_HANDLER;
					result = TRUE;
					_g_free0 (command);
					return result;
				}
			}
		}
	}
	_tmp29_ = command;
	if (g_strcmp0 (_tmp29_, "next-candidate") == 0) {
		SkkRomKanaConverter* _tmp30_;
		const gchar* _tmp31_;
		const gchar* _tmp32_;
		gint _tmp33_;
		gint _tmp34_;
		_tmp30_ = state->rom_kana_converter;
		_tmp31_ = skk_rom_kana_converter_get_output (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = strlen (_tmp32_);
		_tmp34_ = _tmp33_;
		if (_tmp34_ == 0) {
			SkkUnicodeString* _tmp35_;
			_tmp35_ = state->surrounding_text;
			if (_tmp35_ != NULL) {
				GString* _tmp36_;
				SkkUnicodeString* _tmp37_;
				guint _tmp38_;
				gchar* _tmp39_;
				gchar* _tmp40_;
				_tmp36_ = state->output;
				_tmp37_ = state->surrounding_text;
				_tmp38_ = state->surrounding_end;
				_tmp39_ = skk_unicode_string_substring (_tmp37_, (glong) _tmp38_, (glong) -1);
				_tmp40_ = _tmp39_;
				g_string_append (_tmp36_, _tmp40_);
				_g_free0 (_tmp40_);
			}
			skk_state_reset (state);
			result = TRUE;
			_g_free0 (command);
			return result;
		}
		state->handler_type = SKK_TYPE_SELECT_STATE_HANDLER;
		result = FALSE;
		_g_free0 (command);
		return result;
	} else {
		const gchar* _tmp41_;
		_tmp41_ = command;
		if (g_strcmp0 (_tmp41_, "commit") == 0) {
			GString* _tmp42_;
			SkkRomKanaConverter* _tmp43_;
			const gchar* _tmp44_;
			const gchar* _tmp45_;
			SkkUnicodeString* _tmp46_;
			_tmp42_ = state->output;
			_tmp43_ = state->rom_kana_converter;
			_tmp44_ = skk_rom_kana_converter_get_output (_tmp43_);
			_tmp45_ = _tmp44_;
			g_string_append (_tmp42_, _tmp45_);
			_tmp46_ = state->surrounding_text;
			if (_tmp46_ != NULL) {
				GString* _tmp47_;
				SkkUnicodeString* _tmp48_;
				guint _tmp49_;
				gchar* _tmp50_;
				gchar* _tmp51_;
				_tmp47_ = state->output;
				_tmp48_ = state->surrounding_text;
				_tmp49_ = state->surrounding_end;
				_tmp50_ = skk_unicode_string_substring (_tmp48_, (glong) _tmp49_, (glong) -1);
				_tmp51_ = _tmp50_;
				g_string_append (_tmp47_, _tmp51_);
				_g_free0 (_tmp51_);
			}
			skk_state_reset (state);
			result = TRUE;
			_g_free0 (command);
			return result;
		} else {
			const gchar* _tmp52_;
			_tmp52_ = command;
			if (g_strcmp0 (_tmp52_, "commit-unhandled") == 0) {
				GString* _tmp53_;
				SkkRomKanaConverter* _tmp54_;
				const gchar* _tmp55_;
				const gchar* _tmp56_;
				SkkUnicodeString* _tmp57_;
				gboolean _tmp63_;
				_tmp53_ = state->output;
				_tmp54_ = state->rom_kana_converter;
				_tmp55_ = skk_rom_kana_converter_get_output (_tmp54_);
				_tmp56_ = _tmp55_;
				g_string_append (_tmp53_, _tmp56_);
				_tmp57_ = state->surrounding_text;
				if (_tmp57_ != NULL) {
					GString* _tmp58_;
					SkkUnicodeString* _tmp59_;
					guint _tmp60_;
					gchar* _tmp61_;
					gchar* _tmp62_;
					_tmp58_ = state->output;
					_tmp59_ = state->surrounding_text;
					_tmp60_ = state->surrounding_end;
					_tmp61_ = skk_unicode_string_substring (_tmp59_, (glong) _tmp60_, (glong) -1);
					_tmp62_ = _tmp61_;
					g_string_append (_tmp58_, _tmp62_);
					_g_free0 (_tmp62_);
				}
				skk_state_reset (state);
				_tmp63_ = state->egg_like_newline;
				result = _tmp63_;
				_g_free0 (command);
				return result;
			} else {
				const gchar* _tmp64_;
				_tmp64_ = command;
				if (g_strcmp0 (_tmp64_, "delete") == 0) {
					SkkRomKanaConverter* _tmp65_;
					_tmp65_ = state->okuri_rom_kana_converter;
					if (skk_rom_kana_converter_delete (_tmp65_)) {
						SkkRomKanaConverter* _tmp66_;
						const gchar* _tmp67_;
						const gchar* _tmp68_;
						gint _tmp69_;
						gint _tmp70_;
						_tmp66_ = state->okuri_rom_kana_converter;
						_tmp67_ = skk_rom_kana_converter_get_preedit (_tmp66_);
						_tmp68_ = _tmp67_;
						_tmp69_ = strlen (_tmp68_);
						_tmp70_ = _tmp69_;
						if (_tmp70_ == 0) {
							state->okuri = FALSE;
						}
						result = TRUE;
						_g_free0 (command);
						return result;
					} else {
						SkkRomKanaConverter* _tmp71_;
						_tmp71_ = state->rom_kana_converter;
						if (skk_rom_kana_converter_delete (_tmp71_)) {
							result = TRUE;
							_g_free0 (command);
							return result;
						} else {
							GString* _tmp72_;
							gssize _tmp73_;
							_tmp72_ = state->output;
							_tmp73_ = _tmp72_->len;
							if (_tmp73_ > ((gssize) 0)) {
								GString* _tmp74_;
								GString* _tmp75_;
								const gchar* _tmp76_;
								GString* _tmp77_;
								const gchar* _tmp78_;
								_tmp74_ = state->output;
								_tmp75_ = state->output;
								_tmp76_ = _tmp75_->str;
								_tmp77_ = state->output;
								_tmp78_ = _tmp77_->str;
								g_string_truncate (_tmp74_, (gsize) string_index_of_nth_char (_tmp76_, (glong) (g_utf8_strlen (_tmp78_, (gssize) -1) - 1)));
								result = TRUE;
								_g_free0 (command);
								return result;
							}
						}
					}
					state->handler_type = SKK_TYPE_NONE_STATE_HANDLER;
					result = TRUE;
					_g_free0 (command);
					return result;
				} else {
					const gchar* _tmp79_;
					_tmp79_ = command;
					if (g_strcmp0 (_tmp79_, "complete") == 0) {
						GeeBidirListIterator* _tmp80_;
						GeeBidirListIterator* _tmp84_;
						_tmp80_ = state->completion_iterator;
						if (_tmp80_ == NULL) {
							SkkRomKanaConverter* _tmp81_;
							const gchar* _tmp82_;
							const gchar* _tmp83_;
							_tmp81_ = state->rom_kana_converter;
							_tmp82_ = skk_rom_kana_converter_get_output (_tmp81_);
							_tmp83_ = _tmp82_;
							skk_state_completion_start (state, _tmp83_);
						}
						_tmp84_ = state->completion_iterator;
						if (_tmp84_ != NULL) {
							gchar* midasi = NULL;
							GeeBidirListIterator* _tmp85_;
							gpointer _tmp86_;
							SkkRomKanaConverter* _tmp87_;
							SkkRomKanaConverter* _tmp88_;
							const gchar* _tmp89_;
							GeeBidirListIterator* _tmp90_;
							_tmp85_ = state->completion_iterator;
							_tmp86_ = gee_iterator_get ((GeeIterator*) _tmp85_);
							midasi = (gchar*) _tmp86_;
							_tmp87_ = state->rom_kana_converter;
							skk_rom_kana_converter_reset (_tmp87_);
							_tmp88_ = state->rom_kana_converter;
							_tmp89_ = midasi;
							skk_rom_kana_converter_set_output (_tmp88_, _tmp89_);
							_tmp90_ = state->completion_iterator;
							if (gee_iterator_has_next ((GeeIterator*) _tmp90_)) {
								GeeBidirListIterator* _tmp91_;
								_tmp91_ = state->completion_iterator;
								gee_iterator_next ((GeeIterator*) _tmp91_);
							}
							_g_free0 (midasi);
						}
						result = TRUE;
						_g_free0 (command);
						return result;
					} else {
						const gchar* _tmp92_;
						_tmp92_ = command;
						if (g_strcmp0 (_tmp92_, "special-midasi") == 0) {
							SkkRomKanaConverter* _tmp93_;
							const gchar* _tmp94_;
							const gchar* _tmp95_;
							gint _tmp96_;
							gint _tmp97_;
							_tmp93_ = state->rom_kana_converter;
							_tmp94_ = skk_rom_kana_converter_get_output (_tmp93_);
							_tmp95_ = _tmp94_;
							_tmp96_ = strlen (_tmp95_);
							_tmp97_ = _tmp96_;
							if (_tmp97_ > 0) {
								SkkRomKanaConverter* _tmp98_;
								gunichar _tmp99_;
								gunichar _tmp100_;
								SkkKeyEvent* _tmp101_;
								_tmp98_ = state->rom_kana_converter;
								_tmp99_ = skk_key_event_get_code (*key);
								_tmp100_ = _tmp99_;
								skk_rom_kana_converter_append (_tmp98_, g_unichar_tolower (_tmp100_));
								state->handler_type = SKK_TYPE_SELECT_STATE_HANDLER;
								_tmp101_ = skk_state_where_is (state, "next-candidate");
								_g_object_unref0 (*key);
								*key = _tmp101_;
								result = FALSE;
								_g_free0 (command);
								return result;
							} else {
								SkkRomKanaConverter* _tmp102_;
								gunichar _tmp103_;
								gunichar _tmp104_;
								_tmp102_ = state->rom_kana_converter;
								_tmp103_ = skk_key_event_get_code (*key);
								_tmp104_ = _tmp103_;
								skk_rom_kana_converter_append (_tmp102_, _tmp104_);
								result = TRUE;
								_g_free0 (command);
								return result;
							}
						} else {
							gboolean _tmp105_ = FALSE;
							const gchar* _tmp106_;
							_tmp106_ = command;
							if (_tmp106_ != NULL) {
								const gchar* _tmp107_;
								_tmp107_ = command;
								_tmp105_ = g_str_has_prefix (_tmp107_, "insert-kana-");
							} else {
								_tmp105_ = FALSE;
							}
							if (_tmp105_) {
								gchar* kana = NULL;
								const gchar* _tmp108_;
								gint _tmp109_;
								gint _tmp110_;
								const gchar* _tmp111_;
								gint _tmp112_;
								gint _tmp113_;
								gchar* _tmp114_;
								gchar* _tmp115_;
								SkkInputMode _tmp116_;
								SkkInputMode _tmp117_;
								gchar* _tmp118_;
								gchar* _tmp119_;
								gboolean _tmp120_;
								_tmp108_ = command;
								_tmp109_ = strlen ("insert-kana-");
								_tmp110_ = _tmp109_;
								_tmp111_ = command;
								_tmp112_ = strlen (_tmp111_);
								_tmp113_ = _tmp112_;
								_tmp114_ = string_slice (_tmp108_, (glong) _tmp110_, (glong) _tmp113_);
								_tmp115_ = _tmp114_;
								_tmp116_ = skk_state_get_input_mode (state);
								_tmp117_ = _tmp116_;
								_tmp118_ = skk_util_convert_by_input_mode (_tmp115_, _tmp117_);
								_tmp119_ = _tmp118_;
								_g_free0 (_tmp115_);
								kana = _tmp119_;
								_tmp120_ = state->okuri;
								if (_tmp120_) {
									SkkRomKanaConverter* _tmp121_;
									const gchar* _tmp122_;
									SkkKeyEvent* _tmp123_;
									_tmp121_ = state->okuri_rom_kana_converter;
									_tmp122_ = kana;
									skk_rom_kana_converter_set_output (_tmp121_, _tmp122_);
									state->handler_type = SKK_TYPE_SELECT_STATE_HANDLER;
									_tmp123_ = skk_state_where_is (state, "next-candidate");
									_g_object_unref0 (*key);
									*key = _tmp123_;
									result = FALSE;
									_g_free0 (kana);
									_g_free0 (command);
									return result;
								} else {
									SkkRomKanaConverter* _tmp124_;
									SkkRomKanaConverter* _tmp125_;
									const gchar* _tmp126_;
									const gchar* _tmp127_;
									const gchar* _tmp128_;
									gchar* _tmp129_;
									gchar* _tmp130_;
									_tmp124_ = state->rom_kana_converter;
									_tmp125_ = state->rom_kana_converter;
									_tmp126_ = skk_rom_kana_converter_get_output (_tmp125_);
									_tmp127_ = _tmp126_;
									_tmp128_ = kana;
									_tmp129_ = g_strconcat (_tmp127_, _tmp128_, NULL);
									_tmp130_ = _tmp129_;
									skk_rom_kana_converter_set_output (_tmp125_, _tmp130_);
									_g_free0 (_tmp130_);
									result = TRUE;
									_g_free0 (kana);
									_g_free0 (command);
									return result;
								}
								_g_free0 (kana);
							} else {
								const gchar* _tmp131_;
								_tmp131_ = command;
								if (g_strcmp0 (_tmp131_, "start-preedit") == 0) {
									result = TRUE;
									_g_free0 (command);
									return result;
								} else {
									gboolean _tmp132_ = FALSE;
									const gchar* _tmp133_;
									_tmp133_ = command;
									if (g_strcmp0 (_tmp133_, "start-preedit-kana") == 0) {
										_tmp132_ = TRUE;
									} else {
										const gchar* _tmp134_;
										_tmp134_ = command;
										_tmp132_ = g_strcmp0 (_tmp134_, "start-preedit-no-delete") == 0;
									}
									if (_tmp132_) {
										SkkRomKanaConverter* _tmp135_;
										const gchar* _tmp136_;
										const gchar* _tmp137_;
										gint _tmp138_;
										gint _tmp139_;
										_tmp135_ = state->rom_kana_converter;
										_tmp136_ = skk_rom_kana_converter_get_output (_tmp135_);
										_tmp137_ = _tmp136_;
										_tmp138_ = strlen (_tmp137_);
										_tmp139_ = _tmp138_;
										if (_tmp139_ > 0) {
											state->okuri = TRUE;
										}
										result = TRUE;
										_g_free0 (command);
										return result;
									} else {
										const gchar* _tmp140_;
										_tmp140_ = command;
										if (g_strcmp0 (_tmp140_, "expand-preedit") == 0) {
											gboolean _tmp141_ = FALSE;
											SkkUnicodeString* _tmp142_;
											_tmp142_ = state->surrounding_text;
											if (_tmp142_ != NULL) {
												guint _tmp143_;
												SkkUnicodeString* _tmp144_;
												gint _tmp145_;
												_tmp143_ = state->surrounding_end;
												_tmp144_ = state->surrounding_text;
												_tmp145_ = _tmp144_->length;
												_tmp141_ = _tmp143_ < ((guint) _tmp145_);
											} else {
												_tmp141_ = FALSE;
											}
											if (_tmp141_) {
												guint _tmp146_;
												SkkRomKanaConverter* _tmp147_;
												SkkUnicodeString* _tmp148_;
												guint _tmp149_;
												gchar* _tmp150_;
												gchar* _tmp151_;
												_tmp146_ = state->surrounding_end;
												state->surrounding_end = _tmp146_ + 1;
												_tmp147_ = state->rom_kana_converter;
												_tmp148_ = state->surrounding_text;
												_tmp149_ = state->surrounding_end;
												_tmp150_ = skk_unicode_string_substring (_tmp148_, (glong) 0, (glong) _tmp149_);
												_tmp151_ = _tmp150_;
												skk_rom_kana_converter_set_output (_tmp147_, _tmp151_);
												_g_free0 (_tmp151_);
												result = TRUE;
												_g_free0 (command);
												return result;
											}
										} else {
											const gchar* _tmp152_;
											_tmp152_ = command;
											if (g_strcmp0 (_tmp152_, "shrink-preedit") == 0) {
												gboolean _tmp153_ = FALSE;
												SkkUnicodeString* _tmp154_;
												_tmp154_ = state->surrounding_text;
												if (_tmp154_ != NULL) {
													guint _tmp155_;
													_tmp155_ = state->surrounding_end;
													_tmp153_ = _tmp155_ > ((guint) 0);
												} else {
													_tmp153_ = FALSE;
												}
												if (_tmp153_) {
													guint _tmp156_;
													SkkRomKanaConverter* _tmp157_;
													SkkUnicodeString* _tmp158_;
													guint _tmp159_;
													gchar* _tmp160_;
													gchar* _tmp161_;
													_tmp156_ = state->surrounding_end;
													state->surrounding_end = _tmp156_ - 1;
													_tmp157_ = state->rom_kana_converter;
													_tmp158_ = state->surrounding_text;
													_tmp159_ = state->surrounding_end;
													_tmp160_ = skk_unicode_string_substring (_tmp158_, (glong) 0, (glong) _tmp159_);
													_tmp161_ = _tmp160_;
													skk_rom_kana_converter_set_output (_tmp157_, _tmp161_);
													_g_free0 (_tmp161_);
													result = TRUE;
													_g_free0 (command);
													return result;
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	_tmp163_ = skk_state_isupper (state, *key, &_tmp162_);
	lower_code = _tmp162_;
	is_upper = _tmp163_;
	_tmp164_ = state->rom_kana_converter;
	_tmp165_ = lower_code;
	if (skk_rom_kana_converter_is_valid (_tmp164_, _tmp165_)) {
		gboolean _tmp166_ = FALSE;
		gboolean _tmp167_;
		_tmp167_ = state->okuri;
		if (_tmp167_) {
			_tmp166_ = TRUE;
		} else {
			gboolean _tmp168_ = FALSE;
			gboolean _tmp169_ = FALSE;
			gboolean _tmp170_;
			_tmp170_ = is_upper;
			if (_tmp170_) {
				SkkRomKanaConverter* _tmp171_;
				const gchar* _tmp172_;
				const gchar* _tmp173_;
				gint _tmp174_;
				gint _tmp175_;
				_tmp171_ = state->rom_kana_converter;
				_tmp172_ = skk_rom_kana_converter_get_output (_tmp171_);
				_tmp173_ = _tmp172_;
				_tmp174_ = strlen (_tmp173_);
				_tmp175_ = _tmp174_;
				_tmp169_ = _tmp175_ > 0;
			} else {
				_tmp169_ = FALSE;
			}
			if (_tmp169_) {
				SkkRomKanaConverter* _tmp176_;
				gunichar _tmp177_;
				_tmp176_ = state->rom_kana_converter;
				_tmp177_ = lower_code;
				_tmp168_ = !skk_rom_kana_converter_can_consume (_tmp176_, _tmp177_, TRUE, TRUE);
			} else {
				_tmp168_ = FALSE;
			}
			_tmp166_ = _tmp168_;
		}
		if (_tmp166_) {
			gboolean _tmp178_ = FALSE;
			gboolean _tmp179_;
			SkkRomKanaConverter* _tmp184_;
			gboolean _tmp185_;
			SkkRomKanaConverter* _tmp187_;
			gunichar _tmp188_;
			SkkRomKanaConverter* _tmp189_;
			const gchar* _tmp190_;
			const gchar* _tmp191_;
			gint _tmp192_;
			gint _tmp193_;
			_tmp179_ = state->okuri;
			if (!_tmp179_) {
				SkkRomKanaConverter* _tmp180_;
				gunichar _tmp181_;
				_tmp180_ = state->rom_kana_converter;
				_tmp181_ = lower_code;
				_tmp178_ = skk_rom_kana_converter_can_consume (_tmp180_, _tmp181_, TRUE, FALSE);
			} else {
				_tmp178_ = FALSE;
			}
			if (_tmp178_) {
				SkkRomKanaConverter* _tmp182_;
				gunichar _tmp183_;
				_tmp182_ = state->rom_kana_converter;
				_tmp183_ = lower_code;
				skk_rom_kana_converter_append (_tmp182_, _tmp183_);
			}
			_tmp184_ = state->rom_kana_converter;
			skk_rom_kana_converter_output_nn_if_any (_tmp184_);
			state->okuri = TRUE;
			_tmp185_ = is_upper;
			if (_tmp185_) {
				SkkRomKanaConverter* _tmp186_;
				_tmp186_ = state->okuri_rom_kana_converter;
				skk_rom_kana_converter_output_nn_if_any (_tmp186_);
			}
			_tmp187_ = state->okuri_rom_kana_converter;
			_tmp188_ = lower_code;
			skk_rom_kana_converter_append (_tmp187_, _tmp188_);
			_tmp189_ = state->okuri_rom_kana_converter;
			_tmp190_ = skk_rom_kana_converter_get_preedit (_tmp189_);
			_tmp191_ = _tmp190_;
			_tmp192_ = strlen (_tmp191_);
			_tmp193_ = _tmp192_;
			if (_tmp193_ == 0) {
				SkkKeyEvent* _tmp194_;
				state->handler_type = SKK_TYPE_SELECT_STATE_HANDLER;
				_tmp194_ = skk_state_where_is (state, "next-candidate");
				_g_object_unref0 (*key);
				*key = _tmp194_;
				result = FALSE;
				_g_free0 (command);
				return result;
			}
			result = TRUE;
			_g_free0 (command);
			return result;
		} else {
			SkkRomKanaConverter* _tmp195_;
			gunichar _tmp196_;
			_tmp195_ = state->rom_kana_converter;
			_tmp196_ = lower_code;
			skk_rom_kana_converter_append (_tmp195_, _tmp196_);
			if (skk_start_state_handler_check_auto_conversion (self, state, *key)) {
				SkkKeyEvent* _tmp197_;
				state->handler_type = SKK_TYPE_SELECT_STATE_HANDLER;
				_tmp197_ = skk_state_where_is (state, "next-candidate");
				_g_object_unref0 (*key);
				*key = _tmp197_;
				result = FALSE;
				_g_free0 (command);
				return result;
			}
			result = TRUE;
			_g_free0 (command);
			return result;
		}
	} else {
		SkkModifierType _tmp198_;
		SkkModifierType _tmp199_;
		_tmp198_ = skk_key_event_get_modifiers (*key);
		_tmp199_ = _tmp198_;
		if (_tmp199_ == 0) {
			SkkRomKanaConverter* _tmp200_;
			gunichar _tmp201_;
			_tmp200_ = state->rom_kana_converter;
			_tmp201_ = lower_code;
			skk_rom_kana_converter_append (_tmp200_, _tmp201_);
			if (skk_start_state_handler_check_auto_conversion (self, state, *key)) {
				SkkKeyEvent* _tmp202_;
				state->handler_type = SKK_TYPE_SELECT_STATE_HANDLER;
				_tmp202_ = skk_state_where_is (state, "next-candidate");
				_g_object_unref0 (*key);
				*key = _tmp202_;
				result = FALSE;
				_g_free0 (command);
				return result;
			}
			result = TRUE;
			_g_free0 (command);
			return result;
		}
	}
	result = TRUE;
	_g_free0 (command);
	return result;
}


static gchar*
skk_start_state_handler_real_get_preedit (SkkStateHandler* base,
                                          SkkState* state,
                                          guint* underline_offset,
                                          guint* underline_nchars)
{
	SkkStartStateHandler * self;
	guint _vala_underline_offset = 0U;
	guint _vala_underline_nchars = 0U;
	gchar* result = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	guint _tmp1_;
	GString* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	SkkUnicodeString* _tmp5_;
	GString* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	self = (SkkStartStateHandler*) base;
	g_return_val_if_fail (state != NULL, NULL);
	_tmp0_ = g_string_new ("▽");
	builder = _tmp0_;
	_vala_underline_nchars = (guint) 0;
	_tmp1_ = _vala_underline_nchars;
	_vala_underline_offset = _tmp1_;
	_tmp2_ = builder;
	_tmp3_ = skk_state_get_yomi (state);
	_tmp4_ = _tmp3_;
	g_string_append (_tmp2_, _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = state->surrounding_text;
	if (_tmp5_ != NULL) {
		GString* _tmp6_;
		const gchar* _tmp7_;
		GString* _tmp8_;
		SkkUnicodeString* _tmp9_;
		guint _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		_vala_underline_offset = (guint) 1;
		_tmp6_ = builder;
		_tmp7_ = _tmp6_->str;
		_vala_underline_nchars = (guint) (g_utf8_strlen (_tmp7_, (gssize) -1) - 1);
		_tmp8_ = builder;
		_tmp9_ = state->surrounding_text;
		_tmp10_ = state->surrounding_end;
		_tmp11_ = skk_unicode_string_substring (_tmp9_, (glong) _tmp10_, (glong) -1);
		_tmp12_ = _tmp11_;
		g_string_append (_tmp8_, _tmp12_);
		_g_free0 (_tmp12_);
	}
	_tmp13_ = builder;
	_tmp14_ = _tmp13_->str;
	_tmp15_ = g_strdup (_tmp14_);
	result = _tmp15_;
	_g_string_free0 (builder);
	if (underline_offset) {
		*underline_offset = _vala_underline_offset;
	}
	if (underline_nchars) {
		*underline_nchars = _vala_underline_nchars;
	}
	return result;
}


static gboolean
skk_start_state_handler_check_auto_conversion (SkkStartStateHandler* self,
                                               SkkState* state,
                                               SkkKeyEvent* key)
{
	gboolean result = FALSE;
	gchar** _tmp0_;
	gint _tmp0__length1;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = state->auto_start_henkan_keywords;
	_tmp0__length1 = state->auto_start_henkan_keywords_length1;
	{
		gchar** keyword_collection = NULL;
		gint keyword_collection_length1 = 0;
		gint _keyword_collection_size_ = 0;
		gint keyword_it = 0;
		keyword_collection = _tmp0_;
		keyword_collection_length1 = _tmp0__length1;
		for (keyword_it = 0; keyword_it < _tmp0__length1; keyword_it = keyword_it + 1) {
			gchar* _tmp1_;
			gchar* keyword = NULL;
			_tmp1_ = g_strdup (keyword_collection[keyword_it]);
			keyword = _tmp1_;
			{
				gboolean _tmp2_ = FALSE;
				SkkRomKanaConverter* _tmp3_;
				const gchar* _tmp4_;
				const gchar* _tmp5_;
				gint _tmp6_;
				gint _tmp7_;
				const gchar* _tmp8_;
				gint _tmp9_;
				gint _tmp10_;
				_tmp3_ = state->rom_kana_converter;
				_tmp4_ = skk_rom_kana_converter_get_output (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = strlen (_tmp5_);
				_tmp7_ = _tmp6_;
				_tmp8_ = keyword;
				_tmp9_ = strlen (_tmp8_);
				_tmp10_ = _tmp9_;
				if (_tmp7_ > _tmp10_) {
					SkkRomKanaConverter* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					_tmp11_ = state->rom_kana_converter;
					_tmp12_ = skk_rom_kana_converter_get_output (_tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = keyword;
					_tmp2_ = g_str_has_suffix (_tmp13_, _tmp14_);
				} else {
					_tmp2_ = FALSE;
				}
				if (_tmp2_) {
					const gchar* _tmp15_;
					gchar* _tmp16_;
					SkkRomKanaConverter* _tmp17_;
					SkkRomKanaConverter* _tmp18_;
					const gchar* _tmp19_;
					const gchar* _tmp20_;
					const gchar* _tmp21_;
					gint _tmp22_;
					gint _tmp23_;
					gchar* _tmp24_;
					gchar* _tmp25_;
					_tmp15_ = keyword;
					_tmp16_ = g_strdup (_tmp15_);
					_g_free0 (state->auto_start_henkan_keyword);
					state->auto_start_henkan_keyword = _tmp16_;
					_tmp17_ = state->rom_kana_converter;
					_tmp18_ = state->rom_kana_converter;
					_tmp19_ = skk_rom_kana_converter_get_output (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp21_ = keyword;
					_tmp22_ = strlen (_tmp21_);
					_tmp23_ = _tmp22_;
					_tmp24_ = string_slice (_tmp20_, (glong) 0, (glong) (-_tmp23_));
					_tmp25_ = _tmp24_;
					skk_rom_kana_converter_set_output (_tmp17_, _tmp25_);
					_g_free0 (_tmp25_);
					state->handler_type = SKK_TYPE_SELECT_STATE_HANDLER;
					result = TRUE;
					_g_free0 (keyword);
					return result;
				}
				_g_free0 (keyword);
			}
		}
	}
	result = FALSE;
	return result;
}


SkkStartStateHandler*
skk_start_state_handler_construct (GType object_type)
{
	SkkStartStateHandler * self = NULL;
	self = (SkkStartStateHandler*) skk_state_handler_construct (object_type);
	return self;
}


SkkStartStateHandler*
skk_start_state_handler_new (void)
{
	return skk_start_state_handler_construct (SKK_TYPE_START_STATE_HANDLER);
}


static void
skk_start_state_handler_class_init (SkkStartStateHandlerClass * klass)
{
	skk_start_state_handler_parent_class = g_type_class_peek_parent (klass);
	((SkkStateHandlerClass *) klass)->process_key_event = (gboolean (*) (SkkStateHandler *, SkkState*, SkkKeyEvent* *)) skk_start_state_handler_real_process_key_event;
	((SkkStateHandlerClass *) klass)->get_preedit = (gchar* (*) (SkkStateHandler *, SkkState*, guint*, guint*)) skk_start_state_handler_real_get_preedit;
}


static void
skk_start_state_handler_instance_init (SkkStartStateHandler * self)
{
}


GType
skk_start_state_handler_get_type (void)
{
	static volatile gsize skk_start_state_handler_type_id__volatile = 0;
	if (g_once_init_enter (&skk_start_state_handler_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SkkStartStateHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) skk_start_state_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SkkStartStateHandler), 0, (GInstanceInitFunc) skk_start_state_handler_instance_init, NULL };
		GType skk_start_state_handler_type_id;
		skk_start_state_handler_type_id = g_type_register_static (SKK_TYPE_STATE_HANDLER, "SkkStartStateHandler", &g_define_type_info, 0);
		g_once_init_leave (&skk_start_state_handler_type_id__volatile, skk_start_state_handler_type_id);
	}
	return skk_start_state_handler_type_id__volatile;
}


static gboolean
skk_select_state_handler_real_process_key_event (SkkStateHandler* base,
                                                 SkkState* state,
                                                 SkkKeyEvent* * key)
{
	SkkSelectStateHandler * self;
	gboolean result = FALSE;
	gchar* command = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp5_;
	self = (SkkSelectStateHandler*) base;
	g_return_val_if_fail (state != NULL, FALSE);
	g_return_val_if_fail (*key != NULL, FALSE);
	_tmp0_ = skk_state_lookup_key (state, *key);
	command = _tmp0_;
	_tmp2_ = command;
	if (_tmp2_ == NULL) {
		gunichar _tmp3_;
		gunichar _tmp4_;
		_tmp3_ = skk_key_event_get_code (*key);
		_tmp4_ = _tmp3_;
		_tmp1_ = _tmp4_ == ((gunichar) 0);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		result = TRUE;
		_g_free0 (command);
		return result;
	}
	_tmp5_ = command;
	if (g_strcmp0 (_tmp5_, "previous-candidate") == 0) {
		SkkCandidateList* _tmp6_;
		_tmp6_ = state->candidates;
		if (!skk_candidate_list_previous (_tmp6_)) {
			SkkCandidateList* _tmp7_;
			_tmp7_ = state->candidates;
			skk_candidate_list_clear (_tmp7_);
			state->handler_type = SKK_TYPE_START_STATE_HANDLER;
		}
		result = TRUE;
		_g_free0 (command);
		return result;
	} else {
		const gchar* _tmp8_;
		_tmp8_ = command;
		if (g_strcmp0 (_tmp8_, "purge-candidate") == 0) {
			SkkCandidate* candidate = NULL;
			SkkCandidateList* _tmp9_;
			SkkCandidate* _tmp10_;
			SkkCandidate* _tmp11_;
			_tmp9_ = state->candidates;
			_tmp10_ = skk_candidate_list_get (_tmp9_, -1);
			candidate = _tmp10_;
			_tmp11_ = candidate;
			skk_state_purge_candidate (state, _tmp11_);
			skk_state_reset (state);
			result = TRUE;
			_g_object_unref0 (candidate);
			_g_free0 (command);
			return result;
		} else {
			const gchar* _tmp12_;
			_tmp12_ = command;
			if (g_strcmp0 (_tmp12_, "next-candidate") == 0) {
				SkkCandidateList* _tmp13_;
				gint _tmp14_;
				gint _tmp15_;
				gchar* _tmp47_;
				gchar* _tmp48_;
				gboolean _tmp49_;
				SkkCandidateList* _tmp50_;
				gint _tmp51_;
				gint _tmp52_;
				_tmp13_ = state->candidates;
				_tmp14_ = skk_candidate_list_get_cursor_pos (_tmp13_);
				_tmp15_ = _tmp14_;
				if (_tmp15_ < 0) {
					gchar* midasi = NULL;
					gboolean okuri = FALSE;
					GString* _tmp16_;
					gssize _tmp17_;
					const gchar* _tmp41_;
					gboolean _tmp42_;
					SkkCandidateList* _tmp43_;
					gint _tmp44_;
					gint _tmp45_;
					okuri = FALSE;
					_tmp16_ = state->abbrev;
					_tmp17_ = _tmp16_->len;
					if (_tmp17_ > ((gssize) 0)) {
						GString* _tmp18_;
						const gchar* _tmp19_;
						gchar* _tmp20_;
						_tmp18_ = state->abbrev;
						_tmp19_ = _tmp18_->str;
						_tmp20_ = g_strdup (_tmp19_);
						_g_free0 (midasi);
						midasi = _tmp20_;
					} else {
						GString* builder = NULL;
						GString* _tmp21_;
						SkkRomKanaConverter* _tmp22_;
						GString* _tmp23_;
						SkkRomKanaConverter* _tmp24_;
						const gchar* _tmp25_;
						const gchar* _tmp26_;
						gboolean _tmp27_;
						GString* _tmp38_;
						const gchar* _tmp39_;
						gchar* _tmp40_;
						_tmp21_ = g_string_new ("");
						builder = _tmp21_;
						_tmp22_ = state->rom_kana_converter;
						skk_rom_kana_converter_output_nn_if_any (_tmp22_);
						_tmp23_ = builder;
						_tmp24_ = state->rom_kana_converter;
						_tmp25_ = skk_rom_kana_converter_get_output (_tmp24_);
						_tmp26_ = _tmp25_;
						g_string_append (_tmp23_, _tmp26_);
						_tmp27_ = state->okuri;
						if (_tmp27_) {
							gchar* prefix = NULL;
							SkkRomKanaConverter* _tmp28_;
							const gchar* _tmp29_;
							const gchar* _tmp30_;
							gchar* _tmp31_;
							gchar* _tmp32_;
							gchar* _tmp33_;
							gchar* _tmp34_;
							const gchar* _tmp35_;
							_tmp28_ = state->okuri_rom_kana_converter;
							_tmp29_ = skk_rom_kana_converter_get_output (_tmp28_);
							_tmp30_ = _tmp29_;
							_tmp31_ = skk_util_get_hiragana (_tmp30_);
							_tmp32_ = _tmp31_;
							_tmp33_ = skk_util_get_okurigana_prefix (_tmp32_);
							_tmp34_ = _tmp33_;
							_g_free0 (_tmp32_);
							prefix = _tmp34_;
							_tmp35_ = prefix;
							if (_tmp35_ != NULL) {
								GString* _tmp36_;
								const gchar* _tmp37_;
								_tmp36_ = builder;
								_tmp37_ = prefix;
								g_string_append (_tmp36_, _tmp37_);
								okuri = TRUE;
							}
							_g_free0 (prefix);
						}
						_tmp38_ = builder;
						_tmp39_ = _tmp38_->str;
						_tmp40_ = skk_util_get_hiragana (_tmp39_);
						_g_free0 (midasi);
						midasi = _tmp40_;
						_g_string_free0 (builder);
					}
					_tmp41_ = midasi;
					_tmp42_ = okuri;
					skk_state_lookup (state, _tmp41_, _tmp42_);
					_tmp43_ = state->candidates;
					_tmp44_ = skk_candidate_list_get_size (_tmp43_);
					_tmp45_ = _tmp44_;
					if (_tmp45_ > 0) {
						result = TRUE;
						_g_free0 (midasi);
						_g_free0 (command);
						return result;
					}
					_g_free0 (midasi);
				} else {
					SkkCandidateList* _tmp46_;
					_tmp46_ = state->candidates;
					if (skk_candidate_list_next (_tmp46_)) {
						result = TRUE;
						_g_free0 (command);
						return result;
					}
				}
				_tmp47_ = skk_state_get_yomi (state);
				_tmp48_ = _tmp47_;
				_tmp49_ = state->okuri;
				g_signal_emit (state, skk_state_signals[SKK_STATE_RECURSIVE_EDIT_START_SIGNAL], 0, _tmp48_, _tmp49_);
				_g_free0 (_tmp48_);
				_tmp50_ = state->candidates;
				_tmp51_ = skk_candidate_list_get_size (_tmp50_);
				_tmp52_ = _tmp51_;
				if (_tmp52_ == 0) {
					SkkCandidateList* _tmp53_;
					_tmp53_ = state->candidates;
					skk_candidate_list_clear (_tmp53_);
					state->handler_type = SKK_TYPE_START_STATE_HANDLER;
				}
				result = TRUE;
				_g_free0 (command);
				return result;
			} else {
				gboolean _tmp54_ = FALSE;
				gboolean _tmp55_ = FALSE;
				const gchar* _tmp56_;
				_tmp56_ = command;
				if (g_strcmp0 (_tmp56_, "abort") == 0) {
					_tmp55_ = TRUE;
				} else {
					const gchar* _tmp57_;
					_tmp57_ = command;
					_tmp55_ = g_strcmp0 (_tmp57_, "abort-to-latin") == 0;
				}
				if (_tmp55_) {
					_tmp54_ = TRUE;
				} else {
					const gchar* _tmp58_;
					_tmp58_ = command;
					_tmp54_ = g_strcmp0 (_tmp58_, "abort-to-latin-unhandled") == 0;
				}
				if (_tmp54_) {
					SkkCandidateList* _tmp59_;
					_tmp59_ = state->candidates;
					skk_candidate_list_clear (_tmp59_);
					skk_state_cancel_okuri (state);
					state->handler_type = SKK_TYPE_START_STATE_HANDLER;
					result = TRUE;
					_g_free0 (command);
					return result;
				} else {
					gchar* surrounding_after = NULL;
					gchar* _tmp60_;
					SkkUnicodeString* _tmp61_;
					SkkCandidateList* _tmp65_;
					GString* _tmp66_;
					const gchar* _tmp67_;
					const gchar* _tmp68_;
					_tmp60_ = g_strdup ("");
					surrounding_after = _tmp60_;
					_tmp61_ = state->surrounding_text;
					if (_tmp61_ != NULL) {
						SkkUnicodeString* _tmp62_;
						guint _tmp63_;
						gchar* _tmp64_;
						_tmp62_ = state->surrounding_text;
						_tmp63_ = state->surrounding_end;
						_tmp64_ = skk_unicode_string_substring (_tmp62_, (glong) _tmp63_, (glong) -1);
						_g_free0 (surrounding_after);
						surrounding_after = _tmp64_;
					}
					_tmp65_ = state->candidates;
					skk_candidate_list_select (_tmp65_);
					_tmp66_ = state->output;
					_tmp67_ = surrounding_after;
					g_string_append (_tmp66_, _tmp67_);
					_tmp68_ = command;
					if (g_strcmp0 (_tmp68_, "special-midasi") == 0) {
						SkkCandidateList* _tmp69_;
						_tmp69_ = state->candidates;
						skk_candidate_list_clear (_tmp69_);
						state->handler_type = SKK_TYPE_START_STATE_HANDLER;
						result = FALSE;
						_g_free0 (surrounding_after);
						_g_free0 (command);
						return result;
					} else {
						gboolean _tmp70_ = FALSE;
						gboolean _tmp71_ = FALSE;
						gboolean _tmp72_ = FALSE;
						gboolean _tmp73_ = FALSE;
						SkkModifierType _tmp74_;
						SkkModifierType _tmp75_;
						skk_state_reset (state);
						_tmp74_ = skk_key_event_get_modifiers (*key);
						_tmp75_ = _tmp74_;
						if (_tmp75_ == 0) {
							gunichar _tmp76_;
							gunichar _tmp77_;
							_tmp76_ = skk_key_event_get_code (*key);
							_tmp77_ = _tmp76_;
							_tmp73_ = ((gunichar) 0x20) <= _tmp77_;
						} else {
							_tmp73_ = FALSE;
						}
						if (_tmp73_) {
							gunichar _tmp78_;
							gunichar _tmp79_;
							_tmp78_ = skk_key_event_get_code (*key);
							_tmp79_ = _tmp78_;
							_tmp72_ = _tmp79_ <= ((gunichar) 0x7E);
						} else {
							_tmp72_ = FALSE;
						}
						if (_tmp72_) {
							_tmp71_ = TRUE;
						} else {
							const gchar* _tmp80_;
							_tmp80_ = command;
							_tmp71_ = g_strcmp0 (_tmp80_, "delete") == 0;
						}
						if (_tmp71_) {
							_tmp70_ = TRUE;
						} else {
							gboolean _tmp81_ = FALSE;
							gboolean _tmp82_;
							_tmp82_ = state->egg_like_newline;
							if (!_tmp82_) {
								const gchar* _tmp83_;
								_tmp83_ = command;
								_tmp81_ = g_strcmp0 (_tmp83_, "commit-unhandled") == 0;
							} else {
								_tmp81_ = FALSE;
							}
							_tmp70_ = _tmp81_;
						}
						if (_tmp70_) {
							result = FALSE;
							_g_free0 (surrounding_after);
							_g_free0 (command);
							return result;
						} else {
							result = TRUE;
							_g_free0 (surrounding_after);
							_g_free0 (command);
							return result;
						}
					}
					_g_free0 (surrounding_after);
				}
			}
		}
	}
	_g_free0 (command);
}


static gchar*
skk_select_state_handler_real_get_preedit (SkkStateHandler* base,
                                           SkkState* state,
                                           guint* underline_offset,
                                           guint* underline_nchars)
{
	SkkSelectStateHandler * self;
	guint _vala_underline_offset = 0U;
	guint _vala_underline_nchars = 0U;
	gchar* result = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	guint _tmp1_;
	SkkCandidateList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	const gchar* _tmp15_;
	GString* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	self = (SkkSelectStateHandler*) base;
	g_return_val_if_fail (state != NULL, NULL);
	_tmp0_ = g_string_new ("▼");
	builder = _tmp0_;
	_vala_underline_nchars = (guint) 0;
	_tmp1_ = _vala_underline_nchars;
	_vala_underline_offset = _tmp1_;
	_tmp2_ = state->candidates;
	_tmp3_ = skk_candidate_list_get_cursor_pos (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ >= 0) {
		SkkCandidate* c = NULL;
		SkkCandidateList* _tmp5_;
		SkkCandidate* _tmp6_;
		GString* _tmp7_;
		SkkCandidate* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp5_ = state->candidates;
		_tmp6_ = skk_candidate_list_get (_tmp5_, -1);
		c = _tmp6_;
		_tmp7_ = builder;
		_tmp8_ = c;
		_tmp9_ = skk_candidate_get_output (_tmp8_);
		_tmp10_ = _tmp9_;
		g_string_append (_tmp7_, _tmp10_);
		_g_object_unref0 (c);
	} else {
		GString* _tmp11_;
		SkkRomKanaConverter* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		_tmp11_ = builder;
		_tmp12_ = state->rom_kana_converter;
		_tmp13_ = skk_rom_kana_converter_get_output (_tmp12_);
		_tmp14_ = _tmp13_;
		g_string_append (_tmp11_, _tmp14_);
	}
	_tmp15_ = state->auto_start_henkan_keyword;
	if (_tmp15_ != NULL) {
		GString* _tmp16_;
		const gchar* _tmp17_;
		_tmp16_ = builder;
		_tmp17_ = state->auto_start_henkan_keyword;
		g_string_append (_tmp16_, _tmp17_);
	} else {
		gboolean _tmp18_;
		_tmp18_ = state->okuri;
		if (_tmp18_) {
			GString* _tmp19_;
			SkkRomKanaConverter* _tmp20_;
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			_tmp19_ = builder;
			_tmp20_ = state->okuri_rom_kana_converter;
			_tmp21_ = skk_rom_kana_converter_get_output (_tmp20_);
			_tmp22_ = _tmp21_;
			g_string_append (_tmp19_, _tmp22_);
		} else {
			SkkUnicodeString* _tmp23_;
			_tmp23_ = state->surrounding_text;
			if (_tmp23_ != NULL) {
				GString* _tmp24_;
				const gchar* _tmp25_;
				GString* _tmp26_;
				SkkUnicodeString* _tmp27_;
				guint _tmp28_;
				gchar* _tmp29_;
				gchar* _tmp30_;
				_vala_underline_offset = (guint) 1;
				_tmp24_ = builder;
				_tmp25_ = _tmp24_->str;
				_vala_underline_nchars = (guint) (g_utf8_strlen (_tmp25_, (gssize) -1) - 1);
				_tmp26_ = builder;
				_tmp27_ = state->surrounding_text;
				_tmp28_ = state->surrounding_end;
				_tmp29_ = skk_unicode_string_substring (_tmp27_, (glong) _tmp28_, (glong) -1);
				_tmp30_ = _tmp29_;
				g_string_append (_tmp26_, _tmp30_);
				_g_free0 (_tmp30_);
			}
		}
	}
	_tmp31_ = builder;
	_tmp32_ = _tmp31_->str;
	_tmp33_ = g_strdup (_tmp32_);
	result = _tmp33_;
	_g_string_free0 (builder);
	if (underline_offset) {
		*underline_offset = _vala_underline_offset;
	}
	if (underline_nchars) {
		*underline_nchars = _vala_underline_nchars;
	}
	return result;
}


SkkSelectStateHandler*
skk_select_state_handler_construct (GType object_type)
{
	SkkSelectStateHandler * self = NULL;
	self = (SkkSelectStateHandler*) skk_state_handler_construct (object_type);
	return self;
}


SkkSelectStateHandler*
skk_select_state_handler_new (void)
{
	return skk_select_state_handler_construct (SKK_TYPE_SELECT_STATE_HANDLER);
}


static void
skk_select_state_handler_class_init (SkkSelectStateHandlerClass * klass)
{
	skk_select_state_handler_parent_class = g_type_class_peek_parent (klass);
	((SkkStateHandlerClass *) klass)->process_key_event = (gboolean (*) (SkkStateHandler *, SkkState*, SkkKeyEvent* *)) skk_select_state_handler_real_process_key_event;
	((SkkStateHandlerClass *) klass)->get_preedit = (gchar* (*) (SkkStateHandler *, SkkState*, guint*, guint*)) skk_select_state_handler_real_get_preedit;
}


static void
skk_select_state_handler_instance_init (SkkSelectStateHandler * self)
{
}


GType
skk_select_state_handler_get_type (void)
{
	static volatile gsize skk_select_state_handler_type_id__volatile = 0;
	if (g_once_init_enter (&skk_select_state_handler_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SkkSelectStateHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) skk_select_state_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SkkSelectStateHandler), 0, (GInstanceInitFunc) skk_select_state_handler_instance_init, NULL };
		GType skk_select_state_handler_type_id;
		skk_select_state_handler_type_id = g_type_register_static (SKK_TYPE_STATE_HANDLER, "SkkSelectStateHandler", &g_define_type_info, 0);
		g_once_init_leave (&skk_select_state_handler_type_id__volatile, skk_select_state_handler_type_id);
	}
	return skk_select_state_handler_type_id__volatile;
}


static void
_vala_array_destroy (gpointer array,
                     gint array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void
_vala_array_free (gpointer array,
                  gint array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



