Mercurial > freewnn
diff Wnn/jserver/ddefine.h @ 0:bbc77ca4def5
initial import
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 13 Dec 2007 04:30:14 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Wnn/jserver/ddefine.h Thu Dec 13 04:30:14 2007 +0900 @@ -0,0 +1,300 @@ +/* + * $Id: ddefine.h,v 1.7 2003/05/11 18:29:19 hiroo Exp $ + */ + +/* + * FreeWnn is a network-extensible Kana-to-Kanji conversion system. + * This file is part of FreeWnn. + * + * Copyright Kyoto University Research Institute for Mathematical Sciences + * 1987, 1988, 1989, 1990, 1991, 1992 + * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999 + * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992 + * Copyright FreeWnn Project 1999, 2000, 2003 + * + * Maintainer: FreeWnn Project <freewnn@tomo.gr.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 version 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/************************ + * define of daemon + ************************/ + +#ifndef JSERVER_DDEFINE_H +#define JSERVER_DDEFINE_H 1 + +#include <ctype.h> + +#define SIZE_JISHOTABLE 1000 +#define SIZE_JISHOHEAP 2000 + +#define KANGO_HINSI_MX 256 /* ´´¸ì¤ÎÉÊ»ì¿ô¤ÎºÇÂç¿ô */ +#define KANGO_VECT_L (KANGO_HINSI_MX+8*4-1)/(8*4) /* ´´¸ìÀܳ¥Ù¥¯¥¿¤ÎŤµ */ +#define FZKVECT_L 5 /* ÉÕ°¸ì¥Ù¥¯¥¿¤ÎŤµ */ +#define VECT_L KANGO_VECT_L + FZKVECT_L /* Àܳ¥Ù¥¯¥¿¤ÎŤµ */ + +struct fzkkouho +{ /* used in reffering to fuzokugo jouhou + fuzokugo jouhou is stored using this struct */ + int offset; + int vector[KANGO_VECT_L]; /* ´´¸ì½ªÃ¼¥Ù¥¯¥¿ */ +}; + +/* macro C(i , j) is useful for finding a pointer which points out + the first jishoentry whose yomi starts at i and endes at j + which returns NULL if there is no entry which matches this +*/ + +#define C(i,j) (j > maxj[i] ? (struct jdata *)NULL : *(jmtp[i] + (j - i))) + + +/* #define FZKIBNO 10 */ +#define FZKIBNO 5 + +/* ÉÕ°¸ì²òÀÏ·ë²Ì */ +struct ICHBNP +{ + struct ICHBNP *next_p; + struct fzkkouho fzkib[FZKIBNO]; /* vec ¤Î²òÀÏ·ë²Ì */ + struct fzkkouho fzkib1[FZKIBNO]; /* vec1 ¤Î²òÀÏ·ë²Ì */ +}; +/* ¼Â¤Ï¡¢fzkib1->offset ¤Ï¡¢¤´¤ß¤¬Æþ¤Ã¤Æ¤¤¤ë */ + +#define SV_KOSUU 3 + +#define UJIS_A 0xa3c1 /* £Á */ +#define UJIS_Z 0xa3da /* £Ú */ +#define UJIS_a 0xa3e1 /* £á */ +#define UJIS_z 0xa3fa /* £ú */ +#ifdef CHINESE +#define UJIS_comma 0xa3ac /* ¡¤ */ +#define S_PAREN 0xa1ae /* ¡Æ */ +#define E_PAREN 0xa1bf /* ¡Û */ +#else +# ifdef KOREAN +#define UJIS_comma 0xa3ac /* ¡¤ */ +#define S_PAREN 0xa1ae /* ¡Æ */ +#define E_PAREN 0xa1bd /* ¡Û */ +# else +#define UJIS_comma 0xa1a4 /* ¡¤ */ +#define S_PAREN 0xa1c6 /* ¡Æ */ +#define E_PAREN 0xa1db /* ¡Û */ +# endif +#endif /* CHINESE */ +/* +#define isdigit(x) ((unsigned)((x) - '0') <= ('9' - '0')) +#define isalpha(x) ((unsigned)((x) - 'A') <= ('Z' - 'A') || \ + (unsigned)((x) - 'a') <= ('z' - 'a')) +#define isalnum(x) (isalpha(x) || isdigit(x)) +*/ +#ifdef isspace +# undef isspace /* ctype.h ¤Î isspace() ¤Ï»È¤ï¤Ê¤¤ */ +#endif +#define isspace(x) (((x) == ' ') || ((x) == 0x09)) +#define isjspace(x) ((x) == 0xa1a1) +#define isparen_s(x) (/* (x) == '\"' || */ (x) == '`' || \ +/* ³«³ç¸Ì */ (x) == '(' || (x) == '<' || \ + (x) == '[' || (x) == '{') +#define isparen_e(x) ((x) == '\"' || (x) == '\'' || \ +/* Êijç¸Ì */ (x) == ')' || (x) == '>' || \ + (x) == ']' || (x) == '}') + +#define isjdigit(x) ((unsigned)((x) - S_NUM) <= (E_NUM - S_NUM)) +#define isjalpha(x) ((unsigned)((x) - UJIS_A) <= (UJIS_Z - UJIS_A) || \ + (unsigned)((x) - UJIS_a) <= (UJIS_z - UJIS_a)) +#define isjalnum(x) (isjalpha(x) || isjdigit(x)) +#define isjhira(x) ((unsigned)((x) - S_HIRA) <= (E_HIRA - S_HIRA)) +#define isjkata(x) ((unsigned)((x) - S_KATA) <= (E_KATA - S_KATA)) +#define isj1bytekana(x) ((unsigned)((x) - S_HANKATA) <= (E_HANKATA - S_HANKATA)) +# define S_KANJI 0xb0a1 /* 16¶è */ +# define E_KANJI 0xfefe /* 94¶è */ +#ifdef CHINESE +# define S_HANJI 0x20a1 /* 16¶è */ +# define E_HANJI 0x7efe /* 94¶è */ +#define isjkanji(x) (((unsigned)((x) - S_KANJI) <= (E_KANJI - S_KANJI)) || \ + ((unsigned)((x) - S_HANJI) <= (E_HANJI - S_HANJI))) +#define isjparen(x) ((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN) || \ + (x)==0xa3a8 || (x)==0xa3a9 || \ + (x)==0xa3bc || (x)==0xa3be || \ + (x)==0xa3db || (x)==0xa3dd || \ + (x)==0xa3fb || (x)==0xa3fd ) + /* for ( ) < > [ ] { } */ +#define isjparen_s(x) (((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) && \ + (((x) & 0x01) == 0) || \ + (x)==0xa3a8 || (x)==0xa3bc || \ + (x)==0xa3db || (x)==0xa3fb ) + +#define isjparen_e(x) (((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) && \ + (((x) & 0x01) == 1) || \ + (x)==0xa3a9 || (x)==0xa3be || \ + (x)==0xa3dd || (x)==0xa3fd ) +#else +# ifdef KOREAN +#define S_HANJA 0xcaa1 /* Ê¡ */ +#define E_HANJA 0xfdfe /* ýþ */ +#define isjkanji(x) ((unsigned)((x) - S_HANJA) <= (E_HANJA - S_HANJA)) +#define isjparen(x) ((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN) || \ + (x)==0xa3a8 || (x) ==0xa3a9 || \ + (x)==0xa3bc || (x) ==0xa3be || \ + (x)==0xa3db || (x) ==0xa3dd || \ + (x)==0xa3fb || (x) ==0xa3fc ) +#define isjparen_s(x) (((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) && \ + (((x) & 0x01) == 0) || \ + (x)==0xa3a8 || (x)==0xa3bc || \ + (x)==0xa3db || (x)==0xa3fb) +#define isjparen_e(x) (((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) && \ + (((x) & 0x01) == 1) || \ + (x) ==0xa3a9 || (x) ==0xa3be || \ + (x) ==0xa3dd || (x) ==0xa3fc ) +#define ishangul(x) ((unsigned)((x) - S_HANGUL) <= (E_HANGUL - S_HANGUL)) +# else /* JAPANESE */ +#define isjkanji(x) ((unsigned)((x) - S_KANJI) <= (E_KANJI - S_KANJI)) +#define isjparen(x) ((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) +#define isjparen_s(x) (isjparen(x) && (((x) & 0x01) == 0)) +#define isjparen_e(x) (isjparen(x) && ((x) & 0x01)) +# endif /* KOREAN */ +#endif /* CHINESE */ + +#define UJIS_DKT 0xa1ab /* ¡« */ +#define UJIS_HDK 0xa1ac /* ¡¬ */ + +#define BAR_CODE(x) ((x) == BAR) +#define TOKU(x) (((x) == UJIS_DKT) || ((x) == UJIS_HDK)) + +#define TOKUSYU(x) (TOKU(x) || isjkata(x) || isj1bytekana(x)) + /* this resembles macro before */ + +#define kuten(x) (((x)==KUTEN_NUM)? True:False) +#define touten(x) (((x)==TOUTEN_NUM)? True:False) + +struct SYO_BNSETSU +{ + struct SYO_BNSETSU *lnk_br; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + struct SYO_BNSETSU *parent; /* °ì¤ÄÁ°¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + short j_c; /* ´´¸ì top index */ + short i_jc; /* ´´¸ì end index */ + short bend_m; /* ¾®Ê¸Àá end char index */ + int v_jc; /* ¤³¤ÎʸÀá¤Îɾ²ÁÃÍ */ + int son_v; /* ¤³¤Î¾®Ê¸Àá¤Þ¤Ç¤Îɾ²ÁÃͤιç·× */ + struct jdata *jentptr; /* ¼½ñ¥Ç¡¼¥¿¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + int t_jc; /* Éʻ졢ÉÑÅÙ¾ðÊó¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */ + int kangovect; /* Àܳ¥Ù¥¯¥È¥ë¥Æ¡¼¥Ö¥ë¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */ + int hinsi_fk; /* ´´¸ì¤ÎÉÊ»ìNo.(Ê£¹çÉÊ»ì¤ò´Þ¤à) */ + short kbcnt; /* ÂçʸÀáÃæ¤Ç²¿¾®Ê¸ÀáÌܤ« */ + short reference; /* ¤³¤Î¾®Ê¸Àá¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¿ô */ + short status; /* Á°¤ÎʸÀá¤ÈÀܳ¤Ç¤¤ë¤« */ + short status_bkwd; /* ¸å¤ÎʸÀá¤È¤ÈÀܳ¤Ç¤¤ë¤« */ +}; + +struct BZD +{ + struct BZD *lnk_br; /* ¾¤ÎÂçʸÀá¸õÊä */ + struct BZD *lnk_son; /* ¼¡¤ÎÂçʸÀá¤Ø¤Î pointer */ + short j_c; /* ´´¸ì top index */ + short bend_m; /* ¤³¤ÎÂçʸÀá¤Î end char index */ + int v_jc; /* ¤³¤ÎÂçʸÀá¤Îɾ²ÁÃÍ */ + int son_v; /* ¼¡¤ÎÂçʸÀá¤Îɾ²ÁÃÍ */ + struct SYO_BNSETSU *sbn; /* ÀèƬ¤Î¾®Ê¸Àá */ + short sbn_cnt; /* ¤³¤ÎÂçʸÀá¤ò¹½À®¤¹¤ë¾®Ê¸Àá¤Î¿ô */ + short kbcnt; /* ¤³¤ÎÂçʸÀá¤ÎÁ°¤Ë²¿Ê¸Àá²òÀϤ·¤¿¤« */ +}; + +struct JKT_SONE +{ + struct JKT_SONE *lnk_br; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + short i_jc; /* ´´¸ì end index */ + short v_jc; /* ¤³¤ÎʸÀá¤Îɾ²ÁÃÍ */ + struct jdata *jentptr; /* ¼½ñ¥Ç¡¼¥¿¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + int t_jc; /* Éʻ졢ÉÑÅÙ¾ðÊó¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */ + int hinsi_fk; /* ´´¸ì¤ÎÉÊ»ìNo.(Ê£¹çÉÊ»ì¤ò´Þ¤à) */ + short status_bkwd; /* ¸å¤ÎʸÀá¤È¤ÈÀܳ¤Ç¤¤ë¤« */ +}; + +struct JKT_SBN +{ + struct JKT_SBN *lnk_br; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + struct JKT_SBN *parent; /* °ì¤ÄÁ°¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + short j_c; /* ´´¸ì top index */ + short bend_m; /* ¾®Ê¸Àá end char index */ + struct JKT_SONE *sbn; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + int kangovect; /* Àܳ¥Ù¥¯¥È¥ë¥Æ¡¼¥Ö¥ë¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */ + short kbcnt; /* ÂçʸÀáÃæ¤Ç²¿¾®Ê¸ÀáÌܤ« */ + short reference; /* ¤³¤Î¾®Ê¸Àá¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¿ô */ + short status; /* Á°¤ÎʸÀá¤ÈÀܳ¤Ç¤¤ë¤« */ +}; + +struct JKT_DBN +{ + struct JKT_DBN *lnk_br; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + short j_c; /* ´´¸ì top index */ + short bend_m; /* ¾®Ê¸Àá end char index */ + struct JKT_SBN *sbn; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + int v_jc; /* ºÇÂçɾ²Á¤Îɾ²ÁÃÍ */ + short sbn_cnt; /* ¤³¤ÎÂçʸÀá¤ò¹½À®¤¹¤ë¾®Ê¸Àá¤Î¿ô */ +}; + +struct DSD_SBN +{ + short bun_m; /* ¸õÊäʸÀá¤Î end char index */ + short bun_jc; /* ¸õÊäʸÀá¤Î top char index */ + short i_jc; /* ¸õÊäʸÀá¤Î¼«Î©¸ì end char index */ + struct jdata *jentptr; /* ¸õÊäʸÀá¤Î¼½ñ entry pointer */ + int t_jc; /* ¸õÊ伫Ω¸ì¤ÎÉÊ»ì & ÉÑÅÙ index */ + int hinsi; /* ÉÊ»ì */ + int kangovect; /* Àܳ¥Ù¥¯¥È¥ë¥Æ¡¼¥Ö¥ë¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */ + int v_jc; /* ¾®Ê¸Àá¤Îɾ²ÁÃÍ */ + short status; /* Á°¤ÎʸÀá¤ÈÀܳ¤Ç¤¤ë¤« */ + short status_bkwd; /* ¸å¤ÎʸÀá¤È¤ÈÀܳ¤Ç¤¤ë¤« */ +}; + +struct DSD_DBN +{ + short bun_m; /* ¸õÊäʸÀá¤Î end char index */ + short bun_jc; /* ¸õÊäʸÀá¤Î top char index */ + struct DSD_SBN *sbn; /* ¾®Ê¸Àá²òÀÏ·ë²Ì¤Ø¤Î¥Ý¥¤¥ó¥¿ */ + short sbncnt; /* ¾®Ê¸Àá¿ô (¼¡¸õÊä¤Î¾ì¹ç¤Ï¡¢¼¡¸õÊä¿ô) + DSD_SBN¤Ï¡¢*sbn ¤«¤é sbncnt ¤À¤±¤¢¤ë */ + int v_jc; /* ÂçʸÀá¤Îɾ²ÁÃÍ */ +}; + +#ifdef nodef /* move to jslib.h */ +/* µ¿»÷ʸÀá¤ÎľÁ°¤ËÁªÂò¤·¤¿¸õÊä */ +#define HIRAGANA -1 /* ¤Ò¤é¤¬¤Ê */ /* ÆÉ¤ß¤Î¤Þ¤Þ */ +#define KATAKANA -11 /* ¥«¥¿¥«¥Ê */ +/* ¿ô»ú */ +#define NUM_HAN -2 /* Ⱦ³Ñ¿ô»ú */ /* ÆÉ¤ß¤Î¤Þ¤Þ */ +#define NUM_ZEN -12 /* Á´³Ñ¿ô»ú */ /* £±£²£³ */ +#define NUM_KAN -13 /* ´Á¿ô»ú */ /* °ìÆó»° */ +#define NUM_KANSUUJI -15 /* ´Á¿ô»ú */ /* É´Æó½½»° */ +#define NUM_KANOLD -16 /* ´Á¿ô»ú */ /* °íÉ´Æõ½¦»² */ +#define NUM_HANCAN -17 /* Ⱦ³Ñ¿ô»ú */ /* 1,234 */ +#define NUM_ZENCAN -18 /* Á´³Ñ¿ô»ú */ /* £±¡¤£²£³£´ */ +/* ±Ñ¿ô */ +#define ALP_HAN -4 /* Ⱦ³Ñ */ /* ÆÉ¤ß¤Î¤Þ¤Þ */ +#define ALP_ZEN -30 /* Á´³Ñ */ +/* µ¹æ */ +#define KIG_HAN -5 /* Ⱦ³Ñ */ /* ÆÉ¤ß¤Î¤Þ¤Þ */ +#define KIG_JIS -40 /* Á´³Ñ(JIS) */ +#define KIG_ASC -41 /* Á´³Ñ(ASC) */ +#endif + +#define YES 1 +#define NO 0 +#define UN_KNOWN -1 + +#define NOTHING 0 + +#endif /* JSERVER_DDEFINE_H */