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

/*
 * 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 <gio/gio.h>


#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;
typedef struct _SkkDictPrivate SkkDictPrivate;

#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 SKK_TYPE_SKK_SERV (skk_skk_serv_get_type ())
#define SKK_SKK_SERV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SKK_TYPE_SKK_SERV, SkkSkkServ))
#define SKK_SKK_SERV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SKK_TYPE_SKK_SERV, SkkSkkServClass))
#define SKK_IS_SKK_SERV(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SKK_TYPE_SKK_SERV))
#define SKK_IS_SKK_SERV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SKK_TYPE_SKK_SERV))
#define SKK_SKK_SERV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SKK_TYPE_SKK_SERV, SkkSkkServClass))

typedef struct _SkkSkkServ SkkSkkServ;
typedef struct _SkkSkkServClass SkkSkkServClass;
typedef struct _SkkSkkServPrivate SkkSkkServPrivate;

#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_SKK_SERV_0_PROPERTY,
	SKK_SKK_SERV_READ_ONLY_PROPERTY,
	SKK_SKK_SERV_NUM_PROPERTIES
};
static GParamSpec* skk_skk_serv_properties[SKK_SKK_SERV_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_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

typedef enum  {
	SKK_SKK_SERV_ERROR_NOT_READABLE,
	SKK_SKK_SERV_ERROR_INVALID_RESPONSE
} SkkSkkServError;
#define SKK_SKK_SERV_ERROR skk_skk_serv_error_quark ()
struct _SkkDict {
	GObject parent_instance;
	SkkDictPrivate * priv;
};

struct _SkkDictClass {
	GObjectClass parent_class;
	void (*reload) (SkkDict* self, GError** error);
	SkkCandidate** (*lookup) (SkkDict* self, const gchar* midasi, gboolean okuri, int* result_length1);
	gchar** (*complete) (SkkDict* self, const gchar* midasi, int* result_length1);
	gboolean (*select_candidate) (SkkDict* self, SkkCandidate* candidate);
	gboolean (*purge_candidate) (SkkDict* self, SkkCandidate* candidate);
	void (*save) (SkkDict* self, GError** error);
	gboolean (*get_read_only) (SkkDict* self);
};

struct _SkkSkkServ {
	SkkDict parent_instance;
	SkkSkkServPrivate * priv;
};

struct _SkkSkkServClass {
	SkkDictClass parent_class;
};

struct _SkkSkkServPrivate {
	GSocketConnection* connection;
	guint8 buffer[4096];
	gchar* host;
	guint16 port;
	SkkEncodingConverter* converter;
};


static gpointer skk_skk_serv_parent_class = NULL;

GQuark skk_skk_serv_error_quark (void);
GType skk_dict_get_type (void) G_GNUC_CONST;
GType skk_candidate_get_type (void) G_GNUC_CONST;
GType skk_skk_serv_get_type (void) G_GNUC_CONST;
GType skk_encoding_converter_get_type (void) G_GNUC_CONST;
#define SKK_SKK_SERV_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SKK_TYPE_SKK_SERV, SkkSkkServPrivate))
static void skk_skk_serv_close_connection (SkkSkkServ* self);
static void skk_skk_serv_real_reload (SkkDict* base,
                               GError** error);
static gchar* skk_skk_serv_read_response (SkkSkkServ* self,
                                   GError** error);
static SkkCandidate** skk_skk_serv_real_lookup (SkkDict* base,
                                         const gchar* midasi,
                                         gboolean okuri,
                                         int* result_length1);
gchar* skk_encoding_converter_encode (SkkEncodingConverter* self,
                                      const gchar* internal_str,
                                      GError** error);
gchar* skk_encoding_converter_decode (SkkEncodingConverter* self,
                                      const gchar* external_str,
                                      GError** error);
SkkCandidate** skk_dict_split_candidates (SkkDict* self,
                                          const gchar* midasi,
                                          gboolean okuri,
                                          const gchar* line,
                                          int* result_length1);
static gchar** skk_skk_serv_real_complete (SkkDict* base,
                                    const gchar* midasi,
                                    int* result_length1);
SkkSkkServ* skk_skk_serv_new (const gchar* host,
                              guint16 port,
                              const gchar* encoding,
                              GError** error);
SkkSkkServ* skk_skk_serv_construct (GType object_type,
                                    const gchar* host,
                                    guint16 port,
                                    const gchar* encoding,
                                    GError** error);
SkkDict* skk_dict_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);
void skk_dict_reload (SkkDict* self,
                      GError** error);
static void skk_skk_serv_finalize (GObject * obj);
gboolean skk_dict_get_read_only (SkkDict* self);
static void _vala_skk_skk_serv_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static gint _vala_array_length (gpointer array);


GQuark
skk_skk_serv_error_quark (void)
{
	return g_quark_from_static_string ("skk_skk_serv_error-quark");
}


static void
skk_skk_serv_close_connection (SkkSkkServ* self)
{
	GSocketConnection* _tmp0_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->connection;
	if (_tmp0_ != NULL) {
		{
			guint8 _tmp1_;
			gsize bytes_written = 0UL;
			GSocketConnection* _tmp2_;
			GOutputStream* _tmp3_;
			GOutputStream* _tmp4_;
			gsize _tmp5_ = 0UL;
			GSocketConnection* _tmp6_;
			GOutputStream* _tmp7_;
			GOutputStream* _tmp8_;
			GSocketConnection* _tmp9_;
			self->priv->buffer[0] = (guint8) '0';
			_tmp1_ = self->priv->buffer[0];
			_tmp2_ = self->priv->connection;
			_tmp3_ = g_io_stream_get_output_stream ((GIOStream*) _tmp2_);
			_tmp4_ = _tmp3_;
			g_output_stream_write_all (_tmp4_, self->priv->buffer + 0, (gsize) (1 - 0), &_tmp5_, NULL, &_inner_error_);
			bytes_written = _tmp5_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch16_g_error;
			}
			_tmp6_ = self->priv->connection;
			_tmp7_ = g_io_stream_get_output_stream ((GIOStream*) _tmp6_);
			_tmp8_ = _tmp7_;
			g_output_stream_flush (_tmp8_, NULL, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch16_g_error;
			}
			_tmp9_ = self->priv->connection;
			g_io_stream_close ((GIOStream*) _tmp9_, NULL, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch16_g_error;
			}
		}
		goto __finally16;
		__catch16_g_error:
		{
			GError* e = NULL;
			GError* _tmp10_;
			const gchar* _tmp11_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp10_ = e;
			_tmp11_ = _tmp10_->message;
			g_warning ("skkserv.vala:43: can't close skkserv: %s", _tmp11_);
			_g_error_free0 (e);
		}
		__finally16:
		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;
		}
		_g_object_unref0 (self->priv->connection);
		self->priv->connection = NULL;
	}
}


/**
         * {@inheritDoc}
         */
