1 /*
2  * $Id: rk_spclval.h,v 1.2 2001/06/14 18:16:10 ura Exp $
3  */
4 
5 /*
6  * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
7  * This file is part of FreeWnn.
8  *
9  * Copyright Kyoto University Research Institute for Mathematical Sciences
10  *                 1987, 1988, 1989, 1990, 1991, 1992
11  * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
12  * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
13  *
14  * Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.jp>
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 2, or (at your option)
19  * any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with GNU Emacs; see the file COPYING.  If not, write to the
28  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29  *
30  * Commentary:
31  *
32  * Change log:
33  *
34  * Last modified date: 8,Feb.1999
35  *
36  * Code:
37  *
38  */
39 /*      Version 3.0
40  */
41 #ifndef EOLTTR
42 
43 typedef unsigned int letter;    /* ʸ���ϰ��̤ˤ��η���ɽ�� */
44 typedef unsigned char uns_chr;
45 
46 typedef unsigned char modetyp;
47 #define LTRHUG  (~(0xff000000))
48         /* ����ɽ�� �ڤӵ�ʸ���������letter�μ����������� */
49 
50 
51         /* �ʲ�����������ͤϡ��Ǿ�̥Х��Ȥ�255�Ǥʤ���Фʤ�ʤ���
52            �����Τ��������˽Ф�Τ� EOLTTR��CHMSIG��NISEBP��LTREOF��
53            REDRAW�ʵ��ǥ꡼�ȤȤ���NISEDL��Ȥ�����NISEDL��ˡ� */
54 
55 #define EOLTTR  (0xffffffff)    /* ʸ����ν�ü��ɽ�������� */
56                         /* �������Ϥ����ä���ɬ�����������ɤ��֤����֤ˤ���
57                            �����ȡ��ä��֤��٤���Τ��ʤ����Ϥ�����֤��� */
58 #define ERRCOD  (EOLTTR-1)      /* (error)��ɽ������������ */
59 #define CHMSIG  (EOLTTR-2)      /* �⡼�ɥ�������ɽ�������� */
60 #define NISEBP  (EOLTTR-3)      /* ���顼�ٹ��Ѥε�BEL������ */
61 #define VARRNG  (EOLTTR-4)      /* �Ѱ褬��Ĥ�ʸ���δ֤Ǥ���Τ������������� */
62 #define UNUSDC  (EOLTTR-5)      /* �ޥå����Ԥ����뤿������������� */
63 #define REASIG  (EOLTTR-6)      /* ɽ�κ�������׵᤹�뤿������������� */
64 #define URBFCL  (EOLTTR-7)      /* ΢�Хåե�������Ū���ꥢ���׵᤹������������ */
65 #define LTREOF  (EOLTTR-8)      /* romkan_next()��Ʊgetc()��EOF��������֤����
66                                    �ʤǤ����EOF��Ʊ���ˤ��������ġ� */
67 #define REDRAW  (EOLTTR-9)      /* Wnn���Ѵ��Ԥ�redraw���׵᤹���ü쥳���� */
68 #define NISEDL  (EOLTTR-10)     /* ���ǥ꡼�ȤȤ��������Ȥ������ͤΤ���˽���
69                                    ���줿�����â�����Ȥ������ʤ���лȤ�ʤ��Ƥ�
70                                    �����ˡ��ѿ�nisedl�˥��åȤ��ƻȤ� */
71 #define SENDCH  (EOLTTR-11)     /* �Ѵ��Хåե������ʤ顢����ʸ����̵����
72                                    �������褦Wnn���׵᤹�륨�������ץ����ɡ� */
73 
74 
75         /* romkan_init3()�ΰ����Υե饰�˻Ȥ��� */
76 
77 #define RK_CHMOUT 01            /* �⡼�ɥ��������Τ餻�륳���ɤ��֤����� */
78 #define RK_KEYACK 02            /* ����������Ф�ɬ���������֤��� */
79 #define RK_DSPNIL 04            /* �⡼��ɽ��ʸ����̵����λ��˶�ʸ������֤����ʥǥ�
80                                    ����Ȥ�NULL�ˡ��ߴ����ݻ��Τ��� */
81 #define RK_NONISE 010           /* �������ɤ�Ф��ʤ��褦�ˤ��뤫 */
82 #define RK_REDRAW 020           /* Wnn���ü�ե饰��redraw�ѤΥե饰��Ф����ɤ����� */
83 #define RK_SIMPLD 040           /* delete��ư���ñ��ˤ��뤫 */
84 #define RK_VERBOS 0100          /* ���Ѥ���ɽ�ΰ������ݡ��Ȥ��뤫 */
85 
86 
87         /* �����ɤζ��̤˻Ȥ��ޥ��� */
88 
89 #define HG1BIT  (0x80000000)    /* �Ǿ�̥ӥåȤ��� */
90 #define SHUBET(X) ((letter)(X) >> 24)
91                               /* ����ɽ���ǡ��壱�Х��Ȥ����ɽ���˻ȤäƤ� */
92 #define LWRMSK(X) ((X) & ~(0xff000000)) /* �壱�Х��Ȥ������ */
93 #define LWRCUT(X) ((X) &= ~(0xff000000))        /* �壱�Х��Ȥ������ */
94 
95 #define is_HON(X) (SHUBET(X) == 0)      /* ��ʪ��ʸ���� */
96 #define NAIBEX(X) ((int)0 < SHUBET(X) && (int)SHUBET(X) < 0x80) /* ����ɽ�������ͤ� */
97 #define isNISE(X) (SHUBET(X) == 0x80)   /* ��ʪ��ʸ�����ʺǾ�̥ӥåȤ�Ω�ġ� */
98 #define isSPCL(X) (SHUBET(X) == 0xff)   /* rk_spcl_val.h�����������ͤ��ɤ��� */
99  /* NISEDL�ʤɤ�ޤ᤿����ʸ���Ǥ��뤫�ɤ�����Ƚ�ꤹ��ˤϡ�~is_HON(X) ����
100     isNISE(X) || isSPCL(X) �Ȥ���Ƚ�ꤷ�ʤ��Ȥ����ʤ��� */
101 
102 #define toNISE(X) ((X) | HG1BIT)
103 #define to_HON(X) ((X) & ~HG1BIT)
104 
105  /* �ߴ����Τ����Ѱդ��Ƥ�����̾ */
106 #define REALCD(X) is_HON(X)
107 #define NISECD(X) isNISE(X)
108 #define SPCLCD(X) isSPCL(X)
109 
110 #ifndef SS2
111 #define SS2     0x8E
112 #endif
113 #ifndef SS3
114 #define SS3     0x8F
115 #endif
116 
117         /** rk_bltinfn.c ���䴰�Τ���Υޥ���
118             �ʰ�����ʣ����ɾ�������Τ�¿���Τ���ա�*/
119 
120 #define HKKBGN  (SS2 * 0x100 + 0xA1)    /* Ⱦ�ѥ��ʤζ��� */
121 #define HKKEND  (SS2 * 0x100 + 0xDF)    /*     ��    Ⱦ���� */
122 #define HIRBGN  (0xA4A1)        /* �� */
123 #define HIREND  (0xA4F3) /* �� */       /* �Ҥ餬�ʡ�"��"��"��" */
124 #define KATBGN  (0xA5A1)        /* �� */
125 #define KATEND  (0xA5F6) /* �� */       /* �������ʡ�"��"��"��"��"��" */
126 
127 #define _to_kata(l) ((l) + (KATBGN - HIRBGN)) /** �������ʤء���������¡�*/
128 #define _to_hira(l) ((l) - (KATBGN - HIRBGN)) /** �Ҥ餬�ʤء���������¡�*/
129 #define is_hira(l) ((int)HIRBGN <= (int)(l) && (int)(l) <= (int)HIREND) /** �Ҥ餬�ʤ��� */
130 #define is_kata(l) ((int)KATBGN <= (int)(l) && (int)(l) <= (int)KATEND) /** �������ʤ��� */
131 #define is_kata2(l) ((int)_to_kata(HIRBGN) <= (int)(l) && (int)(l) <= (int)_to_kata(HIREND))
132                                 /** �б�����Ҥ餬�ʤΤ��륫�����ʤ��� */
133 #define to_kata(l) (is_hira(l) ? _to_kata(l) : (l)) /** �������ʤ� */
134 #define to_hira(l) (is_kata2(l) ? _to_hira(l) : (l))
135                         /** �Ҥ餬�ʤء��֥������פϥ������ʤΤޤ޻Ĥ롣*/
136 #define is_hankata(l) ((int)HKKBGN <= (int)(l) && (int)(l) <= (int)HKKEND)
137                                 /** Ⱦ�ѥ��ʡʶ����ʤɤ�ޤ�ˤ��� */
138 
139 
140 
141         /* ����¾�Υޥ���ؿ����ʰ�����ʣ����ɾ�������Τ�¿���Τ���ա� */
142 
143 #define numberof(array) (sizeof(array) / sizeof(*array))
144 
145  /* �ݥ�����letter����������ؤ�äƤ�����letter *lp */
146 #define totail(lp) {while(*(lp) != EOLTTR) (lp)++;}
147 
148  /* ʸ����ؤΥݥ�������ʸ����κǸ����ء�totail��char�ǡ�char *sp */
149 #define strtail(sp) {while(*(sp)) (sp)++;}
150 
151         /* ������romkan_init3 */
152 #define romkan_init4(delchr, nisedl, flg) \
153         romkan_init3(delchr, nisedl, EOLTTR, flg)
154 
155 #define romkan_init5(delchr, flg) \
156         romkan_init4(delchr, toNISE(delchr), flg)
157 
158 
159 #endif /* of ifndef EOLTTR */
160