1 /* Copyright 1994 NEC Corporation, Tokyo, Japan.
2  *
3  * Permission to use, copy, modify, distribute and sell this software
4  * and its documentation for any purpose is hereby granted without
5  * fee, provided that the above copyright notice appear in all copies
6  * and that both that copyright notice and this permission notice
7  * appear in supporting documentation, and that the name of NEC
8  * Corporation not be used in advertising or publicity pertaining to
9  * distribution of the software without specific, written prior
10  * permission.  NEC Corporation makes no representations about the
11  * suitability of this software for any purpose.  It is provided "as
12  * is" without express or implied warranty.
13  *
14  * NEC CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
16  * NO EVENT SHALL NEC CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
18  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19  * OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20  * PERFORMANCE OF THIS SOFTWARE.
21  */
22 
23 /* LINTLIBRARY */
24 /* $Id: RKintern.h,v 1.15.2.2 2003/12/27 17:15:24 aida_s Exp $ */
25 #ifndef		_RKintern_h
26 #define		_RKintern_h
27 
28 #define BUNMATU
29 
30 /* BUNMATU �ޥ���� define ����ȡ���Φ��ü�ʳص�����ر���ؾ���ʳ�
31    ����ʤ�ƣ���¹�(fujieda@jaist.ac.jp)�������ؤ���ʡ٤Τ��ʴ�����
32    ����Ψ����Τ���ˡ�1994 �ߤ��Ȥ߹������ʸ��������פ�ͭ���ˤʤ��
33    ��������ˤ��ʸ�����ˤ�������ʤ�ʸ����ʸ�������˽Ф���뤳�Ȥ�
34    �ʤ��ʤ��Ѵ���Ψ�����夷�ޤ������Υ����ɤ����Ʋ������ޤ���ƣ�ޤ�
35    ��˴��դ��ޤ��� */
36 
37 #define LOGIC_HACK
38 /* ƣ�ޡ��ʣ��ɣӣԤΥϥå���ͭ���ˤ��� */
39 
40 #define EXTENSION_NEW
41 
42 #include "cannaconf.h"
43 
44 #if !defined(WINDOWS_STYLE_FILENAME) && !defined(USE_OBSOLETE_STYLE_FILENAME)
45 #define WINDOWS_STYLE_FILENAME
46 #endif
47 
48 #ifdef __CYGWIN32__
49 #define USE_MALLOC_FOR_BIG_ARRAY
50 #endif
51 
52 typedef unsigned short Wchar;
53 
54 #define RK_INTERNAL
55 typedef Wchar cannawc;
56 #define CANNAWC_DEFINED
57 #define CANNA_NEW_WCHAR_AWARE
58 #include "canna/RK.h"
59 
60 #include "ccompat.h"
61 
62 #include <unistd.h>
63 #ifdef HAVE_FCNTL_H
64 # include <fcntl.h>
65 #endif
66 
67 #ifndef AIXV3
68 #include	<ctype.h>
69 #endif
70 
71 #ifdef NOT_DEF
72 #include <errno.h>
73 int	Rk_errno;
74 #define RkSetErrno(number) {\
75     if (number)
76 	Rk_errno = (number);
77     else
78 	Rk_errno = errno;
79 }
80 #else
81 #define RkSetErrno(number)
82 #endif
83 
84 #ifndef RK_DEBUG
85 #define	RkDebug(fmt, p, q, r)
86 #endif
87 #ifdef __STDC__
88 #define QUOTE(s) #s
89 #else
90 #define QUOTE(s) "s"
91 #endif
92 #ifdef NDEBUG
93 #define RK_ASSERT(expr) ((void)0)
94 #else
95 #define RK_ASSERT(expr) ((expr) ? (void)0 : RkAssertFail(\
96 	    __FILE__, __LINE__, QUOTE(expr)))
97 #endif /* NDEBUG */
98 
99 #define	MKDIR_MODE	0775
100 #define	CREAT_MODE	0664
101 
102 typedef unsigned char	*pointer;
103 typedef unsigned char   Wrec;
104 
105 #define WMASK		(~0x0303)
106 #define RK_WMASK	WMASK
107 #define WNILL		(unsigned short)0x0000
108 #define WNULL		(unsigned short *)0
109 #define	us_iscodeG0(wc)	(((wc) & 0x8080) == 0x0000)
110 #define	us_iscodeG1(wc)	(((wc) & 0x8080) == 0x8080)
111 #define	us_iscodeG2(wc)	(((wc) & 0x8080) == 0x0080)
112 #define	us_iscodeG3(wc)	(((wc) & 0x8080) == 0x8000)
113 
114 #define RK_SS2 (unsigned char)0x8e
115 #define RK_SS3 (unsigned char)0x8f
116 
117 #define RK_ESC_CHAR ((Wchar)'\\')
118 
119 #define	euc_iscodeG0(c)	isascii(c)
120 #define	euc_iscodeG1(c)	(((c) & 0x80) && !((c) & RK_SS2) && !((c) & RK_SS3))
121 #define	euc_iscodeG2(c)	((c) & RK_SS2)
122 #define	euc_iscodeG3(c)	((c) & RK_SS3)
123 
124 /* RkUnion
125  *	private data at each class.
126  */
127 typedef union _rkunion {
128   pointer	ptr;
129   long		var;
130   unsigned long	uvar;
131 } RkUnion;
132 
133 /*	kana kanji henkan jisho
134  *		MS	870713
135  *
136  *	+---------------+
137  *	|     HEADER	|	jisho header (256 byte)
138  *	+---------------+256L
139  *	|		|	yomigana no index
140  *	|   DIRECTORY	|
141  *	+---------------+
142  *	|		|	tango jouhou
143  *	|		|		yomi, {(row, col), tsuduri, hindo}...
144  *	|     WORD	|
145  *	|		|
146  *	|		|
147  *	+---------------+
148  *	|		|	setuzoku jouhou(swd nomi)
149  *	|   CONJUNCT	|		row...
150  *	|		|
151  *	+---------------+
152  */
153 
154 /* BASIC TYPE:
155  *	subete no data ha MSB first(Motorolla order) de tenkai sareru
156  *		unsigned char	w
157  *		unsigned short	wx
158  *		unsigned long	wxyz
159  */
160 #define LOMASK(x)	((x)&255)
161 /* #include	"type.h" */
162 /*
163  * 	byte stream <=> long or short
164  */
165 #define l_to_bst4(src, dst) {\
166     dst[0] = (unsigned char)(((long)(src) >> 24) & 0xff);\
167     dst[1] = (unsigned char)(((long)(src) >> 16) & 0xff);\
168     dst[2] = (unsigned char)(((long)(src) >> 8) & 0xff);\
169     dst[3] = (unsigned char)( (long)(src) & 0xff);\
170 }
171 
172 #define bst4_to_l(src) \
173     (unsigned long)(((long)(src)[0] << 24) |\
174 		    ((long)(src)[1] << 16) |\
175 		    ((long)(src)[2] << 8) |\
176 		     (long)(src)[3])
177 
178 #define l_to_bst3(src, dst) {\
179     dst[0] = (unsigned char)(((long)(src) >> 16) & 0xff);\
180     dst[1] = (unsigned char)(((long)(src) >> 8) & 0xff);\
181     dst[2] = (unsigned char)( (long)(src) & 0xff);\
182 }
183 
184 #define bst3_to_l(src) \
185     (unsigned long)(((long)(src)[0] << 16) | ((long)(src)[1] << 8) | (long)(src)[2])
186 
187 #define s_to_bst2(src, dst) {\
188     (dst)[0] = (unsigned char)((src >> 8) & 0xff);\
189     (dst)[1] = (unsigned char)(src & 0xff);\
190 }
191 
192 #define	bst2_to_s(src) \
193     (unsigned short)(((unsigned short)(src)[0] << 8) | (src)[1])
194 
195 #define l_to_bst	l_to_bst4
196 #define bst_to_l	bst4_to_l
197 #define s_to_bst	s_to_bst2
198 
199 #define	L4TOL(l4)\
200 	(((((((unsigned long)(l4)[0]<<8)|(l4)[1])<<8) | (l4)[2])<<8)|(l4)[3])
201 #define	L3TOL(l3)\
202 	(((((unsigned long)(l3)[0]<<8)|(l3)[1])<<8) | (l3)[2])
203 #define	S2TOS(s2)	(((unsigned short)(s2)[0]<<8)|(s2)[1])
204 #define	LTOL4(l, l4)	{\
205 	(l4)[0] = LOMASK((l)>>24); (l4)[1] = LOMASK((l)>>16);\
206 	(l4)[2] = LOMASK((l)>> 8); (l4)[3] = LOMASK((l));\
207 	}
208 #define	LTOL3(l, l3)	{\
209 			   (l3)[0] = LOMASK((l)>>16);\
210 			   (l3)[1] = LOMASK((l)>> 8);\
211 			   (l3)[2] = LOMASK((l));\
212 			}
213 #define	STOS2(s, s2)	{\
214 			   (s2)[0] = LOMASK((s)>> 8);\
215 			   (s2)[1] = LOMASK((s));\
216 			 }
217 
218 #define RkNumber(ary) (sizeof(ary)/sizeof(ary[0]))
219 
220 #define rk_isdigit(c) (!((c) & ~0xff) ? isdigit((int)(c)) : 0)
221 #define rk_isascii(c) (!((c) & ~0xff) ? isascii((int)(c)) : 0)
222 #define rk_isspace(c) (!((c) & ~0xff) ? isspace((int)(c)) : 0)
223 
224 /* WARNING: ������¤��Ѥ���Ȥ���Hdrtag����դ��뤳��! */
225 enum {
226   /* These must be first 5 tags in this order for new (>=300702L) dic */
227   HD_MAG, /* mandatory */
228   HD_SIZ, /* mandatory */
229   HD_HSZ, /* mandatory */
230   HD_CURV, /* mandatory for new dic, but must not exist in 300000L dic */
231   HD_CMPV, /* mandatory for new dic, but must not exist in 300000L dic */
232   /* Some of them are optional */
233   HD_VER, /* only for 300000L format, must not exist in new format */
234   HD_TIME, /* mandatory */
235   HD_REC, /* mandatory */
236   HD_CAN, /* mandatory */
237   HD_L2P, /* mandatory except for freq file */
238   HD_L2C, /* mandatory except for freq file */
239   HD_PAG, /* mandatory except for freq file */
240   HD_LND, /* mandatory except for freq file */
241   HD_SND, /* mandatory except for freq file */
242   HD_DROF, /* mandatory except for freq file */
243   HD_PGOF, /* mandatory except for freq file */
244   HD_DMNM, /* mandatory */
245   HD_CODM, /* mandatory only in freq file, otherwise not referred */
246   HD_LANG, /* record is set but not referred */
247   HD_WWID, /* record is set but not referred */
248   HD_WTYP, /* record is set but not referred */
249   HD_COPY, /* optional */
250   HD_NOTE, /* optional */
251   HD_TYPE, /* record is set but not referred */
252   /* Tags below must not appear in 300000L dic */
253   HD_CRC, /* optional */
254   HD_GRAM, /* optional */
255   HD_GRSZ, /* optional */
256   HD_MAXTAG
257 };
258 
259 #define HD_TAGSIZ	4
260 #define HD_MIN_TAGSIZ	(3 * HD_TAGSIZ)
261 #define HD_VERSION(hd) (((hd)->flag[HD_CURV] == -1) \
262     ? (hd)->data[HD_CURV].var : 0x300000L)
263 
264 struct HD {
265     RkUnion	data[HD_MAXTAG];
266     int		flag[HD_MAXTAG];
267 };
268 
269 #define JMWD	1
270 #define JSWD	2
271 #define JPRE	3
272 #define JSUC	4
273 
274 #define BYTE2		2
275 #define BYTE4		4
276 
277 #define DEF_WWID	2
278 
279 #define WORD_NODE		(0x80)
280 #define LAST_NODE		(0x40)
281 #define BIT_UNIT		8
282 
283 #define NOLOCALE	"NOLOCALE"
284 #define DEF_WTYP	"W16 "
285 #define DEF_TYPE	"jmwd"
286 
287 #define	RK_PG_LOADED		0x01
288 #define	RK_PG_USED		0x02
289 
290 #define	isLoadedPage(p)		((p)->flags & RK_PG_LOADED)
291 #define	isUsedPage(p)		((p)->flags & RK_PG_USED)
292 
293 #define	thisPWO(p)	(unsigned long)((((unsigned long ) *(p) << 6) & 0x3fc0) \
294 				   | ((*((p)+1) >> 2) & 0x3f))
295 #define	thisLVO(p)	(unsigned long)((((unsigned long) *((p)+1) << 13) & 0x6000) \
296 				   | (((unsigned long) *((p)+2) << 5) & 0x1fe0) \
297 				   | ((*((p)+3) >> 3) & 0x1f))
298 #define	thisCSN(p)	(unsigned long)((((unsigned long) *((p)+3) << 8) & 0x700) | *((p)+4))
299 
300 struct NP {
301   unsigned	ndsz;
302   unsigned	lnksz;
303   unsigned long	lvo;
304   unsigned long	csn;
305   unsigned	flags;
306   int		count;
307   unsigned char	*buf;
308 };
309 
310 /*
311  * definition of off_t added by Kenji Rikitake 27-MAR-1995
312  *
313  * Include necessary headers for lseek() here.
314  * note: sys/types.h only applies for BSD/OS 2.0.
315  * Use the appropriate files for other systems.
316  */
317 
318 #include <sys/types.h>
319 
320 struct ND {
321   unsigned long time;
322   unsigned long crc;
323   int           crc_found;
324   unsigned long rec;
325   unsigned long can;
326   unsigned long sz;
327   off_t         doff;
328   unsigned long drsz;
329   unsigned long pgsz;
330   unsigned long ttlpg;
331   int           fd;
332   unsigned char *buf;
333   struct NP     *pgs;
334   long		version;
335 };
336 
337 /* HEADER:
338  *	unsigned char	magic[2];
339  *	unsigned char	pakeuc;		key ga asshuku sareteiru
340  *	unsigned char	name[];		jisho mei
341  *					xxx.mwd xxx.swd xxx.pre xxx.suc
342  *					\n de shuuryou
343  */
344 #define		ND_HDMAGICSIZ		4
345 #define		ND_HDRSIZ		256		/* header size */
346 #if 0 /* iranai? */
347 #define		ND_HDRMAG (('H'<<8)|'N')/* magic number */
348 #endif
349 /* jisho class */
350 #define		ND_MWD		RK_MWD
351 #define		ND_SWD		RK_SWD
352 #define		ND_PRE		RK_PRE
353 #define		ND_SUC		RK_SUC
354 #define		ND_EMP		4		/* kuugo */
355 #define		ND_OPN		5		/* hiraki kakko */
356 #define		ND_CLS		6		/* toji kakko */
357 #define		ND_PUN		7		/* kutouten */
358 
359 
360 struct wcand {
361     unsigned char	*addr;
362     unsigned short	row;
363     unsigned char	klen;
364 };
365 
366 struct RkXwrec {
367     unsigned		ncands, wrecsz;
368     unsigned char	*wrec;
369 };
370 
371 /* DIRECTORY:
372  *	xxxx NODE....
373  *	    xxxx niha, DIRECTORY no ookisa ga byte de hairu.
374  *
375  *	4 byte no NODE kara kousei
376  *
377  *	+--+--+--+--+
378  *	|KY|X1 X2 X3|
379  *	+--+--+--+--+
380  *	 !  !
381  *	 !  +-------------	X1
382  *	 !			word record/directory offset
383  *	 !			 (X1<<16) | (X2<<8) | (X3)
384  *	 !
385  *	 +----------------	yomi (ascii/euc hiragara lower byte)
386  *				0
387  */
388 #define	ND_NODSIZ	6		/* node size in byte */
389 #define	ND_DSPENT	189		/* #entry in the dispatch table */
390 /* mask values */
391 #define	ND_OFFMASK	0x00ffffffL	/* offset mask (24 bit) */
392 /* X1 bit flags */
393 
394 #define	ND_NULLOFF	ND_OFFMASK	/* tango ga sakujo sareta */
395 #define	VMASK		0x7fffffL
396 
397 /* predicators */
398 #define	ND_LAST		0x0080L	/* directory no saishuu node (entry) */
399 #define	ND_WORD		0x0040L	/* offset ha tango joushou wo sasu */
400 #define	ND_RFU		0x0020L	/* Mishiyou (offset ni tuika ?) */
401 #define	ISLASTNOD(flag)	((flag)&ND_LAST)
402 #define	ISWORDNOD(flag)	((flag)&ND_WORD)
403 
404 
405 #define HN (unsigned long) 256
406 #define HashFunc(key) (unsigned long)((key) % HN)
407 
408 struct WRT{
409        unsigned long sz;
410        unsigned long cs;
411        unsigned long frst;
412        unsigned long tm;
413        unsigned char *buf;
414 };
415 
416 struct CTdata{
417        struct CTdata *next;
418        unsigned long ct[2];
419 };
420 
421 struct RUT{
422        unsigned long sz;
423        unsigned long cs;
424        unsigned long frst;
425        unsigned long tm;
426        struct CTdata **dp;
427 };
428 
429 #define a_csn(x)  (unsigned long) \
430 (((((unsigned long)(x)[0] << 8) | (x)[1]) << 4) | (((unsigned long)(x)[2] & 0xf0) >> 4))
431 
432 #define a_tick(x) (unsigned long) \
433 ((((((unsigned long)(x)[2] & 0x0f) << 8) | (unsigned long)(x)[3]) << 8) | (x)[4])
434 
435 #define WriteVal(csn, tick, buf){\
436    (buf)[0] = (unsigned char)(((csn)>>12) & 0xff);\
437    (buf)[1] = (unsigned char)(((csn)>>4) & 0xff);\
438    (buf)[2] = (unsigned char)((((csn)<< 4) & 0xf0)|(((tick)>>16) & 0x0f));\
439    (buf)[3] = (unsigned char)(((tick)>>8) & 0xff);\
440    (buf)[4] = (unsigned char)((tick) & 0xff);\
441 }
442 
443 #define WriteCT(csn, tick, arr){\
444    (arr)[0] = (unsigned long) (csn);\
445    (arr)[1] = (unsigned long) (tick);\
446 }
447 
448 #define freeWRT(wruc) {\
449      free(wruc->buf);\
450      free(wruc);\
451 }
452 
453 #define RKmaxDN (unsigned long) 0xff
454 #define RKmaxCN (unsigned long) 0xffffff
455 
456 
457 /* WORD:
458  *	xxxx {yomi nkouho {flags row col freq kouho}...}...
459  *	    xxxx niha, WORD no ookisa ga byte de hairu.
460  *
461  * tango:
462  *	unsigned char	yomi[];			yomigana
463  *	unsigned char	nkouho;			kouho no kazu
464  *		unsigned char	flags;		kouho no nagasa + flags
465  *		unsigned char	row;		kouho no row bangou
466  *		unsigned char	col;		kouho no col bangou
467  *		unsigned char	freq		kouho no shiyou hindo
468  *		unsigned char	kouho[];
469  *
470  */
471 
472 #define	NW_PREFIX	2	/* the length of kouho prefix in byte */
473 
474 /* flags */
475 #define	NW_LEN		0x7f	/* kouho no nagasa ( zenkaku 31 moji) */
476 #ifdef LOGIC_HACK
477 #define NW_RCBITS	9	/* bits of maximum rowcol number */
478 #endif
479 
480 #define	candlen(flag)	((flag) & NW_LEN)
481 #define wordlen(flag)	((candlen(flag) << 1) + NW_PREFIX)
482 /* RkWcand
483  *	data structure used to handle the word record
484  */
485 typedef struct RkWcand {
486     Wrec		*addr;		/* houho sentou address */
487     short		rcnum;		/* row column number */
488     unsigned char	klen;		/* kouho no nagasa */
489 } Candidate;
490 
491 /* CONJUNCT:
492  *	xxxx rrcc
493 		row_0  row_1  ... row_rr-1
494  *		name_0 name_1 ... name_rr-1
495  *	    xxxx niha, CONJUNCT no ookisa ga byte de hairu.
496  *	    rr, cc ha sorezore, row, col no kosuu wo simesu.
497  *	    row_i ha byte kyoukai kara hajimaru cc bit karanaru bit retu
498  *	    name_i ha EOS de owaru mojiretu
499  *
500  */
501 
502 struct RkKxGram;
503 struct RkGramIterator {
504     int			rowcol;
505 };
506 #define RkNextGram(iter) ((void)++(iter)->rowcol)
507 
508 /* hinshi no bunrui
509  *	renbunsetu henkan de siyou sareru
510  */
511 #define	IsShuutan(g, r)		RkTestGram(g, r, 0)
512 #ifdef BUNMATU
513 #define	IsBunmatu(g, r)		RkTestGram(g, r, 1)
514 #endif
515 
516 /* RkGram -- grammatical information
517  */
518 
519 struct RkGram {
520   int			refcount; /* reference counter */
521   struct RkKxGram	*gramdic; /* grammar dictionary */
522   int	 		P_BB, P_NN, P_T00, P_T30, P_T35; /* hinshi codes */
523 #ifdef LOGIC_HACK
524   int			P_KJ; /* tankanji */
525 #endif
526   int			P_Ftte; /* FIXME: should go away */
527 };
528 
529 extern struct RkGram SG;
530 
531 
532 /* ncache
533  *	tango record no caching list
534  *  ncache ha, jisho kara itido yomikomareta tango record wo cache kanri suru
535  * tameno jouhou kouzou dearu.
536  *  tango record ha key (dicnum, address) de skibetu sareru.
537  *  taiou suru tango record ha nc_word ni yori simesareru HEAP ryouiki ni aru.
538  *	+------------+
539  *	| nc_dicnum  |	key part
540  *	| nc_address |
541  *	+------------+
542  *	|  nc_word   |	value part
543  *	+------------+
544  *  ncache ha 2tu no souhoukou list hash/free list ni tunagareru.
545  *  (* koreha UNIX i/o system no buffer cache kara hint wo eta *)
546  *  hash list ha key no kensaku wo kousoku ka suru tame ni shiyou sareru.
547  *  free list ha kaihou sareta cache ga tunagareru.
548  */
549 struct ncache	{
550     struct ncache	*nc_hnext;	/* hash list */
551     struct ncache	*nc_hprev;
552     struct ncache	*nc_anext;	/* free list */
553     struct ncache	*nc_aprev;
554     Wrec		*nc_word;	/* heap jouno tango record */
555     struct DM		*nc_dic;	/* yomikomareta jisho */
556     unsigned short	nc_flags;
557     unsigned long	nc_count;	/* word karano sanshou dosuu */
558     long		nc_address;	/* word record no file address */
559 };
560 /* flags */
561 #define	NC_DIRTY	1	/* word no naiyou ga henkou sareta */
562 #define	NC_ERROR	2	/* cache no naiyou ga tadasiku nai */
563 #define	NC_NHEAP	4	/* word ha heap wo sasite inai */
564 
565 struct nread {
566   struct ncache	*cache;
567   unsigned long	offset;
568   unsigned long	csn;
569   int		nk;
570 };
571 
572 /* nword
573  *	bunsetsu kaiseki kekka
574  * 	jisho kara no tango yomidasi kekka
575  * nword ha, jisho kara search sareta tango record wo kirokusi,
576  * bunsetsu kaiseki ni yori sakusei sareru bunsetsu tree wo hyougen suru.
577  */
578 struct nword {
579     struct ncache	*nw_cache;	/* tango record wo fukumu cache */
580     short		nw_rowcol;	/* setsuzoku  jouhou */
581     unsigned char	nw_ylen;	/* #chars in yomi */
582     unsigned char	nw_klen;	/* #chars in kanji */
583     unsigned char	nw_class;	/* word class */
584     unsigned char	nw_flags;	/* word flags (see below) */
585     unsigned char	nw_lit;		/* literal conversion */
586     unsigned long	nw_prio;	        /* kouzou ni yoru priority */  /* True ? by tamano */
587     unsigned long   nw_csn;
588     unsigned char	nw_count;	/* setsuzoku suu */
589     struct nword	*nw_left;	/* hidari ni tunagaru word */
590     struct nword	*nw_next;	/* onaji nw_len wo motu list */
591     unsigned char	*nw_kanji;	/* kanji kouho ichi/douteki na kouho */
592 /* nw_klen ha fuyou ni naru kanousei ari */
593     struct DM		*nw_freq;	/* pointer to frequncy file */
594 };
595 /*
596  * word flags
597  */
598 #define NW_MWD		0x80
599 #define NW_SWD		0x40
600 #define NW_PRE		0x20
601 #define NW_SUC		0x10
602 #define NW_LOWPRI	0x08
603 #ifdef BUNMATU
604 #define NW_BUNMATU	0x04
605 #endif
606 #define	NW_FOLLOW	0x02		/* has some words following to me */
607 #define	NW_NEVER_SPLIT	0x01		/* cannot terminate here */
608 /* accessor & predicates */
609 #define	IsFollowed(w)	((w)->nw_flags&NW_FOLLOW)
610 #define	DontSplitWord(w)	((w)->nw_flags |= NW_NEVER_SPLIT)
611 #define	CanSplitWord(w)		(!((w)->nw_flags&NW_NEVER_SPLIT))
612 #ifdef BUNMATU
613 #define	OnlyBunmatu(w)		((w)->nw_flags & NW_BUNMATU)
614 #endif
615 
616 /* conversion number */
617 #define	LIT2GRP(cn)	((cn)>>4)
618 #define	LIT2MEM(cn)	((cn)&15)
619 #define	MAKELIT(g, w)	(((g)<<4)|(w))
620 #define	MAXLIT		16
621 
622 #define	LIT_NONE	0
623 #define	LIT_NUM		1
624 #define	LIT_ALPHA	2
625 #define	LIT_HIRA	3
626 
627 /* nbun
628  *	bunsetsu queue
629  * renbunsetsu henkan kekka wo kiroku
630  */
631 struct nbun {
632     struct nword	*nb_cand;	/* kouho wo kousei suru word
633 				         * nw_next niyori sort sareru */
634     unsigned short	nb_yoff;	/* yomigana offset in buffer  */
635     unsigned short	nb_curlen;	/* current candidate length in char */
636     unsigned short	nb_maxcand;	/* number of candidates */
637     unsigned short	nb_curcand;	/* current candidate */
638     unsigned short	nb_flags;	/* ?? */
639 };
640 
641 /* DM/DF/DD
642  */
643 /* MS1214
644  *	now DM supports frequency files as well
645  */
646 typedef struct DM {
647 /* pointers for the file structure */
648     struct DM		*dm_next;
649     struct DM		*dm_prev;
650     struct DF		*dm_file;	/* ptr to the file containing this */
651 /* attributes */
652     char		*dm_dicname;
653     char		*dm_nickname;
654     unsigned		dm_class;	/* MWD/SWD/PRE/SUC */
655     unsigned		dm_flags;	/* flags */
656     unsigned char	dm_packbyte;	/* shouryaku sareta joui byte */
657 /* reference  count from MD */
658     int			dm_rcount;
659 /* setuzoku jouhou (SWD nomi) */
660     struct RkGram	*dm_gram;
661     RkUnion		dm_extdata;
662     unsigned char	*dm_qbits;	/* MS1214 gakushuu jouhou */
663 /* */
664     struct DDT		*dm_line;	/* pointer to dd line */
665     long		dm_offset;
666     struct RUT		*dm_rut;
667     struct NV		*dm_nv;
668 } DM;
669 /* flag values */
670 #define	DM_EXIST	0x01		/* member exists */
671 #define	DM_WRITABLE	(DM_EXIST << 1)	/* jisho ga write dekiru */
672 #define	DM_LOADWORD	(DM_EXIST << 2)	/* word rec wo memory ni yomi */
673 #define	DM_UPDATED	(DM_EXIST << 4)	/* member changed */
674 #define DM_READOK	(DM_EXIST << 5) /* jisho no read ken */
675 #define DM_WRITEOK	(DM_EXIST << 6) /* jisho no write ken */
676 
677 typedef struct DF {
678 /* DF doubly linked list */
679     struct DF	*df_next;
680     struct DF	*df_prev;
681     struct DD	*df_direct;	/* backward pointer to the directory */
682     struct DM	df_members;	/* the header of the dictionary */
683 /* attributes */
684     char	*df_link; /* link name of the file */
685     unsigned	df_type;	/* type of file */
686     unsigned	df_flags;	/* access mode */
687     int		df_rcount;	/* # the mounted members */
688     RkUnion	df_extdata;
689     long	df_size;
690 } DF;
691 #define	DM2TYPE(dm)	((dm)->dm_file->df_type)
692 /* jisho no shurui */
693 #define	DF_PERMDIC	0	/* file ni aru jisho */
694 #define	DF_TEMPDIC	1	/* zantei jisho */
695 #define DF_FREQDIC 	2	/* gakushuu hindo jisho MS1214 */
696 #define DF_RUCDIC 	3	/* gakushuu hindo jisho MS1214 */
697 
698 /* flag values */
699 #define	DF_EXIST	1	/* file exists */
700 #define	DF_WRITABLE	2	/* file is writable */
701 
702 /*
703  * DD
704  */
705 struct DDT	{
706    struct DDT		*ddt_next;
707    struct DDT		*ddt_prev;
708    int			ddt_status;
709    char			*ddt_spec;
710 };
711 
712 typedef struct DD {
713 /* DD doubly linked list */
714     struct DD		*dd_next;
715     struct DD		*dd_prev;
716     char		*dd_path;	/* path name of the directory */
717     char		*dd_name;	/* unique name of the directory */
718     int			dd_rcount;	/* # opened files+reference from DDP */
719     struct DF		dd_files;	/* the header of the file list */
720     unsigned		dd_flags;	/* flag */
721 /* dics.dir file */
722     struct DDT		dd_text;
723 } DD, *DDP;
724 
725 #define	DD_WRITEOK	1	/* directory is allowed to write */
726 #define DD_READOK	2
727 
728 /* MD ----------------------------------------------------------------
729  *  context ni mount sareta jisho/jisho wo mount siteiru jisho list no taiou
730  * ---------------------------------------------------------------- */
731 typedef struct MD {
732     struct MD		*md_next;	/* dictionary list */
733     struct MD		*md_prev;
734     struct DM		*md_dic;	/* jisho heno pointer */
735     struct DM		*md_freq;	/* MS1214 gakushuu jisho heno pointer */
736     int			md_flags;	/* mount flags */
737 } MD, *MDP;
738 #define	MD_WRITE	1		/* gakushuu shitei */
739 #define	MD_MPEND	2		/* mount pending */
740 #define	MD_UPEND	4		/* unmount pending */
741 
742 /* RkParam
743  *	common parameter block
744  */
745 struct RkParam {
746 /* cache */
747     struct ncache	*cache;
748     int			maxcache;
749 /* heap */
750     unsigned char	*heap;
751     int			maxheap;
752     unsigned char	*ham;
753     int			maxham;
754 /* word */
755     struct nword	*word;		/* henkyaku sareta word wo tunageru */
756     struct nword	*page;		/* word page list */
757     int			word_in_use;
758     int			page_in_use;
759 /* jisho */
760     struct DD		dd;
761     char        	*ddhome;	/* dictionary home directory */
762     struct DD		**ddpath;	/* system ddpath */
763 /* flags */
764     unsigned		flag;		/* checks initialize */
765 /* */
766 };
767 
768 extern struct RkParam SX;
769 
770 #define SX_INITED	1
771 
772 #define RK_REARRANGED	0x01
773 
774 struct NVE {
775   unsigned char	*data;
776   struct NVE	*left;
777   struct NVE	*right;
778   struct NVE	*next;
779 };
780 
781 struct NV {
782   unsigned long	sz;
783   unsigned long	tsz;
784   long		csz;
785   long		cnt;
786 /* int		lst; delete by tamano(tajima) */
787   struct NVE	head;
788   struct NVE	**buf;
789 };
790 
791 #ifdef RK_LOG
792 struct henkanlog {
793     int n;
794     char *henkan;
795     struct henkanlog *next;
796 };
797 #endif
798 
799 struct nstore {
800     Wchar		*yomi;		/* yomigana buffer */
801 #ifdef RK_LOG
802     unsigned		nblog;
803     char		**blog;
804     struct henkanlog	*hlog;
805     struct henkanlog	dmi;
806 #endif
807     unsigned		nyomi;		/* number of yomigana chars */
808     unsigned		maxyomi;	/* maximum number of yomigana chars */
809     struct nbun		*bunq;		/* ʸ�ᥭ�塼 */
810     unsigned		maxbunq;	/* saidai bunnsetu suu */
811     unsigned		maxbun;		/* saidai bunsetsu suu */
812     int			curbun;		/* ������ʸ�� */
813     int			maxxq;		/* saidai queue == bunsetu moji suu */
814     struct nqueue	*xq;		/* henkan queue */
815     struct nword	**xqh;		/* used in _RkparseBun() */
816     int			word_in_use;   	/* #words used in context */
817 };
818 
819 /* context
820  *	ncontext ha rennbunnsetu hennkann client wo seigyo suru jouhou
821  *		jisho kankyou
822  *		renbunsetsu henkan sagyou ryouiki
823  */
824 struct 	nqueue {
825     struct nword	*tree;
826     short		maxlen;
827     short		status;
828 };
829 
830 typedef struct RkContext {
831     struct nstore	*store;
832     struct MD		*md[4];		/* mwd/swd/pre/suc */
833     struct DD   	**ddpath;	/* dictionary search path */
834     struct DM   	*dmprev;	/* dictionary search path : dic */
835     struct DM   	*qmprev;	/* dictionary search path : freq */
836     unsigned long	time;		/* tic */
837     unsigned		flags;		/* context control flags */
838     unsigned long	kouhomode;	/* kana kouho mode */
839     unsigned long	*litmode;	/* literal conversion table */
840     int			concmode;	/* connect words mode */
841     int			poss_cont;	/* */
842     RkUnion		cx_extdata;	/* etc data */
843     struct NV		*nv;
844     struct RkGram	*gram;
845 } RkContext;
846 
847 /* Extension Data in DM */
848 typedef struct TD {
849     struct TN   *td_node;	/* array of node TN */
850     unsigned	td_n;		/* # effective nodes */
851     unsigned	td_max;		/* # maximum nodes in the array */
852 } TD;
853 
854 struct TW {
855   Wrec		*word;
856   unsigned long	lucks[2];
857 };
858 
859 typedef struct TN {
860   unsigned char	tn_flags;	/* type of node (see blow) */
861   Wchar		tn_key;
862   union {
863     struct TD	*tree;
864     struct TW	*word;
865   }	tn_value;				/* type specific data */
866   /* syntax sugar */
867 #define tn_tree		tn_value.tree
868 #define tn_word		tn_value.word
869 } TN;
870 /* flags  values */
871 #define	TN_WORD		1		/* is a word */
872 #define	TN_WDEF		2		/* wrec has been defined */
873 #define	TN_WDEL		4		/* wrec has been deleted */
874 #define	IsWordNode(tn)	((tn)->tn_flags&TN_WORD)
875 
876 /* td_and_n structure
877  *
878  * tupple of td and n for RkGetWordTextDic()
879  */
880 struct td_n_tupple {
881   char               *td; /* in fact this type is (struct TD *) */
882   int                n;
883   struct td_n_tupple *next;
884 };
885 
886 /* jishowo 1gyouzutu yomu tokino pointer :used in RkGetWordTextDic */
887 typedef struct _rec {
888     int                 gwt_cx;
889     unsigned char       *gwt_dicname;
890     struct td_n_tupple  *tdn;
891 } GWT;
892 
893 /* flag values */
894 #define	CTX_LIVE		1	/* allocate sareta */
895 #define	CTX_XFER		2	/* bunsetu henkann chuu */
896 #define	CTX_XAUT		4	/* jidou henkan chuu */
897 #define	CTX_XFSH	      010
898 #define	CTX_NODIC	      020	/* have never tried to mount dic */
899 
900 #define	MAX_CONTEXT		256
901 #define	INIT_CONTEXT		32
902 #define	ADD_CONTEXT		32
903 
904 #ifndef SYSTEM_DDHOME_NAME
905 #define SYSTEM_DDHOME_NAME	"canna"
906 #endif
907 
908 #define USER_DIC_DIR		"user"
909 #define GROUP_DIC_DIR		"group"
910 
911 #define	IS_LIVECTX(cx)	((cx)->flags & CTX_LIVE)
912 #define IS_XFERCTX(cx)	(IS_LIVECTX(cx) && ((cx)->flags & CTX_XFER))
913 #define IS_XAUTCTX(cx)	(IS_LIVECTX(cx) && ((cx)->flags & CTX_XAUT))
914 #define RK_CONNECT_WORD	0x01
915 #define	IsCxNum(cn) (0<=((unsigned long)cn)&&((unsigned long)cn)<now_context)
916 #define	IsLiveCxNum(cn) (IsCxNum(cn) && IS_LIVECTX(&CX[cn]))
917 #define	IsXferCxNum(cn) (IsLiveCxNum(cn) && IS_XFERCTX(&CX[cn]))
918 #define Is_Word_Connect(cx)\
919     ((cx) && (((cx)->concmode & RK_CONNECT_WORD) == RK_CONNECT_WORD))
920 #define Is_Word_Make(cx)\
921     ((cx) && (((cx)->concmode & RK_MAKE_WORD) == RK_MAKE_WORD))
922 
923 
924 /* RkDST
925  *	dictionary switch table
926  */
927 struct RkDST {
928   int (*d_open) /* jisho ga open sareta toki */
929     pro((struct DM *, char *, int, struct RkKxGram *));
930   int (*d_close) /* jisho ga close sareta toki */
931     pro((struct DM *, char *, struct RkKxGram *));
932   int (*d_search) /* jisho kara tango wo search suru */
933     pro((struct RkContext *, struct DM *, Wchar *,
934 	 int, struct nread *, int, int *));
935   int (*d_io) /* jisho he tango to cache no io */
936     pro((struct DM *, struct ncache *, int));
937   int (*d_ctl)	/* jisho koyuuno sousa */
938     pro((struct DM *, struct DM *, int, Wchar *, struct RkKxGram *));
939   int (*d_sync) /* jisho sync suru */
940     pro((struct RkContext *, struct DM *, struct DM *));
941 };
942 extern struct RkDST	_RkDST[];
943 
944 #define	_RkEnrefCache(a)	((a)->nc_count++)
945 #define	DST_PROC(dm)		_RkDST[DM2TYPE(dm)]
946 #define	DST_OPEN(dm, file, mode, gram)\
947 	(DST_PROC(dm).d_open)(dm, file, mode, gram)
948 #define	DST_CLOSE(dm, file, gram)	(DST_PROC(dm).d_close)(dm, file, gram)
949 #define	DST_SEARCH(cx, dm, k, n, cp, max, cf)\
950 	(DST_PROC(dm).d_search)(cx, dm, k, n, cp, max, cf)
951 #define	DST_IO(dm, cp, io)	(DST_PROC(dm).d_io)(dm, cp, io)
952 #define	DST_READ(dm, cp)	DST_IO(dm, cp, 0)
953 #define	DST_WRITE(dm, cp)	DST_IO(dm, cp, 1)
954 #define	DST_CTL(dm, qm, what, arg, gram)\
955 	(DST_PROC(dm).d_ctl)(dm, qm, what, arg, gram)
956 #define	DST_SYNC(cx, dm, qm)	(DST_PROC(dm).d_sync)(cx, dm, qm)
957 
958 /* ctl command */
959 #define DST_DoDefine		0	/* define words */
960 #define DST_DoDelete		1	/* delete words */
961 /* more commands (not implemented) */
962 #define DST_DoQuery		2	/* query on the dictionary info */
963 
964 #define DST_DoPrint		9999	/* print debug information */
965 
966 
967 
968 /* Internal Functions */
969 struct RkParam		*RkGetSystem();
970 struct DD		*RkGetSystemDD();
971 struct DD		*RkGetUserDD();
972 struct RkContext	*RkGetContext();
973 struct RkContext	*RkGetXContext();
974 struct RkKxGram		*RkReadGram pro((int, size_t));
975 struct RkKxGram		*RkOpenGram();
976 struct RkKxGram		*RkDuplicateGram();
977 void			RkCloseGram();
978 
979 int			_RkInitializeCache();
980 void			_RkFinalizeCache();
981 struct ncache		*_RkFindCache();
982 struct ncache		*_RkReadCache();
983 void			_RkFreeCache();
984 void		 	_RkKillCache();
985 void		 	_RkPurgeCache();
986 void			_RkDerefCache();
987 
988 int			_RkRenbun2();
989 void			_RkLearnBun();
990 
991 int			RkScanWcand();
992 int			RkUniqWcand();
993 int			RkUnionWcand();
994 int			RkSubtractWcand();
995 
996 unsigned char		*RkGetGramName();
997 int			RkGetGramNum();
998 Wchar			*RkUparseWrec();
999 Wchar			*_RkUparseWrec();
1000 Wrec			*RkParseWrec();
1001 Wrec			*RkParseOWrec();
1002 Wchar			*RkUparseGramNum();
1003 Wchar			*RkParseGramNum();
1004 
1005 /* Context */
1006 char			*allocStr();
1007 void			_RkEndBun();
1008 void			freeDF();
1009 
1010 int			_RkCandNumber();
1011 int			_RkWordLength();
1012 int			_RkCalcLog2 pro((int));
1013 int			_RkCalcUnlog2();
1014 
1015 /* etc. */
1016 
1017 #ifdef OPTIMIZE
1018 #define RkGetContext(cx_num)\
1019     ((IsCxNum(cn) && IS_LIVECTX(&CX[cn])) ? \
1020      (&CX[cx_num]) : ((struct RkContext *)0))
1021 
1022 #define RkGetXContext(cx_num)\
1023     ((IsCxNum(cn) && IS_LIVECTX(&CX[cn]) && \
1024       ((IS_XFERCTX(cx)) || (IS_XAUTCTX(cx))) ? \
1025       (&CX[cx_num]) : ((struct RkContext *)0))
1026 
1027 #define RkGetNXContext(cx_num)\
1028     ((IsCxNum(cn) && IS_LIVECTX(&CX[cn]) && \
1029       !(IS_XFERCTX(cx)) && !(IS_XAUTCTX(cx))) ? \
1030       (&CX[cx_num]) : ((struct RkContext *)0))
1031 
1032 #endif
1033 
1034 
1035 /* lang dep part */
1036 #define IS_WC_G1_HYPHEN(wc)	((wc) == 0xa1bc)
1037 #define IS_HYPHEN(wc)		(IS_WC_G1_HYPHEN(wc) || ((wc) == '-'))
1038 /* space �����Ȥ��ƻȤ����������ν�� space */
1039 #define IS_DIC_PUNCT(euc)	isspace(euc)
1040 
1041 	int		_RkRealizeDF();
1042 
1043 	struct DM	*_RkSearchDDQ();
1044 	struct DM	*_RkSearchDDP();
1045 	struct DM	*_RkSearchUDDP();
1046 	struct DM	*_RkSearchDDMEM();
1047 
1048 	int		_RkIsinDDP();
1049 struct DD		**_RkCopyDDP();
1050 struct DD		**_RkCreateDDP();
1051 void			_RkFreeDDP();
1052 
1053 struct DM		*DMcreate();
1054 int			DMremove();
1055 int			DMrename();
1056 
1057 int			_RkMountMD();
1058 void			_RkUmountMD();
1059 
1060 char			*_RkCreatePath();
1061 char			*_RkCreateUniquePath();
1062 char			*_RkMakePath();
1063 
1064 unsigned char		*_RkCreateHeader pro((struct HD *, size_t *size));
1065 int			_RkReadHeader pro((int, struct HD *, off_t));
1066 void			_RkClearHeader pro((struct HD *));
1067 void			_RkRehashCache();
1068 
1069 /*
1070  * limits
1071  */
1072 /*
1073  *   NOTE: The following number does not includes EOS at the end of string.
1074  *	RK_PATH_BMAX	maximum path name length
1075  *	RK_LINK_BMAX	maximum file name length
1076  *	RK_MEMBER_BMAX	maximum member name length
1077  *	RK_NICK_BMAX	maximum nickname length
1078  */
1079 #ifdef PATH_MAX
1080 #define	RK_PATH_BMAX	PATH_MAX
1081 #else
1082 #define RK_PATH_BMAX 1024
1083 #endif
1084 #ifdef  NAME_MAX
1085 #define RK_LINK_BMAX	NAME_MAX
1086 #else
1087 #ifdef	MAXNAMLEN
1088 #define RK_LINK_BMAX	MAXNAMLEN
1089 #else
1090 #define RK_LINK_BMAX	14
1091 #endif
1092 #endif
1093 #define	RK_MEMBER_BMAX	255
1094 #define	RK_NICK_BMAX	255
1095 
1096 #define RK_LINE_BMAX    1024
1097 #define RK_BUFFER_SIZE  1024
1098 
1099 /*
1100  * RK_KEY_WMAX <= RK_LEN_WMAX
1101  */
1102 #define	RK_KEY_WMAX		0x7f
1103 #define	RK_LEFT_KEY_WMAX	0x3f
1104 #define	RK_LEN_WMAX		0x7f
1105 /*
1106  * RK_CAND_WMAX <= RK_LEN_WMAX
1107  */
1108 /* ����� */
1109 #define	NW_MAXCAND	0x07	/* 7 */
1110 #define	EX_NW_MAXCAND	0xfff	/* 4096 */
1111 
1112 /* ����Ĺ */
1113 #define	NW_MAXCANDLEN	0x7f
1114 #define RK_CAND_WMAX	0x7f
1115 #define RK_CAND_NMAX    0xfff /* 4095 */
1116 
1117 /* wrec len */
1118 #define NW_MAXWREC	0x3f	/* 63 */
1119 #define EX_NW_MAXWREC	0x1fff	/* 8191 */
1120 
1121 #define RK_RCNAME_BMAX	16	/* essential ?! */
1122 
1123 #define	RK_DIV_NMAX	2048
1124 /*
1125 #define MAX_TEXT_LEN \
1126     ((EX_NW_MAXCAND * \
1127       ((NW_MAXCANDLEN + 2) * sizeof(unsigned short) + RK_RCNAME_BMAX)) + \
1128      (RK_LEFT_KEY_WMAX *  sizeof(unsigned short) \
1129       + 2 * sizeof(unsigned short)))
1130 */
1131 #define	RK_WREC_BMAX	EX_NW_MAXWREC
1132 #define	RK_MAX_TEXT_LEN	MAX_WREC_BMAX
1133 
1134 #define	RK_CONC_NMAX	16	/* ��³������°��ο�(�����Ƥ�Τ��ʡ�) */
1135 
1136 #define RK_OLD_MAX_HDRSIZ	1024
1137 
1138 #ifndef	_RK_INTERN_FUNCTIONS_DEF_
1139 #define	_RK_INTERN_FUNCTIONS_DEF_
1140 
1141 struct DM *_RkSearchDicWithFreq pro((struct DD **, char *, struct DM **));
1142 #ifdef __STDC__
1143 void _Rkpanic pro((const char *, ...));
1144 #else
1145 void _Rkpanic();
1146 #endif
1147 void RkAssertFail pro((const char *, int, const char *));
1148 unsigned long _RkGetTick pro((int));
1149 struct TW *RkCopyWrec pro((struct TW *));
1150 struct TW *RkUnionWrec pro((struct TW *, struct TW *));
1151 struct TW *RkSubtractWrec pro((struct TW *, struct TW *));
1152 void _RkFreeQue pro((struct nstore *, int, int));
1153 void freeTdn pro((struct RkContext *));
1154 void _RkFreeBunq pro((struct nstore *));
1155 int _RkRealizeDD pro((struct DD *));
1156 int RkCvtWide pro((Wchar *, int, char *, int));
1157 int RkCvtNarrow pro((char *, int, Wchar *, int));
1158 
1159 #if defined(MMAP)
1160 int _RkDoInvalidateCache pro((long, unsigned long));
1161 #endif
1162 
1163 int _RkGetLink pro((struct ND *, long, unsigned long,
1164 		    unsigned long *, unsigned long *));
1165 long _RkUnpackBits pro((unsigned *, unsigned char *, long, int, int));
1166 long _RkPackBits pro((unsigned char *, long, int, unsigned *, int));
1167 int _RkSetBitNum pro((unsigned char *, unsigned long, int, int, int));
1168 int FQsync pro((struct RkContext *, struct DM *, struct DM *, char *));
1169 
1170 int RkwCvtSuuji pro((Wchar *, int, Wchar *, int, int));
1171 int RkwCvtNone pro((Wchar *, int, Wchar *, int));
1172 
1173 int _RkRowNumber pro((unsigned char *));
1174 int RkTestGram pro((const struct RkKxGram *, int, int));
1175 #ifdef LOGIC_HACK
1176 int RkCheckNegGram pro((const struct RkKxGram *, int, int, int));
1177 #endif
1178 void RkFirstGram pro((struct RkGramIterator *, const struct RkKxGram *));
1179 void RkEndGram pro((struct RkGramIterator *, const struct RkKxGram *));
1180 int _RkRegisterNV pro((struct NV *, Wrec *, int, int));
1181 int FQopen pro((struct DM *, struct DM *, char *, int));
1182 void FQclose pro((struct RkContext *, struct DM *, struct DM *, char *));
1183 int _RkSubstYomi pro((struct RkContext *, int, int, Wchar *, int));
1184 long _RkCopyBits
1185      pro((unsigned char *, long, int, unsigned char *, long, int));
1186 int _RkIsInDDP pro((struct DD **, struct DD *));
1187 int _RkEql pro((Wchar *, unsigned char *, int));
1188 int DMcheck pro((char *, char *));
1189 int copyFile pro((struct DM *, struct DM *));
1190 int DDchmod pro((struct DD *, int));
1191 int DMchmod pro((struct DM *, int));
1192 int uslen pro((Wchar *));
1193 unsigned char *ustoeuc pro((Wchar *, int, unsigned char *, int));
1194 int _RkSubstYomi pro((struct RkContext *, int, int, Wchar *, int));
1195 int HowManyChars pro((Wchar *, int));
1196 int HowManyBytes pro((Wchar *, int));
1197 int _RkFlushYomi pro((struct RkContext *));
1198 int parse_string pro((char *));
1199 
1200 #endif /* _RK_INTERN_FUNCTIONS_DEF_ */
1201 
1202 #endif /* _RKintern_h */
1203 /* vim: set sw=2: */
1204 /* don't add stuff after this line */
1205