Skip to content

Instantly share code, notes, and snippets.

@tsutsui
Last active August 29, 2015 14:22
Show Gist options
  • Save tsutsui/1d4f9af3b4a53c906eb4 to your computer and use it in GitHub Desktop.
Save tsutsui/1d4f9af3b4a53c906eb4 to your computer and use it in GitHub Desktop.
A dumb patch for mlterm-3.5.0 wnn support to add more Romanized Japanese conversion including the Hepburn-type
$NetBSD$
- Add more Romanized Japanese conversion including the Hepburn-type
--- inputmethod/wnn/im_wnn.c.orig 2015-06-07 01:36:25.000000000 +0000
+++ inputmethod/wnn/im_wnn.c
@@ -408,11 +408,11 @@ insert_char(
{ 0xa4ab , 0xa4ad , 0xa4af , 0xa4b1 , 0xa4b3 } , /* c */
{ 0xa4c0 , 0xa4c2 , 0xa4c5 , 0xa4c7 , 0xa4c9 } , /* d */
{ 0xa4e3 , 0 , 0xa4e5 , 0 , 0xa4e7 } , /* xy */
- { 0 , 0 , 0 , 0 , 0 , } ,
+ { 0 , 0 , 0xa4d5 , 0 , 0 , } , /* f */
{ 0xa4ac , 0xa4ae , 0xa4b0 , 0xa4b2 , 0xa4b4 } , /* g */
{ 0xa4cf , 0xa4d2 , 0xa4d5 , 0xa4d8 , 0xa4db } , /* h */
- { 0 , 0 , 0 , 0 , 0 , } ,
- { 0 , 0 , 0 , 0 , 0 , } ,
+ { 0xa4e3 , 0 , 0xa4e5 , 0xa4a7 , 0xa4e7 } , /* ch/sh */
+ { 0 , 0xa4b8 , 0 , 0 , 0 , } , /* j */
{ 0xa4ab , 0xa4ad , 0xa4af , 0xa4b1 , 0xa4b3 } , /* k */
{ 0xa4a1 , 0xa4a3 , 0xa4a5 , 0xa4a7 , 0xa4a9 } , /* l */
{ 0xa4de , 0xa4df , 0xa4e0 , 0xa4e1 , 0xa4e2 } , /* m */
@@ -453,28 +453,74 @@ insert_char(
jcDeleteChar( wnn->convbuf , 1) ;
}
+ if( wnn->dan == 'i' - 'a' && key_char == 'i')
+ {
+ wnn->dan = 0 ;
+ return 0 ; /* shi/chi */
+ }
+
if( key_char == 'a')
{
+ if( wnn->dan == 'f' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4d5) ; /* hu */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'j' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4b8) ; /* zi */
+ wnn->dan = 'e' - 'a' ;
+ }
wch = kana_table[wnn->dan].a ;
wnn->dan = 0 ;
}
else if( key_char == 'i')
{
+ if( wnn->dan == 'f' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4d5) ; /* hu */
+ wnn->dan = 'x' - 'a' ;
+ }
wch = kana_table[wnn->dan].i ;
wnn->dan = 0 ;
}
else if( key_char == 'u')
{
+ if( wnn->dan == 'j' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4b8) ; /* zi */
+ wnn->dan = 'e' - 'a' ;
+ }
wch = kana_table[wnn->dan].u ;
wnn->dan = 0 ;
}
else if( key_char == 'e')
{
+ if( wnn->dan == 'f' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4d5) ; /* hu */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'j' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4b8) ; /* zi */
+ wnn->dan = 'x' - 'a' ;
+ }
wch = kana_table[wnn->dan].e ;
wnn->dan = 0 ;
}
else if( key_char == 'o')
{
+ if( wnn->dan == 'f' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4d5) ; /* hu */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'j' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4b8) ; /* zi */
+ wnn->dan = 'e' - 'a' ;
+ }
wch = kana_table[wnn->dan].o ;
wnn->dan = 0 ;
}
@@ -520,6 +566,56 @@ insert_char(
jcInsertChar( wnn->convbuf , 0xa4ae) ; /* gi */
wnn->dan = 'x' - 'a' ;
}
+ else if( wnn->dan == 's' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4b7) ; /* si */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'z' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4b8) ; /* zi */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 't' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4c1) ; /* ti */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'd' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4c2) ; /* di */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'n' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4cb) ; /* ni */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'h' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4d2) ; /* hi */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'b' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4d3) ; /* bi */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'p' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4d4) ; /* pi */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'm' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4df) ; /* mi */
+ wnn->dan = 'x' - 'a' ;
+ }
+ else if( wnn->dan == 'r' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4ea) ; /* ri */
+ wnn->dan = 'x' - 'a' ;
+ }
if( wnn->dan == 'x' - 'a')
{
@@ -546,6 +642,23 @@ insert_char(
goto normal ;
}
}
+ else if( key_char == 'h')
+ {
+ if( wnn->dan == 'c' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4c1) ; /* ti */
+ wnn->dan = 'i' - 'a' ;
+ }
+ else if( wnn->dan == 's' - 'a')
+ {
+ jcInsertChar( wnn->convbuf , 0xa4b7) ; /* si */
+ wnn->dan = 'i' - 'a' ;
+ }
+ else
+ {
+ goto normal ;
+ }
+ }
else
{
normal:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment