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/* THIS SOURCE CODE IS MODIFIED FOR TKO BY T.MURAI 1997
25/************************************************************************/
26
27
28#if !defined(lint) && !defined(__CODECENTER__)
29static char rcs_id[] = "@(#) 102.1 $Id: empty.c 14875 2005-11-12 21:25:31Z bonefish $";
30#endif /* lint */
31
32#include "canna.h"
33#include "patchlevel.h"
34#include "RK.h"
35#include "RKintern.h"
36
37extern struct RkRxDic *romajidic, *englishdic;
38
39static int inEmptySelfInsert(uiContext d);
40static int EmptySelfInsert(uiContext d);
41static int EmptyYomiInsert(uiContext d);
42static int EmptyQuotedInsert(uiContext d);
43static int AlphaSelfInsert(uiContext d);
44static int AlphaNop(uiContext d);
45static int EmptyQuit(uiContext d);
46static int EmptyKakutei(uiContext d);
47static int EmptyDeletePrevious(uiContext d);
48static int UserMode(uiContext d, extraFunc *estruct);
49static int UserSelect(uiContext d, extraFunc *estruct);
50static int UserMenu(uiContext d, extraFunc *estruct);
51static int ProcExtraFunc(uiContext d, int fnum);
52static int HenkanRegion(uiContext d);
53static int PhonoEdit(uiContext d);
54static int DicEdit(uiContext d);
55static int Configure(uiContext d);
56static int renbunInit(uiContext d);
57static int showVersion(uiContext d);
58static int showServer(uiContext d);
59static int showGakushu(uiContext d);
60static int showInitFile(uiContext d);
61static int showRomkanaFile(uiContext d);
62static int dicSync(uiContext d);
63
64extern KanjiModeRec yomi_mode, cy_mode;
65
66/* EmptySelfInsert -- ¼«Ê¬¼«¿È¤ò³ÎÄêʸ»úÎó¤È¤·¤ÆÊÖ¤¹´Ø¿ô¡£
67 *
68 */
69
70static int
71inEmptySelfInsert(uiContext d)
72{
73  yomiContext yc = (yomiContext)d->modec;
74  int res = 0;
75
76  d->kanji_status_return->info |= KanjiThroughInfo | KanjiEmptyInfo;
77  if (!(yc->generalFlags & CANNA_YOMI_END_IF_KAKUTEI)) {
78    res = d->nbytes;
79  }
80  /* else { ³ÎÄê¥Ç¡¼¥¿¤À¤±¤òÂԤäƤ¤¤ë¿Í¤Ë¤Ï³ÎÄê¥Ç¡¼¥¿¤òÅϤµ¤Ê¤¤ } */
81
82  return res;
83}
84
85
86static int
87EmptySelfInsert(uiContext d)
88{
89  yomiContext yc = (yomiContext)d->modec;
90  int res = inEmptySelfInsert(d);
91
92/* ñ¸ìÅÐÏ¿¤Î¤È¤­¤Ë yomi mode ¤Î³ÎÄꥭ¡¼¤¬ empty mode ¤Ç¤Ï³ÎÄꥭ¡¼¤Ç¤Ê
93   ¤«¤Ã¤¿¤ê¤¹¤ë¤È¡¢¤½¤Î¥­¡¼¤Î²¡²¼¤Ç»à¤ó¤Ç¤·¤Þ¤Ã¤¿¤ê¤¹¤ë¤Î¤ÎµßºÑ¡£yomi
94   mode ¤Î¾å¤Ë yomi mode ¤¬¾è¤Ã¤Æ¤¤¤ë¤Î¤Ïñ¸ìÅÐÏ¿¤Î»þ¤°¤é¤¤¤À¤í¤¦¤È¸À
95   ¤¦¤³¤È¤ÇȽÃǤκàÎÁ¤Ë¤·¤Æ¤¤¤ë¡£ËÜÅö¤Ï¤³¤ó¤Ê¤³¤È¤ä¤ê¤¿¤¯¤Ê¤¤¡£ */
96
97  if (yc->next && yc->next->id == YOMI_CONTEXT &&
98      yomi_mode.keytbl[d->buffer_return[0]] == CANNA_FN_Kakutei) {
99    d->status = EXIT_CALLBACK;
100    if (d->cb->func[EXIT_CALLBACK] != NO_CALLBACK) {
101      d->kanji_status_return->info &= ~KanjiThroughInfo; /* »Å»ö¤·¤¿ */
102      popYomiMode(d);
103    }
104  }
105  return res;
106}
107
108/* EmptyYomiInsert -- ¡û¥â¡¼¥É¤Ë°Ü¹Ô¤·¡¢ÆɤߤòÆþÎϤ¹¤ë´Ø¿ô
109 *
110 */
111
112
113static int
114EmptyYomiInsert(uiContext d)
115{
116  yomiContext yc = (yomiContext)d->modec;
117
118  d->current_mode = (yc->generalFlags & CANNA_YOMI_CHIKUJI_MODE) ?
119    &cy_mode : &yomi_mode;
120  RomajiClearYomi(d);
121  return YomiInsert(d); /* ¥³¡¼¥ë¥Ð¥Ã¥¯¤Î¥Á¥§¥Ã¥¯¤Ï YomiInsert ¤Ç¤µ¤ì¤ë */
122}
123
124/* EmptyQuotedInsert -- ¼¡¤Î°ì»ú¤¬¤É¤Î¤è¤¦¤Êʸ»ú¤Ç¤â¥¹¥ë¡¼¤ÇÄ̤¹´Ø¿ô¡£
125 *
126 */
127
128/*
129  Empty ¥â¡¼¥É¤Ç¤Î quotedInset ¤Ï ^Q ¤Î¤è¤¦¤Êʸ»ú¤¬°ì²ó Emacs ¤Ê¤É¤ÎÊý
130  ¤ËÄ̤äƤ·¤Þ¤¨¤Ð¥Þ¥Ã¥×¤¬ÊÖ¤é¤ì¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢¥«¥Ê´Á»úÊÑ´¹¤ÎÊý¤Ç²¿¤«¤ò
131  ¤¹¤ë¤Ê¤ó¤Æ¤³¤È¤ÏɬÍפʤ¤¤Î¤Ç¤Ï¤Ê¤¤¤Î¤«¤Ê¤¡¡£
132 */
133
134static int
135EmptyQuotedInsert(uiContext d)
136{
137  yomiContext yc = (yomiContext)d->modec;
138
139  d->current_mode = (yc->generalFlags & CANNA_YOMI_CHIKUJI_MODE) ?
140    &cy_mode : &yomi_mode;
141  return YomiQuotedInsert(d);
142}
143
144/*
145  AlphaSelfInsert -- ¼«Ê¬¼«¿È¤ò³ÎÄêʸ»úÎó¤È¤·¤ÆÊÖ¤¹´Ø¿ô¡£
146 */
147
148static int
149AlphaSelfInsert(uiContext d)
150{
151  unsigned kanap = (unsigned)d->ch;
152
153  d->kanji_status_return->length = 0;
154  d->kanji_status_return->info |= KanjiEmptyInfo;
155  d->kanji_status_return->info |= KanjiThroughInfo;
156  if ( d->nbytes != 1 || kanap <= 0xa0 || 0xe0 <= kanap ) {
157    return d->nbytes;
158  }
159  else { /* ²¾Ì¾¥­¡¼ÆþÎϤξì¹ç */
160    if (d->n_buffer > 1) {
161      return 1;
162    }
163    else {
164      return 0;
165    }
166  }
167}
168
169static int
170AlphaNop(uiContext d)
171{
172  /* currentModeInfo ¤Ç¥â¡¼¥É¾ðÊó¤¬É¬¤ºÊÖ¤ë¤è¤¦¤Ë¥À¥ß¡¼¤Î¥â¡¼¥É¤òÆþ¤ì¤Æ¤ª¤¯ */
173  d->majorMode = d->minorMode = CANNA_MODE_KigoMode;
174  currentModeInfo(d);
175  return 0;
176}
177
178static int
179EmptyQuit(uiContext d)
180{
181  int res;
182
183  res = inEmptySelfInsert(d);
184  d->status = QUIT_CALLBACK;
185  if (d->cb->func[QUIT_CALLBACK] != NO_CALLBACK) {
186    d->kanji_status_return->info &= ~KanjiThroughInfo; /* »Å»ö¤·¤¿ */
187    popYomiMode(d);
188  }
189  return res;
190}
191
192static int
193EmptyKakutei(uiContext d)
194{
195  int res;
196
197  res = inEmptySelfInsert(d);
198  d->status = EXIT_CALLBACK;
199  if (d->cb->func[EXIT_CALLBACK] != NO_CALLBACK) {
200    d->kanji_status_return->info &= ~KanjiThroughInfo; /* »Å»ö¤·¤¿ */
201    popYomiMode(d);
202  }
203  return res;
204}
205
206static int
207EmptyDeletePrevious(uiContext d)
208{
209  yomiContext yc = (yomiContext)d->modec;
210
211  if (yc->generalFlags & CANNA_YOMI_DELETE_DONT_QUIT) {
212    /* Delete ¤Ç QUIT ¤·¤Ê¤¤¤Î¤Ç¤¢¤ì¤Ð¡¢selfInsert */
213    return inEmptySelfInsert(d);
214  }
215  else {
216    return EmptyQuit(d);
217  }
218}
219
220extraFunc *
221FindExtraFunc(int fnum)
222{
223  extern extraFunc *extrafuncp;
224  extraFunc *extrafunc;
225
226  for (extrafunc = extrafuncp; extrafunc; extrafunc = extrafunc->next) {
227    if (extrafunc->fnum == fnum) {
228      return extrafunc;
229    }
230  }
231  return (extraFunc *)0;
232}
233
234static int
235UserMode(uiContext d, extraFunc *estruct)
236{
237  newmode *nmode = estruct->u.modeptr;
238  yomiContext yc = (yomiContext)d->modec;
239  int modeid
240    = estruct->fnum - CANNA_FN_MAX_FUNC + CANNA_MODE_MAX_IMAGINARY_MODE;
241
242  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
243    return NothingChangedWithBeep(d);
244  }
245
246  yc->generalFlags &= ~CANNA_YOMI_ATTRFUNCS;
247  yc->generalFlags |= nmode->flags;
248  if (yc->generalFlags & CANNA_YOMI_END_IF_KAKUTEI) {
249    /* ³ÎÄê¤Ç½ª¤ï¤ë¤è¤¦¤Ê¥â¡¼¥É¤À¤Ã¤¿¤é³ÎÄê¥â¡¼¥É¤Ë¤Ê¤é¤Ê¤¤ */
250    yc->generalFlags &= ~CANNA_YOMI_KAKUTEI;
251  }
252  yc->romdic = nmode->romdic;
253  d->current_mode = yc->myEmptyMode = nmode->emode;
254
255  yc->majorMode = yc->minorMode = yc->myMinorMode = (BYTE)modeid;
256
257  currentModeInfo(d);
258
259  d->kanji_status_return->length = 0;
260  return 0;
261}
262
263#ifndef NO_EXTEND_MENU /* continues to the bottom of this file */
264static int
265UserSelect(uiContext d, extraFunc *estruct)
266{
267  int curkigo = 0, *posp = (int *)0;
268  kigoIchiran *kigop = (kigoIchiran *)0;
269  selectinfo *selinfo = (selectinfo *)0, *info;
270  yomiContext yc = (yomiContext)d->modec;
271
272  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
273    return NothingChangedWithBeep(d);
274  }
275  info = d->selinfo;
276  while (info) {
277    if (info->ichiran == estruct->u.kigoptr) {
278      selinfo = info;
279      break;
280    }
281    info = info->next;
282  }
283
284  if (!selinfo) {
285    selinfo = (selectinfo *)malloc(sizeof(selectinfo));
286    /* malloc ¤Ë¼ºÇÔ¤·¤¿¾ì¹ç¤Ï¡¢Á°²óÁªÂò¤·¤¿Èֹ椬Êݸ¤µ¤ì¤Ê¤¤ */
287    if (selinfo) {
288      selinfo->ichiran = estruct->u.kigoptr;
289      selinfo->curnum = 0;
290      selinfo->next = d->selinfo;
291      d->selinfo = selinfo;
292    }
293  }
294
295  if (selinfo) {
296    curkigo = selinfo->curnum;
297    posp = &selinfo->curnum;
298  }
299
300  kigop = estruct->u.kigoptr;
301  if (!kigop) {
302    return NothingChangedWithBeep(d);
303  }
304  return uuKigoMake(d, kigop->kigo_data, kigop->kigo_size,
305                    curkigo, kigop->kigo_mode, (int(*)(...))uuKigoGeneralExitCatch, posp);
306}
307
308static int
309UserMenu(uiContext d, extraFunc *estruct)
310{
311  return showmenu(d, estruct->u.menuptr);
312}
313#endif /* NO_EXTEND_MENU */
314
315/* ¥Ç¥Õ¥©¥ë¥È°Ê³°¤Î¥â¡¼¥É»ÈÍÑ»þ¤Ë¸Æ¤Ó½Ð¤¹´Ø¿ô¤òÀÚ¤êʬ¤±¤ë */
316
317static int
318ProcExtraFunc(uiContext d, int fnum)
319{
320  extraFunc *extrafunc;
321
322  extrafunc = FindExtraFunc(fnum);
323  if (extrafunc) {
324    switch (extrafunc->keyword) {
325      case EXTRA_FUNC_DEFMODE:
326        return UserMode(d, extrafunc);
327#ifndef NO_EXTEND_MENU
328      case EXTRA_FUNC_DEFSELECTION:
329        return UserSelect(d, extrafunc);
330      case EXTRA_FUNC_DEFMENU:
331        return UserMenu(d, extrafunc);
332#endif
333      default:
334        break;
335    }
336  }
337  return NothingChangedWithBeep(d);
338}
339
340int
341getBaseMode(yomiContext yc)
342{
343  int res;
344  long fl = yc->generalFlags;
345
346  if (yc->myMinorMode) {
347    return yc->myMinorMode;
348  }
349  else if (fl & CANNA_YOMI_ROMAJI) {
350    res = CANNA_MODE_ZenAlphaHenkanMode;
351  }
352  else if (fl & CANNA_YOMI_KATAKANA) {
353    res = CANNA_MODE_ZenKataHenkanMode;
354  }
355  else {
356    res = CANNA_MODE_ZenHiraHenkanMode;
357  }
358  if (fl & CANNA_YOMI_BASE_HANKAKU) {
359    res++;
360  }
361  if (fl & CANNA_YOMI_KAKUTEI) {
362    res += CANNA_MODE_ZenHiraKakuteiMode - CANNA_MODE_ZenHiraHenkanMode;
363  }
364  if (res == CANNA_MODE_ZenHiraHenkanMode) {
365    if (chikujip(yc)) {
366      res = CANNA_MODE_ChikujiYomiMode;
367    }
368    else {
369      res = CANNA_MODE_HenkanMode;
370    }
371  }
372  return res;
373}
374
375/* ¥Ù¡¼¥¹Ê¸»ú¤ÎÀÚ¤êÂؤ¨ */
376
377void
378EmptyBaseModeInfo(uiContext d, yomiContext yc)
379{
380  coreContext cc = (coreContext)d->modec;
381
382  cc->minorMode = getBaseMode(yc);
383  currentModeInfo(d);
384}
385
386int
387EmptyBaseHira(uiContext d)
388{
389  yomiContext yc = (yomiContext)d->modec;
390
391  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
392    return NothingChangedWithBeep(d);
393  }
394  yc->generalFlags &= ~(CANNA_YOMI_KATAKANA | CANNA_YOMI_HANKAKU |
395			CANNA_YOMI_ROMAJI | CANNA_YOMI_ZENKAKU);
396  EmptyBaseModeInfo(d, yc);
397  return 0;
398}
399
400int
401EmptyBaseKata(uiContext d)
402{
403  yomiContext yc = (yomiContext)d->modec;
404
405  if ((yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED)
406      || (cannaconf.InhibitHankakuKana
407	  && (yc->generalFlags & CANNA_YOMI_BASE_HANKAKU))) {
408    return NothingChangedWithBeep(d);
409  }
410  yc->generalFlags &= ~(CANNA_YOMI_ROMAJI | CANNA_YOMI_ZENKAKU);
411  yc->generalFlags |= CANNA_YOMI_KATAKANA |
412    ((yc->generalFlags & CANNA_YOMI_BASE_HANKAKU) ? CANNA_YOMI_HANKAKU : 0);
413  EmptyBaseModeInfo(d, yc);
414  return 0;
415}
416
417int
418EmptyBaseEisu(uiContext d)
419{
420  yomiContext yc = (yomiContext)d->modec;
421
422  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
423    return NothingChangedWithBeep(d);
424  }
425/*  yc->generalFlags &= ~CANNA_YOMI_ATTRFUNCS; ¥¯¥ê¥¢¤¹¤ë¤Î¤ä¤á */
426  yc->generalFlags |= CANNA_YOMI_ROMAJI |
427    ((yc->generalFlags & CANNA_YOMI_BASE_HANKAKU) ? 0 : CANNA_YOMI_ZENKAKU);
428  EmptyBaseModeInfo(d, yc);
429  return 0;
430}
431
432int
433EmptyBaseZen(uiContext d)
434{
435  yomiContext yc = (yomiContext)d->modec;
436
437  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
438    return NothingChangedWithBeep(d);
439  }
440  yc->generalFlags &= ~CANNA_YOMI_BASE_HANKAKU;
441  if (yc->generalFlags & CANNA_YOMI_ROMAJI) {
442    yc->generalFlags |= CANNA_YOMI_ZENKAKU;
443  }
444  /* ¢¨Ãí ¥í¡¼¥Þ»ú¥â¡¼¥É¤Ç¤«¤Ä¥«¥¿¥«¥Ê¥â¡¼¥É¤Î»þ¤¬¤¢¤ë
445          (¤½¤Î¾ì¹çɽÌ̾å¤Ï¥í¡¼¥Þ»ú¥â¡¼¥É) */
446  if (yc->generalFlags & CANNA_YOMI_KATAKANA) {
447    yc->generalFlags &= ~CANNA_YOMI_HANKAKU;
448  }
449  EmptyBaseModeInfo(d, yc);
450  return 0;
451}
452
453int
454EmptyBaseHan(uiContext d)
455{
456  yomiContext yc = (yomiContext)d->modec;
457
458  if ((yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) ||
459      /* ¥â¡¼¥ÉÊѹ¹¤¬¶Ø»ß¤µ¤ì¤Æ¤¤¤ë¤È¤« */
460      (cannaconf.InhibitHankakuKana &&
461       (yc->generalFlags & CANNA_YOMI_KATAKANA) &&
462       !(yc->generalFlags & CANNA_YOMI_ROMAJI))) {
463    /* Ⱦ³Ñ¥«¥Ê¤¬¶Ø»ß¤µ¤ì¤Æ¤¤¤ë¤Î¤ËȾ³Ñ¥«¥Ê¤Ë¤¤¤­¤½¤¦¤Ê¤È¤­ */
464    return NothingChangedWithBeep(d);
465  }
466  yc->generalFlags |= CANNA_YOMI_BASE_HANKAKU;
467  if (yc->generalFlags & CANNA_YOMI_ROMAJI) {
468    yc->generalFlags &= ~CANNA_YOMI_ZENKAKU;
469  }
470  /* ¢¨Ãí ¥í¡¼¥Þ»ú¥â¡¼¥É¤Ç¤«¤Ä¥«¥¿¥«¥Ê¥â¡¼¥É¤Î»þ¤¬¤¢¤ë
471          (¤½¤Î¾ì¹çɽÌ̾å¤Ï¥í¡¼¥Þ»ú¥â¡¼¥É) */
472  if (yc->generalFlags & CANNA_YOMI_KATAKANA) {
473    if (!cannaconf.InhibitHankakuKana) {
474      yc->generalFlags |= CANNA_YOMI_HANKAKU;
475    }
476  }
477  EmptyBaseModeInfo(d, yc);
478  return 0;
479}
480
481int
482EmptyBaseKana(uiContext d)
483{
484  yomiContext yc = (yomiContext)d->modec;
485
486  if ((yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) ||
487      /* ¥â¡¼¥ÉÊѹ¹¤¬¶Ø»ß¤µ¤ì¤Æ¤¤¤¿¤ê */
488      (!cannaconf.InhibitHankakuKana &&
489       (yc->generalFlags & CANNA_YOMI_KATAKANA) &&
490       (yc->generalFlags & CANNA_YOMI_BASE_HANKAKU))) {
491    /* Ⱦ³Ñ¥«¥Ê¤¬¶Ø»ß¤µ¤ì¤Æ¤¤¤ë¤Î¤ËȾ³Ñ¥«¥Ê¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤½¤¦¤Ê¾ì¹ç */
492    return NothingChangedWithBeep(d);
493  }
494  yc->generalFlags &= ~(CANNA_YOMI_ROMAJI | CANNA_YOMI_ZENKAKU);
495
496  if ((yc->generalFlags & CANNA_YOMI_BASE_HANKAKU) &&
497      (yc->generalFlags & CANNA_YOMI_KATAKANA)) {
498    yc->generalFlags |= CANNA_YOMI_HANKAKU;
499  }
500  EmptyBaseModeInfo(d, yc);
501  return 0;
502}
503
504int
505EmptyBaseKakutei(uiContext d)
506{
507  yomiContext yc = (yomiContext)d->modec;
508
509  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
510    return NothingChangedWithBeep(d);
511  }
512  yc->generalFlags |= CANNA_YOMI_KAKUTEI;
513
514  EmptyBaseModeInfo(d, yc);
515  return 0;
516}
517
518int
519EmptyBaseHenkan(uiContext d)
520{
521  yomiContext yc = (yomiContext)d->modec;
522
523  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
524    return NothingChangedWithBeep(d);
525  }
526  yc->generalFlags &= ~CANNA_YOMI_KAKUTEI;
527
528  EmptyBaseModeInfo(d, yc);
529  return 0;
530}
531
532#ifdef WIN
533
534extern specialfunc (uiContext, int);
535
536static HenkanRegion (uiContext);
537
538static
539HenkanRegion(uiContext d)
540{
541  return specialfunc(d, CANNA_FN_HenkanRegion);
542}
543
544static PhonoEdit (uiContext);
545
546static
547PhonoEdit(uiContext d)
548{
549  return specialfunc(d, CANNA_FN_PhonoEdit);
550}
551
552static DicEdit (uiContext);
553
554static
555DicEdit(uiContext d)
556{
557  return specialfunc(d, CANNA_FN_DicEdit);
558}
559
560static Configure (uiContext);
561
562static
563Configure(uiContext d)
564{
565  return specialfunc(d, CANNA_FN_Configure);
566}
567
568#endif
569
570#ifndef NO_EXTEND_MENU
571static int
572renbunInit(uiContext d)
573{
574  yomiContext yc = (yomiContext)d->modec;
575
576  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
577    return NothingChangedWithBeep(d);
578  }
579  d->status = 0;
580  killmenu(d);
581  if (ToggleChikuji(d, 0) == -1) {
582    jrKanjiError = "\317\242\312\270\300\341\312\321\264\271\244\313\300\332"
583	"\302\330\244\250\244\353\244\263\244\310\244\254\244\307\244\255"
584	"\244\336\244\273\244\363";
585                   /* ϢʸÀáÊÑ´¹¤ËÀÚÂؤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó */
586    makeGLineMessageFromString(d, jrKanjiError);
587    currentModeInfo(d);
588    return(-1);
589  }
590  else {
591    makeGLineMessageFromString(d, "\317\242\312\270\300\341\312\321\264\271"
592	"\244\313\300\332\302\330\244\250\244\336\244\267\244\277");
593                   /* ϢʸÀáÊÑ´¹¤ËÀÚÂؤ¨¤Þ¤·¤¿ */
594    currentModeInfo(d);
595    return 0;
596  }
597}
598
599static int
600showVersion(uiContext d)
601{
602  int retval = 0;
603  char s[512];
604  yomiContext yc = (yomiContext)d->modec;
605
606  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
607    return NothingChangedWithBeep(d);
608  }
609  d->status = 0;
610  killmenu(d);
611
612  sprintf(s, "\306\374\313\334\270\354\306\376\316\317\245\267\245\271\245\306"
613	"\245\340\241\330\244\253\244\363\244\312\241\331Version %d.%d",
614	  cannaconf.CannaVersion / 1000, cannaconf.CannaVersion % 1000);
615             /* ÆüËܸìÆþÎÏ¥·¥¹¥Æ¥à¡Ø¤«¤ó¤Ê¡Ù */
616  strcat(s, CANNA_PATCH_LEVEL);
617  makeGLineMessageFromString(d, s);
618  currentModeInfo(d);
619
620  return (retval);
621}
622
623static int
624showServer(uiContext d)
625{
626#ifndef STANDALONE /* This is not used in Windows environment 1996.7.30 kon */
627  int retval = 0;
628  char s[512];
629  extern defaultContext;
630  yomiContext yc = (yomiContext)d->modec;
631
632  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
633    return NothingChangedWithBeep(d);
634  }
635  d->status = 0;
636  killmenu(d);
637
638  if(defaultContext == -1) {
639    sprintf(s, "\244\253\244\312\264\301\273\372\312\321\264\271\245\265"
640	"\241\274\245\320\244\310\244\316\300\334\302\263\244\254\300\332"
641	"\244\354\244\306\244\244\244\336\244\271");
642               /* ¤«¤Ê´Á»úÊÑ´¹¥µ¡¼¥Ð¤È¤ÎÀܳ¤¬ÀÚ¤ì¤Æ¤¤¤Þ¤¹ */
643  }
644  else {
645    sprintf(s, "%s \244\316\244\253\244\312\264\301\273\372\312\321\264\271"
646	"\245\265\241\274\245\320\244\313\300\334\302\263\244\267\244\306"
647	"\244\244\244\336\244\271", RkwGetServerName());
648               /* ¤Î¤«¤Ê´Á»úÊÑ´¹¥µ¡¼¥Ð¤ËÀܳ¤·¤Æ¤¤¤Þ¤¹ */
649  }
650  makeGLineMessageFromString(d, s);
651  currentModeInfo(d);
652
653  return (retval);
654#else
655  return (0);
656#endif /* STANDALONE */
657}
658
659static int
660showGakushu(uiContext d)
661{
662  int retval = 0;
663  yomiContext yc = (yomiContext)d->modec;
664
665  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
666    return NothingChangedWithBeep(d);
667  }
668  d->status = 0;
669  killmenu(d);
670
671  if (cannaconf.Gakushu == 1) {
672    makeGLineMessageFromString(d, "\263\330\275\254\244\254\243\317\243\316"
673	"\244\316\276\365\302\326\244\307\244\271");
674                                  /* ³Ø½¬¤¬£Ï£Î¤Î¾õÂ֤Ǥ¹ */
675  }
676  else {
677    makeGLineMessageFromString(d, "\263\330\275\254\244\254\243\317\243\306"
678	"\243\306\244\316\276\365\302\326\244\307\244\271");
679                                  /* ³Ø½¬¤¬£Ï£Æ£Æ¤Î¾õÂ֤Ǥ¹ */
680  }
681    currentModeInfo(d);
682
683  return (retval);
684}
685
686static int
687showInitFile(uiContext d)
688{
689  int retval = 0;
690  char s[512];
691  extern char *CANNA_initfilename;
692  yomiContext yc = (yomiContext)d->modec;
693
694  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
695    return NothingChangedWithBeep(d);
696  }
697  d->status = 0;
698  killmenu(d);
699
700  if (CANNA_initfilename && strlen(CANNA_initfilename)) {
701    sprintf(s, "\245\253\245\271\245\277\245\336\245\244\245\272\245\325"
702	"\245\241\245\244\245\353\244\317 %s \244\362\273\310\315\321\244\267"
703	"\244\306\244\244\244\336\244\271", CANNA_initfilename);
704               /* ¥«¥¹¥¿¥Þ¥¤¥º¥Õ¥¡¥¤¥ë¤Ï %s ¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹ */
705    makeGLineMessageFromString(d, s);
706  }
707  else {
708    sprintf(s, "\245\253\245\271\245\277\245\336\245\244\245\272\245\325"
709	"\245\241\245\244\245\353\244\317\300\337\304\352\244\265\244\354"
710	"\244\306\244\244\244\336\244\273\244\363");
711               /* ¥«¥¹¥¿¥Þ¥¤¥º¥Õ¥¡¥¤¥ë¤ÏÀßÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó */
712    makeGLineMessageFromString(d, s);
713  }
714    currentModeInfo(d);
715
716  return (retval);
717}
718
719static int
720showRomkanaFile(uiContext d)
721{
722  int retval = 0;
723  char s[512];
724  extern char *RomkanaTable;
725  yomiContext yc = (yomiContext)d->modec;
726
727  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
728    return NothingChangedWithBeep(d);
729  }
730  d->status = 0;
731  killmenu(d);
732
733  if (RomkanaTable && romajidic) {
734    sprintf(s, "\245\355\241\274\245\336\273\372\244\253\244\312\312\321"
735	"\264\271\245\306\241\274\245\326\245\353\244\317 %s \244\362\273\310"
736	"\315\321\244\267\244\306\244\244\244\336\244\271",
737	    RomkanaTable);
738               /* ¥í¡¼¥Þ»ú¤«¤ÊÊÑ´¹¥Æ¡¼¥Ö¥ë¤Ï %s ¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹ */
739    makeGLineMessageFromString(d, s);
740  }
741  else {
742    sprintf(s, "\245\355\241\274\245\336\273\372\244\253\244\312\312\321"
743	"\264\271\245\306\241\274\245\326\245\353\244\317\273\310\315\321"
744	"\244\265\244\354\244\306\244\244\244\336\244\273\244\363");
745               /* ¥í¡¼¥Þ»ú¤«¤ÊÊÑ´¹¥Æ¡¼¥Ö¥ë¤Ï»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤»¤ó */
746    makeGLineMessageFromString(d, s);
747  }
748    currentModeInfo(d);
749
750  return (retval);
751}
752
753static int
754dicSync(uiContext d)
755{
756  int retval = 0;
757  char s[512];
758  extern int defaultContext;
759  yomiContext yc = (yomiContext)d->modec;
760
761  if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
762    return NothingChangedWithBeep(d);
763  }
764  d->status = 0;
765  killmenu(d);
766
767  retval = RkwSync(defaultContext, "");
768  sprintf(s, "\274\255\275\361\244\316 Sync \275\350\315\375%s",
769          retval < 0 ? "\244\313\274\272\307\324\244\267\244\336\244\267"
770	"\244\277" : "\244\362\271\324\244\244\244\336\244\267\244\277");
771          /* ¼­½ñ¤Î Sync ½èÍý%s",
772                retval < 0 ? "¤Ë¼ºÇÔ¤·¤Þ¤·¤¿" : "¤ò¹Ô¤¤¤Þ¤·¤¿ */
773  makeGLineMessageFromString(d, s);
774  currentModeInfo(d);
775
776  return 0;
777}
778#endif /* not NO_EXTEND_MENU */
779
780#include "emptymap.h"
781#include "alphamap.h"
782