1/* Copyright 1992 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/*
24 * @(#) 102.1 $Id: canna.h 14875 2005-11-12 21:25:31Z bonefish $
25 */
26
27/************************************************************************/
28/* THIS SOURCE CODE IS MODIFIED FOR TKO BY T.MURAI 1997 */
29/************************************************************************/
30
31
32#ifndef _CANNA_H_
33#define _CANNA_H_
34
35#undef DEBUG
36
37#include "cannaconf.h"
38#include "widedef.h"
39#include <stdio.h>
40#include <canna/cannabuild.h>
41#include <stdlib.h>
42#include <bsd_mem.h>
43
44#include <string.h>
45# ifndef index
46# define index strchr
47# endif
48
49#include <canna/RK.h>
50#include <canna/jrkanji.h>
51
52#ifdef BIGPOINTER
53#define POINTERINT long long
54#else
55#define POINTERINT long
56#endif
57
58#define	WCHARSIZE	(sizeof(WCHAR_T))
59
60#ifdef HAVE_WCHAR_OPERATION
61
62#ifndef JAPANESE_LOCALE
63#define JAPANESE_LOCALE "japan"
64#endif
65
66#define MBstowcs mbstowcs
67#define WCstombs wcstombs
68
69#else
70
71#define MBstowcs CANNA_mbstowcs
72#define WCstombs CANNA_wcstombs
73
74extern int CANNA_wcstombs (char *, WCHAR_T *, int);
75
76#endif
77
78#define STROKE_LIMIT 500 /* �������������������������������������������� */
79
80typedef unsigned char BYTE;
81
82/*
83 * CANNALIBDIR  -- ������������������������������������������������������������������������������������������������
84 *                 ����������������������������������������������������������������
85 */
86
87//#ifndef CANNALIBDIR
88//#define CANNALIBDIR "/usr/lib/canna"
89//#endif
90
91/* flags ������������ */
92#define CANNA_KANJIMODE_TABLE_SHARED	01
93#define CANNA_KANJIMODE_EMPTY_MODE	02
94
95/* func �������������������� */
96#define KEY_CALL  0
97#define KEY_CHECK 1
98#define KEY_SET   2
99
100extern BYTE default_kmap[];
101
102/* menuitem -- ������������������������������������������������������������������������ */
103
104typedef struct _menuitem {
105  int flag; /* ���������������� */
106  union {
107    struct _menustruct *menu_next; /* ���������������������������������������� */
108    int fnum;    /* ���������������� */
109    char *misc;  /* ������������(lisp ����������������������������) */
110  } u;
111} menuitem;
112
113#define MENU_SUSPEND 0 /* ������������������������������������(lisp ��������������������) */
114#define MENU_MENU    1 /* ���������������� */
115#define MENU_FUNC    2 /* ���������������� */
116
117/* menustruct -- �������������������������������������������� */
118
119typedef struct _menustruct {
120  int     nentries; /* ������������������������������������ */
121  WCHAR_T **titles; /* �������������������������������������������� */
122  WCHAR_T *titledata; /* �������������������������������������������� */
123  menuitem *body;   /* ����������������������������(��������) */
124  int     modeid;   /* ���������������������������������������� */
125  struct _menustruct *prev; /* �������������������������������������������������������� */
126} menustruct;
127
128typedef struct _menuinfo {
129  menustruct *mstruct; /* ���������������������������� */
130  int        curnum;   /* �������������������������������������������������������������������� */
131  struct _menuinfo *next;
132} menuinfo;
133
134/* defselection ���������������������������������������������������������������������������������������� */
135
136typedef struct {
137  WCHAR_T	**kigo_data;	/* �������������������������������������������� */
138  WCHAR_T	*kigo_str;	/* �������������������������������������������������������� */
139  int		kigo_size;	/* ���������������� */
140  int		kigo_mode;	/* �������������������������������� */
141} kigoIchiran;
142
143typedef struct _selectinfo {
144  kigoIchiran	*ichiran;	/* �������������������� */
145  int		curnum;		/* ������������������������������������ */
146  struct _selectinfo *next;
147} selectinfo;
148
149/* deldicinfo -- ������������������������������������������������������������������������������������������������ */
150
151#define INDPHLENGTH 16 /* ���������������������������������������������������� */
152
153typedef struct _deldicinfo {
154  WCHAR_T *name;
155  WCHAR_T hcode[INDPHLENGTH];
156} deldicinfo;
157
158/*
159 * glineinfo -- ����������������������������������������������������������������������������������������������������������������
160 * ������������������������������������������������������������������������
161 *
162 * glkosu -- ����������������������������������������
163 * glhead -- ����������������������������������������kouhoinfo��������������������(0��������������������)
164 * gllen  -- ��������������������������������������������������������������������
165 * gldata -- ��������������������������������������������������������������������������������
166 */
167
168typedef struct {
169  int glkosu;
170  int glhead;
171  int gllen;
172  WCHAR_T *gldata;
173} glineinfo;
174
175/*
176 * kouhoinfo -- ����������������������������������������������������������������������������������������������������
177 * ������������������������������������������������������������������������
178 *
179 * khretsu -- ��������������������������������
180 * khpoint -- ����������������������������������������������������
181 * khdata -- ��������������������������������������������������������
182 */
183
184typedef struct {
185  int khretsu;
186  int khpoint;
187  WCHAR_T *khdata;
188} kouhoinfo;
189
190#define ROMEBUFSIZE 	1024
191#define	BANGOSIZE	2	/* ���������������������������������������������������������������� */
192#define	BANGOMAX   	9	/* �������������������������������������������� */
193
194#define	KIGOBANGOMAX   	16	/* �������������������������������������������� */
195#define GOBISUU		9
196
197#define	ON		1
198#define	OFF		0
199
200#define	NG		-1
201
202#define NO_CALLBACK     (canna_callback_t)0
203#define NCALLBACK	4
204
205#define	JISHU_HIRA	0
206#define JISHU_ZEN_KATA	1
207#define JISHU_HAN_KATA	2
208#define JISHU_ZEN_ALPHA	3
209#define JISHU_HAN_ALPHA	4
210#define MAX_JISHU	5
211
212#define  SENTOU        0x01
213#define  HENKANSUMI    0x02
214#define  SUPKEY        0x04
215#define  GAIRAIGO      0x08
216#define  STAYROMAJI    0x10
217
218/* ���������������������������� */
219#define MEISHI       0
220#define KOYUMEISHI   1
221#define DOSHI        2
222#define KEIYOSHI     3
223#define KEIYODOSHI   4
224#define FUKUSHI      5
225#define TANKANJI     6
226#define SUSHI        7
227#define RENTAISHI    8
228#define SETSUZOKUSHI 9
229#define SAHENMEISHI 10
230#define MEISHIN     11
231#define JINMEI      12
232#define KOYUMEISHIN 13
233#define GODAN       14
234#define RAGYODOSHI  15
235#define RAGYOGODAN  16
236#define KAMISHIMO   17
237#define KEIYOSHIY   18
238#define KEIYOSHIN   19
239#define KEIYODOSHIY 20
240#define KEIYODOSHIN 21
241#define FUKUSHIY    22
242#define FUKUSHIN    23
243
244/* identifier for each context structures */
245#define CORE_CONTEXT       ((BYTE)0)
246#define YOMI_CONTEXT       ((BYTE)1)
247#define ICHIRAN_CONTEXT    ((BYTE)2)
248#define FORICHIRAN_CONTEXT ((BYTE)3)
249#define MOUNT_CONTEXT      ((BYTE)4)
250#define TOUROKU_CONTEXT    ((BYTE)5)
251#define TAN_CONTEXT	   ((BYTE)6)
252
253typedef struct _coreContextRec {
254  BYTE id;
255  BYTE majorMode, minorMode;
256  struct _kanjiMode *prevMode; /* ���������������������������� */
257  struct _coreContextRec *next;
258} coreContextRec, *coreContext;
259
260typedef coreContext mode_context;
261
262typedef struct  _yomiContextRec {
263  /* core ���������������������������� */
264  BYTE id;
265  BYTE majorMode, minorMode;
266  struct _kanjiMode *prevMode;	/* ���������������������������� */
267  mode_context    next;
268
269  struct _kanjiMode *curMode;
270  struct _tanContextRec	 *left, *right;
271
272  /* ���������������������������������������� */
273  struct RkRxDic *romdic;	/* ������������������������������������������������ */
274  WCHAR_T   romaji_buffer[ROMEBUFSIZE];
275  /* ������������������������������������ rStartp, rEndp ������������������������������������������������������������������������
276   * ��������rStartp ����������������������������������������������������������������������������������������������������������������
277   * ������������������������rEndp ������������������������������������������������������������������������������������
278   * romaji_buffer ��������������������������������������������������������������������������������������������������������
279   * romaji_buffer + rEndp ����������������������������������������������������������������������������������������
280   * ����������������romaji_buffer + rStartp �������� rEndp - rStartp ����������������������������
281   * ������������������������ */
282  int		  rEndp, rStartp, rCurs; /* ���������������������������������������������������� */
283  WCHAR_T         kana_buffer[ROMEBUFSIZE];
284  BYTE            rAttr[ROMEBUFSIZE], kAttr[ROMEBUFSIZE];
285  int		  kEndp; /* �������������������������������������������������������������������� */
286  int             kRStartp, kCurs;
287
288  /* ������������������������������������ */
289  BYTE            myMinorMode;  /* yomiContext ������������������������������������ */
290  struct _kanjiMode *myEmptyMode;		/* empty ���������������������������� */
291  long		  generalFlags;		/* see below */
292  long		  savedFlags;		/* ������������������������������������������������ */
293  BYTE		  savedMinorMode;	/* ���������������������������������������� */
294  BYTE		  allowedChars;		/* see jrkanji.h */
295  BYTE		  henkanInhibition;	/* see below */
296  int             cursup;		/* �������������������������������������������� */
297#define SUSPCHARBIAS 100
298  int             n_susp_chars;
299
300/* from henkanContext */
301  /* �������������������������������� */
302  int            context;
303  int		 kouhoCount;	/* �������� henkanNext ���������������������������������������� */
304  WCHAR_T        echo_buffer[ROMEBUFSIZE];
305  WCHAR_T        **allkouho; /* RkGetKanjiList��������������������������������������������������������
306				�������������������������������� */
307  int            curbun;     /* ������������������������ */
308  int		 curIkouho;  /* ������������������������ */
309  int            nbunsetsu;  /* ���������������� */
310
311/* ifdef MEASURE_TIME */
312  long		 proctime;   /* ����������������(���������������������������� */
313  long		 rktime;     /* ����������������(RK������������������������) */
314/* endif MEASURE_TIME */
315/* end of from henkanContext */
316
317/* ���������������������������������������� */
318  int		 ye, ys, status;
319/* ����������������������������������������(����������������) */
320  int		 cStartp, cRStartp; /* ������������������������������������������������������������ */
321
322/* ���������������������������������������� */
323  BYTE           inhibition;
324  BYTE           jishu_kc, jishu_case;
325  int            jishu_kEndp, jishu_rEndp;
326  short          rmark;
327/* ����������������������������������������(����������������) */
328
329/* adjustContext �������� */
330  int kanjilen, bunlen;           /* ���������������������������������������� */
331/* adjustContext ��������(����������������) */
332  struct _kanjiMode *tanMode; /* ���������������������������������������� */
333  int tanMinorMode;     /*        ����            */
334
335  /* �������������������� */
336  int		  last_rule;		/* ���������������������������������������������������������������� */
337  WCHAR_T	  *retbuf, *retbufp;
338  int		  retbufsize;
339  short           pmark, cmark; /* ���������������������������������������������������� */
340  BYTE            englishtype;  /* ��������������������(��������������������) */
341} yomiContextRec, *yomiContext;
342
343/* for generalFlags */
344#define CANNA_YOMI_MODE_SAVED		0x01L /* savedFlags �������������������������������� */
345
346#define CANNA_YOMI_BREAK_ROMAN		0x01L
347#define CANNA_YOMI_CHIKUJI_MODE		0x02L
348#define CANNA_YOMI_CHGMODE_INHIBITTED	0x04L
349#define CANNA_YOMI_END_IF_KAKUTEI	0x08L
350#define CANNA_YOMI_DELETE_DONT_QUIT	0x10L
351
352#define CANNA_YOMI_IGNORE_USERSYMBOLS	0x20L
353#define CANNA_YOMI_IGNORE_HENKANKEY	0x40L
354
355#define CANNA_YOMI_BASE_CHIKUJI		0x80L /* ���������������� */
356
357/* for generalFlags also used in savedFlags */
358
359/* ������������ ATTRFUNCS �������������������������������������������� defmode ���������������������������������������� */
360#define CANNA_YOMI_KAKUTEI		0x0100L
361#define CANNA_YOMI_HENKAN		0x0200L
362#define CANNA_YOMI_ZENKAKU		0x0400L
363#define CANNA_YOMI_HANKAKU		0x0800L /* �������������������� */
364#define CANNA_YOMI_HIRAGANA		0x1000L
365#define CANNA_YOMI_KATAKANA		0x2000L
366#define CANNA_YOMI_ROMAJI		0x4000L
367#define CANNA_YOMI_JISHUFUNCS		0x7c00L
368#define CANNA_YOMI_ATTRFUNCS		0x7f00L
369
370#define CANNA_YOMI_BASE_HANKAKU		0x8000L /* ���������������� */
371
372/* kind of allowed input keys */
373#define CANNA_YOMI_INHIBIT_NONE		0
374#define CANNA_YOMI_INHIBIT_HENKAN	1
375#define CANNA_YOMI_INHIBIT_JISHU	2
376#define CANNA_YOMI_INHIBIT_ASHEX	4
377#define CANNA_YOMI_INHIBIT_ASBUSHU	8
378#define CANNA_YOMI_INHIBIT_ALL		15
379
380/* �������������������������������������������� */
381#define NUMBERING 			1
382#define CHARINSERT			2
383
384#define CANNA_JISHU_UPPER		1
385#define CANNA_JISHU_LOWER		2
386#define CANNA_JISHU_CAPITALIZE		3
387#define CANNA_JISHU_MAX_CASE		4
388
389/* englishtype */
390#define CANNA_ENG_KANA			0 /* ������������������������ */
391#define CANNA_ENG_ENG1			1
392#define CANNA_ENG_ENG2			2 /* �������������������������������������������� */
393#define CANNA_ENG_NO			3
394
395/* yc->status ����������������(������������) */
396
397#define	CHIKUJI_ON_BUNSETSU		0x0001 /* ������������������������ */
398#define	CHIKUJI_OVERWRAP		0x0002 /* ������������������������������������ */
399#define	CHIKUJI_NULL_STATUS	        0 /* ������������������������ */
400
401/* yc ������������������������������������(������������) */
402
403#define adjustp(yc) (0< (yc)->bunlen)
404#define jishup(yc) (0 < (yc)->jishu_kEndp)
405#define chikujip(yc) ((yc)->generalFlags & CANNA_YOMI_CHIKUJI_MODE)
406#define henkanp(yc) (0 < (yc)->nbunsetsu)
407
408#define chikujiyomiremain(yc) ((yc)->cStartp < (yc)->kEndp)
409
410typedef struct _ichiranContextRec {
411  BYTE id;
412  BYTE majorMode, minorMode;
413  struct _kanjiMode *prevMode;	/* ���������������������������� */
414  mode_context    next;
415
416  int            svIkouho;   /* ��������������������������������������������������������(��������������������) */
417  int            *curIkouho; /* ������������������������ */
418  int            nIkouho;    /* ����������������(��������������������) */
419  int		 tooSmall;   /* ������������������������������������������������������������������������������������ */
420  int            curIchar;   /* ����������������������������������������������������������������������������
421    							���������������������������� */
422  BYTE           inhibit;
423  BYTE           flags;	     /* �������������������� */
424  WCHAR_T        **allkouho; /* RkGetKanjiList��������������������������������������������������������
425				�������������������������������� */
426  WCHAR_T        *glinebufp; /* ����������������������������������������������������������������������������
427				���������������������������� */
428  kouhoinfo      *kouhoifp;  /* ����������������������������������������������������������������������������
429				������������������������ */
430  glineinfo      *glineifp;  /* ����������������������������������������������������������������������������
431				������������������������ */
432} ichiranContextRec, *ichiranContext;
433
434/* ������������������������ */
435#define ICHIRAN_ALLOW_CALLBACK 1 /* ������������������������������������������������ */
436#define ICHIRAN_STAY_LONG    0x02 /* ������������������������ */
437#define ICHIRAN_NEXT_EXIT    0x04 /* �������� quit ���������������� */
438
439
440typedef struct _foirchiranContextRec {
441  BYTE id;
442  BYTE majorMode, minorMode;
443  struct _kanjiMode *prevMode;	/* ���������������������������� */
444  mode_context    next;
445
446  int            curIkouho;  /* ������������������������ */
447  WCHAR_T        **allkouho; /* RkGetKanjiList��������������������������������������������������������
448				�������������������������������� */
449  menustruct     *table;  /* �������������������������������������������� */
450  int            *prevcurp;  /* �������������������������������� */
451} forichiranContextRec, *forichiranContext;
452
453typedef struct _mountContextRec {
454  BYTE id;
455  BYTE majorMode, minorMode;
456  struct _kanjiMode *prevMode;	/* ���������������������������� */
457  mode_context    next;
458
459  BYTE            *mountOldStatus; /* �������������������������������������������������������� */
460  BYTE            *mountNewStatus; /* �������������������������������������������������������� */
461  char            **mountList;   /* ������������������������������������������������ */
462  int            curIkouho;     /* ������������������������ */
463} mountContextRec, *mountContext;
464
465typedef struct _tourokuContextRec {
466  BYTE id;
467  BYTE majorMode, minorMode;
468  struct _kanjiMode *prevMode;	/* ���������������������������� */
469  mode_context    next;
470
471  WCHAR_T        genbuf[ROMEBUFSIZE];
472  WCHAR_T        qbuf[ROMEBUFSIZE];
473  WCHAR_T        tango_buffer[ROMEBUFSIZE];
474  int            tango_len;  /* �������������������������������������������������������� */
475  WCHAR_T        yomi_buffer[ROMEBUFSIZE];
476  int            yomi_len;   /* �������������������������������������������������������� */
477  int            curHinshi;  /* �������������������� */
478  int            workDic;    /* ������������������������ */
479  deldicinfo     *workDic2;  /* ������������������������������������ */
480  int            nworkDic2;  /* �������������������������������������������� */
481  deldicinfo     *workDic3;  /* �������������������������������� */
482  int            nworkDic3;  /* ���������������������������������������� */
483  struct dicname *newDic;    /* ������������������������ */
484  WCHAR_T        hcode[INDPHLENGTH];  /* ���������������������������� */
485  int            katsuyou;   /* �������������������������������������������� */
486  WCHAR_T        **udic;     /* ������������������������������������ (������������) */
487  int            nudic;      /* �������������������������������������������� */
488  int            delContext; /* �������������������������������������������������������������������� */
489} tourokuContextRec, *tourokuContext;
490
491typedef struct _tanContextRec {
492  BYTE id;
493  BYTE majorMode, minorMode;
494  struct _kanjiMode *prevMode;	/* ���������������������������� */
495  mode_context    next;
496
497  struct _kanjiMode *curMode;
498  struct _tanContextRec	 *left, *right;
499
500  struct RkRxDic *romdic;	/* ������������������������������������������������ */
501  BYTE            myMinorMode;  /* yomiContext ������������������������������������ */
502  struct _kanjiMode *myEmptyMode;		/* empty ���������������������������� */
503  long generalFlags, savedFlags; /* yomiContext ���������������� */
504  BYTE		  savedMinorMode;	/* ���������������������������������������� */
505  BYTE		  allowedChars;		/* see jrkanji.h */
506  BYTE		  henkanInhibition;	/* see below */
507
508  WCHAR_T *kanji, *yomi, *roma;
509  BYTE *kAttr, *rAttr;
510} tanContextRec, *tanContext;
511
512struct moreTodo {
513  BYTE          todo; /* ���������������������������������������� */
514  BYTE          fnum; /* ���������������������������������������������������������������������������������������� */
515  int		ch;   /* �������� */
516};
517
518/* ���������������������������������������������������������������� */
519
520struct ModeNameRecs {
521  int           alloc;
522  WCHAR_T       *name;
523};
524
525/* ������������������������������������������������������������������������������������ */
526
527#define DEFAULTINDEXSEPARATOR     '.'
528
529/*
530   wcKanjiAttribute for internal use
531 */
532
533typedef struct {
534  wcKanjiAttribute u;
535  int len;
536  char *sp, *ep;
537} wcKanjiAttributeInternal;
538
539/*
540
541  uiContext ����������������������������������������������������������������������������������������������������������������
542  XLookupKanjiString ������������������������������������������������������������������������������������������������
543  ������������������������������������������������������������������������������������������������������������������������������������
544  ������������������������������������������������������������������������������������������������������������������������������������
545  ��������������������������������������������������������������������������������������������������������
546
547  ������������������������������������������������������������������������������������������������������������������������
548
549 */
550
551typedef struct _uiContext {
552
553  /* XLookupKanjiString�������������������� */
554  WCHAR_T        *buffer_return;
555  int            n_buffer;
556  wcKanjiStatus    *kanji_status_return;
557
558  /* XLookupKanjiString���������������������������������������������������� */
559  int		 nbytes;
560
561  /* �������������������� */
562  int ch;
563
564  /* ���������������������������������������� */
565  int		 contextCache;	 /* ���������������������������������������������������� */
566  struct _kanjiMode *current_mode;
567  BYTE		 majorMode, minorMode;	 /* �������������������� */
568
569  short		 curkigo;	 /* ������������������������(����������������) */
570  char           currussia;	 /* ������������������������(��������������������) */
571  char           curgreek;	 /* ������������������������(������������������������) */
572  char           curkeisen;	 /* ������������������������(��������) */
573  short          curbushu;       /* ���������������������������� */
574  int            ncolumns;	 /* �������������������������������������������������������������������������������� */
575  WCHAR_T        genbuf[ROMEBUFSIZE];	/* ������������������������ */
576  short          strokecounter;  /* ������������������������������������������������
577				    �������������������������������������������������������� */
578  wcKanjiAttributeInternal *attr;
579
580  /* �������������������������������������������� */
581  char           *client_data;   /* ������������������������������������������������ */
582  int            (*list_func) (char *, int, WCHAR_T **, int, int *);
583                 /* �������������������������������������������� */
584  /* ������������ */
585  char		 flags;		 /* �������������������� */
586  char		 status;	 /* ��������������������������������������������������������������������
587				    ������������������������������������
588				     ����������������
589				     ��������������������
590				     ��������������������
591				     ����������������
592				    ����������������(����������������) */
593
594  /* ���������������������������������������� */
595  struct callback *cb;
596
597  /* �������������������������������������������������������������������� */
598  struct moreTodo more;
599
600  /* �������������������������������� */
601  menustruct *prevMenu;
602
603  /* ���������������������������������������������������������������������������������������������������������������� */
604  menuinfo *minfo;
605
606  /* �������������������������������������������������������������������������������������������������������� */
607  selectinfo *selinfo;
608
609  /* ���������������������������������������������������� */
610  mode_context   modec;		/* ���������������������������������������� */
611} uiContextRec, *uiContext;
612
613/* uiContext ���� flags ���������������������������� */
614#define PLEASE_CLEAR_GLINE	1	/* GLine �������������������� */
615#define PCG_RECOGNIZED		2	/* GLine �������������������������������� */
616#define MULTI_SEQUENCE_EXECUTED	4	/* ���������������������������������������������������������������� */
617
618#define EVERYTIME_CALLBACK	0
619#define EXIT_CALLBACK		1
620#define QUIT_CALLBACK		2
621#define AUX_CALLBACK		3
622
623/*
624 * ����������������������������������������������������������������������������������������
625 * ������������������������������������������������������������������������������������������������������������������������
626 */
627
628struct funccfunc {
629  BYTE funcid;
630  int (*cfunc) (struct _uiContext *);
631};
632
633typedef struct _kanjiMode {
634  int (*func) (struct _uiContext *, struct _kanjiMode *, int, int, int);
635  BYTE *keytbl;
636  int flags;			/* ���������������� */
637  struct funccfunc *ftbl;
638} *KanjiMode, KanjiModeRec;
639
640struct callback {
641  int (*func[NCALLBACK]) (struct _uiContext *, int, mode_context);
642  mode_context    env;
643  struct callback *next;
644};
645
646/* ������������������������������������������������ */
647
648extern struct RkRxDic *RkwOpenRoma(char *romaji);
649extern void RkwCloseRoma(struct RkRxDic *rdic);
650
651/*
652 * ����������������������������������������������������
653 */
654
655struct dicname {
656  struct dicname *next;
657  char *name;
658  int dictype;
659  unsigned long dicflag;
660};
661
662/* dictype ������������������������������������������������ */
663#define DIC_PLAIN 0     /* �������������������� */
664#define DIC_USER  1     /* ���������������������������� */
665#define DIC_BUSHU 2     /* ���������������������������� */
666#define DIC_GRAMMAR 3   /* ���������������� */
667#define DIC_RENGO 4     /* ������������������������ */
668#define DIC_KATAKANA 5  /* �������������������������������� */
669#define DIC_HIRAGANA 6  /* �������������������������������� */
670
671/* dicflag ������������������������������������������������ */
672#define DIC_NOT_MOUNTED  0
673#define DIC_MOUNTED      1
674#define DIC_MOUNT_FAILED 2
675
676extern struct dicname *kanjidicnames;
677
678/*
679 * ��������������������������������������������������������������������
680 */
681
682extern char *jrKanjiError;
683
684/*
685 * ��������������������������������������������������������������������
686 */
687
688extern int iroha_debug;
689
690/*
691 * ��������������������������������������������������������������������
692 */
693
694#define IrohaFunctionKey(key) \
695  ((0x80 <= (int)(unsigned char)(key) &&  \
696    (int)(unsigned char)(key) <= 0x8b) || \
697   (0x90 <= (int)(unsigned char)(key) &&  \
698    (int)(unsigned char)(key) <= 0x9b) || \
699   (0xe0 <= (int)(unsigned char)(key) &&  \
700    (int)(unsigned char)(key) <= 0xff) )
701
702/* selectOne �������������������������������������������������������������������������������� */
703
704#define WITHOUT_LIST_CALLBACK 0
705#define WITH_LIST_CALLBACK    1
706
707/*
708 * Rk ��������������������������������������������������������������������������������
709 */
710
711#ifdef DEBUG
712#include "traceRK.h"
713#endif /* DEBUG */
714
715/*
716 * ������������������������������������������������������������
717 */
718
719#ifdef DEBUG
720#define debug_message(fmt, x, y, z)	dbg_msg(fmt, x, y, z)
721#else /* !DEBUG */
722#define debug_message(fmt, x, y, z)
723#endif /* !DEBUG */
724
725/*
726 * malloc ����������������
727 */
728
729#ifdef DEBUG_ALLOC
730extern char *debug_malloc (int);
731extern int fail_malloc;
732#define malloc(n) debug_malloc(n)
733#endif /* DEBUG_MALLOC */
734
735/*
736 * ��������������������������������������������������������
737 */
738
739typedef struct {
740  char           *romaji_table; /* ����������������������������������������������������(EUC) */
741  struct RkRxDic *romdic;	 /* ������������������������������������ */
742  int             romdic_owner;  /* ����������������������������������������Open������������ */
743  long            flags;	 /* flags for yomiContext->generalFlags */
744  KanjiMode       emode;	 /* current_mode ������������������������ */
745} newmode;
746
747/* ���������������������������������������������������������������������������������������������������� */
748
749typedef struct {
750  WCHAR_T	key;		/* �������� */
751  WCHAR_T       xkey;
752  int		groupid;	/* ����������������id */
753  int           ncand;          /* ���������������� */
754  WCHAR_T       **cand;         /* �������������������� */
755  WCHAR_T	*fullword;	/* ������������ (��������1@��������2@...��������n@@) */
756#ifdef WIN_CANLISP
757  int		fullwordsize;	/* sizeof fullword by WCHAR_T unit */
758#endif
759} keySupplement;
760
761#define MAX_KEY_SUP 64
762
763#define HEX_USUAL     0
764#define HEX_IMMEDIATE 1
765
766#define ModeInfoStyleIsString		0
767#define ModeInfoStyleIsNumeric		1
768#define ModeInfoStyleIsExtendedNumeric	2
769#define ModeInfoStyleIsBaseNumeric      3
770#define MaxModeInfoStyle                ModeInfoStyleIsBaseNumeric
771
772#define killmenu(d) ((d)->prevMenu = (menustruct *)0)
773#define	defineEnd(d) killmenu(d)
774#define	deleteEnd(d) killmenu(d)
775
776/* defmode����defselection����defmenu �������������������� */
777
778typedef struct _extra_func {
779  int  		fnum;		/* ���������������� */
780  int		keyword;	/* �������������������������������������������������������������������� */
781  WCHAR_T	*display_name;	/* ������������������������ */
782  union {
783    newmode 	*modeptr;	/* defmode �������������������������������� */
784    kigoIchiran	*kigoptr;	/* defselection �������������������������������� */
785    menustruct	*menuptr;	/* defmenu �������������������������������� */
786  } u;
787#ifdef BINARY_CUSTOM
788  int           mid;
789  char          *symname;
790#endif
791  struct _extra_func *next;
792} extraFunc;
793
794#define EXTRA_FUNC_DEFMODE	1
795#define EXTRA_FUNC_DEFSELECTION	2
796#define EXTRA_FUNC_DEFMENU	3
797
798#define tanbunMode(d, tan) /* tanContext ������������������������������������ */ \
799  { extern KanjiModeRec tankouho_mode; (d)->current_mode = &tankouho_mode; \
800    (d)->modec = (mode_context)(tan); currentModeInfo(d); }
801
802#define freeForIchiranContext(fc) free((char *)fc)
803#define freeIchiranContext(ic) free((char *)ic)
804#define freeYomiContext(yc) free((char *)yc)
805#define freeCoreContext(cc) free((char *)cc)
806
807#define DEFAULT_CANNA_SERVER_NAME "cannaserver"
808
809#ifndef	_UTIL_FUNCTIONS_DEF_
810
811#define	_UTIL_FUNCTIONS_DEF_
812
813/* ���������������������������������������������������� */
814#define canna_version(majv, minv) ((majv) * 1024 + (minv))
815
816/* �������������������������������������������������������������������������������������������������������������������� */
817extern int RkwGoto (char *, int);
818
819/* storing customize configuration to the following structure. */
820struct CannaConfig { /* ����������������������������������������������������������������������������������������������������
821			������������������������! ������������������������������������������������������������������������
822			������������������������������������ */
823  int CannaVersion;  /* (������������) ������������������������������������ */
824  int kouho_threshold; /* ���������������������������������������������������������������� */
825  int strokelimit;  /* (������������) ������������������������������������������������������������������������������������ */
826  int indexSeparator; /* (������������) ���������������������������������������������������������������� */
827  BYTE ReverseWidely; /* ������������������������������������       */
828  BYTE chikuji;       /* ������������������������             */
829  BYTE Gakushu;       /* ��������������������������������         */
830  BYTE CursorWrap;    /* ����������������������������������������     */
831  BYTE SelectDirect;  /* ���������������������������������������������������� */
832  BYTE HexkeySelect;  /* (������������) 16���������������������������������������� */
833  BYTE BunsetsuKugiri; /* ������������������������������������������������  */
834  BYTE ChBasedMove;   /* !��������������������������������������������������������������������   */
835  BYTE ReverseWord;   /* (������������) ������������������������������������ */
836  BYTE QuitIchiranIfEnd; /* �������������������������������������������� */
837  BYTE kakuteiIfEndOfBunsetsu; /* ���������������������������������������������������� */
838  BYTE stayAfterValidate; /* !���������������������������������������������������� */
839  BYTE BreakIntoRoman;    /* BS���������������������������������������� */
840  BYTE grammaticalQuestion; /* (������������) ���������������������������������������������������� */
841  BYTE forceKana;           /* Isn't this used? */
842  BYTE kCount;        /* (������������) ������������������������������������������������ */
843  BYTE LearnNumericalType;  /* Isn't this used? */
844  BYTE BackspaceBehavesAsQuit; /* ���������������������������� BS �������������������������������������������� */
845  BYTE iListCB;       /* (������������) �������������������������������������������������������� */
846  BYTE keepCursorPosition;  /* !����������������BS������������������������������������������������������������ */
847  BYTE abandonIllegalPhono; /* �������������������������������������������������������������������������������� */
848  BYTE hexCharacterDefiningStyle; /* Isn't this used? */
849  BYTE kojin;         /* ���������������� */
850  BYTE indexHankaku;  /* (������������) ���������������������������������������������������������������� */
851  BYTE allowNextInput; /* ������������������������������������������������������������������������ */
852  BYTE doKatakanaGakushu; /* Isn't this used? */
853  BYTE doHiraganaGakushu; /* Isn't this used? */
854  BYTE ChikujiContinue; /* �������������������������������������������������������������������������������������������� */
855  BYTE RenbunContinue;  /* ���������������������������������������������������������������������������������������� */
856  BYTE MojishuContinue; /* ������������������������������������������������������������������������������������ */
857  BYTE chikujiRealBackspace; /* ����������������������������BS���������������������������������������� */
858  BYTE ignore_case;   /* ������������������������������������������������ */
859  BYTE romaji_yuusen; /* ���������������������������������������������������� */
860  BYTE auto_sync;     /* �������������������������������������������� */
861  BYTE quickly_escape; /* (������������) ������������������������������������������������������������������������ */
862  BYTE InhibitHankakuKana; /* ������������������������������������ */
863  BYTE code_input;    /* ������������(0: jis, 1: sjis, 2: ��������) */
864};
865
866#define CANNA_CODE_JIS   0
867#define CANNA_CODE_SJIS  1
868#define CANNA_CODE_KUTEN 2
869#define CANNA_MAX_CODE   3
870
871extern struct CannaConfig cannaconf;
872typedef int (* canna_callback_t) (uiContext, int, mode_context);
873
874/* RKkana.c */
875int RkCvtZen(unsigned char *zen, int maxzen, unsigned char *han, int maxhan);
876int RkCvtHan(unsigned char *han, int maxhan, unsigned char *zen, int maxzen);
877int RkCvtKana(unsigned char *kana, int maxkana, unsigned char *hira, int maxhira);
878int RkCvtHira(unsigned char *hira, int maxhira, unsigned char *kana, int maxkana);
879int RkCvtNone(unsigned char *dst, int maxdst, unsigned char *src, int maxsrc);
880int RkCvtEuc(unsigned char *euc, int maxeuc, unsigned char *sj, int maxsj);
881int RkCvtSuuji(unsigned char *dst, int maxdst, unsigned char *src, int maxsrc, int format);
882int RkwCvtHan(WCHAR_T *dst, int maxdst, WCHAR_T *src, int srclen);
883int RkwCvtHira(WCHAR_T *dst, int maxdst, WCHAR_T *src, int srclen);
884int RkwCvtKana(WCHAR_T *dst, int maxdst, WCHAR_T *src, int srclen);
885int RkwCvtZen(WCHAR_T *dst, int maxdst, WCHAR_T *src, int srclen);
886int RkwCvtNone(WCHAR_T *dst, int maxdst, WCHAR_T *src, int srclen);
887int RkwMapRoma(struct RkRxDic *romaji, WCHAR_T *dst, int maxdst, WCHAR_T *src, int srclen, int flags, int *status);
888int RkwMapPhonogram(struct RkRxDic *romaji, WCHAR_T *dst, int maxdst, WCHAR_T *src, int srclen, WCHAR_T key, int flags, int *ulen, int *dlen, int *tlen, int *rule);
889int RkwCvtRoma(struct RkRxDic *romaji, WCHAR_T *dst, int maxdst, WCHAR_T *src, int srclen, int flags);
890
891/* RKroma.c */
892int compar(struct romaRec *p, struct romaRec *q);
893struct RkRxDic *RkwOpenRoma(char *romaji);
894void RkwCloseRoma(struct RkRxDic *rdic);
895struct RkRxDic *RkOpenRoma(char *romaji);
896void RkCloseRoma(struct RkRxDic *rdic);
897int RkMapRoma(struct RkRxDic *rdic, unsigned char *dst, int maxdst, unsigned char *src, int maxsrc, int flags, int *status);
898int RkMapPhonogram(struct RkRxDic *rdic, unsigned char *dst, int maxdst, unsigned char *src, int srclen, unsigned key, int flags, int *used_len_return, int *dst_len_return, int *tmp_len_return, int *rule_id_inout);
899int RkCvtRoma(struct RkRxDic *rdic, unsigned char *dst, int maxdst, unsigned char *src, int maxsrc, unsigned flags);
900
901/* bunsetsu.c */
902int enterAdjustMode(uiContext d, yomiContext yc);
903int leaveAdjustMode(uiContext d, yomiContext yc);
904
905/* bushu.c */
906int initBushuTable(void);
907int getForIchiranContext(uiContext d);
908void popForIchiranMode(uiContext d);
909int BushuMode(uiContext d);
910int ConvertAsBushu(uiContext d);
911
912/* chikuji.c */
913void clearHenkanContext(yomiContext yc);
914int chikujiInit(uiContext d);
915int ChikujiSubstYomi(uiContext d);
916int ChikujiTanDeletePrevious(uiContext d);
917void moveToChikujiTanMode(uiContext d);
918void moveToChikujiYomiMode(uiContext d);
919
920/* commondata.c */
921void InitCannaConfig(struct CannaConfig *cf);
922void restoreBindings(void);
923
924/* defaultmap.c */
925int searchfunc (uiContext, KanjiMode, int, int, int);
926int CYsearchfunc(uiContext d, KanjiMode mode, int whattodo, int key, int fnum);
927
928/* ebind.c */
929int XLookupKanji2(unsigned int dpy, unsigned int win, char *buffer_return, int bytes_buffer, int nbytes, int functionalChar, jrKanjiStatus *kanji_status_return);
930int XKanjiControl2(unsigned int display, unsigned int window, unsigned int request, BYTE *arg);
931
932/* empty.c */
933extraFunc *FindExtraFunc(int fnum);
934int getBaseMode(yomiContext yc);
935void EmptyBaseModeInfo(uiContext d, yomiContext yc);
936int EmptyBaseHira(uiContext d);
937int EmptyBaseKata(uiContext d);
938int EmptyBaseEisu(uiContext d);
939int EmptyBaseZen(uiContext d);
940int EmptyBaseHan(uiContext d);
941int EmptyBaseKana(uiContext d);
942int EmptyBaseKakutei(uiContext d);
943int EmptyBaseHenkan(uiContext d);
944
945/* engine.c */
946int RkSetServerName(char *s);
947char *RkGetServerHost(void);
948void close_engine(void);
949
950/* henkan.c */
951int KanjiInit(void);
952int KanjiFin(void);
953void freeTanContext(tanContext tan);
954int doTanConvertTb(uiContext d, yomiContext yc);
955int YomiBubunKakutei(uiContext d);
956yomiContext newFilledYomiContext(mode_context next, KanjiMode prev);
957int TanBubunMuhenkan(uiContext d);
958int prepareHenkanMode(uiContext d);
959int doHenkan(uiContext d, int len, WCHAR_T *kanji);
960int TanNop(uiContext d);
961int TanForwardBunsetsu(uiContext d);
962int TanBackwardBunsetsu(uiContext d);
963int TanKouhoIchiran(uiContext d);
964int TanNextKouho(uiContext d);
965int TanPreviousKouho(uiContext d);
966int TanHiragana(uiContext d);
967int TanKatakana(uiContext d);
968int TanRomaji(uiContext d);
969int TanUpper(uiContext d);
970int TanCapitalize(uiContext d);
971int TanZenkaku(uiContext d);
972int TanHankaku(uiContext d);
973int TanKanaRotate(uiContext d);
974int TanRomajiRotate(uiContext d);
975int TanCaseRotateForward(uiContext d);
976int TanBeginningOfBunsetsu(uiContext d);
977int TanEndOfBunsetsu(uiContext d);
978int tanMuhenkan(uiContext d, int kCurs);
979int TanMuhenkan(uiContext d);
980int TanDeletePrevious(uiContext d);
981void finishTanKakutei(uiContext d);
982int TanKakutei(uiContext d);
983int TanPrintBunpou(uiContext d);
984void jrKanjiPipeError(void);
985void setMode(uiContext d, tanContext tan, int forw);
986int TbForward(uiContext d);
987int TbBackward(uiContext d);
988int TbBeginningOfLine(uiContext d);
989int TbEndOfLine(uiContext d);
990
991/* hex.c */
992int HexMode(uiContext d);
993
994/* ichiran.c */
995int initIchiran(void);
996void makeGlineStatus(uiContext d);
997void freeIchiranBuf(ichiranContext ic);
998void freeGetIchiranList(WCHAR_T **buf);
999WCHAR_T **getIchiranList(int context, int *nelem, int *currentkouho);
1000ichiranContext newIchiranContext(void);
1001int selectOne (uiContext d, WCHAR_T **buf, int *ck, int nelem, int bangomax, unsigned inhibit, int currentkouho, int allowcallback, canna_callback_t everyTimeCallback, canna_callback_t exitCallback, canna_callback_t quitCallback, canna_callback_t auxCallback);
1002int allocIchiranBuf(uiContext d);
1003int tanKouhoIchiran(uiContext d, int step);
1004int IchiranQuit(uiContext d);
1005int IchiranNop(uiContext d);
1006int IchiranForwardKouho(uiContext d);
1007int IchiranBackwardKouho(uiContext d);
1008int IchiranPreviousKouhoretsu(uiContext d);
1009int IchiranNextKouhoretsu(uiContext d);
1010int IchiranBeginningOfKouho(uiContext d);
1011int IchiranEndOfKouho(uiContext d);
1012void ichiranFin(uiContext d);
1013
1014/* jishu.c */
1015void enterJishuMode(uiContext d, yomiContext yc);
1016void leaveJishuMode(uiContext d, yomiContext yc);
1017int extractJishuString(yomiContext yc, WCHAR_T *s, WCHAR_T *e, WCHAR_T **sr, WCHAR_T **er);
1018
1019/* jrbind.c */
1020int XwcLookupKanji2(unsigned int dpy, unsigned int win, WCHAR_T *buffer_return, int nbuffer, int nbytes, int functionalChar, wcKanjiStatus *kanji_status_return);
1021int XwcKanjiControl2(unsigned int display, unsigned int window, unsigned int request, BYTE *arg);
1022struct callback *pushCallback(uiContext d, mode_context env, canna_callback_t ev, canna_callback_t ex, canna_callback_t qu, canna_callback_t au);
1023void popCallback(uiContext d);
1024
1025/* kctrl.c */
1026int initRomeStruct(uiContext d, int flg);
1027void freeRomeStruct(uiContext d);
1028uiContext keyToContext(unsigned int data1, unsigned int data2);
1029struct bukRec *internContext(unsigned int data1, unsigned int data2, uiContext context);
1030void rmContext(unsigned int data1, unsigned int data2);
1031void addWarningMesg(char *s);
1032int escapeToBasicStat(uiContext d, int how);
1033void makeAllContextToBeClosed(int flag);
1034int _do_func_slightly(uiContext d, int fnum, mode_context mode_c, KanjiMode c_mode);
1035int _doFunc(uiContext d, int fnum);
1036int _afterDoFunc(uiContext d, int retval);
1037int doFunc(uiContext d, int fnum);
1038int wcCloseKanjiContext (int context);
1039int jrCloseKanjiContext (int context);
1040int ToggleChikuji(uiContext d, int flg);
1041int kanjiControl(int request, uiContext d, caddr_t arg);
1042
1043/* keydef.c */
1044int initKeyTables(void);
1045void restoreDefaultKeymaps(void);
1046int changeKeyfunc(int modenum, int key, int fnum, unsigned char *actbuff, unsigned char *keybuff);
1047int changeKeyfuncOfAll(int key, int fnum, unsigned char *actbuff, unsigned char *keybuff);
1048unsigned char *actFromHash(unsigned char *tbl_ptr, unsigned char key);
1049struct map *mapFromHash(KanjiMode tbl, unsigned char key, struct map ***ppp);
1050int askQuitKey(unsigned key);
1051
1052/* kigo.c */
1053void initKigoTable(void);
1054int KigoIchiran(uiContext d);
1055int makeKigoIchiran(uiContext d, int major_mode);
1056
1057/* lisp.c */
1058int WCinit(void);
1059int clisp_init(void);
1060void clisp_fin(void);
1061int YYparse_by_rcfilename(char *s);
1062int parse_string(char *str);
1063void clisp_main(void);
1064int DEFVAR(int Vromkana, int StrAcc, char *, int RomkanaTable);
1065
1066/* mode.c */
1067newmode *findExtraKanjiMode(int mnum);
1068void currentModeInfo(uiContext d);
1069void initModeNames(void);
1070void resetModeNames(void);
1071int JapaneseMode(uiContext d);
1072int AlphaMode(uiContext d);
1073int HenkanNyuryokuMode(uiContext d);
1074int queryMode(uiContext d, WCHAR_T *arg);
1075int changeModeName(int modeid, char *str);
1076
1077/* multi.c */
1078int UseOtherKeymap(uiContext d);
1079int DoFuncSequence(uiContext d);
1080int multiSequenceFunc(uiContext d, KanjiMode mode, int whattodo, int key, int fnum);
1081
1082/* onoff.c */
1083int initOnoffTable(void);
1084int selectOnOff(uiContext d, WCHAR_T **buf, int *ck, int nelem, int bangomax, int currentkouho, unsigned char *status, int (*everyTimeCallback )(...), int (*exitCallback )(...), int (*quitCallback )(...), int (*auxCallback )(...));
1085
1086/* parse.c */
1087#ifdef BINARY_CUSTOM
1088int binparse (void);
1089#else
1090void parse(void);
1091#endif
1092
1093int parse_string(char *str);
1094void clisp_main(void);
1095
1096/* romaji.c */
1097void debug_yomi(yomiContext x);
1098void kPos2rPos(yomiContext yc, int s, int e, int *rs, int *re);
1099void makeYomiReturnStruct(uiContext d);
1100int RomkanaInit(void);
1101void RomkanaFin(void);
1102yomiContext newYomiContext(WCHAR_T *buf, int bufsize, int allowedc, int chmodinhibit, int quitTiming, int hinhibit);
1103yomiContext GetKanjiString(uiContext d, WCHAR_T *buf, int bufsize, int allowedc, int chmodinhibit, int quitTiming, int hinhibit, canna_callback_t everyTimeCallback, canna_callback_t exitCallback, canna_callback_t quitCallback);
1104void popYomiMode(uiContext d);
1105void fitmarks(yomiContext yc);
1106void ReCheckStartp(yomiContext yc);
1107void removeCurrentBunsetsu(uiContext d, tanContext tan);
1108void restoreChikujiIfBaseChikuji(yomiContext yc);
1109int YomiInsert(uiContext d);
1110int findSup(WCHAR_T key);
1111void moveStrings(WCHAR_T *str, BYTE *attr, int start, int end, int distance);
1112int forceRomajiFlushYomi(uiContext d);
1113int RomajiFlushYomi(uiContext d, WCHAR_T *b, int bsize);
1114void restoreFlags(yomiContext yc);
1115int xString(WCHAR_T *str, int len, WCHAR_T *s, WCHAR_T *e);
1116int appendTan2Yomi(tanContext tan, yomiContext yc);
1117yomiContext dupYomiContext(yomiContext yc);
1118void doMuhenkan(uiContext d, yomiContext yc);
1119int doKakutei(uiContext d, tanContext st, tanContext et, WCHAR_T *s, WCHAR_T *e, yomiContext *yc_return);
1120int cutOffLeftSide(uiContext d, yomiContext yc, int n);
1121int YomiKakutei(uiContext d);
1122void clearYomiContext(yomiContext yc);
1123void RomajiClearYomi(uiContext d);
1124int YomiExit(uiContext d, int retval);
1125void RomajiStoreYomi(uiContext d, WCHAR_T *kana, WCHAR_T *roma);
1126int KanaDeletePrevious(uiContext d);
1127coreContext newCoreContext(void);
1128int alphaMode(uiContext d);
1129int YomiQuotedInsert(uiContext d);
1130int convertAsHex(uiContext d);
1131int selectKeysup(uiContext d, yomiContext yc, int ind);
1132int containUnconvertedKey(yomiContext yc);
1133int YomiBaseHiraKataToggle(uiContext d);
1134int YomiBaseZenHanToggle(uiContext d);
1135int YomiBaseRotateForw(uiContext d);
1136int YomiBaseRotateBack(uiContext d);
1137int YomiBaseKanaEisuToggle(uiContext d);
1138int YomiBaseKakuteiHenkanToggle(uiContext d);
1139int YomiModeBackup(uiContext d);
1140int exitJishu(uiContext d);
1141int YomiMark(uiContext d);
1142int Yomisearchfunc(uiContext d, KanjiMode mode, int whattodo, int key, int fnum);
1143void trimYomi(uiContext d, int sy, int ey, int sr, int er);
1144int TanBubunKakutei(uiContext d);
1145int TanBubunKakutei(uiContext d);
1146void removeKana(uiContext d, yomiContext yc, int k, int r);
1147int cvtAsHex(uiContext d, WCHAR_T *buf, WCHAR_T *hexbuf, int hexlen);
1148
1149/* uiutil.c */
1150menustruct *allocMenu(int n, int nc);
1151int uiUtilIchiranTooSmall(uiContext d, int retval, mode_context env);
1152int UiUtilMode(uiContext d);
1153
1154#ifndef NO_EXTEND_MENU
1155int initExtMenu(void);
1156int prevMenuIfExist(uiContext d);
1157int showmenu(uiContext d, menustruct *table);
1158void finExtMenu(void);
1159void freeAllMenuInfo(menuinfo *p);
1160void freeMenu(menustruct *m);
1161#endif
1162
1163/* uldefine.c */
1164int dicTouroku(uiContext d);
1165int dicSakujo(uiContext d);
1166int initHinshiTable(void);
1167void clearYomi(uiContext d);
1168int getTourokuContext(uiContext d);
1169void popTourokuMode(uiContext d);
1170int uuTTangoQuitCatch(uiContext d, int retval, mode_context env);
1171WCHAR_T **getUserDicName(uiContext d);
1172int dicTouroku(uiContext d);
1173int dicTourokuTango(uiContext d, canna_callback_t quitfunc);
1174int dicTourokuHinshi(uiContext d);
1175int dicTourokuControl(uiContext d, WCHAR_T *tango, canna_callback_t quitfunc);
1176
1177/* uldelete.c */
1178void freeWorkDic3(tourokuContext tc);
1179void freeWorkDic(tourokuContext tc);
1180void freeDic(tourokuContext tc);
1181void freeAndPopTouroku(uiContext d);
1182int dicSakujo(uiContext d);
1183
1184/* ulhinshi.c */
1185int initHinshiMessage(void);
1186void EWStrcat(WCHAR_T *buf, char *xxxx);
1187int initGyouTable(void);
1188int dicTourokuHinshiDelivery(uiContext d);
1189int dicTourokuDictionary(uiContext d, int (*exitfunc )(...), int (*quitfunc )(...));
1190
1191/* ulkigo.c */
1192int initUlKigoTable(void);
1193int initUlKeisenTable(void);
1194int uuKigoGeneralExitCatch(uiContext d, int retval, mode_context env);
1195int uuKigoMake(uiContext d, WCHAR_T **allkouho, int size, char cur, char mode, int (*exitfunc )(...), int *posp);
1196int kigoRussia(uiContext d);
1197int kigoGreek(uiContext d);
1198int kigoKeisen(uiContext d);
1199
1200/* ulmount.c */
1201int getMountContext(uiContext d);
1202void popMountMode(uiContext d);
1203int dicMount(uiContext d);
1204
1205/* ulserver.c */
1206int serverFin(uiContext d);
1207int serverChange(uiContext d);
1208
1209/* util.c */
1210void GlineClear(uiContext d);
1211void echostrClear(uiContext d);
1212int checkGLineLen(uiContext d);
1213int NothingChanged(uiContext d);
1214int NothingForGLine(uiContext d);
1215void CannaBeep(void);
1216int NothingChanged(uiContext d);
1217int NothingChangedWithBeep(uiContext d);
1218int NothingForGLineWithBeep(uiContext d);
1219int Insertable(unsigned char ch);
1220int extractTanString(tanContext tan, WCHAR_T *s, WCHAR_T *e);
1221int extractTanYomi(tanContext tan, WCHAR_T *s, WCHAR_T *e);
1222int extractTanRomaji(tanContext tan, WCHAR_T *s, WCHAR_T *e);
1223void makeKanjiStatusReturn(uiContext d, yomiContext yc);
1224void makeGLineMessage(uiContext d, WCHAR_T *msg, int sz);
1225void makeGLineMessageFromString(uiContext d, char *msg);
1226int setWStrings(WCHAR_T **ws, char **s, int sz);
1227int dbg_msg(char *fmt, int x, int y, int z);
1228int checkModec(uiContext d);
1229int showRomeStruct(unsigned int dpy, unsigned int win);
1230int NoMoreMemory(void);
1231int GLineNGReturn(uiContext d);
1232int GLineNGReturnFI(uiContext d);
1233int specialfunc(uiContext d, int fn);
1234int GLineNGReturnTK(uiContext d);
1235int copyAttribute(BYTE *dest, BYTE *src, int n);
1236char *debug_malloc(int n);
1237int WCinit(void);
1238int WStrlen(WCHAR_T *ws);
1239WCHAR_T *WStrcpy(WCHAR_T *ws1, WCHAR_T *ws2);
1240WCHAR_T *WStrncpy(WCHAR_T *ws1, WCHAR_T *ws2, int cnt);
1241WCHAR_T *WStraddbcpy(WCHAR_T *ws1, WCHAR_T *ws2, int cnt);
1242WCHAR_T *WStrcat(WCHAR_T *ws1, WCHAR_T *ws2);
1243int WStrcmp(WCHAR_T *w1, WCHAR_T *w2);
1244int WStrncmp(WCHAR_T *w1, WCHAR_T *w2, int n);
1245int WWhatGPlain(WCHAR_T wc);
1246int WIsG0(WCHAR_T wc);
1247int WIsG1(WCHAR_T wc);
1248int WIsG2(WCHAR_T wc);
1249int WIsG3(WCHAR_T wc);
1250int CANNA_mbstowcs(WCHAR_T *dest, char *src, int destlen);
1251int CNvW2E(WCHAR_T *src, int srclen, char *dest, int destlen);
1252int CANNA_wcstombs(char *dest, WCHAR_T *src, int destlen);
1253int WStringOpen(void);
1254WCHAR_T *WString(char *s);
1255void WStringClose(void);
1256int WSfree(WCHAR_T *s);
1257void generalReplace(WCHAR_T *buf, BYTE *attr, int *startp, int *cursor, int *endp, int bytes, WCHAR_T *rplastr, int len, int attrmask);
1258int WToupper(WCHAR_T w);
1259int WTolower(WCHAR_T w);
1260WCHAR_T key2wchar(int key, int *check);
1261int confirmContext(uiContext d, yomiContext yc);
1262int abandonContext(uiContext d, yomiContext yc);
1263int makeRkError(uiContext d, char *str);
1264int canna_alert(uiContext d, char *message, canna_callback_t cnt);
1265void EWStrcat(WCHAR_T *buf, char *xxxx);
1266char *KanjiInitError(void);
1267int wchar2ushort(WCHAR_T *src, int slen, uint32 *dst, int dlen);
1268int ushort2wchar(uint32 *src, int slen, WCHAR_T *dst, int dlen);
1269int euc2ushort(char *src, int srclen, uint32 *dest, int destlen);
1270
1271/* yesno.c */
1272int getYesNoContext(uiContext d, canna_callback_t everyTimeCallback, canna_callback_t exitCallback, canna_callback_t quitCallback, canna_callback_t auxCallback);
1273
1274#endif /* _UTIL_FUNCTIONS_DEF_ */
1275#endif /* !_CANNA_H_ */
1276