static void
skk_skk_serv_real_reload (SkkDict* base,
                          GError** error)
{
	SkkSkkServ * self;
	GError * _inner_error_ = NULL;
	self = (SkkSkkServ*) base;
	skk_skk_serv_close_connection (self);
	{
		GSocketClient* client = NULL;
		GSocketClient* _tmp0_;
		GSocketConnection* _tmp1_ = NULL;
		GSocketClient* _tmp2_;
		const gchar* _tmp3_;
		guint16 _tmp4_;
		GSocketConnection* _tmp5_;
		GSocketConnection* _tmp6_;
		guint8 _tmp7_;
		gsize bytes_written = 0UL;
		GSocketConnection* _tmp8_;
		GOutputStream* _tmp9_;
		GOutputStream* _tmp10_;
		gsize _tmp11_ = 0UL;
		GSocketConnection* _tmp12_;
		GOutputStream* _tmp13_;
		GOutputStream* _tmp14_;
		gssize len = 0L;
		GSocketConnection* _tmp15_;
		GInputStream* _tmp16_;
		GInputStream* _tmp17_;
		gssize _tmp18_;
		_tmp0_ = g_socket_client_new ();
		client = _tmp0_;
		_tmp2_ = client;
		_tmp3_ = self->priv->host;
		_tmp4_ = self->priv->port;
		_tmp5_ = g_socket_client_connect_to_host (_tmp2_, _tmp3_, _tmp4_, NULL, &_inner_error_);
		_tmp1_ = _tmp5_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (client);
			goto __catch17_g_error;
		}
		_tmp6_ = _tmp1_;
		_tmp1_ = NULL;
		_g_object_unref0 (self->priv->connection);
		self->priv->connection = _tmp6_;
		self->priv->buffer[0] = (guint8) '2';
		_tmp7_ = self->priv->buffer[0];
		_tmp8_ = self->priv->connection;
		_tmp9_ = g_io_stream_get_output_stream ((GIOStream*) _tmp8_);
		_tmp10_ = _tmp9_;
		g_output_stream_write_all (_tmp10_, self->priv->buffer + 0, (gsize) (1 - 0), &_tmp11_, NULL, &_inner_error_);
		bytes_written = _tmp11_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (_tmp1_);
			_g_object_unref0 (client);
			goto __catch17_g_error;
		}
		_tmp12_ = self->priv->connection;
		_tmp13_ = g_io_stream_get_output_stream ((GIOStream*) _tmp12_);
		_tmp14_ = _tmp13_;
		g_output_stream_flush (_tmp14_, NULL, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (_tmp1_);
			_g_object_unref0 (client);
			goto __catch17_g_error;
		}
		_tmp15_ = self->priv->connection;
		_tmp16_ = g_io_stream_get_input_stream ((GIOStream*) _tmp15_);
		_tmp17_ = _tmp16_;
		len = g_input_stream_read (_tmp17_, self->priv->buffer, (gsize) 4096, NULL, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (_tmp1_);
			_g_object_unref0 (client);
			goto __catch17_g_error;
		}
		_tmp18_ = len;
		if (_tmp18_ <= ((gssize) 0)) {
			skk_skk_serv_close_connection (self);
		}
		_g_object_unref0 (_tmp1_);
		_g_object_unref0 (client);
	}
	goto __finally17;
	__catch17_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp19_;
		guint16 _tmp20_;
		GError* _tmp21_;
		const gchar* _tmp22_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp19_ = self->priv->host;
		_tmp20_ = self->priv->port;
		_tmp21_ = e;
		_tmp22_ = _tmp21_->message;
		g_warning ("skkserv.vala:67: can't open skkserv at %s:%u: %s", _tmp19_, (guint) _tmp20_, _tmp22_);
		skk_skk_serv_close_connection (self);
		_g_error_free0 (e);
	}
	__finally17:
	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;
	}
}


