~ubuntu-branches/ubuntu/maverick/kakasi/maverick

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
 * KAKASI (Kanji Kana Simple inversion program)
 * $Id: kakasi.h,v 1.6 2001/09/03 10:02:38 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.
 */

#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

/* options */
#define HEPBURN 0
#define KUNREI  1

#define MAXJISYO 10


/*
 * 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. */

   /* A part at the head of kakasi, load does only this at the time of the start. */
struct kanwa_entry {
    int index; /* It points at the offset in the file. */
    int entry; /* The registered number of words. */
};
extern struct kanwa_entry kanwa[0x60][0x60];

   /* The part of the body.
unsigned char tail;         If there is an okurigana, if it is not here, '0'.
unsigned char kanji_length; The entire length of the part of the kanji, a character at the head, '\0' of the end aren't contained.
unsigned char kanji[];      The body of the kanji.
unsigned char yomi_length;  The entire length of the part of the reading, '\0' of the end aren't contained.
unsigned char yomi[];       The body of the reading.
*/


/*
 * global variables.
 */

extern int input_term_type;

extern int input_GL;
extern int input_GR;
extern int input_G[5];

extern int output_term_type;

extern int output_GL;
extern int output_GR;
extern int output_G[5];

/* options */
extern int romaji_type;
extern int romaji_capitalize;
extern int romaji_upcase;
extern int bunkatu_mode;
extern int heiki_mode;
extern int furigana_mode;
extern int cr_eat_mode;
extern int separator_out;
#ifdef WAKATIGAKI
extern int wo_mode;
#endif /* WAKATIGAKI */


/*
 * prototype declarations
 */

/* a2.c */
extern int a2j PARAMS((Character *c, Character *n));
extern int a2E PARAMS((Character *c, Character *n));

/* g2.c */
extern int g2a PARAMS((Character *c, Character *n));
extern int g2j PARAMS((Character *c, Character *n));
extern int g2E PARAMS((Character *c, Character *n));

/* j2.c */
extern int j2a PARAMS((Character *c, Character *n));
extern int j2E PARAMS((Character *c, Character *n));

/* k2.c */
extern int k2a PARAMS((Character *c, Character *n));
extern int k2j PARAMS((Character *c, Character *n));
extern int k2K PARAMS((Character *c, Character *n));
extern int k2H PARAMS((Character *c, Character *n));

/* ee2.c */
extern int E2a PARAMS((Character *c, Character *n));
extern int E2j PARAMS((Character *c, Character *n));

/* hh2.c */
extern int H2a PARAMS((Character *c, Character *n));
extern int H2j PARAMS((Character *c, Character *n));
extern int H2K PARAMS((Character *c, Character *n));
extern int H2k PARAMS((Character *c, Character *n));
#ifdef WAKATIGAKI
extern int H2H PARAMS((Character *c, Character *n));
#endif /* WAKATIGAKI */

/* jj2.c */
extern int J2H PARAMS((Character *c, Character *n));
extern int J2a PARAMS((Character *c, Character *n));
extern int J2j PARAMS((Character *c, Character *n));
extern int J2k PARAMS((Character *c, Character *n));
extern int J2K PARAMS((Character *c, Character *n));

/* kk2.c */
extern int K2a PARAMS((Character *c, Character *n));
extern int K2j PARAMS((Character *c, Character *n));
extern int K2H PARAMS((Character *c, Character *n));
extern int K2k PARAMS((Character *c, Character *n));
#ifdef WAKATIGAKI
extern int K2K PARAMS((Character *c, Character *n));
#endif /* WAKATIGAKI */

/* Other prototypes */

/* kanjiio.c */
extern void getkanji PARAMS((Character *c));
extern void putkanji PARAMS((Character *c));
extern void ungetkanji PARAMS((Character *c));
extern int term_type_str PARAMS((char *str));
extern void set_input_term PARAMS((int type));
extern void set_output_term PARAMS((int type));
#ifdef LIBRARY
extern void putcharpbuf PARAMS((int c));
#endif /* LIBRARY */

/* 78_83.c */
extern void exc78_83 PARAMS((Character *c));

/* itaiji.c */
extern void mkitaijitbl PARAMS((void));
extern void itaijiknj PARAMS((int *c1, int *c2));

/* dict.c */
extern void init_jisyo PARAMS((void));
extern void add_jisyo PARAMS((char *filename));
extern void init_kanwa PARAMS((void));
extern void add_kanwa PARAMS((int c1, int c2));

/* hh2.c */
extern int H2rom PARAMS((Character *c, Character *n, int type));
/* kk2.c */
extern int K2rom PARAMS((Character *c, Character *n, int type));

#endif /* _KAKASI_H */