kakasi-2.3.6/0000755000175000017500000000000012311767006007771 500000000000000kakasi-2.3.6/install-sh0000755000175000017500000003325612311764400011721 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: kakasi-2.3.6/src/0000755000175000017500000000000012311767006010560 500000000000000kakasi-2.3.6/src/rdic-conv.c0000644000175000017500000000427110707302744012535 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: rdic-conv.c,v 1.3 2007-10-23 05:25:56 knok Exp $ * Copyright (C) 1992 1994 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include #include "conv-util.h" static void jis2ujis(buffer) unsigned char *buffer; { unsigned char *p, *q; int kanji=0; p = q = buffer; while(*p != '\0') { if (*p == '\033') { if ((p[1] == '$') && ((p[2] == '@') || (p[2] == 'B'))) { kanji = 1; p += 2; } else if ((p[1] == '(') && ((p[2] == 'B') || (p[2] == 'J'))) { kanji = 0; p += 2; } else { *(q ++) = *p; } } else { if (kanji) { *(q ++) = *(p ++) | 0x80; *(q ++) = *p | 0x80; } else { *(q ++) = *p; } } ++ p; } *q = '\0'; } static void extract(file_name) char *file_name; { FILE *fp; unsigned char buffer[1024]; unsigned char f1[1024], f2[1024], f3[1024]; if ((fp = fopen(file_name, "r")) == NULL) { perror(file_name); return; } while(fgets((char *)buffer, 1024, fp) != NULL) { if ((buffer[0] == '\0') || (buffer[0] == '#')) continue; jis2ujis(buffer); if (sscanf((const char *)buffer, "%s%s%s", f1, f2, f3) != 3) continue; if (isallkana(f2) == 0) continue; if (isallzenkaku(f3) == 0) continue; if (includekanji(f3) == 0) continue; printf("%s %s\n", f2, f3); } fclose(fp); } int main(argc, argv) int argc; char **argv; { int i; for(i = 1; i < argc; ++ i) { extract(argv[i]); } return 0; } kakasi-2.3.6/src/78_83.c0000644000175000017500000000405007230776623011424 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: 78_83.c,v 1.2 2001-01-16 07:51:47 rug Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include "kakasi.h" void exc78_83(c) Character *c; { int i; static unsigned char table78_83[22][2][3] = { {"\260\263", "\362\315"}, {"\262\251", "\362\364"}, {"\263\302", "\351\332"}, {"\263\311", "\331\370"}, {"\263\366", "\343\336"}, {"\264\303", "\336\365"}, {"\264\322", "\353\335"}, {"\267\333", "\360\364"}, {"\271\334", "\342\350"}, {"\274\311", "\351\242"}, {"\277\331", "\360\327"}, {"\301\250", "\354\315"}, {"\304\333", "\324\344"}, {"\305\327", "\342\352"}, {"\305\356", "\333\355"}, {"\305\363", "\336\271"}, {"\306\366", "\355\356"}, {"\307\350", "\352\244"}, {"\311\260", "\333\330"}, {"\313\371", "\320\326"}, {"\314\371", "\351\256"}, {"\317\266", "\344\306"}}; switch(c->type) { case JIS78: c->type = JIS83; break; case JIS83: c->type = JIS78; break; default: return; } for(i = 0; i < 22; ++ i) { if ((c->c1 == table78_83[i][0][0]) && (c->c2 == table78_83[i][0][1])) { c->c1 = table78_83[i][1][0]; c->c2 = table78_83[i][1][1]; return; } if ((c->c1 == table78_83[i][1][0]) && (c->c2 == table78_83[i][1][1])) { c->c1 = table78_83[i][0][0]; c->c2 = table78_83[i][0][1]; return; } } } kakasi-2.3.6/src/dict.c0000644000175000017500000002502412277072233011574 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: dict.c,v 1.13 2014-02-13 07:30:35 knok Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ /* Modified by NOKUBI Takatsugu 1999/03/04 Rename PERLMOD macro to LIBRARY 1999/01/11 Add PERLMOD macro. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #ifdef HAVE_STRING_H # include #else # include #endif #ifdef HAVE_MALLOC_H # include #endif #include #ifdef HAVE_STDINT_H # include #else typedef int uintptr_t; #endif #include "kakasi.h" #define BUFLEN 1024 #define IALLOCSIZE (1024*100) #define CELLALLOC 5000 #ifndef KANWADICT #define KANWADICT "./kanwadict" #endif /* variables for memory management */ void ** ary_charalloc = NULL; void ** ary_cellalloc = NULL; size_t ary_size_charalloc = -1; size_t ary_cur_charalloc = -1; size_t ary_size_cellalloc = -1; size_t ary_cur_cellalloc = -1; int point_charalloc = 0; unsigned char *ptr_charalloc = NULL; int point_cellalloc = 0; struct kanji_yomi *ptr_cellalloc = NULL; struct kanji_yomi *jisyo_table[0x80][0x80]; /* hash table */ int kanwa_load[0x80][0x80]; /* Is kanwadict put? */ struct kanwa_entry kanwa[0x60][0x60]; /* ujis onl 0xa0 is shift to code. */ static void add_ary_charalloc(ptr) void * ptr; { ary_cur_charalloc ++; if (ary_charalloc == NULL || ary_cur_charalloc > ary_size_charalloc) { ary_size_charalloc += CELLALLOC; ary_charalloc = realloc(ary_charalloc, sizeof(void *) * ary_size_charalloc +1); } ary_charalloc[ary_cur_charalloc] = ptr; } static void add_ary_cellalloc(ptr) void * ptr; { ary_cur_cellalloc ++; if (ary_cellalloc == NULL || ary_cur_cellalloc > ary_size_cellalloc) { ary_size_cellalloc += CELLALLOC; ary_cellalloc = realloc(ary_cellalloc, sizeof(void *) * ary_size_cellalloc +1); } ary_cellalloc[ary_cur_cellalloc] = ptr; } static unsigned char * charalloc(length) int length; { unsigned char *ret; if ((ptr_charalloc == NULL) || (point_charalloc+length >= IALLOCSIZE)) { ptr_charalloc = (unsigned char *)malloc(IALLOCSIZE); add_ary_charalloc(ptr_charalloc); point_charalloc = 0; } ret = ptr_charalloc+point_charalloc; point_charalloc += length; return ret; } static struct kanji_yomi * cellalloc() { if ((ptr_cellalloc == NULL) || (point_cellalloc >= CELLALLOC)) { char *cptr; cptr = malloc((CELLALLOC+1)*sizeof(struct kanji_yomi)); add_ary_cellalloc(cptr); if ((uintptr_t)cptr & 7) cptr += 8 - ((uintptr_t)cptr & 7); ptr_cellalloc = (struct kanji_yomi *) cptr; point_cellalloc = 0; } ++ point_cellalloc; return ptr_cellalloc ++; } void init_jisyo() { int c1, c2; for(c1 = 0; c1 < 0x80; c1 ++) for(c2 = 0; c2 < 0x80; c2 ++) jisyo_table[c1][c2] = NULL; } static void jis2ujis_jisyo(buffer) unsigned char *buffer; { unsigned char *p, *q; int kanji=0; p = q = buffer; while(*p != '\0') { if (*p == '\033') { if ((p[1] == '$') && ((p[2] == '@') || (p[2] == 'B'))) { kanji = 1; p += 2; } else if ((p[1] == '(') && ((p[2] == 'B') || (p[2] == 'J'))) { kanji = 0; p += 2; } else { *(q ++) = *p; } } else { if (kanji) { *(q ++) = *(p ++) | 0x80; *(q ++) = *p | 0x80; } else { *(q ++) = *p; } } ++ p; } *q = '\0'; } static void add_item(yomi, kanji, tail) unsigned char *yomi; unsigned char *kanji; int tail; { unsigned char *q, *ptr_kanji, *ptr_yomi; struct kanji_yomi *ptr_kanji_yomi, **ptr; int length, c1, c2; /* Is the head a kanji? */ if (kanji[0] < 0xb0) return; /* Isn't a HANKAKU character contained? Convert ITAIJI. */ for (q = kanji;; q += 2) { c1 = q[0]; c2 = q[1]; if ((c1 == '\0') || (c2 == '\0')) break; if ((c1 <= 0xa0) || (c2 <= 0xa0)) return; itaijiknj(&c1, &c2); q[0] = c1; q[1] = c2; } /* Isn't the one except for the KANA contained? A KATAKANA changes into the HIRAGANA. */ for (q = yomi; (q[0] != '\0') && (q[1] != '\0'); q += 2) { if (*q < 0xa1) return; if (*q == 0xa5) { *q = 0xa4; if (q[1] >= 0xf4 && q[1] <= 0xf6) /* skip when input is "vu", small "ka", small "ke" */ return; } if ((*q != 0xa4) && ((q[0] != 0xa1) || (q[1] != 0xbc)) && /* Prolonged sound */ ((q[0] != 0xa1) || (q[1] != 0xab)) && /* Sonant */ ((q[0] != 0xa1) || (q[1] != 0xac))) /* Half-sonant */ return; } /* A cell because of the reading is made. */ length = strlen((const char *)kanji); ptr_kanji = charalloc(length-1); strcpy((char *)ptr_kanji, (const char *)(kanji+2)); ptr_yomi = charalloc(strlen((const char *)yomi)+1); strcpy((char *)ptr_yomi, (const char *)yomi); ptr_kanji_yomi = cellalloc(); ptr_kanji_yomi->next = NULL; ptr_kanji_yomi->length = tail ? length+1 : length; ptr_kanji_yomi->kanji = ptr_kanji; ptr_kanji_yomi->yomi = ptr_yomi; ptr_kanji_yomi->tail = tail; /* It is connected in search of the end of the link of the internal dictionary. */ for (ptr = &(jisyo_table[kanji[0]-0x80][kanji[1]-0x80]); *ptr != NULL; ptr = &((*ptr)->next)); *ptr = ptr_kanji_yomi; } void add_jisyo(filename) char *filename; { FILE *jisyo_fp; unsigned char buffer[BUFLEN]; unsigned char *p; unsigned char *yomi, *kanji; int tail; extern char *ialloc(); if ((jisyo_fp = fopen(filename, "rb")) == NULL) { perror(filename); exit(0); } while(fgets((char *)buffer, BUFLEN, jisyo_fp)) { /* If there is the one except for the KANA at the head, to the next */ if ((buffer[0] < 0xa0) && (buffer[0] != '\033')) continue; /* A line is changed into ujis. */ jis2ujis_jisyo(buffer); yomi = buffer; /* The next ward is looked for. */ for (p = buffer; (*p != ' ') && (*p != '\011') && (*p != ','); ++ p) { if ((*p == '\0') || (*p == '\n')) goto next_line; } if (isalpha(p[-1])) { /* An OKURIGANA is given if the last character is an alphabet. */ tail = p[-1]; p[-1] = '\0'; } else { tail = 0; p[0] = '\0'; } /* The next ward is looked for. */ for (++ p; (*p == ' ') || (*p == '\011') || (*p == ','); ++ p) { if ((*p == '\0') || (*p == '\n')) goto next_line; } if (*p == '/') { /* It seems to be the dictionary of SKK. */ for (;;) { kanji = p+1; /* The next ward is looked for. */ for (++ p; (*p != '/'); ++ p) { if ((*p == '\0')||(*p == '\n')||(*p == '[')) goto next_line; } *p = '\0'; add_item(yomi, kanji, tail); } } else { /* It seems to be a standard dictionary. */ kanji = p; /* The next ward is looked for. */ for (++ p; (*p != ' ') && (*p != '\n') && (*p != '\011') && (*p != '\0') && (*p != ',') ; ++ p) { ; } *p = '\0'; add_item(yomi, kanji, tail); } next_line:; } fclose(jisyo_fp); } /* The initialization of kanwa is done. Reading kanwa_load is actually cleared in kanwa the part at the head. */ #ifdef LIBRARY FILE *kanwadict = NULL; unsigned short dict_endian_mark; #else static FILE *kanwadict; static unsigned short dict_endian_mark; #endif static void fix_dict_endian_int(int *v) { unsigned char *p; int i; if (dict_endian_mark == 0xFEFF) { /* native endian */ return; } i = 0; p = (unsigned char *)v; i = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0]; *v = i; } void init_kanwa() { int i, j; char *kanwadictpath; char magic[6]; int kanwa_offset; kanwadictpath = (char*)getenv("KANWADICTPATH"); if (kanwadictpath == (char*)NULL) kanwadictpath = (char*)getenv("KANWADICT"); if (kanwadictpath == (char*)NULL) kanwadictpath = KANWADICT; if ((kanwadict = fopen(kanwadictpath,"rb")) == NULL) { perror(kanwadictpath); exit(2); } fread(magic, 6, 1, kanwadict); if (memcmp(magic, "KAKASI", 6) == 0) { fread(&dict_endian_mark, 2, 1, kanwadict); fread(&kanwa_offset, sizeof(int), 1, kanwadict); fix_dict_endian_int(&kanwa_offset); /* XXX: ignore options */ fseek(kanwadict, kanwa_offset, SEEK_SET); } else { dict_endian_mark = 0; } if (fread((char *)kanwa, sizeof kanwa, 1, kanwadict) != 1) { perror(kanwadictpath); } if (dict_endian_mark) { for (i = 0x20; i < 0x7f; i++) { for (j = 0x20; j < 0x7f; j++) { fix_dict_endian_int(&kanwa[i-0x20][j-0x20].index); fix_dict_endian_int(&kanwa[i-0x20][j-0x20].entry); } } } for (i = 0; i < 0x80; ++ i) for (j = 0; j < 0x80; ++ j) kanwa_load[i][j] = 0; } /* An applicable part from kanwa if necessary is drawn. */ void add_kanwa(c1, c2) int c1; int c2; { unsigned char *ptr_yomi, *ptr_kanji; struct kanji_yomi *ptr_kanji_yomi, **ptr; int i; unsigned char tail, length; c1 &= 0x7f; c2 &= 0x7f; if (kanwa_load[c1][c2]) return; kanwa_load[c1][c2] = 1; /* It is finished when there is no description in the dictionary just in case. */ if (kanwa[c1-0x20][c2-0x20].entry == 0) return; /* It is moved to the fixed position of kanwadict. */ fseek(kanwadict, (long)(kanwa[c1-0x20][c2-0x20].index), 0L); /* The end of the link of the internal dictionary is looked for. */ for (ptr = &(jisyo_table[c1][c2]); *ptr != NULL; ptr = &((*ptr)->next)); for (i = 0; i < kanwa[c1-0x20][c2-0x20].entry; ++ i) { ptr_kanji_yomi = cellalloc(); fread(&tail, 1, 1, kanwadict); ptr_kanji_yomi->tail = tail; fread(&length, 1, 1, kanwadict); ptr_kanji = charalloc(length+1); fread(ptr_kanji, (int)length, 1, kanwadict); ptr_kanji[length] = '\0'; ptr_kanji_yomi->kanji = ptr_kanji; ptr_kanji_yomi->length = length + ((tail == 0) ? 2 : 3); fread(&length, 1, 1, kanwadict); ptr_yomi = charalloc(length+1); fread(ptr_yomi, (int)length, 1, kanwadict); ptr_yomi[length] = '\0'; ptr_kanji_yomi->yomi = ptr_yomi; ptr_kanji_yomi->next = NULL; *ptr = ptr_kanji_yomi; ptr = &(ptr_kanji_yomi->next); } } kakasi-2.3.6/src/atoc-conv.c0000644000175000017500000001074610707302744012546 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: atoc-conv.c,v 1.3 2007-10-23 05:25:56 knok Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include #include "conv-util.h" static void sjis2ujis(sjis, ujis) unsigned char *sjis; unsigned char *ujis; { unsigned char *p, *q; int c1, c2, o1, o2; static unsigned char k2H_table[64][3] = { "\241\241", "\241\243", "\241\326", "\241\327", "\241\242", "\241\245", "\244\362", "\244\241", "\244\243", "\244\245", "\244\247", "\244\251", "\244\343", "\244\345", "\244\347", "\244\303", "\241\274", "\244\242", "\244\244", "\244\246", "\244\250", "\244\252", "\244\253", "\244\255", "\244\257", "\244\261", "\244\263", "\244\265", "\244\267", "\244\271", "\244\273", "\244\275", "\244\277", "\244\301", "\244\304", "\244\306", "\244\310", "\244\312", "\244\313", "\244\314", "\244\315", "\244\316", "\244\317", "\244\322", "\244\325", "\244\330", "\244\333", "\244\336", "\244\337", "\244\340", "\244\341", "\244\342", "\244\344", "\244\346", "\244\350", "\244\351", "\244\352", "\244\353", "\244\354", "\244\355", "\244\357", "\244\363", "\241\253", "\241\254" }; static unsigned char k2H_dtable[64][3] = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\244\254", "\244\256", "\244\260", "\244\262", "\244\264", "\244\266", "\244\270", "\244\272", "\244\274", "\244\276", "\244\300", "\244\302", "\244\305", "\244\307", "\244\311", "", "", "", "", "", "\244\320", "\244\323", "\244\326", "\244\331", "\244\334", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; static unsigned char k2H_htable[64][3] = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" , "", "", "", "", "", "", "", "", "", "", "", "\244\321", "\244\324", "\244\327", "\244\332", "\244\335", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; p = sjis; q = ujis; while((c1 = *p) != '\0') { if (c1 == ',') { *(q ++) = ' '; } else if (c1 < 0x80) { *(q ++) = c1; } else if ((0xa0 <= c1) && (c1 < 0xe0)) { c2 = p[1]; if ((c2==0xde) && (k2H_dtable[c1-0xa0][0] != '\0')) { *(q ++) = k2H_dtable[c1-0xa0][0]; *(q ++) = k2H_dtable[c1-0xa0][1]; ++ p; } else if ((c2==0xdf) && (k2H_htable[c1-0xa0][0] != '\0')) { *(q ++) = k2H_htable[c1-0xa0][0]; *(q ++) = k2H_htable[c1-0xa0][1]; ++ p; } else { *(q ++) = k2H_table[c1-0xa0][0]; *(q ++) = k2H_table[c1-0xa0][1]; } } else { c2 = p[1]; if (c2 >= 0x9f) { if (c1 >= 0xe0) o1 = c1*2 - 0xe0; else o1 = c1*2 - 0x60; o2 = c2 + 2; } else { if (c1 >= 0xe0) o1 = c1*2 - 0xe1; else o1 = c1*2 - 0x61; if (c2 >= 0x7f) o2 = c2 + 0x60; else o2 = c2 + 0x61; } *(q ++) = o1; *(q ++) = o2; ++ p; } ++ p; } *q = '\0'; } static void extract(file_name) char *file_name; { FILE *fp; unsigned char sjis[1024], ujis[1024]; unsigned char f1[1024], f2[1024]; if ((fp = fopen(file_name, "r")) == NULL) { perror(file_name); return; } while(fgets((char *)sjis, 1024, fp) != NULL) { if ((sjis[0] == '\0') || (sjis[0] == '#')) continue; sjis2ujis((const char *)sjis, ujis); if (sscanf((const char *)ujis, "%s%s", f1, f2) != 2) continue; if (isallkana(f1) == 0) continue; if (isallzenkaku(f2) == 0) continue; if (includekanji(f2) == 0) continue; printf("%s %s\n", f1, f2); } fclose(fp); } int main(argc, argv) int argc; char **argv; { int i; for(i = 1; i < argc; ++ i) { extract(argv[i]); } return 0; } kakasi-2.3.6/src/itaiji.c0000644000175000017500000000435610575173171012131 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: itaiji.c,v 1.3 2007-03-12 06:43:05 knok Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include #include #include "kakasi.h" #define BUFSIZE 128 #ifndef ITAIJIDICT #define ITAIJIDICT "./itaijidict" #endif /* The change table of ITAIJI is made. */ static unsigned char ittbl1[0x80][0x80], ittbl2[0x80][0x80]; static int itaijitbl_made=0; void mkitaijitbl() { FILE *fp; int i, j; char buffer[BUFSIZE]; unsigned char n1, n2, o1, o2; char *itaijidictpath; itaijidictpath = (char*)getenv("ITAIJIDICTPATH"); if (itaijidictpath == (char*)NULL) itaijidictpath = (char*)getenv("ITAIJIDICT"); if (itaijidictpath == (char*)NULL) itaijidictpath = ITAIJIDICT; if ((fp = fopen(itaijidictpath, "rb")) == NULL) { fprintf(stderr, "Can't open Kanji itaijidict file "); perror(itaijidictpath); exit(0); } for (i = 0; i < 0x80; ++ i) { for (j = 0; j < 0x80; ++ j) { ittbl1[i][j] = i | 0x80; ittbl2[i][j] = j | 0x80; } } while(fgets(buffer, BUFSIZE, fp) != NULL) { n1 = buffer[0]; n2 = buffer[1]; o1 = buffer[2]; o2 = buffer[3]; n1 &= 0x7f; n2 &= 0x7f; ittbl1[n1][n2] = o1; ittbl2[n1][n2] = o2; } fclose(fp); } /* The change of ITAIJI */ void itaijiknj(c1, c2) int *c1; int *c2; { int b1, b2; if (itaijitbl_made == 0) { mkitaijitbl(); itaijitbl_made =1; } b1 = *c1 & 0x7f; b2 = *c2 & 0x7f; *c1 = ittbl1[b1][b2]; *c2 = ittbl2[b1][b2]; } kakasi-2.3.6/src/mkkanwa.c0000644000175000017500000000704010441221776012277 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: mkkanwa.c,v 1.6 2006-06-06 06:43:10 knok Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # include #endif #include #include "getopt.h" #include "kakasi.h" /* new dictionary format flag */ int new_format = 1; static void usage(argv) char **argv; { (void)fprintf(stderr, "usage: %s kanwadict dict1 [dict2,,,]\n", argv[0]); exit (2); } static void make_kanwa_dict(kdict) FILE *kdict; { unsigned char length; int i, j, count; struct kanji_yomi *ptr; char magic[] = "KAKASI"; unsigned short emark = 0xFEFF; /* endian mark */ int kanwa_offset_offset = 0; int kanwa_offset = 0; int opt_type, opt_length; if (new_format) { /* new dict format support 2003/03/11 ukai * see kakasi.h */ fwrite(magic, 6, 1, kdict); fwrite(&emark, 2, 1, kdict); kanwa_offset_offset = ftell(kdict); fwrite(&kanwa_offset, sizeof(int), 1, kdict); opt_type = 0; opt_length = 0; fwrite(&opt_type, sizeof(int), 1, kdict); fwrite(&opt_length, sizeof(int), 1, kdict); kanwa_offset = ftell(kdict); fseek(kdict, kanwa_offset_offset, SEEK_SET); fwrite(&kanwa_offset, sizeof(int), 1, kdict); fseek(kdict, kanwa_offset + sizeof kanwa, SEEK_SET); } for (i = 0x20; i < 0x7f; ++ i) for (j = 0x20; j < 0x7f; ++ j) { kanwa[i-0x20][j-0x20].index = ftell(kdict); count = 0; for (ptr = jisyo_table[i][j]; ptr != NULL; ptr = ptr->next) { fwrite(&(ptr->tail), 1, 1, kdict); length = ptr->length - ((ptr->tail == 0) ? 2 : 3); fwrite(&length, 1, 1, kdict); fwrite(ptr->kanji, (int)length, 1, kdict); length = strlen((const char*)ptr->yomi); fwrite(&length, 1, 1, kdict); fwrite(ptr->yomi, (int)length, 1, kdict); ++count; } kanwa[i-0x20][j-0x20].entry = count; } if (new_format) fseek(kdict, kanwa_offset, SEEK_SET); else fseek(kdict, 0, 0L); fwrite((char *)kanwa, sizeof kanwa, 1, kdict); } int main(argc, argv) int argc; char **argv; { FILE *kdict; static char options[]="ho"; int c; extern int optind; /* An optional extraction. = It must not be this version. */ while ((c = getopt(argc, argv, options)) != -1) { switch (c) { case 'o': new_format = 0; break; case 'h': default: usage(argv); } } if (optind >= argc) usage(argv); if ((kdict = fopen(argv[optind],"wb")) == NULL) { perror(argv[optind]); exit(2); } /* The preparation of the change table of ITAIJI. */ mkitaijitbl(); /* Reading of the dictionary. */ init_jisyo(); for (optind ++ ; optind < argc; optind++) add_jisyo(argv[optind]); make_kanwa_dict(kdict); fclose(kdict); return 0; } kakasi-2.3.6/src/conv-util.c0000644000175000017500000000265107230776623012601 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: conv-util.c,v 1.2 2001-01-16 07:51:47 rug Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include #include "conv-util.h" int isallkana(str) unsigned char *str; { while(*str) { if (str[0] <= 0xa0) return 0; if (str[1] <= 0xa0) return 0; if ((str[0] != 0xa4) && (str[0] != 0xa5)) return 0; str += 2; } return 1; } int isallzenkaku(str) unsigned char *str; { while(*str) { if (str[0] <= 0xa0) return 0; if (str[1] <= 0xa0) return 0; str += 2; } return 1; } int includekanji(str) unsigned char *str; { while(*str) { if (str[0] >= 0xb0) return 1; str += 2; } return 0; } kakasi-2.3.6/src/hh2.c0000644000175000017500000010212712277071135011332 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: hh2.c,v 1.16 2014-02-07 07:36:54 knok Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # include #endif #include "kakasi.h" struct H2rom_tbl { unsigned char kana[10]; char romaji[7]; } H2rom_h_table_old[] = { {"\244\241", "a"}, {"\244\242", "a"}, {"\244\243", "i"}, {"\244\244", "i"}, {"\244\245", "u"}, {"\244\246", "u"}, {"\244\246\241\253", "vu"}, {"\244\246\241\253\244\241", "va"}, {"\244\246\241\253\244\243", "vi"}, {"\244\246\241\253\244\247", "ve"}, {"\244\246\241\253\244\251", "vo"}, {"\244\247", "e"}, {"\244\250", "e"}, {"\244\251", "o"}, {"\244\252", "o"}, {"\244\253", "ka"}, {"\244\254", "ga"}, {"\244\255", "ki"}, {"\244\255\244\343", "kya"}, {"\244\255\244\345", "kyu"}, {"\244\255\244\347", "kyo"}, {"\244\256", "gi"}, {"\244\256\244\343", "gya"}, {"\244\256\244\345", "gyu"}, {"\244\256\244\347", "gyo"}, {"\244\257", "ku"}, {"\244\260", "gu"}, {"\244\261", "ke"}, {"\244\262", "ge"}, {"\244\263", "ko"}, {"\244\264", "go"}, {"\244\265", "sa"}, {"\244\266", "za"}, {"\244\267", "shi"}, {"\244\267\244\343", "sha"}, {"\244\267\244\345", "shu"}, {"\244\267\244\347", "sho"}, {"\244\270", "ji"}, {"\244\270\244\343", "ja"}, {"\244\270\244\345", "ju"}, {"\244\270\244\347", "jo"}, {"\244\271", "su"}, {"\244\272", "zu"}, {"\244\273", "se"}, {"\244\274", "ze"}, {"\244\275", "so"}, {"\244\276", "zo"}, {"\244\277", "ta"}, {"\244\300", "da"}, {"\244\301", "chi"}, {"\244\301\244\343", "cha"}, {"\244\301\244\345", "chu"}, {"\244\301\244\347", "cho"}, {"\244\302", "di"}, {"\244\302\244\343", "dya"}, {"\244\302\244\345", "dyu"}, {"\244\302\244\347", "dyo"}, {"\244\303", "tsu"}, {"\244\303\244\246\241\253", "vvu"}, {"\244\303\244\246\241\253\244\241", "vva"}, {"\244\303\244\246\241\253\244\243", "vvi"}, {"\244\303\244\246\241\253\244\247", "vve"}, {"\244\303\244\246\241\253\244\251", "vvo"}, {"\244\303\244\253", "kka"}, {"\244\303\244\254", "gga"}, {"\244\303\244\255", "kki"}, {"\244\303\244\255\244\343", "kkya"}, {"\244\303\244\255\244\345", "kkyu"}, {"\244\303\244\255\244\347", "kkyo"}, {"\244\303\244\256", "ggi"}, {"\244\303\244\256\244\343", "ggya"}, {"\244\303\244\256\244\345", "ggyu"}, {"\244\303\244\256\244\347", "ggyo"}, {"\244\303\244\257", "kku"}, {"\244\303\244\260", "ggu"}, {"\244\303\244\261", "kke"}, {"\244\303\244\262", "gge"}, {"\244\303\244\263", "kko"}, {"\244\303\244\264", "ggo"}, {"\244\303\244\265", "ssa"}, {"\244\303\244\266", "zza"}, {"\244\303\244\267", "sshi"}, {"\244\303\244\267\244\343", "ssha"}, {"\244\303\244\267\244\345", "sshu"}, {"\244\303\244\267\244\347", "ssho"}, {"\244\303\244\270", "jji"}, {"\244\303\244\270\244\343", "jja"}, {"\244\303\244\270\244\345", "jju"}, {"\244\303\244\270\244\347", "jjo"}, {"\244\303\244\271", "ssu"}, {"\244\303\244\272", "zzu"}, {"\244\303\244\273", "sse"}, {"\244\303\244\274", "zze"}, {"\244\303\244\275", "sso"}, {"\244\303\244\276", "zzo"}, {"\244\303\244\277", "tta"}, {"\244\303\244\300", "dda"}, {"\244\303\244\301", "cchi"}, {"\244\303\244\301\244\343", "ccha"}, {"\244\303\244\301\244\345", "cchu"}, {"\244\303\244\301\244\347", "ccho"}, {"\244\303\244\302", "ddi"}, {"\244\303\244\302\244\343", "ddya"}, {"\244\303\244\302\244\345", "ddyu"}, {"\244\303\244\302\244\347", "ddyo"}, {"\244\303\244\304", "ttsu"}, {"\244\303\244\305", "ddu"}, {"\244\303\244\306", "tte"}, {"\244\303\244\307", "dde"}, {"\244\303\244\310", "tto"}, {"\244\303\244\311", "ddo"}, {"\244\303\244\317", "hha"}, {"\244\303\244\320", "bba"}, {"\244\303\244\321", "ppa"}, {"\244\303\244\322", "hhi"}, {"\244\303\244\322\244\343", "hhya"}, {"\244\303\244\322\244\345", "hhyu"}, {"\244\303\244\322\244\347", "hhyo"}, {"\244\303\244\323", "bbi"}, {"\244\303\244\323\244\343", "bbya"}, {"\244\303\244\323\244\345", "bbyu"}, {"\244\303\244\323\244\347", "bbyo"}, {"\244\303\244\324", "ppi"}, {"\244\303\244\324\244\343", "ppya"}, {"\244\303\244\324\244\345", "ppyu"}, {"\244\303\244\324\244\347", "ppyo"}, {"\244\303\244\325", "ffu"}, {"\244\303\244\325\244\241", "ffa"}, {"\244\303\244\325\244\243", "ffi"}, {"\244\303\244\325\244\247", "ffe"}, {"\244\303\244\325\244\251", "ffo"}, {"\244\303\244\326", "bbu"}, {"\244\303\244\327", "ppu"}, {"\244\303\244\330", "hhe"}, {"\244\303\244\331", "bbe"}, {"\244\303\244\332", "ppe"}, {"\244\303\244\333", "hho"}, {"\244\303\244\334", "bbo"}, {"\244\303\244\335", "ppo"}, {"\244\303\244\344", "yya"}, {"\244\303\244\346", "yyu"}, {"\244\303\244\350", "yyo"}, {"\244\303\244\351", "rra"}, {"\244\303\244\352", "rri"}, {"\244\303\244\352\244\343", "rrya"}, {"\244\303\244\352\244\345", "rryu"}, {"\244\303\244\352\244\347", "rryo"}, {"\244\303\244\353", "rru"}, {"\244\303\244\354", "rre"}, {"\244\303\244\355", "rro"}, {"\244\304", "tsu"}, {"\244\305", "du"}, {"\244\306", "te"}, {"\244\307", "de"}, {"\244\310", "to"}, {"\244\311", "do"}, {"\244\312", "na"}, {"\244\313", "ni"}, {"\244\313\244\343", "nya"}, {"\244\313\244\345", "nyu"}, {"\244\313\244\347", "nyo"}, {"\244\314", "nu"}, {"\244\315", "ne"}, {"\244\316", "no"}, {"\244\317", "ha"}, {"\244\320", "ba"}, {"\244\321", "pa"}, {"\244\322", "hi"}, {"\244\322\244\343", "hya"}, {"\244\322\244\345", "hyu"}, {"\244\322\244\347", "hyo"}, {"\244\323", "bi"}, {"\244\323\244\343", "bya"}, {"\244\323\244\345", "byu"}, {"\244\323\244\347", "byo"}, {"\244\324", "pi"}, {"\244\324\244\343", "pya"}, {"\244\324\244\345", "pyu"}, {"\244\324\244\347", "pyo"}, {"\244\325", "fu"}, {"\244\325\244\241", "fa"}, {"\244\325\244\243", "fi"}, {"\244\325\244\247", "fe"}, {"\244\325\244\251", "fo"}, {"\244\326", "bu"}, {"\244\327", "pu"}, {"\244\330", "he"}, {"\244\331", "be"}, {"\244\332", "pe"}, {"\244\333", "ho"}, {"\244\334", "bo"}, {"\244\335", "po"}, {"\244\336", "ma"}, {"\244\337", "mi"}, {"\244\337\244\343", "mya"}, {"\244\337\244\345", "myu"}, {"\244\337\244\347", "myo"}, {"\244\340", "mu"}, {"\244\341", "me"}, {"\244\342", "mo"}, {"\244\343", "ya"}, {"\244\344", "ya"}, {"\244\345", "yu"}, {"\244\346", "yu"}, {"\244\347", "yo"}, {"\244\350", "yo"}, {"\244\351", "ra"}, {"\244\352", "ri"}, {"\244\352\244\343", "rya"}, {"\244\352\244\345", "ryu"}, {"\244\352\244\347", "ryo"}, {"\244\353", "ru"}, {"\244\354", "re"}, {"\244\355", "ro"}, {"\244\356", "wa"}, {"\244\357", "wa"}, {"\244\360", "i"}, {"\244\361", "e"}, {"\244\362", "wo"}, {"\244\363", "n"}, {"\244\363\244\242", "n'a"}, {"\244\363\244\244", "n'i"}, {"\244\363\244\246", "n'u"}, {"\244\363\244\250", "n'e"}, {"\244\363\244\252", "n'o"}, {"", ""}, }, H2rom_h_table[] = { {"\244\241", "a"}, {"\244\242", "a"}, {"\244\243", "i"}, {"\244\244", "i"}, {"\244\245", "u"}, {"\244\246", "u"}, {"\244\246\241\253", "vu"}, {"\244\246\241\253\244\241", "va"}, {"\244\246\241\253\244\243", "vi"}, {"\244\246\241\253\244\247", "ve"}, {"\244\246\241\253\244\251", "vo"}, {"\244\247", "e"}, {"\244\250", "e"}, {"\244\251", "o"}, {"\244\252", "o"}, {"\244\253", "ka"}, {"\244\254", "ga"}, {"\244\255", "ki"}, {"\244\255\244\343", "kya"}, {"\244\255\244\345", "kyu"}, {"\244\255\244\347", "kyo"}, {"\244\256", "gi"}, {"\244\256\244\343", "gya"}, {"\244\256\244\345", "gyu"}, {"\244\256\244\347", "gyo"}, {"\244\257", "ku"}, {"\244\260", "gu"}, {"\244\261", "ke"}, {"\244\262", "ge"}, {"\244\263", "ko"}, {"\244\264", "go"}, {"\244\265", "sa"}, {"\244\266", "za"}, {"\244\267", "shi"}, {"\244\267\244\343", "sha"}, {"\244\267\244\345", "shu"}, {"\244\267\244\347", "sho"}, {"\244\270", "ji"}, {"\244\270\244\343", "ja"}, {"\244\270\244\345", "ju"}, {"\244\270\244\347", "jo"}, {"\244\271", "su"}, {"\244\272", "zu"}, {"\244\273", "se"}, {"\244\274", "ze"}, {"\244\275", "so"}, {"\244\276", "zo"}, {"\244\277", "ta"}, {"\244\300", "da"}, {"\244\301", "chi"}, {"\244\301\244\247", "che"}, {"\244\301\244\343", "cha"}, {"\244\301\244\345", "chu"}, {"\244\301\244\347", "cho"}, {"\244\302", "ji"}, {"\244\302\244\343", "ja"}, {"\244\302\244\345", "ju"}, {"\244\302\244\347", "jo"}, {"\244\303", "tsu"}, {"\244\303\244\246\241\253", "vvu"}, {"\244\303\244\246\241\253\244\241", "vva"}, {"\244\303\244\246\241\253\244\243", "vvi"}, {"\244\303\244\246\241\253\244\247", "vve"}, {"\244\303\244\246\241\253\244\251", "vvo"}, {"\244\303\244\253", "kka"}, {"\244\303\244\254", "gga"}, {"\244\303\244\255", "kki"}, {"\244\303\244\255\244\343", "kkya"}, {"\244\303\244\255\244\345", "kkyu"}, {"\244\303\244\255\244\347", "kkyo"}, {"\244\303\244\256", "ggi"}, {"\244\303\244\256\244\343", "ggya"}, {"\244\303\244\256\244\345", "ggyu"}, {"\244\303\244\256\244\347", "ggyo"}, {"\244\303\244\257", "kku"}, {"\244\303\244\260", "ggu"}, {"\244\303\244\261", "kke"}, {"\244\303\244\262", "gge"}, {"\244\303\244\263", "kko"}, {"\244\303\244\264", "ggo"}, {"\244\303\244\265", "ssa"}, {"\244\303\244\266", "zza"}, {"\244\303\244\267", "sshi"}, {"\244\303\244\267\244\343", "ssha"}, {"\244\303\244\267\244\345", "sshu"}, {"\244\303\244\267\244\347", "ssho"}, {"\244\303\244\270", "jji"}, {"\244\303\244\270\244\343", "jja"}, {"\244\303\244\270\244\345", "jju"}, {"\244\303\244\270\244\347", "jjo"}, {"\244\303\244\271", "ssu"}, {"\244\303\244\272", "zzu"}, {"\244\303\244\273", "sse"}, {"\244\303\244\274", "zze"}, {"\244\303\244\275", "sso"}, {"\244\303\244\276", "zzo"}, {"\244\303\244\277", "tta"}, {"\244\303\244\300", "dda"}, {"\244\303\244\301", "tchi"}, {"\244\303\244\301\244\343", "tcha"}, {"\244\303\244\301\244\345", "tchu"}, {"\244\303\244\301\244\347", "tcho"}, {"\244\303\244\302", "jji"}, {"\244\303\244\302\244\343", "jjya"}, {"\244\303\244\302\244\345", "jjyu"}, {"\244\303\244\302\244\347", "jjyo"}, {"\244\303\244\304", "ttsu"}, {"\244\303\244\305", "zzu"}, {"\244\303\244\306", "tte"}, {"\244\303\244\307", "dde"}, {"\244\303\244\310", "tto"}, {"\244\303\244\311", "ddo"}, {"\244\303\244\317", "hha"}, {"\244\303\244\320", "bba"}, {"\244\303\244\321", "ppa"}, {"\244\303\244\322", "hhi"}, {"\244\303\244\322\244\343", "hhya"}, {"\244\303\244\322\244\345", "hhyu"}, {"\244\303\244\322\244\347", "hhyo"}, {"\244\303\244\323", "bbi"}, {"\244\303\244\323\244\343", "bbya"}, {"\244\303\244\323\244\345", "bbyu"}, {"\244\303\244\323\244\347", "bbyo"}, {"\244\303\244\324", "ppi"}, {"\244\303\244\324\244\343", "ppya"}, {"\244\303\244\324\244\345", "ppyu"}, {"\244\303\244\324\244\347", "ppyo"}, {"\244\303\244\325", "ffu"}, {"\244\303\244\325\244\241", "ffa"}, {"\244\303\244\325\244\243", "ffi"}, {"\244\303\244\325\244\247", "ffe"}, {"\244\303\244\325\244\251", "ffo"}, {"\244\303\244\326", "bbu"}, {"\244\303\244\327", "ppu"}, {"\244\303\244\330", "hhe"}, {"\244\303\244\331", "bbe"}, {"\244\303\244\332", "ppe"}, {"\244\303\244\333", "hho"}, {"\244\303\244\334", "bbo"}, {"\244\303\244\335", "ppo"}, {"\244\303\244\344", "yya"}, {"\244\303\244\346", "yyu"}, {"\244\303\244\350", "yyo"}, {"\244\303\244\351", "rra"}, {"\244\303\244\352", "rri"}, {"\244\303\244\352\244\343", "rrya"}, {"\244\303\244\352\244\345", "rryu"}, {"\244\303\244\352\244\347", "rryo"}, {"\244\303\244\353", "rru"}, {"\244\303\244\354", "rre"}, {"\244\303\244\355", "rro"}, {"\244\304", "tsu"}, {"\244\305", "zu"}, {"\244\306", "te"}, {"\244\307", "de"}, {"\244\307\244\243", "di"}, {"\244\310", "to"}, {"\244\311", "do"}, {"\244\312", "na"}, {"\244\313", "ni"}, {"\244\313\244\343", "nya"}, {"\244\313\244\345", "nyu"}, {"\244\313\244\347", "nyo"}, {"\244\314", "nu"}, {"\244\315", "ne"}, {"\244\316", "no"}, {"\244\317", "ha"}, {"\244\320", "ba"}, {"\244\321", "pa"}, {"\244\322", "hi"}, {"\244\322\244\343", "hya"}, {"\244\322\244\345", "hyu"}, {"\244\322\244\347", "hyo"}, {"\244\323", "bi"}, {"\244\323\244\343", "bya"}, {"\244\323\244\345", "byu"}, {"\244\323\244\347", "byo"}, {"\244\324", "pi"}, {"\244\324\244\343", "pya"}, {"\244\324\244\345", "pyu"}, {"\244\324\244\347", "pyo"}, {"\244\325", "fu"}, {"\244\325\244\241", "fa"}, {"\244\325\244\243", "fi"}, {"\244\325\244\247", "fe"}, {"\244\325\244\251", "fo"}, {"\244\326", "bu"}, {"\244\327", "pu"}, {"\244\330", "he"}, {"\244\331", "be"}, {"\244\332", "pe"}, {"\244\333", "ho"}, {"\244\334", "bo"}, {"\244\335", "po"}, {"\244\336", "ma"}, {"\244\337", "mi"}, {"\244\337\244\343", "mya"}, {"\244\337\244\345", "myu"}, {"\244\337\244\347", "myo"}, {"\244\340", "mu"}, {"\244\341", "me"}, {"\244\342", "mo"}, {"\244\343", "ya"}, {"\244\344", "ya"}, {"\244\345", "yu"}, {"\244\346", "yu"}, {"\244\347", "yo"}, {"\244\350", "yo"}, {"\244\351", "ra"}, {"\244\352", "ri"}, {"\244\352\244\343", "rya"}, {"\244\352\244\345", "ryu"}, {"\244\352\244\347", "ryo"}, {"\244\353", "ru"}, {"\244\354", "re"}, {"\244\355", "ro"}, {"\244\356", "wa"}, {"\244\357", "wa"}, {"\244\360", "i"}, {"\244\361", "e"}, {"\244\362", "wo"}, {"\244\363", "n"}, {"\244\363\244\242", "n'a"}, {"\244\363\244\244", "n'i"}, {"\244\363\244\246", "n'u"}, {"\244\363\244\250", "n'e"}, {"\244\363\244\252", "n'o"}, {"", ""}, }, H2rom_k_table_old[] = { {"\244\241", "a"}, {"\244\242", "a"}, {"\244\243", "i"}, {"\244\244", "i"}, {"\244\245", "u"}, {"\244\246", "u"}, {"\244\246\241\253", "vu"}, {"\244\246\241\253\244\241", "va"}, {"\244\246\241\253\244\243", "vi"}, {"\244\246\241\253\244\247", "ve"}, {"\244\246\241\253\244\251", "vo"}, {"\244\247", "e"}, {"\244\250", "e"}, {"\244\251", "o"}, {"\244\252", "o"}, {"\244\253", "ka"}, {"\244\254", "ga"}, {"\244\255", "ki"}, {"\244\255\244\343", "kya"}, {"\244\255\244\345", "kyu"}, {"\244\255\244\347", "kyo"}, {"\244\256", "gi"}, {"\244\256\244\343", "gya"}, {"\244\256\244\345", "gyu"}, {"\244\256\244\347", "gyo"}, {"\244\257", "ku"}, {"\244\260", "gu"}, {"\244\261", "ke"}, {"\244\262", "ge"}, {"\244\263", "ko"}, {"\244\264", "go"}, {"\244\265", "sa"}, {"\244\266", "za"}, {"\244\267", "si"}, {"\244\267\244\343", "sya"}, {"\244\267\244\345", "syu"}, {"\244\267\244\347", "syo"}, {"\244\270", "zi"}, {"\244\270\244\343", "zya"}, {"\244\270\244\345", "zyu"}, {"\244\270\244\347", "zyo"}, {"\244\271", "su"}, {"\244\272", "zu"}, {"\244\273", "se"}, {"\244\274", "ze"}, {"\244\275", "so"}, {"\244\276", "zo"}, {"\244\277", "ta"}, {"\244\300", "da"}, {"\244\301", "ti"}, {"\244\301\244\343", "tya"}, {"\244\301\244\345", "tyu"}, {"\244\301\244\347", "tyo"}, {"\244\302", "di"}, {"\244\302\244\343", "dya"}, {"\244\302\244\345", "dyu"}, {"\244\302\244\347", "dyo"}, {"\244\303", "tu"}, {"\244\303\244\246\241\253", "vvu"}, {"\244\303\244\246\241\253\244\241", "vva"}, {"\244\303\244\246\241\253\244\243", "vvi"}, {"\244\303\244\246\241\253\244\247", "vve"}, {"\244\303\244\246\241\253\244\251", "vvo"}, {"\244\303\244\253", "kka"}, {"\244\303\244\254", "gga"}, {"\244\303\244\255", "kki"}, {"\244\303\244\255\244\343", "kkya"}, {"\244\303\244\255\244\345", "kkyu"}, {"\244\303\244\255\244\347", "kkyo"}, {"\244\303\244\256", "ggi"}, {"\244\303\244\256\244\343", "ggya"}, {"\244\303\244\256\244\345", "ggyu"}, {"\244\303\244\256\244\347", "ggyo"}, {"\244\303\244\257", "kku"}, {"\244\303\244\260", "ggu"}, {"\244\303\244\261", "kke"}, {"\244\303\244\262", "gge"}, {"\244\303\244\263", "kko"}, {"\244\303\244\264", "ggo"}, {"\244\303\244\265", "ssa"}, {"\244\303\244\266", "zza"}, {"\244\303\244\267", "ssi"}, {"\244\303\244\267\244\343", "ssya"}, {"\244\303\244\267\244\345", "ssyu"}, {"\244\303\244\267\244\347", "ssho"}, {"\244\303\244\270", "zzi"}, {"\244\303\244\270\244\343", "zzya"}, {"\244\303\244\270\244\345", "zzyu"}, {"\244\303\244\270\244\347", "zzyo"}, {"\244\303\244\271", "ssu"}, {"\244\303\244\272", "zzu"}, {"\244\303\244\273", "sse"}, {"\244\303\244\274", "zze"}, {"\244\303\244\275", "sso"}, {"\244\303\244\276", "zzo"}, {"\244\303\244\277", "tta"}, {"\244\303\244\300", "dda"}, {"\244\303\244\301", "tti"}, {"\244\303\244\301\244\343", "ttya"}, {"\244\303\244\301\244\345", "ttyu"}, {"\244\303\244\301\244\347", "ttyo"}, {"\244\303\244\302", "ddi"}, {"\244\303\244\302\244\343", "ddya"}, {"\244\303\244\302\244\345", "ddyu"}, {"\244\303\244\302\244\347", "ddyo"}, {"\244\303\244\304", "ttu"}, {"\244\303\244\305", "ddu"}, {"\244\303\244\306", "tte"}, {"\244\303\244\307", "dde"}, {"\244\303\244\310", "tto"}, {"\244\303\244\311", "ddo"}, {"\244\303\244\317", "hha"}, {"\244\303\244\320", "bba"}, {"\244\303\244\321", "ppa"}, {"\244\303\244\322", "hhi"}, {"\244\303\244\322\244\343", "hhya"}, {"\244\303\244\322\244\345", "hhyu"}, {"\244\303\244\322\244\347", "hhyo"}, {"\244\303\244\323", "bbi"}, {"\244\303\244\323\244\343", "bbya"}, {"\244\303\244\323\244\345", "bbyu"}, {"\244\303\244\323\244\347", "bbyo"}, {"\244\303\244\324", "ppi"}, {"\244\303\244\324\244\343", "ppya"}, {"\244\303\244\324\244\345", "ppyu"}, {"\244\303\244\324\244\347", "ppyo"}, {"\244\303\244\325", "hhu"}, {"\244\303\244\325\244\241", "ffa"}, {"\244\303\244\325\244\243", "ffi"}, {"\244\303\244\325\244\247", "ffe"}, {"\244\303\244\325\244\251", "ffo"}, {"\244\303\244\326", "bbu"}, {"\244\303\244\327", "ppu"}, {"\244\303\244\330", "hhe"}, {"\244\303\244\331", "bbe"}, {"\244\303\244\332", "ppe"}, {"\244\303\244\333", "hho"}, {"\244\303\244\334", "bbo"}, {"\244\303\244\335", "ppo"}, {"\244\303\244\344", "yya"}, {"\244\303\244\346", "yyu"}, {"\244\303\244\350", "yyo"}, {"\244\303\244\351", "rra"}, {"\244\303\244\352", "rri"}, {"\244\303\244\352\244\343", "rrya"}, {"\244\303\244\352\244\345", "rryu"}, {"\244\303\244\352\244\347", "rryo"}, {"\244\303\244\353", "rru"}, {"\244\303\244\354", "rre"}, {"\244\303\244\355", "rro"}, {"\244\304", "tu"}, {"\244\305", "du"}, {"\244\306", "te"}, {"\244\307", "de"}, {"\244\310", "to"}, {"\244\311", "do"}, {"\244\312", "na"}, {"\244\313", "ni"}, {"\244\313\244\343", "nya"}, {"\244\313\244\345", "nyu"}, {"\244\313\244\347", "nyo"}, {"\244\314", "nu"}, {"\244\315", "ne"}, {"\244\316", "no"}, {"\244\317", "ha"}, {"\244\320", "ba"}, {"\244\321", "pa"}, {"\244\322", "hi"}, {"\244\322\244\343", "hya"}, {"\244\322\244\345", "hyu"}, {"\244\322\244\347", "hyo"}, {"\244\323", "bi"}, {"\244\323\244\343", "bya"}, {"\244\323\244\345", "byu"}, {"\244\323\244\347", "byo"}, {"\244\324", "pi"}, {"\244\324\244\343", "pya"}, {"\244\324\244\345", "pyu"}, {"\244\324\244\347", "pyo"}, {"\244\325", "hu"}, {"\244\325\244\241", "fa"}, {"\244\325\244\243", "fi"}, {"\244\325\244\247", "fe"}, {"\244\325\244\251", "fo"}, {"\244\326", "bu"}, {"\244\327", "pu"}, {"\244\330", "he"}, {"\244\331", "be"}, {"\244\332", "pe"}, {"\244\333", "ho"}, {"\244\334", "bo"}, {"\244\335", "po"}, {"\244\336", "ma"}, {"\244\337", "mi"}, {"\244\337\244\343", "mya"}, {"\244\337\244\345", "myu"}, {"\244\337\244\347", "myo"}, {"\244\340", "mu"}, {"\244\341", "me"}, {"\244\342", "mo"}, {"\244\343", "ya"}, {"\244\344", "ya"}, {"\244\345", "yu"}, {"\244\346", "yu"}, {"\244\347", "yo"}, {"\244\350", "yo"}, {"\244\351", "ra"}, {"\244\352", "ri"}, {"\244\352\244\343", "rya"}, {"\244\352\244\345", "ryu"}, {"\244\352\244\347", "ryo"}, {"\244\353", "ru"}, {"\244\354", "re"}, {"\244\355", "ro"}, {"\244\356", "wa"}, {"\244\357", "wa"}, {"\244\360", "i"}, {"\244\361", "e"}, {"\244\362", "wo"}, {"\244\363", "n"}, {"\244\363\244\242", "n'a"}, {"\244\363\244\244", "n'i"}, {"\244\363\244\246", "n'u"}, {"\244\363\244\250", "n'e"}, {"\244\363\244\252", "n'o"}, {"", ""}, }, H2rom_k_table[] = { {"\244\241", "a"}, {"\244\242", "a"}, {"\244\243", "i"}, {"\244\244", "i"}, {"\244\245", "u"}, {"\244\246", "u"}, {"\244\246\241\253", "vu"}, {"\244\246\241\253\244\241", "va"}, {"\244\246\241\253\244\243", "vi"}, {"\244\246\241\253\244\247", "ve"}, {"\244\246\241\253\244\251", "vo"}, {"\244\247", "e"}, {"\244\250", "e"}, {"\244\251", "o"}, {"\244\252", "o"}, {"\244\253", "ka"}, {"\244\254", "ga"}, {"\244\255", "ki"}, {"\244\255\244\343", "kya"}, {"\244\255\244\345", "kyu"}, {"\244\255\244\347", "kyo"}, {"\244\256", "gi"}, {"\244\256\244\343", "gya"}, {"\244\256\244\345", "gyu"}, {"\244\256\244\347", "gyo"}, {"\244\257", "ku"}, {"\244\260", "gu"}, {"\244\261", "ke"}, {"\244\262", "ge"}, {"\244\263", "ko"}, {"\244\264", "go"}, {"\244\265", "sa"}, {"\244\266", "za"}, {"\244\267", "si"}, {"\244\267\244\343", "sya"}, {"\244\267\244\345", "syu"}, {"\244\267\244\347", "syo"}, {"\244\270", "zi"}, {"\244\270\244\343", "zya"}, {"\244\270\244\345", "zyu"}, {"\244\270\244\347", "zyo"}, {"\244\271", "su"}, {"\244\272", "zu"}, {"\244\273", "se"}, {"\244\274", "ze"}, {"\244\275", "so"}, {"\244\276", "zo"}, {"\244\277", "ta"}, {"\244\300", "da"}, {"\244\301", "ti"}, {"\244\301\244\343", "tya"}, {"\244\301\244\345", "tyu"}, {"\244\301\244\347", "tyo"}, {"\244\302", "di"}, {"\244\302\244\343", "dya"}, {"\244\302\244\345", "dyu"}, {"\244\302\244\347", "dyo"}, {"\244\303", "tu"}, {"\244\303\244\246\241\253", "vvu"}, {"\244\303\244\246\241\253\244\241", "vva"}, {"\244\303\244\246\241\253\244\243", "vvi"}, {"\244\303\244\246\241\253\244\247", "vve"}, {"\244\303\244\246\241\253\244\251", "vvo"}, {"\244\303\244\253", "kka"}, {"\244\303\244\254", "gga"}, {"\244\303\244\255", "kki"}, {"\244\303\244\255\244\343", "kkya"}, {"\244\303\244\255\244\345", "kkyu"}, {"\244\303\244\255\244\347", "kkyo"}, {"\244\303\244\256", "ggi"}, {"\244\303\244\256\244\343", "ggya"}, {"\244\303\244\256\244\345", "ggyu"}, {"\244\303\244\256\244\347", "ggyo"}, {"\244\303\244\257", "kku"}, {"\244\303\244\260", "ggu"}, {"\244\303\244\261", "kke"}, {"\244\303\244\262", "gge"}, {"\244\303\244\263", "kko"}, {"\244\303\244\264", "ggo"}, {"\244\303\244\265", "ssa"}, {"\244\303\244\266", "zza"}, {"\244\303\244\267", "ssi"}, {"\244\303\244\267\244\343", "ssya"}, {"\244\303\244\267\244\345", "ssyu"}, {"\244\303\244\267\244\347", "ssyo"}, {"\244\303\244\270", "zzi"}, {"\244\303\244\270\244\343", "zzya"}, {"\244\303\244\270\244\345", "zzyu"}, {"\244\303\244\270\244\347", "zzyo"}, {"\244\303\244\271", "ssu"}, {"\244\303\244\272", "zzu"}, {"\244\303\244\273", "sse"}, {"\244\303\244\274", "zze"}, {"\244\303\244\275", "sso"}, {"\244\303\244\276", "zzo"}, {"\244\303\244\277", "tta"}, {"\244\303\244\300", "dda"}, {"\244\303\244\301", "tti"}, {"\244\303\244\301\244\343", "ttya"}, {"\244\303\244\301\244\345", "ttyu"}, {"\244\303\244\301\244\347", "ttyo"}, {"\244\303\244\302", "ddi"}, {"\244\303\244\302\244\343", "ddya"}, {"\244\303\244\302\244\345", "ddyu"}, {"\244\303\244\302\244\347", "ddyo"}, {"\244\303\244\304", "ttu"}, {"\244\303\244\305", "ddu"}, {"\244\303\244\306", "tte"}, {"\244\303\244\307", "dde"}, {"\244\303\244\310", "tto"}, {"\244\303\244\311", "ddo"}, {"\244\303\244\317", "hha"}, {"\244\303\244\320", "bba"}, {"\244\303\244\321", "ppa"}, {"\244\303\244\322", "hhi"}, {"\244\303\244\322\244\343", "hhya"}, {"\244\303\244\322\244\345", "hhyu"}, {"\244\303\244\322\244\347", "hhyo"}, {"\244\303\244\323", "bbi"}, {"\244\303\244\323\244\343", "bbya"}, {"\244\303\244\323\244\345", "bbyu"}, {"\244\303\244\323\244\347", "bbyo"}, {"\244\303\244\324", "ppi"}, {"\244\303\244\324\244\343", "ppya"}, {"\244\303\244\324\244\345", "ppyu"}, {"\244\303\244\324\244\347", "ppyo"}, {"\244\303\244\325", "hhu"}, {"\244\303\244\325\244\241", "ffa"}, {"\244\303\244\325\244\243", "ffi"}, {"\244\303\244\325\244\247", "ffe"}, {"\244\303\244\325\244\251", "ffo"}, {"\244\303\244\326", "bbu"}, {"\244\303\244\327", "ppu"}, {"\244\303\244\330", "hhe"}, {"\244\303\244\331", "bbe"}, {"\244\303\244\332", "ppe"}, {"\244\303\244\333", "hho"}, {"\244\303\244\334", "bbo"}, {"\244\303\244\335", "ppo"}, {"\244\303\244\344", "yya"}, {"\244\303\244\346", "yyu"}, {"\244\303\244\350", "yyo"}, {"\244\303\244\351", "rra"}, {"\244\303\244\352", "rri"}, {"\244\303\244\352\244\343", "rrya"}, {"\244\303\244\352\244\345", "rryu"}, {"\244\303\244\352\244\347", "rryo"}, {"\244\303\244\353", "rru"}, {"\244\303\244\354", "rre"}, {"\244\303\244\355", "rro"}, {"\244\304", "tu"}, {"\244\305", "du"}, {"\244\306", "te"}, {"\244\307", "de"}, {"\244\310", "to"}, {"\244\311", "do"}, {"\244\312", "na"}, {"\244\313", "ni"}, {"\244\313\244\343", "nya"}, {"\244\313\244\345", "nyu"}, {"\244\313\244\347", "nyo"}, {"\244\314", "nu"}, {"\244\315", "ne"}, {"\244\316", "no"}, {"\244\317", "ha"}, {"\244\320", "ba"}, {"\244\321", "pa"}, {"\244\322", "hi"}, {"\244\322\244\343", "hya"}, {"\244\322\244\345", "hyu"}, {"\244\322\244\347", "hyo"}, {"\244\323", "bi"}, {"\244\323\244\343", "bya"}, {"\244\323\244\345", "byu"}, {"\244\323\244\347", "byo"}, {"\244\324", "pi"}, {"\244\324\244\343", "pya"}, {"\244\324\244\345", "pyu"}, {"\244\324\244\347", "pyo"}, {"\244\325", "hu"}, {"\244\325\244\241", "fa"}, {"\244\325\244\243", "fi"}, {"\244\325\244\247", "fe"}, {"\244\325\244\251", "fo"}, {"\244\326", "bu"}, {"\244\327", "pu"}, {"\244\330", "he"}, {"\244\331", "be"}, {"\244\332", "pe"}, {"\244\333", "ho"}, {"\244\334", "bo"}, {"\244\335", "po"}, {"\244\336", "ma"}, {"\244\337", "mi"}, {"\244\337\244\343", "mya"}, {"\244\337\244\345", "myu"}, {"\244\337\244\347", "myo"}, {"\244\340", "mu"}, {"\244\341", "me"}, {"\244\342", "mo"}, {"\244\343", "ya"}, {"\244\344", "ya"}, {"\244\345", "yu"}, {"\244\346", "yu"}, {"\244\347", "yo"}, {"\244\350", "yo"}, {"\244\351", "ra"}, {"\244\352", "ri"}, {"\244\352\244\343", "rya"}, {"\244\352\244\345", "ryu"}, {"\244\352\244\347", "ryo"}, {"\244\353", "ru"}, {"\244\354", "re"}, {"\244\355", "ro"}, {"\244\356", "wa"}, {"\244\357", "wa"}, {"\244\360", "i"}, {"\244\361", "e"}, {"\244\362", "wo"}, {"\244\363", "n"}, {"\244\363\244\242", "n'a"}, {"\244\363\244\244", "n'i"}, {"\244\363\244\246", "n'u"}, {"\244\363\244\250", "n'e"}, {"\244\363\244\252", "n'o"}, {"", ""}, }; #define H2rom_buflen 11 int H2rom(c, n, type) Character *c; Character *n; int type; { static int index_table[0x81]; static int index_made = UNINITIALIZED; static struct H2rom_tbl *H2rom_ptr; struct H2rom_tbl *p; int i, clen, ylen; unsigned char buffer[H2rom_buflen]; int max_match, match_more; char *max_romaji; if (index_made != romaji_type) { int last; for (i = 0; i < 0x81; ++ i) { index_table[i] = -1; } index_table[0x21] = 0; H2rom_ptr = (romaji_type == HEPBURN) ? H2rom_h_table : H2rom_k_table; if (use_old_romaji_table && romaji_type == HEPBURN) H2rom_ptr = H2rom_h_table_old; if (use_old_romaji_table && romaji_type == KUNREI) H2rom_ptr = H2rom_k_table_old; for (p = H2rom_ptr, i = 0; *(p->kana) != '\0'; ++ p, ++ i) { index_table[(((p->kana)[1])&0x7f)+1] = i+1; } last = i; for (i = 0x80; i >= 0; -- i) { if (index_table[i] == -1) index_table[i] = last; else last = index_table[i]; } index_made = romaji_type; } buffer[H2rom_buflen-1] = '\0'; clen = H2rom_buflen-1; for (i = 0; i < (H2rom_buflen-1)/2; i ++) { buffer[i*2 ] = c[i].c1; buffer[i*2+1] = c[i].c2; if (c[i].c1 == '\0') { clen = i*2; break; } } if (clen == 0) { n[0].type=OTHER; n[0].c1 = '\0'; return 0; } max_match = 0; max_romaji = NULL; match_more = 0; for (i = index_table[buffer[1]&0x7f]; i < index_table[(buffer[1]&0x7f)+1]; ++ i) { ylen = strlen((const char *)(H2rom_ptr[i].kana)); if (clen >= ylen) { if (max_match < ylen) { if (strncmp((const char *)buffer, (char *)(H2rom_ptr[i].kana), ylen) == 0) { max_match = ylen/2; max_romaji = H2rom_ptr[i].romaji; } } } else { if (match_more == 0) if (strncmp((const char *)buffer, (char *)(H2rom_ptr[i].kana), clen) == 0) match_more = 1; } } if (max_romaji == NULL) { i = 0; max_match = 1; } else { for (i = 0; max_romaji[i] != '\0'; ++ i) { n[i].type=type; n[i].c1 = max_romaji[i]; } } n[i].type=OTHER; n[i].c1 = '\0'; return (match_more == 0) ? max_match : -max_match; } int H2a(c, n) Character *c; Character *n; { return H2rom(c, n, ASCII); } int H2j(c, n) Character *c; Character *n; { return H2rom(c, n, JISROMAN); } int H2K(c, n) Character *c; Character *n; { if (c[0].c1 == 0xa4) { n[0].type = JIS83; n[0].c1 = 0xa5; n[0].c2 = c[0].c2; n[1].type = OTHER; n[1].c1 = 0; n[1].c2 = 0; if (c[0].c2 == 0xa6) { /* == charcter code(\244\246) */ if (c[1].c1 == 0) return -1; if ((c[1].c1 == 0xa1) && (c[1].c2 == 0xab)) { /* == charcter code(\244\246),charcter code(\241\253) */ n[0].type = JIS83; n[0].c1 = 0xa5; n[0].c2 = 0xf4; return 2; } } return 1; } else if (c[0].c1 == 0xa1) { if ((c[0].c2 == 0xbc) || (c[0].c2 == 0xab) || (c[0].c2 == 0xac)) { n[0].type = JIS83; n[0].c1 = c[0].c1; n[0].c2 = c[0].c2; n[1].type = OTHER; n[1].c1 = 0; n[1].c2 = 0; return 1; } else if (c[0].c2 == 0xb5 || c[0].c2 == 0xb6) { n[0].type = JIS83; n[0].c1 = c[0].c1; n[0].c2 = c[0].c2 - 2; n[1].type = OTHER; n[1].c1 = 0; n[1].c2 = 0; return 1; } } n[0].type = OTHER; n[0].c1 = 0; n[0].c2 = 0; return 1; } int H2k(c, n) Character *c; Character *n; { unsigned char *b; int i; static unsigned char H2k_table[0x60][3] = { "", "'", "1", "(", "2", ")", "3", "*", "4", "+", "5", "6", "6^", "7", "7^", "8", "8^", "9", "9^", ":", ":^", ";", ";^", "<", "<^", "=", "=^", ">", ">^", "?", "?^", "@", "@^", "A", "A^", "/", "B", "B^", "C", "C^", "D", "D^", "E", "F", "G", "H", "I", "J", "J^", "J_", "K", "K^", "K_", "L", "L^", "L_", "M", "M^", "M_", "N", "N^", "N_", "O", "P", "Q", "R", "S", ",", "T", "-", "U", ".", "V", "W", "X", "Y", "Z", "[", "\\", "\\", "2", "4", "&", "]", "", "", "", "", "", "", "", "", "", "", "", ""}; if (c[0].c1 == 0xa4) { for (b = H2k_table[(c[0].c2 & 0x7f) - 0x20], i = 0; *b != '\0'; ++ b, ++ i) { n[i].type = KATAKANA; n[i].c1 = *b; } n[i].type = OTHER; n[i].c1 = 0; } else if ((c[0].c1 == 0xa1) && ((c[0].c2 == 0xbc) || (c[0].c2 == 0xab) || (c[0].c2 == 0xac))) { n[0].type = KATAKANA; switch(c[0].c2) { case 0xbc: n[0].c1 = '0'; break; case 0xab: n[0].c1 = '^'; break; case 0xac: n[0].c1 = '_'; break; } n[1].type = OTHER; n[1].c1 = 0; } else { n[0].type = OTHER; n[0].c1 = 0; } return 1; } #ifdef WAKATIGAKI /* As for the hiragana as well, the function which isn't necessarily needed if reading raising becomes possible. */ int H2H(c, n) Character *c; Character *n; { /* Hiragana except for '\244\362' */ if (c[0].c1 == 0xA4 && c[0].c2 != 0xF2) { if ( bunkatu_mode ) { if ( wo_mode == 2 ) { separator_out = 1; n[1].type = JIS83; n[1].c1 = c[0].c1; n[1].c2 = c[0].c2; n[2].type = OTHER; n[2].c1 = 0; n[2].c2 = 0; wo_mode = 0; return 2; } else { n[0].type = JIS83; n[0].c1 = c[0].c1; n[0].c2 = c[0].c2; n[1].type = OTHER; n[1].c1 = 0; n[1].c2 = 0; wo_mode = 0; return 1; } } } else if (c[0].c1 == 0xA4 && c[0].c2 == 0xF2) { /* '\244\362' */ wo_mode = 1; if (bunkatu_mode) { if (! terminate_done) separator_out = 2; } n[0].type = JIS83; n[0].c1 = c[0].c1; n[0].c2 = c[0].c2; n[1].type = OTHER; n[1].c1 = 0; n[1].c2 = 0; return 2; } else if ((c[0].c1 == 0xa1) && ((c[0].c2 == 0xbc) || (c[0].c2 == 0xab) || (c[0].c2 == 0xac))) { n[0].type = JIS83; n[0].c1 = c[0].c1; n[0].c2 = c[0].c2; n[1].type = OTHER; n[1].c1 = 0; n[1].c2 = 0; return 1; } else { wo_mode = 0; separator_out = 0; n[0].type = OTHER; n[0].c1 = 0; n[0].c2 = 0; return 1; } } #endif /* WAKATIGAKI */ kakasi-2.3.6/src/jj2.c0000644000175000017500000001404107265241716011340 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: jj2.c,v 1.7 2001-04-12 05:57:34 rug Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #ifdef HAVE_STRING_H # include #else # include #endif #include "kakasi.h" #include #define J2HBUF 256 #define J2READ 10 static int J2_cletter(l, c1, c2) unsigned int l; unsigned int c1; unsigned int c2; { static char *cl_table[96] = { "", "aiueow", "aiueow", "aiueow", "aiueow", "aiueow", "aiueow", "aiueow", "aiueow", "aiueow", "aiueow", "k", "g", "k", "g", "k", "g", "k", "g", "k", "g", "s", "zj", "s", "zj", "s", "zj", "s", "zj", "s", "zj", "t", "d", "tc", "d", "aiueokstchgzjfdbpw", "t", "d", "t", "d", "t", "d", "n", "n", "n", "n", "n", "h", "b", "p", "h", "b", "p", "hf", "b", "p", "h", "b", "p", "h", "b", "p", "m", "m", "m", "m", "m", "y", "y", "y", "y", "y", "y", "rl", "rl", "rl", "rl", "rl", "wiueo", "wiueo", "wiueo", "wiueo", "w", "n", "v", "k", "k", "", "", "", "", "", "", "", "", ""}; char *p; if ((c1 == 0xa4) && (0xa0 <= c2 ) && (c2 < 0xff)) { for (p = cl_table[c2 - 0xa0]; *p != '\0'; ++ p) { if (*p == l) return 0; } } return 1; } static void J2append(n, str) Character *n; unsigned char *str; { int i, j; j = 0; for (i = 0; str[i] != '\0'; ++ i, ++j) { if (str[i] > 0xa0) { n[j].type = JIS83; n[j].c1 = str[i]; n[j].c2 = str[i+1]; ++ i; } else { n[j].type = ASCII; n[j].c1 = str[i]; } } n[j].type = OTHER; n[j].c1 = 0; n[j].c2 = 0; } int J2H(c, n) Character *c; Character *n; { int c1, c2; unsigned char Jstr[J2HBUF], Hstr[J2READ][J2HBUF], Dstr[J2HBUF], *h_point; int max_len, length, match_more, n_read, i, clen; struct kanji_yomi *ptr; max_len = 0; match_more = 0; n_read = 0; for (i = 0; i * 2 < J2HBUF - 2 && c[i].c1 != 0; ++ i) { /* FIXME: chop down incoming string (ad-hoc solution)*/ c1 = c[i].c1; c2 = c[i].c2; if ((c[i].type == JIS83) || (c[i].type == JIS78)) { itaijiknj(&c1, &c2); Jstr[i*2] = c1; Jstr[i*2+1] = c2; } else { Jstr[i*2] = 0; Jstr[i*2+1] = 0; } } assert(i*2 < J2HBUF); Jstr[i*2] = '\0'; clen = i*2; add_kanwa((int)Jstr[0], (int)Jstr[1]); for (ptr = jisyo_table[Jstr[0]&0x7f][Jstr[1]&0x7f]; ptr != NULL; ptr = ptr->next) { length = ptr->length; if (clen >= length) { if (strncmp((char *)Jstr+2, (char *)(ptr->kanji), (length & 1) ? length-3 : length-2)) continue; if (length & 1) if (J2_cletter(ptr->tail,Jstr[length-1],Jstr[length])) continue; if (max_len < length) { if (length & 1) { sprintf((char *)Hstr[0], "%s%c%c", ptr->yomi, Jstr[length-1],Jstr[length]); } else { strcpy((char *)Hstr[0], (const char *)(ptr->yomi)); } max_len = length; n_read = 1; } else if (max_len == length) { if ((heiki_mode) && (n_read < J2READ)) { if (length & 1) { sprintf((char *)Hstr[n_read], "%s%c%c", ptr->yomi, Jstr[length-1],Jstr[length]); } else { strcpy((char *)Hstr[n_read], (const char *)(ptr->yomi)); } for (i = 0; i < n_read; ++ i) { if (strcmp((const char *)Hstr[i], (const char *)Hstr[n_read]) == 0) goto next; } n_read ++; next:; } } } else { if (clen == 2) match_more = 1; else if (strncmp((char *)Jstr+2, (char *)(ptr->kanji), clen-2) == 0) match_more = 1; } } if (max_len == 0) { n[0].type = OTHER; n[0].c1 = 0; n[0].c2 = 0; return 1; } h_point = Jstr+((max_len-1) & 0xfffe); if (strncmp((const char *)h_point, "\244\303", 2) == 0) { if (clen <= max_len+1) match_more = 1; else { max_len += 2; for (i = 0; i < n_read; ++ i) { sprintf((char *)Hstr[i], "%s%c%c", Hstr[i], h_point[2], h_point[3]); } } } if (n_read > 1) { strcpy((char *)Dstr, "{"); for (i = 0; i < n_read; ++ i) { strcat((char *)Dstr, (const char *)Hstr[i]); if (n_read - i == 1) strcat((char *)Dstr, "}"); else strcat((char *)Dstr, "|"); } J2append(n, Dstr); } else { J2append(n, Hstr[0]); } return (match_more == 0) ? (max_len+1)/2 : -(max_len+1)/2; } static void J2convert(m, n, proc) Character *m; Character *n; int (*proc)(); { int mp=0, np=0; int ret; while(m[mp].c1 != 0) { if (m[mp].type != JIS83) { n[np].type = m[mp].type; n[np].c1 = m[mp].c1; n[np].c2 = m[mp].c2; ++ np; ++ mp; } else { ret = (* proc)(m+mp, n+np); if (ret == 0) ret = 1; mp += (ret < 0) ? -ret : ret; for (; n[np].c1 != 0; ++ np) ; } } n[np].type = OTHER; n[np].c1 = 0; n[np].c2 = 0; } int J2a(c, n) Character *c; Character *n; { Character m[256]; int ret; ret = J2H(c, m); J2convert(m, n, H2a); return ret; } int J2j(c, n) Character *c; Character *n; { Character m[256]; int ret; ret = J2H(c, m); J2convert(m, n, H2j); return ret; } int J2k(c, n) Character *c; Character *n; { Character m[256]; int ret; ret = J2H(c, m); J2convert(m, n, H2k); return ret; } int J2K(c, n) Character *c; Character *n; { Character m[256]; int ret; ret = J2H(c, m); J2convert(m, n, H2K); return ret; } kakasi-2.3.6/src/conv-util.h0000644000175000017500000000234707223155117012577 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: conv-util.h,v 1.2 2000-12-29 18:39:11 rug Exp $ * Copyright (C) 1994 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifndef _CONV_UTIL_H #define _CONV_UTIL_H #ifndef PARAMS # if __STDC__ || defined __cplusplus # define PARAMS(args) args # else # define PARAMS(args) () # endif #endif extern int isallkana PARAMS((unsigned char *str)); extern int isallzenkaku PARAMS((unsigned char *str)); extern int includekanji PARAMS((unsigned char *str)); #endif /* _CONV_UTIL_H */ kakasi-2.3.6/src/kakasi.h0000644000175000017500000001600610020543533012107 00000000000000/* * KAKASI (Kanji Kana Simple inversion program) * $Id: kakasi.h,v 1.13 2004-03-01 05:17:15 knok Exp $ * Copyright (C) 1992 * Hironobu Takahashi (takahasi@tiny.or.jp) * * 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 versions 2, 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 KAKASI, see the file COPYING. If not, write to the Free * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifndef _KAKASI_H #define _KAKASI_H #ifndef PARAMS # if __STDC__ || defined __cplusplus # define PARAMS(args) args # else # define PARAMS(args) () # endif #endif /* * macro definitions */ /* character set */ #define ASCII 0 #define JISROMAN 1 #define GRAPHIC 2 #define KATAKANA 3 #define JIS78 4 #define JIS83 5 #define OTHER 127 /* assign */ #define SETG0 0 #define SETG1 1 #define SETG2 2 #define SETG3 3 #define SJKANA 4 /* terminal type */ #define UNKNOWN 0 #define OLDJIS 1 #define NEWJIS 2 #define DEC 3 #define EUC 4 #define MSKANJI 5 #define UTF8 6 /* options */ #define UNINITIALIZED -1 #define HEPBURN 0 #define KUNREI 1 #define MAXJISYO 10 #define KAKASIBUF 256 /* * data structures */ typedef struct character { char type; unsigned char c1, c2; } Character; /* The internal dictionary format of KAKASI. */ extern struct kanji_yomi *jisyo_table[0x80][0x80]; /* hash table */ extern int kanwa_load[0x80][0x80]; /* Is kanwadict put? */ struct kanji_yomi { struct kanji_yomi *next; int length; unsigned char *kanji; unsigned char *yomi; unsigned char tail; }; /* The dictionary format of kanwadict. */ /* * new dict format - 2003/03/11 ukai * * 0x0000 | K A K A S I | magic * 0x0008 | nn nn nn nn | * | 00 00 00 00 |