static gint
string_index_of_char (const gchar* self,
                      gunichar c,
                      gint start_index)
{
	gint result = 0;
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = g_utf8_strchr (((gchar*) self) + start_index, (gssize) -1, c);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}


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 gchar*
skk_skk_serv_read_response (SkkSkkServ* self,
                            GError** error)
{
	gchar* result = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	gint index = 0;
	GString* _tmp19_;
	const gchar* _tmp20_;
	gint _tmp21_;
	GString* _tmp23_;
	const gchar* _tmp24_;
	gint _tmp25_;
	gchar* _tmp26_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	while (TRUE) {
		GString* _tmp1_;
		const gchar* _tmp2_;
		gssize len = 0L;
		GSocketConnection* _tmp3_;
		GInputStream* _tmp4_;
		GInputStream* _tmp5_;
		gssize _tmp6_;
		_tmp1_ = builder;
		_tmp2_ = _tmp1_->str;
		if (!(string_index_of_char (_tmp2_, (gunichar) '\n', 0) < 0)) {
			break;
		}
		_tmp3_ = self->priv->connection;
		_tmp4_ = g_io_stream_get_input_stream ((GIOStream*) _tmp3_);
		_tmp5_ = _tmp4_;
		len = g_input_stream_read (_tmp5_, self->priv->buffer, (gsize) 4096, NULL, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if ((_inner_error_->domain == SKK_SKK_SERV_ERROR) || (_inner_error_->domain == G_IO_ERROR)) {
				g_propagate_error (error, _inner_error_);
				_g_string_free0 (builder);
				return NULL;
			} else {
				_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;
			}
		}
		_tmp6_ = len;
		if (_tmp6_ < ((gssize) 0)) {
			GError* _tmp7_;
			_tmp7_ = g_error_new_literal (SKK_SKK_SERV_ERROR, SKK_SKK_SERV_ERROR_NOT_READABLE, "read error");
			_inner_error_ = _tmp7_;
			if ((_inner_error_->domain == SKK_SKK_SERV_ERROR) || (_inner_error_->domain == G_IO_ERROR)) {
				g_propagate_error (error, _inner_error_);
				_g_string_free0 (builder);
				return NULL;
			} else {
				_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;
			}
		} else {
			gssize _tmp8_;
			_tmp8_ = len;
			if (_tmp8_ == ((gssize) 0)) {
				break;
			} else {
				gssize _tmp9_;
				_tmp9_ = len;
				if (_tmp9_ > ((gssize) 0)) {
					guint8 _tmp10_;
					gchar* data = NULL;
					gssize _tmp12_;
					gchar* _tmp13_;
					gint data_length1;
					gint _data_size_;
					gchar* _tmp14_;
					gint _tmp14__length1;
					gssize _tmp15_;
					gint _tmp16_;
					GString* _tmp17_;
					gchar* _tmp18_;
					gint _tmp18__length1;
					_tmp10_ = self->priv->buffer[0];
					if (_tmp10_ != ((guint8) '1')) {
						GError* _tmp11_;
						_tmp11_ = g_error_new_literal (SKK_SKK_SERV_ERROR, SKK_SKK_SERV_ERROR_INVALID_RESPONSE, "invalid response code");
						_inner_error_ = _tmp11_;
						if ((_inner_error_->domain == SKK_SKK_SERV_ERROR) || (_inner_error_->domain == G_IO_ERROR)) {
							g_propagate_error (error, _inner_error_);
							_g_string_free0 (builder);
							return NULL;
						} else {
							_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;
						}
					}
					_tmp12_ = len;
					_tmp13_ = g_new0 (gchar, _tmp12_ + 1);
					data = _tmp13_;
					data_length1 = _tmp12_ + 1;
					_data_size_ = data_length1;
					_tmp14_ = data;
					_tmp14__length1 = data_length1;
					_tmp15_ = len;
					memcpy (_tmp14_, self->priv->buffer, (gsize) _tmp15_);
					_tmp16_ = data_length1;
					data_length1 = _tmp16_ - 1;
					_tmp17_ = builder;
					_tmp18_ = data;
					_tmp18__length1 = data_length1;
					g_string_append (_tmp17_, (const gchar*) _tmp18_);
					data = (g_free (data), NULL);
				}
			}
		}
	}
	_tmp19_ = builder;
	_tmp20_ = _tmp19_->str;
	index = string_index_of_char (_tmp20_, (gunichar) '\n', 0);
	_tmp21_ = index;
	if (_tmp21_ < 0) {
		GError* _tmp22_;
		_tmp22_ = g_error_new_literal (SKK_SKK_SERV_ERROR, SKK_SKK_SERV_ERROR_INVALID_RESPONSE, "missing newline");
		_inner_error_ = _tmp22_;
		if ((_inner_error_->domain == SKK_SKK_SERV_ERROR) || (_inner_error_->domain == G_IO_ERROR)) {
			g_propagate_error (error, _inner_error_);
			_g_string_free0 (builder);
			return NULL;
		} else {
			_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;
		}
	}
	_tmp23_ = builder;
	_tmp24_ = _tmp23_->str;
	_tmp25_ = index;
	_tmp26_ = string_slice (_tmp24_, (glong) 0, (glong) _tmp25_);
	result = _tmp26_;
	_g_string_free0 (builder);
	return result;
}


