[Tomoe-cvs 1338] CVS update: tomoe/recognizer

Back to archive index

Kouhei Sutou kous****@users*****
2006年 11月 29日 (水) 00:07:02 JST


Index: tomoe/recognizer/tomoe-recognizer-simple.c
diff -u tomoe/recognizer/tomoe-recognizer-simple.c:1.10 tomoe/recognizer/tomoe-recognizer-simple.c:1.11
--- tomoe/recognizer/tomoe-recognizer-simple.c:1.10	Tue Nov 28 16:14:40 2006
+++ tomoe/recognizer/tomoe-recognizer-simple.c	Wed Nov 29 00:07:02 2006
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  *  Copyright (C) 2006 Kouhei Sutou <kou****@cozmi*****>
  *
@@ -17,47 +17,102 @@
  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  *  Boston, MA  02111-1307  USA
  *
- *  $Id: tomoe-recognizer-simple.c,v 1.10 2006/11/28 07:14:40 kous Exp $
+ *  $Id: tomoe-recognizer-simple.c,v 1.11 2006/11/28 15:07:02 kous Exp $
  */
 
 #include <stdlib.h>
 
-#include "tomoe-recognizer-impl.h"
+#include <tomoe-recognizer-impl.h>
 #include "tomoe-recognizer-simple-logic.h"
 
+#define TOMOE_TYPE_RECOGNIZER_SIMPLE            tomoe_type_recognizer_simple
+#define TOMOE_RECOGNIZER_SIMPLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOMOE_TYPE_RECOGNIZER_SIMPLE, TomoeRecognizerSimple))
+#define TOMOE_RECOGNIZER_SIMPLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), TOMOE_TYPE_RECOGNIZER_SIMPLE, TomoeRecognizerSimpleClass))
+#define TOMOE_IS_RECOGNIZER_SIMPLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOMOE_TYPE_RECOGNIZER_SIMPLE))
+#define TOMOE_IS_RECOGNIZER_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOMOE_TYPE_RECOGNIZER_SIMPLE))
+#define TOMOE_RECOGNIZER_SIMPLE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), TOMOE_TYPE_RECOGNIZER_SIMPLE, TomoeRecognizerSimpleClass))
+
+
 typedef struct _TomoeRecognizerSimple TomoeRecognizerSimple;
+typedef struct _TomoeRecognizerSimpleClass TomoeRecognizerSimpleClass;
 
 struct _TomoeRecognizerSimple
 {
-    gint ref;
+    TomoeRecognizer object;
+};
+
+struct _TomoeRecognizerSimpleClass
+{
+    TomoeRecognizerClass parent_class;
 };
 
+static GType tomoe_type_recognizer_simple = 0;
+
+static GList *search (TomoeRecognizer *recognizer,
+                      TomoeDict       *dict,
+                      TomoeWriting    *input);
 
-gpointer
-TOMOE_RECOGNIZER_IMPL_NEW (void)
+static void
+class_init (TomoeRecognizerSimpleClass *klass)
 {
-    TomoeRecognizerSimple *recognizer;
-    recognizer = calloc (1, sizeof (TomoeRecognizerSimple));
-    if (!recognizer) return NULL;
+    TomoeRecognizerClass *recognizer_class;
 
-    recognizer->ref = 1;
-    return recognizer;
+    recognizer_class = TOMOE_RECOGNIZER_CLASS (klass);
+
+    recognizer_class->search = search;
+}
+
+static void
+init (TomoeRecognizerSimple *recognizer)
+{
+}
+
+static void
+register_type (GTypeModule *type_module)
+{
+    static const GTypeInfo info =
+        {
+            sizeof (TomoeRecognizerSimpleClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            NULL,           /* class_finalize */
+            NULL,           /* class_data */
+            sizeof (TomoeRecognizerSimple),
+            0,
+            (GInstanceInitFunc) init,
+        };
+
+    tomoe_type_recognizer_simple =
+        g_type_module_register_type (type_module,
+                                     TOMOE_TYPE_RECOGNIZER,
+                                     "TomoeRecognizerSimple",
+                                     &info, 0);
+}
+
+void
+TOMOE_RECOGNIZER_IMPL_INIT (GTypeModule *type_module)
+{
+    register_type (type_module);
 }
 
 void
-TOMOE_RECOGNIZER_IMPL_FREE (gpointer context)
+TOMOE_RECOGNIZER_IMPL_EXIT (void)
 {
-    TomoeRecognizerSimple *recognizer = context;
-    if (!recognizer) return;
-    free (recognizer);
+}
+
+TomoeRecognizer *
+TOMOE_RECOGNIZER_IMPL_INSTANTIATE (void)
+{
+    return g_object_new (TOMOE_TYPE_RECOGNIZER_SIMPLE, NULL);
 }
 
 GList *
-TOMOE_RECOGNIZER_IMPL_SEARCH (gpointer context, TomoeDict *dict,
-                              TomoeWriting *input)
+search (TomoeRecognizer *recognizer, TomoeDict *dict, TomoeWriting *input)
 {
-    return _tomoe_recognizer_simple_get_candidates (context, dict, input);
+    return _tomoe_recognizer_simple_get_candidates (recognizer, dict, input);
 }
+
 /*
 vi:ts=4:nowrap:ai:expandtab
 */


tomoe-cvs メーリングリストの案内
Back to archive index