diff cmd/kinput2.c @ 16:598fcbe482b5

imported patch 19_kinput2-v3.1-ruby.patch
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 08 Mar 2010 20:38:17 +0900
parents 92745d501b9a
children 7a454839a6de
line wrap: on
line diff
--- a/cmd/kinput2.c	Mon Mar 08 20:38:16 2010 +0900
+++ b/cmd/kinput2.c	Mon Mar 08 20:38:17 2010 +0900
@@ -38,7 +38,7 @@
 #include "XimpProto.h"
 #include "IMProto.h"
 
-#if !defined(USE_WNN) && !defined(USE_CANNA) && !defined(USE_SJ3) && !defined(USE_ATOK)
+#if !defined(USE_WNN) && !defined(USE_CANNA) && !defined(USE_SJ3) && !defined(USE_ATOK) && !defined(USE_RUBY)
 #define USE_WNN			/* default */
 #endif
 
@@ -58,6 +58,10 @@
 #include "Atok.h"
 #include "WcharDisp.h"
 #endif
+#ifdef USE_RUBY
+#include "Ruby.h"
+#include "WcharDisp.h"
+#endif
 
 #include "DebugPrint.h"
 
@@ -155,6 +159,12 @@
     {"-atokconf",    "*Atok.conf",      XrmoptionSepArg,    NULL},
     {"-atokstyle",   "*Atok.style",     XrmoptionSepArg,    NULL},
 #endif
+#ifdef USE_RUBY
+    {"-ruby",		".conversionEngine",	XrmoptionNoArg,		"ruby"},
+    {"-rubyserver",	"*Canna.cannahost",	XrmoptionSepArg,	NULL},
+    {"-rs",		"*Canna.cannahost",	XrmoptionSepArg,	NULL},
+    {"-rubyfile",	"*Canna.cannafile",	XrmoptionSepArg,	NULL},
+#endif
 };
 
 XtAppContext	apc;
@@ -392,6 +402,11 @@
 	return atokObjectClass;
     }
 #endif
+#ifdef USE_RUBY
+    if (!strcmp(appres.conversionEngine, "ruby")) {
+	return rubyObjectClass;
+    }
+#endif
 
     /* set default input object */
 #ifdef USE_ATOK
@@ -406,6 +421,9 @@
 #ifdef USE_WNN
     class = ccWnnObjectClass;
 #endif
+#ifdef USE_RUBY
+    class = rubyObjectClass;
+#endif
 
     return class;
 }
@@ -560,6 +578,11 @@
 	"-atokconf <file>",             "specify atok customize file",
 	"-atokstyle <file>",            "specify atok style file",
 #endif
+#ifdef USE_RUBY
+	"-ruby",		"use Canna (Iroha) as the conversion engine",
+	"{-rubyserver|-rs} <hostname>[:n]", "specify cannaserver host",
+	"-rubyfile <cannafile>", "specify canna customize file",
+#endif
 	"-bc",			"backward compatible mode",
 	"-font <font>",		"ASCII font to be used",
 	"-kanjifont <font>",	"KANJI font to be used",
@@ -623,6 +646,9 @@
 #ifdef USE_ATOK
     printf("[Atok] ");
 #endif
+#ifdef USE_RUBY
+    printf("[Ruby] ");
+#endif
 #ifdef DEBUG
     printf("[DEBUG] ");
 #endif