/**
         * {@inheritDoc}
         */
static guint8*
string_get_data (const gchar* self,
                 int* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	guint8* _tmp3_;
	gint _tmp3__length1;
	guint8* _tmp4_;
	gint _tmp4__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res_length1;
	_tmp3_ = res;
	_tmp3__length1 = res_length1;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}


static SkkCandidate**
skk_skk_serv_real_lookup (SkkDict* base,
                          const gchar* midasi,
                          gboolean okuri,
                          int* result_length1)
{
	SkkSkkServ * self;
	SkkCandidate** result = NULL;
	GSocketConnection* _tmp0_;
	gchar* _midasi = NULL;
	GError * _inner_error_ = NULL;
	self = (SkkSkkServ*) base;
	g_return_val_if_fail (midasi != NULL, NULL);
	_tmp0_ = self->priv->connection;
	if (_tmp0_ == NULL) {
		SkkCandidate** _tmp1_;
		SkkCandidate** _tmp2_;
		gint _tmp2__length1;
		_tmp1_ = g_new0 (SkkCandidate*, 0 + 1);
		_tmp2_ = _tmp1_;
		_tmp2__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp2__length1;
		}
		result = _tmp2_;
		return result;
	}
	{
		gchar* _tmp3_ = NULL;
		SkkEncodingConverter* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = self->priv->converter;
		_tmp5_ = skk_encoding_converter_encode (_tmp4_, midasi, &_inner_error_);
		_tmp3_ = _tmp5_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch18_g_error;
		}
		_tmp6_ = _tmp3_;
		_tmp3_ = NULL;
		_g_free0 (_midasi);
		_midasi = _tmp6_;
		_g_free0 (_tmp3_);
	}
	goto __finally18;
	__catch18_g_error:
	{
		GError* e = NULL;
		SkkCandidate** _tmp7_;
		SkkCandidate** _tmp8_;
		gint _tmp8__length1;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp7_ = g_new0 (SkkCandidate*, 0 + 1);
		_tmp8_ = _tmp7_;
		_tmp8__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp8__length1;
		}
		result = _tmp8_;
		_g_error_free0 (e);
		_g_free0 (_midasi);
		return result;
	}
	__finally18:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (_midasi);
		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;
	}
	{
		gsize bytes_written = 0UL;
		GSocketConnection* _tmp9_;
		GOutputStream* _tmp10_;
		GOutputStream* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		guint8* _tmp15_;
		gint _tmp15__length1;
		guint8* _tmp16_;
		gint _tmp16__length1;
		gsize _tmp17_ = 0UL;
		GSocketConnection* _tmp18_;
		GOutputStream* _tmp19_;
		GOutputStream* _tmp20_;
		gchar* response = NULL;
		gchar* _tmp21_;
		const gchar* _tmp22_;
		gint _tmp23_;
		gint _tmp24_;
		gchar* _tmp27_ = NULL;
		SkkEncodingConverter* _tmp28_;
		const gchar* _tmp29_;
		const gchar* _tmp30_;
		gint _tmp31_;
		gint _tmp32_;
		gchar* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		gint _tmp37_;
		SkkCandidate** _tmp38_;
		SkkCandidate** _tmp39_;
		gint _tmp39__length1;
		_tmp9_ = self->priv->connection;
		_tmp10_ = g_io_stream_get_output_stream ((GIOStream*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = _midasi;
		_tmp13_ = g_strdup_printf ("1%s ", _tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = string_get_data (_tmp14_, &_tmp15__length1);
		_tmp16_ = _tmp15_;
		_tmp16__length1 = _tmp15__length1;
		g_output_stream_write_all (_tmp11_, _tmp16_, (gsize) _tmp16__length1, &_tmp17_, NULL, &_inner_error_);
		bytes_written = _tmp17_;
		_g_free0 (_tmp14_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == SKK_SKK_SERV_ERROR) {
				goto __catch19_skk_skk_serv_error;
			}
			goto __catch19_g_error;
		}
		_tmp18_ = self->priv->connection;
		_tmp19_ = g_io_stream_get_output_stream ((GIOStream*) _tmp18_);
		_tmp20_ = _tmp19_;
		g_output_stream_flush (_tmp20_, NULL, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == SKK_SKK_SERV_ERROR) {
				goto __catch19_skk_skk_serv_error;
			}
			goto __catch19_g_error;
		}
		_tmp21_ = skk_skk_serv_read_response (self, &_inner_error_);
		response = _tmp21_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == SKK_SKK_SERV_ERROR) {
				goto __catch19_skk_skk_serv_error;
			}
			goto __catch19_g_error;
		}
		_tmp22_ = response;
		_tmp23_ = strlen (_tmp22_);
		_tmp24_ = _tmp23_;
		if (_tmp24_ == 0) {
			SkkCandidate** _tmp25_;
			SkkCandidate** _tmp26_;
			gint _tmp26__length1;
			_tmp25_ = g_new0 (SkkCandidate*, 0 + 1);
			_tmp26_ = _tmp25_;
			_tmp26__length1 = 0;
			if (result_length1) {
				*result_length1 = _tmp26__length1;
			}
			result = _tmp26_;
			_g_free0 (response);
			_g_free0 (_midasi);
			return result;
		}
		_tmp28_ = self->priv->converter;
		_tmp29_ = response;
		_tmp30_ = response;
		_tmp31_ = strlen (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = string_slice (_tmp29_, (glong) 1, (glong) _tmp32_);
		_tmp34_ = _tmp33_;
		_tmp35_ = skk_encoding_converter_decode (_tmp28_, _tmp34_, &_inner_error_);
		_tmp36_ = _tmp35_;
		_g_free0 (_tmp34_);
		_tmp27_ = _tmp36_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (response);
			if (_inner_error_->domain == SKK_SKK_SERV_ERROR) {
				goto __catch19_skk_skk_serv_error;
			}
			goto __catch19_g_error;
		}
		_tmp38_ = skk_dict_split_candidates ((SkkDict*) self, midasi, okuri, _tmp27_, &_tmp37_);
		_tmp39_ = _tmp38_;
		_tmp39__length1 = _tmp37_;
		if (result_length1) {
			*result_length1 = _tmp39__length1;
		}
		result = _tmp39_;
		_g_free0 (_tmp27_);
		_g_free0 (response);
		_g_free0 (_midasi);
		return result;
	}
	goto __finally19;
	__catch19_skk_skk_serv_error:
	{
		GError* e = NULL;
		SkkCandidate** _tmp40_;
		SkkCandidate** _tmp41_;
		gint _tmp41__length1;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp40_ = g_new0 (SkkCandidate*, 0 + 1);
		_tmp41_ = _tmp40_;
		_tmp41__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp41__length1;
		}
		result = _tmp41_;
		_g_error_free0 (e);
		_g_free0 (_midasi);
		return result;
	}
	goto __finally19;
	__catch19_g_error:
	{
		GError* e = NULL;
		SkkCandidate** _tmp42_;
		SkkCandidate** _tmp43_;
		gint _tmp43__length1;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp42_ = g_new0 (SkkCandidate*, 0 + 1);
		_tmp43_ = _tmp42_;
		_tmp43__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp43__length1;
		}
		result = _tmp43_;
		_g_error_free0 (e);
		_g_free0 (_midasi);
		return result;
	}
	__finally19:
	_g_free0 (_midasi);
	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;
}


/**
         * {@inheritDoc}
         */
static gchar**
skk_skk_serv_real_complete (SkkDict* base,
                            const gchar* midasi,
                            int* result_length1)
{
	SkkSkkServ * self;
	gchar** result = NULL;
	GSocketConnection* _tmp0_;
	gchar* _midasi = NULL;
	GError * _inner_error_ = NULL;
	self = (SkkSkkServ*) base;
	g_return_val_if_fail (midasi != NULL, NULL);
	_tmp0_ = self->priv->connection;
	if (_tmp0_ == NULL) {
		gchar** _tmp1_;
		gchar** _tmp2_;
		gint _tmp2__length1;
		_tmp1_ = g_new0 (gchar*, 0 + 1);
		_tmp2_ = _tmp1_;
		_tmp2__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp2__length1;
		}
		result = _tmp2_;
		return result;
	}
	{
		gchar* _tmp3_ = NULL;
		SkkEncodingConverter* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = self->priv->converter;
		_tmp5_ = skk_encoding_converter_encode (_tmp4_, midasi, &_inner_error_);
		_tmp3_ = _tmp5_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch20_g_error;
		}
		_tmp6_ = _tmp3_;
		_tmp3_ = NULL;
		_g_free0 (_midasi);
		_midasi = _tmp6_;
		_g_free0 (_tmp3_);
	}
	goto __finally20;
	__catch20_g_error:
	{
		GError* e = NULL;
		gchar** _tmp7_;
		gchar** _tmp8_;
		gint _tmp8__length1;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp7_ = g_new0 (gchar*, 0 + 1);
		_tmp8_ = _tmp7_;
		_tmp8__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp8__length1;
		}
		result = _tmp8_;
		_g_error_free0 (e);
		_g_free0 (_midasi);
		return result;
	}
	__finally20:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (_midasi);
		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;
	}
	{
		gsize bytes_written = 0UL;
		GSocketConnection* _tmp9_;
		GOutputStream* _tmp10_;
		GOutputStream* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		guint8* _tmp15_;
		gint _tmp15__length1;
		guint8* _tmp16_;
		gint _tmp16__length1;
		gsize _tmp17_ = 0UL;
		GSocketConnection* _tmp18_;
		GOutputStream* _tmp19_;
		GOutputStream* _tmp20_;
		gchar* response = NULL;
		gchar* _tmp21_;
		const gchar* _tmp22_;
		gint _tmp23_;
		gint _tmp24_;
		gchar* _tmp27_ = NULL;
		SkkEncodingConverter* _tmp28_;
		const gchar* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		gchar** _tmp34_;
		gchar** _tmp35_;
		gchar** _tmp36_;
		gint _tmp36__length1;
		_tmp9_ = self->priv->connection;
		_tmp10_ = g_io_stream_get_output_stream ((GIOStream*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = _midasi;
		_tmp13_ = g_strdup_printf ("4%s ", _tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = string_get_data (_tmp14_, &_tmp15__length1);
		_tmp16_ = _tmp15_;
		_tmp16__length1 = _tmp15__length1;
		g_output_stream_write_all (_tmp11_, _tmp16_, (gsize) _tmp16__length1, &_tmp17_, NULL, &_inner_error_);
		bytes_written = _tmp17_;
		_g_free0 (_tmp14_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == SKK_SKK_SERV_ERROR) {
				goto __catch21_skk_skk_serv_error;
			}
			goto __catch21_g_error;
		}
		_tmp18_ = self->priv->connection;
		_tmp19_ = g_io_stream_get_output_stream ((GIOStream*) _tmp18_);
		_tmp20_ = _tmp19_;
		g_output_stream_flush (_tmp20_, NULL, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == SKK_SKK_SERV_ERROR) {
				goto __catch21_skk_skk_serv_error;
			}
			goto __catch21_g_error;
		}
		_tmp21_ = skk_skk_serv_read_response (self, &_inner_error_);
		response = _tmp21_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == SKK_SKK_SERV_ERROR) {
				goto __catch21_skk_skk_serv_error;
			}
			goto __catch21_g_error;
		}
		_tmp22_ = response;
		_tmp23_ = strlen (_tmp22_);
		_tmp24_ = _tmp23_;
		if (_tmp24_ < 2) {
			gchar** _tmp25_;
			gchar** _tmp26_;
			gint _tmp26__length1;
			_tmp25_ = g_new0 (gchar*, 0 + 1);
			_tmp26_ = _tmp25_;
			_tmp26__length1 = 0;
			if (result_length1) {
				*result_length1 = _tmp26__length1;
			}
			result = _tmp26_;
			_g_free0 (response);
			_g_free0 (_midasi);
			return result;
		}
		_tmp28_ = self->priv->converter;
		_tmp29_ = response;
		_tmp30_ = string_slice (_tmp29_, (glong) 2, (glong) -1);
		_tmp31_ = _tmp30_;
		_tmp32_ = skk_encoding_converter_decode (_tmp28_, _tmp31_, &_inner_error_);
		_tmp33_ = _tmp32_;
		_g_free0 (_tmp31_);
		_tmp27_ = _tmp33_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (response);
			if (_inner_error_->domain == SKK_SKK_SERV_ERROR) {
				goto __catch21_skk_skk_serv_error;
			}
			goto __catch21_g_error;
		}
		_tmp35_ = _tmp34_ = g_strsplit (_tmp27_, "/", 0);
		_tmp36_ = _tmp35_;
		_tmp36__length1 = _vala_array_length (_tmp34_);
		if (result_length1) {
			*result_length1 = _tmp36__length1;
		}
		result = _tmp36_;
		_g_free0 (_tmp27_);
		_g_free0 (response);
		_g_free0 (_midasi);
		return result;
	}
	goto __finally21;
	__catch21_skk_skk_serv_error:
	{
		GError* e = NULL;
		GError* _tmp37_;
		const gchar* _tmp38_;
		gchar** _tmp39_;
		gchar** _tmp40_;
		gint _tmp40__length1;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp37_ = e;
		_tmp38_ = _tmp37_->message;
		g_warning ("skkserv.vala:158: server completion failed %s", _tmp38_);
		_tmp39_ = g_new0 (gchar*, 0 + 1);
		_tmp40_ = _tmp39_;
		_tmp40__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp40__length1;
		}
		result = _tmp40_;
		_g_error_free0 (e);
		_g_free0 (_midasi);
		return result;
	}
	goto __finally21;
	__catch21_g_error:
	{
		GError* e = NULL;
		GError* _tmp41_;
		const gchar* _tmp42_;
		gchar** _tmp43_;
		gchar** _tmp44_;
		gint _tmp44__length1;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp41_ = e;
		_tmp42_ = _tmp41_->message;
		g_warning ("skkserv.vala:161: server completion failed %s", _tmp42_);
		_tmp43_ = g_new0 (gchar*, 0 + 1);
		_tmp44_ = _tmp43_;
		_tmp44__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp44__length1;
		}
		result = _tmp44_;
		_g_error_free0 (e);
		_g_free0 (_midasi);
		return result;
	}
	__finally21:
	_g_free0 (_midasi);
	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;
}


/**
         * Create a new SkkServ.
         *
         * @param host host to connect
         * @param port port at the host
         * @param encoding encoding to convert text over network traffic
         *
         * @return a new SkkServ.
         * @throws GLib.Error if opening a connection is failed
         */
SkkSkkServ*
skk_skk_serv_construct (GType object_type,
                        const gchar* host,
                        guint16 port,
                        const gchar* encoding,
                        GError** error)
{
	SkkSkkServ * self = NULL;
	gchar* _tmp0_;
	SkkEncodingConverter* _tmp1_ = NULL;
	SkkEncodingConverter* _tmp2_;
	SkkEncodingConverter* _tmp3_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (host != NULL, NULL);
	g_return_val_if_fail (encoding != NULL, NULL);
	self = (SkkSkkServ*) skk_dict_construct (object_type);
	_tmp0_ = g_strdup (host);
	_g_free0 (self->priv->host);
	self->priv->host = _tmp0_;
	self->priv->port = port;
	_tmp2_ = skk_encoding_converter_new (encoding, &_inner_error_);
	_tmp1_ = _tmp2_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp3_ = _tmp1_;
	_tmp1_ = NULL;
	_g_object_unref0 (self->priv->converter);
	self->priv->converter = _tmp3_;
	skk_dict_reload ((SkkDict*) self, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (_tmp1_);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_object_unref0 (_tmp1_);
	return self;
}


SkkSkkServ*
skk_skk_serv_new (const gchar* host,
                  guint16 port,
                  const gchar* encoding,
                  GError** error)
{
	return skk_skk_serv_construct (SKK_TYPE_SKK_SERV, host, port, encoding, error);
}


static gboolean
skk_skk_serv_real_get_read_only (SkkDict* base)
{
	gboolean result;
	SkkSkkServ* self;
	self = (SkkSkkServ*) base;
	result = TRUE;
	return result;
}


static void
skk_skk_serv_class_init (SkkSkkServClass * klass)
{
	skk_skk_serv_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SkkSkkServPrivate));
	((SkkDictClass *) klass)->reload = (void (*) (SkkDict *, GError**)) skk_skk_serv_real_reload;
	((SkkDictClass *) klass)->lookup = (SkkCandidate** (*) (SkkDict *, const gchar*, gboolean, int*)) skk_skk_serv_real_lookup;
	((SkkDictClass *) klass)->complete = (gchar** (*) (SkkDict *, const gchar*, int*)) skk_skk_serv_real_complete;
	SKK_DICT_CLASS (klass)->get_read_only = skk_skk_serv_real_get_read_only;
	G_OBJECT_CLASS (klass)->get_property = _vala_skk_skk_serv_get_property;
	G_OBJECT_CLASS (klass)->finalize = skk_skk_serv_finalize;
	/**
	         * {@inheritDoc}
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), SKK_SKK_SERV_READ_ONLY_PROPERTY, skk_skk_serv_properties[SKK_SKK_SERV_READ_ONLY_PROPERTY] = g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}


static void
skk_skk_serv_instance_init (SkkSkkServ * self)
{
	self->priv = SKK_SKK_SERV_GET_PRIVATE (self);
}


static void
skk_skk_serv_finalize (GObject * obj)
{
	SkkSkkServ * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SKK_TYPE_SKK_SERV, SkkSkkServ);
	skk_skk_serv_close_connection (self);
	_g_object_unref0 (self->priv->connection);
	_g_free0 (self->priv->host);
	_g_object_unref0 (self->priv->converter);
	G_OBJECT_CLASS (skk_skk_serv_parent_class)->finalize (obj);
}


/**
     * Network based Implementation of Dict.
     */
GType
skk_skk_serv_get_type (void)
{
	static volatile gsize skk_skk_serv_type_id__volatile = 0;
	if (g_once_init_enter (&skk_skk_serv_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SkkSkkServClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) skk_skk_serv_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SkkSkkServ), 0, (GInstanceInitFunc) skk_skk_serv_instance_init, NULL };
		GType skk_skk_serv_type_id;
		skk_skk_serv_type_id = g_type_register_static (SKK_TYPE_DICT, "SkkSkkServ", &g_define_type_info, 0);
		g_once_init_leave (&skk_skk_serv_type_id__volatile, skk_skk_serv_type_id);
	}
	return skk_skk_serv_type_id__volatile;
}


static void
_vala_skk_skk_serv_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	SkkSkkServ * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SKK_TYPE_SKK_SERV, SkkSkkServ);
	switch (property_id) {
		case SKK_SKK_SERV_READ_ONLY_PROPERTY:
		g_value_set_boolean (value, skk_dict_get_read_only ((SkkDict*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static gint
_vala_array_length (gpointer array)
{
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



