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 #if !defined(lint) && !defined(__CODECENTER__)
24 static char rcs_id[] = "@(#) 102.1 $Id: uldelete.c,v 1.4 2003/09/17 08:50:53 aida_s Exp $";
25 #endif
26 
27 #if !defined(NO_EXTEND_MENU)
28 #include	<errno.h>
29 #include 	"canna.h"
30 
31 #ifdef luna88k
32 extern int errno;
33 #endif
34 
35 /*********************************************************************
36  *                      wchar_t replace begin                        *
37  *********************************************************************/
38 #ifdef wchar_t
39 # error "wchar_t is already defined"
40 #endif
41 #define wchar_t cannawc
42 
43 extern exp(int) RkwGetServerVersion pro((int *, int *));
44 extern exp(int) RkwChmodDic pro((int, char *, int));
45 
46 static int dicSakujoYomi pro((uiContext)),
47            dicSakujoEndBun pro((uiContext)),
48            dicSakujoTango pro((uiContext)),
49            dicSakujoDictionary pro((uiContext)),
50            dicSakujoDo pro((uiContext));
51 
52 void
freeWorkDic3(tc)53 freeWorkDic3(tc)
54 tourokuContext tc;
55 {
56   if (tc->workDic3) {
57     free((char *)tc->workDic3);
58     tc->workDic3 = (deldicinfo *)0;
59   }
60 }
61 
62 void
freeWorkDic(tc)63 freeWorkDic(tc)
64 tourokuContext tc;
65 {
66   if (tc->workDic2) {
67     free((char *)tc->workDic2);
68     tc->workDic2 = (deldicinfo *)0;
69   }
70   freeWorkDic3(tc);
71 }
72 
73 void
freeDic(tc)74 freeDic(tc)
75 tourokuContext tc;
76 {
77   if (tc->udic) {
78     wchar_t **p = tc->udic;
79 
80     for ( ; *p; p++) {
81       WSfree(*p);
82     }
83     free((char *)tc->udic);
84   }
85   freeWorkDic(tc);
86 }
87 
88 void
freeAndPopTouroku(d)89 freeAndPopTouroku(d)
90 uiContext d;
91 {
92   tourokuContext tc = (tourokuContext)d->modec;
93 
94   freeDic(tc);
95   popTourokuMode(d);
96   popCallback(d);
97 }
98 
99 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
100  * ñ�������ɤߤ�����                                                      *
101  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
102 static
uuSYomiEveryTimeCatch(d,retval,env)103 uuSYomiEveryTimeCatch(d, retval, env)
104 uiContext d;
105 int retval;
106 mode_context env;
107 /* ARGSUSED */
108 {
109   int len, echoLen, revPos;
110   wchar_t tmpbuf[ROMEBUFSIZE];
111 
112   retval = 0;
113   if((echoLen = d->kanji_status_return->length) < 0)
114     return(retval);
115 
116   if (echoLen == 0) {
117     d->kanji_status_return->revPos = 0;
118     d->kanji_status_return->revLen = 0;
119   }
120 
121   /* ��ꤢ���� echoStr �� d->genbuf ���⤷��ʤ��Τ� copy ���Ƥ��� */
122   WStrncpy(tmpbuf, d->kanji_status_return->echoStr, echoLen);
123 
124   revPos = MBstowcs(d->genbuf, "\306\311\244\337?[", ROMEBUFSIZE);
125 				/* �ɤ� */
126   WStrncpy(d->genbuf + revPos, tmpbuf, echoLen);
127   *(d->genbuf + revPos + echoLen) = (wchar_t) ']';
128   len = revPos + echoLen + 1;
129   *(d->genbuf + len) = (wchar_t) '\0';
130   d->kanji_status_return->gline.line = d->genbuf;
131   d->kanji_status_return->gline.length = len;
132   if (d->kanji_status_return->revLen) {
133     d->kanji_status_return->gline.revPos =
134       d->kanji_status_return->revPos + revPos;
135     d->kanji_status_return->gline.revLen = d->kanji_status_return->revLen;
136   }
137   else { /* ȿž�ΰ褬�ʤ���� */
138     d->kanji_status_return->gline.revPos = len - 1;
139     d->kanji_status_return->gline.revLen = 1;
140   }
141   d->kanji_status_return->info &= ~(KanjiThroughInfo | KanjiEmptyInfo);
142   d->kanji_status_return->info |= KanjiGLineInfo;
143   echostrClear(d);
144   checkGLineLen(d);
145 
146   return retval;
147 }
148 
149 static
uuSYomiExitCatch(d,retval,env)150 uuSYomiExitCatch(d, retval, env)
151 uiContext d;
152 int retval;
153 mode_context env;
154 /* ARGSUSED */
155 {
156   tourokuContext tc;
157 
158   popCallback(d); /* �ɤߤ� pop */
159 
160   tc = (tourokuContext)d->modec;
161 
162   WStrncpy(tc->yomi_buffer, d->buffer_return, retval);
163   tc->yomi_buffer[retval] = (wchar_t)'\0';
164   tc->yomi_len = WStrlen(tc->yomi_buffer);
165 
166   return dicSakujoTango(d);
167 }
168 
169 static
uuSYomiQuitCatch(d,retval,env)170 uuSYomiQuitCatch(d, retval, env)
171 uiContext d;
172 int retval;
173 mode_context env;
174 /* ARGSUSED */
175 {
176   popCallback(d); /* �ɤߤ� pop */
177 
178   clearYomi(d);
179 
180   freeAndPopTouroku(d);
181   GlineClear(d);
182   currentModeInfo(d);
183 
184   return prevMenuIfExist(d);
185 }
186 
187 static
dicSakujoYomi(d)188 dicSakujoYomi(d)
189 uiContext d;
190 {
191   yomiContext yc;
192 
193   d->status = 0;
194 
195   yc = GetKanjiString(d, (wchar_t *)NULL, 0,
196 	       CANNA_NOTHING_RESTRICTED,
197 	       (int)CANNA_YOMI_CHGMODE_INHIBITTED,
198 	       (int)CANNA_YOMI_END_IF_KAKUTEI,
199 	       (CANNA_YOMI_INHIBIT_HENKAN | CANNA_YOMI_INHIBIT_ASHEX |
200 	       CANNA_YOMI_INHIBIT_ASBUSHU),
201 	       uuSYomiEveryTimeCatch, uuSYomiExitCatch,
202 	       uuSYomiQuitCatch);
203   if (yc == (yomiContext)0) {
204     deleteEnd(d);
205     return NoMoreMemory();
206   }
207   yc->majorMode = CANNA_MODE_ExtendMode;
208   yc->minorMode = CANNA_MODE_DeleteDicMode;
209   currentModeInfo(d);
210 
211   return 0;
212 }
213 
214 static
acDicSakujoYomi(d,dn,dm)215 acDicSakujoYomi(d, dn, dm)
216 uiContext d;
217 int dn;
218 mode_context dm;
219 /* ARGSUSED */
220 {
221   popCallback(d);
222   return dicSakujoYomi(d);
223 }
224 
225 static
acDicSakujoDictionary(d,dn,dm)226 acDicSakujoDictionary(d, dn, dm)
227 uiContext d;
228 int dn;
229 mode_context dm;
230 /* ARGSUSED */
231 {
232   popCallback(d);
233   return dicSakujoDictionary(d);
234 }
235 
236 /*
237  * �ޥ���Ȥ���Ƥ��뼭���� WRITE ���Τ����Τ���Ф�
238  */
239 static
240 wchar_t **
getMountDicName(d,num_return)241 getMountDicName(d, num_return)
242 uiContext d;
243 int *num_return;
244 /* ARGSUSED */
245 {
246   int nmmdic, check, majv, minv;
247   struct dicname *p;
248   wchar_t **tourokup, **tp;
249   extern defaultContext;
250 
251   if (defaultContext < 0) {
252     if ((KanjiInit() < 0) || (defaultContext < 0)) {
253 #ifdef STANDALONE
254 #ifndef CODED_MESSAGE
255       jrKanjiError = "���ʴ����Ѵ��Ǥ��ޤ���";
256 #else
257       jrKanjiError = "\244\253\244\312\264\301\273\372\312\321\264\271\244\307\244\255\244\336\244\273\244\363";
258 #endif
259 #else
260 #ifndef CODED_MESSAGE
261       jrKanjiError = "���ʴ����Ѵ������Ф��̿��Ǥ��ޤ���";
262 #else
263       jrKanjiError = "\244\253\244\312\264\301\273\372\312\321\264\271\245\265"
264 	"\241\274\245\320\244\310\304\314\277\256\244\307\244\255\244\336"
265 	"\244\273\244\363";    /* ���ʴ����Ѵ������Ф��̿��Ǥ��ޤ��� */
266 #endif
267 #endif /* STANDALONE */
268       return 0;
269     }
270   }
271 
272   /* �����Ф� Version �ˤ�äƼ��Ф������ʬ���� */
273   RkwGetServerVersion(&majv, &minv);
274 
275   if (canna_version(majv, minv) < canna_version(3, 2)) {
276     /* Version3.2 ������Υ����Фξ�� */
277     for (nmmdic = 0, p = kanjidicnames; p; p = p->next) {
278       if (p->dicflag == DIC_MOUNTED && p->dictype == DIC_USER) {
279         nmmdic++;
280       }
281     }
282   }
283   else {
284     /* Version3.2 �ʹߤΥ����Фξ�� */
285     for (nmmdic = 0, p = kanjidicnames ; p ; p = p->next) {
286       if (p->dicflag == DIC_MOUNTED) {
287         check = RkwChmodDic(defaultContext, p->name, 0);
288         if (check >= 0 && (check & RK_ENABLE_WRITE)) {
289           nmmdic++;
290         } else {
291 	  check = RkwChmodDic(defaultContext, p->name, RK_GRP_DIC);
292 	  if (check >= 0 && (check & RK_ENABLE_WRITE)) {
293 	    nmmdic++;
294 	  }
295 	}
296       }
297     }
298   }
299 
300   /* return BUFFER �� alloc */
301   if ((tourokup = (wchar_t **)calloc(nmmdic + 1, sizeof(wchar_t *)))
302                                                   == (wchar_t **)NULL) {
303     /* + 1 �ʤΤ��Ǥ��ߤ�ޡ�������뤿�� */
304     jrKanjiError = "malloc (getMountDicName) \244\307\244\255\244\336\244\273"
305 	"\244\363\244\307\244\267\244\277";
306                        /* �Ǥ��ޤ���Ǥ��� */
307     return 0;
308   }
309 
310   if (canna_version(majv, minv) < canna_version(3, 2)) {
311     /* Version3.2 ������Υ����Фξ�� */
312     for (tp = tourokup + nmmdic, p = kanjidicnames ; p ; p = p->next) {
313       if (p->dicflag == DIC_MOUNTED && p->dictype == DIC_USER) {
314         *--tp = WString(p->name);
315       }
316     }
317   }
318   else {
319     /* Version3.2 �ʹߤΥ����Фξ�� */
320     for (tp = tourokup + nmmdic, p = kanjidicnames ; p ; p = p->next) {
321       if (p->dicflag == DIC_MOUNTED) {
322         check = RkwChmodDic(defaultContext, p->name, 0);
323         if (check >= 0 && (check & RK_ENABLE_WRITE)) {
324           *--tp = WString(p->name);
325         } else {
326 	  check = RkwChmodDic(defaultContext, p->name, RK_GRP_DIC);
327 	  if (check >= 0 && (check & RK_ENABLE_WRITE)) {
328 	    *--tp = WString(p->name);
329 	  }
330         }
331       }
332     }
333   }
334   tourokup[nmmdic] = (wchar_t *)0;
335   *num_return = nmmdic;
336 
337   return tourokup;
338 }
339 
dicSakujo(d)340 dicSakujo(d)
341 uiContext d;
342 {
343   wchar_t **mp, **p;
344   tourokuContext tc;
345   int num;
346   yomiContext yc = (yomiContext)d->modec;
347 
348   if (yc->generalFlags & CANNA_YOMI_CHGMODE_INHIBITTED) {
349     return NothingChangedWithBeep(d);
350   }
351   d->status = 0;
352 
353   /* �ޥ���Ȥ���Ƥ��뼭��� WRITE ���Τ����Τ��äƤ��� */
354   if ((mp = getMountDicName(d, &num)) != 0) {
355     if (getTourokuContext(d) != NG) {
356       tc = (tourokuContext)d->modec;
357 
358       tc->udic = mp;
359       if(!*mp) {
360         makeGLineMessageFromString(d, "\303\261\270\354\272\357\275\374"
361 	"\262\304\307\275\244\312\274\255\275\361\244\254\302\270\272\337"
362 	"\244\267\244\336\244\273\244\363");
363 			/* ñ������ǽ�ʼ���¸�ߤ��ޤ��� */
364 
365         freeAndPopTouroku(d);
366         deleteEnd(d);
367         currentModeInfo(d);
368         return 0;
369       }
370       tc->nudic = num;
371       return dicSakujoYomi(d);
372     }
373     for ( p = mp; *p; p++) {
374       WSfree(*p);
375     }
376     free((char *)mp);
377   }
378   deleteEnd(d);
379   return GLineNGReturn(d);
380 }
381 
382 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
383  * ñ������ñ�������                                                      *
384  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
385 
386 static
CloseDeleteContext(tc)387 CloseDeleteContext(tc)
388 tourokuContext tc;
389 {
390   if(tc->delContext >= 0) {
391     if (RkwCloseContext(tc->delContext) < 0) {
392       if (errno == EPIPE) {
393 	jrKanjiPipeError();
394       }
395     }
396   }
397 #ifdef DEBUG
398   else
399     printf("ERROR: delContext < 0\n");
400 #endif
401 }
402 
403 /*
404  * ���ꤵ�줿ñ�줬��Ͽ����Ƥ��뼭�����Ф�
405  */
406 static
getEffectDic(tc)407 getEffectDic(tc)
408 tourokuContext tc;
409 {
410   int workContext, currentkouho, nbunsetsu, nelem = tc->nudic;
411   wchar_t **mdic, **cands, **work;
412   wchar_t **getIchiranList();
413   char dicname[1024], tmpbuf[64];
414   RkLex lex[5];
415   deldicinfo *dic;
416 
417   dic = (deldicinfo *)malloc((nelem + 1) * sizeof(deldicinfo));
418   if (dic == (deldicinfo *)NULL) {
419 #ifndef CODED_MESSAGE
420     jrKanjiError = "malloc (getEffectDic) �Ǥ��ޤ���Ǥ���";
421 #else
422     jrKanjiError = "malloc (getEffectDic) \244\307\244\255\244\336\244\273"
423 	"\244\363\244\307\244\267\244\277";
424 #endif
425     return NG;
426   }
427   tc->workDic2 = dic;
428 
429   if ((workContext = RkwCreateContext()) == NG) {
430     if (errno == EPIPE) {
431       jrKanjiPipeError();
432     }
433 #ifndef CODED_MESSAGE
434     jrKanjiError = "�������ѥ���ƥ����Ȥ�����Ǥ��ޤ���Ǥ���";
435 #else
436     jrKanjiError = "\274\255\275\361\270\241\272\367\315\321\245\263\245\363"
437 	"\245\306\245\257\245\271\245\310\244\362\272\356\300\256\244\307"
438 	"\244\255\244\336\244\273\244\363\244\307\244\267\244\277";
439 #endif
440     return NG;
441   }
442 
443 #ifdef STANDALONE
444   if ((RkwSetDicPath(workContext, "iroha")) == NG) {
445 #ifndef CODED_MESSAGE
446     jrKanjiError = "����ǥ��쥯�ȥ������Ǥ��ޤ���Ǥ���";
447 #else
448     jrKanjiError = "\274\255\275\361\245\307\245\243\245\354\245\257\245\310\245\352\244\362\300\337\304\352\244\307\244\255\244\336\244\273\244\363\244\307\244\267\244\277";
449 #endif
450     CloseDeleteContext(tc);
451     return NG;
452   }
453 #endif /* STANDALONE */
454 
455   for (mdic = tc->udic; *mdic; mdic++) {
456     WCstombs(dicname, *mdic, sizeof(dicname));
457     if (RkwMountDic(workContext, dicname, 0) == NG) {
458       if (errno == EPIPE) {
459         jrKanjiPipeError();
460       }
461       jrKanjiError = "\274\255\275\361\270\241\272\367\315\321\245\263\245\363"
462 	"\245\306\245\257\245\271\245\310\244\313\274\255\275\361\244\362"
463 	"\245\336\245\246\245\363\245\310\244\307\244\255\244\336\244\273"
464 	"\244\363\244\307\244\267\244\277";
465               /* �������ѥ���ƥ����Ȥ˼����ޥ���ȤǤ��ޤ���Ǥ��� */
466       RkwCloseContext(workContext);
467       return NG;
468     }
469 
470     nbunsetsu = RkwBgnBun(workContext, tc->yomi_buffer, tc->yomi_len, 0);
471     if (nbunsetsu == 1) {
472       if ((cands = getIchiranList(workContext, &nelem, &currentkouho)) != 0) {
473         work = cands;
474         while (*work) {
475           if (WStrcmp(*work, tc->tango_buffer) == 0) {
476             dic->name = *mdic;
477             if (RkwXfer(workContext, currentkouho) == NG) {
478               if (errno == EPIPE)
479                 jrKanjiPipeError();
480               jrKanjiError = "\245\253\245\354\245\363\245\310\270\365\312\344"
481 			     "\244\362\274\350\244\352\275\320\244\273\244\336"
482 			     "\244\273\244\363\244\307\244\267\244\277";
483                /* �����ȸ������Ф��ޤ���Ǥ��� */
484               freeGetIchiranList(cands);
485               RkwEndBun(workContext, 0);
486               RkwUnmountDic(workContext, dicname);
487               RkwCloseContext(workContext);
488               return NG;
489             }
490             if (RkwGetLex(workContext, lex, 5) <= 0) {
491               if (errno == EPIPE)
492                 jrKanjiPipeError();
493               jrKanjiError = "\267\301\302\326\301\307\276\360\312\363\244\362"
494 		"\274\350\244\352\275\320\244\273\244\336\244\273\244\363"
495 		"\244\307\244\267\244\277";
496                 /* �����Ǿ������Ф��ޤ���Ǥ��� */
497               freeGetIchiranList(cands);
498               RkwEndBun(workContext, 0);
499               RkwUnmountDic(workContext, dicname);
500               RkwCloseContext(workContext);
501               return NG;
502             }
503             sprintf((char *)tmpbuf, "#%d#%d", lex[0].rownum, lex[0].colnum);
504             MBstowcs(dic->hcode, tmpbuf, 16);
505             dic++;
506             break;
507           }
508           work++;
509         }
510         freeGetIchiranList(cands);
511       }
512     }
513 
514     if (RkwEndBun(workContext, 0) == NG) {
515       if (errno == EPIPE) {
516         jrKanjiPipeError();
517       }
518       jrKanjiError = "\244\253\244\312\264\301\273\372\312\321\264\271\244\316"
519 	"\275\252\316\273\244\313\274\272\307\324\244\267\244\336\244\267"
520 	"\244\277";
521        /* ���ʴ����Ѵ��ν�λ�˼��Ԥ��ޤ��� */
522       RkwUnmountDic(workContext, dicname);
523       RkwCloseContext(workContext);
524       return NG;
525     }
526 
527     if (RkwUnmountDic(workContext, dicname) == NG) {
528       if (errno == EPIPE) {
529         jrKanjiPipeError();
530       }
531       jrKanjiError = "\274\255\275\361\270\241\272\367\315\321\244\316\274\255"
532 	"\275\361\244\362\245\242\245\363\245\336\245\246\245\363\245\310"
533 	"\244\307\244\255\244\336\244\273\244\363\244\307\244\267\244\277";
534        /* �������Ѥμ������ޥ���ȤǤ��ޤ���Ǥ��� */
535       RkwCloseContext(workContext);
536       return NG;
537     }
538   }
539 
540   if (RkwCloseContext(workContext) < 0) {
541     if (errno == EPIPE) {
542       jrKanjiPipeError();
543     }
544     jrKanjiError = "\274\255\275\361\270\241\272\367\315\321\244\316\245\263"
545 	"\245\363\245\306\245\257\245\271\245\310\244\362\245\257\245\355"
546 	"\241\274\245\272\244\307\244\255\244\336\244\273\244\363\244\307"
547 	"\244\267\244\277";
548      /* �������ѤΥ���ƥ����Ȥ������Ǥ��ޤ���Ǥ��� */
549     return NG;
550   }
551 
552   dic->name = (wchar_t *)0;
553   tc->nworkDic2 = dic - tc->workDic2;
554   return 0;
555 }
556 
557 static
uuSTangoExitCatch(d,retval,env)558 uuSTangoExitCatch(d, retval, env)
559 uiContext d;
560 int retval;
561 mode_context env;
562 /* ARGSUSED */
563 {
564   forichiranContext fc;
565   tourokuContext tc;
566 
567   popCallback(d); /* ������ pop */
568 
569   fc = (forichiranContext)d->modec;
570   freeGetIchiranList(fc->allkouho);
571 
572   popForIchiranMode(d);
573   popCallback(d);
574 
575   tc = (tourokuContext)d->modec;
576   WStrcpy(tc->tango_buffer, d->buffer_return);
577   tc->tango_buffer[d->nbytes] = 0;
578   tc->tango_len = d->nbytes;
579 
580   d->nbytes = 0;
581 
582   if (getEffectDic(tc) == NG) {
583     freeDic(tc);
584     deleteEnd(d);
585     return GLineNGReturnTK(d);
586   }
587 
588   return dicSakujoDictionary(d);
589 }
590 
591 static
uuSTangoQuitCatch(d,retval,env)592 uuSTangoQuitCatch(d, retval, env)
593 uiContext d;
594 int retval;
595 mode_context env;
596 /* ARGSUSED */
597 {
598   forichiranContext fc;
599 
600   popCallback(d); /* ������ pop */
601 
602   fc = (forichiranContext)d->modec;
603   freeGetIchiranList(fc->allkouho);
604 
605   popForIchiranMode(d);
606   popCallback(d);
607 
608   clearYomi(d);
609   return dicSakujoYomi(d);
610 }
611 
612 /*
613  * �ɤߤ���ꤵ�줿�������Ѵ�����
614  */
615 static
dicSakujoBgnBun(d,st)616 dicSakujoBgnBun(d, st)
617 uiContext d;
618 RkStat *st;
619 {
620   tourokuContext tc = (tourokuContext)d->modec;
621   int nbunsetsu;
622   char dicname[1024];
623   wchar_t **mdic;
624 
625   if(!tc) {
626 #if !defined(DEBUG)
627     printf("tc = NULL\n");
628 #endif
629   }
630   if(!tc->udic) {
631 #if !defined(DEBUG)
632     printf("tc->udic = NULL\n");
633 #endif
634   }
635 
636   if((tc->delContext = RkwCreateContext())== NG) {
637     if (errno == EPIPE) {
638       jrKanjiPipeError();
639     }
640     jrKanjiError = "\303\261\270\354\272\357\275\374\315\321\244\316\245\263"
641 	"\245\363\245\306\245\257\245\271\245\310\244\362\272\356\300\256"
642 	"\244\307\244\255\244\336\244\273\244\363";
643      /* ñ�����ѤΥ���ƥ����Ȥ�����Ǥ��ޤ��� */
644     return(NG);
645   }
646 
647 #ifdef STANDALONE
648   if ((RkwSetDicPath(tc->delContext, "iroha")) == NG) {
649 #ifndef CODED_MESSAGE
650     jrKanjiError = "����ǥ��쥯�ȥ������Ǥ��ޤ���Ǥ���";
651 #else
652     jrKanjiError = "\274\255\275\361\245\307\245\243\245\354\245\257\245\310\245\352\244\362\300\337\304\352\244\307\244\255\244\336\244\273\244\363\244\307\244\267\244\277";
653 #endif
654     CloseDeleteContext(tc);
655     return NG;
656   }
657 #endif /* STANDALONE */
658 
659   for (mdic = tc->udic; *mdic; mdic++) {
660     WCstombs(dicname, *mdic, sizeof(dicname));
661     if (RkwMountDic(tc->delContext, dicname, 0) == NG) {
662       if (errno == EPIPE) {
663         jrKanjiPipeError();
664       }
665       jrKanjiError = "\303\261\270\354\272\357\275\374\315\321\244\316\274"
666 	"\255\275\361\244\362\245\336\245\246\245\363\245\310\244\307\244"
667 	"\255\244\336\244\273\244\363\244\307\244\267\244\277";
668         /* ñ�����Ѥμ����ޥ���ȤǤ��ޤ���Ǥ��� */
669       CloseDeleteContext(tc);
670       return(NG);
671     }
672   }
673 
674   if((nbunsetsu = RkwBgnBun(tc->delContext, tc->yomi_buffer, tc->yomi_len, 0))
675 	== -1) {
676     if (errno == EPIPE) {
677       jrKanjiPipeError();
678     }
679     jrKanjiError = "\244\253\244\312\264\301\273\372\312\321\264\271\244\313"
680 	"\274\272\307\324\244\267\244\336\244\267\244\277";
681       /* ���ʴ����Ѵ��˼��Ԥ��ޤ��� */
682     CloseDeleteContext(tc);
683     return(NG);
684   }
685 
686   if(RkwGetStat(tc->delContext, st) == -1) {
687     RkwEndBun(tc->delContext, 0); /* 0:�ؽ����ʤ� */
688     if(errno == EPIPE)
689       jrKanjiPipeError();
690     jrKanjiError = "\245\271\245\306\245\244\245\277\245\271\244\362\274\350"
691 	"\244\352\275\320\244\273\244\336\244\273\244\363\244\307\244\267"
692 	"\244\277";
693                /* ���ƥ���������Ф��ޤ���Ǥ��� */
694     /* ����ޥ���Ȥ��Ƥʤ� */
695     CloseDeleteContext(tc);
696     return(NG);
697   }
698 
699   return(nbunsetsu);
700 }
701 
702 static
dicSakujoEndBun(d)703 dicSakujoEndBun(d)
704 uiContext d;
705 {
706   tourokuContext tc = (tourokuContext)d->modec;
707 
708   if(RkwEndBun(tc->delContext, 0) == -1) {	/* 0:�ؽ����ʤ� */
709     if(errno == EPIPE)
710       jrKanjiPipeError();
711     jrKanjiError = "\244\253\244\312\264\301\273\372\312\321\264\271\244\316"
712 	"\275\252\316\273\244\313\274\272\307\324\244\267\244\336\244\267"
713 	"\244\277";
714        /* ���ʴ����Ѵ��ν�λ�˼��Ԥ��ޤ��� */
715     return(NG);
716   }
717 
718   return(0);
719 }
720 
721 static
dicSakujoTango(d)722 dicSakujoTango(d)
723 uiContext d;
724 {
725   tourokuContext tc = (tourokuContext)d->modec;
726   forichiranContext fc;
727   ichiranContext ic;
728   wchar_t **allDelCands, **getIchiranList();
729   BYTE inhibit = 0;
730   int nbunsetsu, nelem, currentkouho, retval = 0;
731   RkStat st;
732 
733   if(tc->yomi_len < 1) {
734     return canna_alert(d, "\306\311\244\337\244\362\306\376\316\317\244\267"
735 	"\244\306\244\257\244\300\244\265\244\244", acDicSakujoYomi);
736 		/* �ɤߤ����Ϥ��Ƥ������� */
737   }
738 
739   if((nbunsetsu = dicSakujoBgnBun(d, &st)) == NG) {
740     freeDic(tc);
741     deleteEnd(d);
742     return(GLineNGReturnTK(d));
743   }
744   if((nbunsetsu != 1) || (st.maxcand == 0)) {
745     /* ���䤬�ʤ� */
746     if(dicSakujoEndBun(d) == NG) {
747       freeDic(tc);
748       CloseDeleteContext(tc);
749       deleteEnd(d);
750       return(GLineNGReturnTK(d));
751     }
752 
753     makeGLineMessageFromString(d, "\244\263\244\316\306\311\244\337\244\307"
754 	"\305\320\317\277\244\265\244\354\244\277\303\261\270\354\244\317"
755 	"\302\270\272\337\244\267\244\336\244\273\244\363");
756          /* �����ɤߤ���Ͽ���줿ñ���¸�ߤ��ޤ��� */
757     CloseDeleteContext(tc);
758     freeAndPopTouroku(d);
759     deleteEnd(d);
760     currentModeInfo(d);
761     return(0);
762   }
763 
764   /* ���٤Ƥθ������Ф� */
765   if((allDelCands =
766       getIchiranList(tc->delContext, &nelem, &currentkouho)) == 0) {
767     freeDic(tc);
768     dicSakujoEndBun(d);
769     CloseDeleteContext(tc);
770     deleteEnd(d);
771     return(GLineNGReturnTK(d));
772   }
773 
774   if (dicSakujoEndBun(d) == NG) {
775     freeDic(tc);
776     CloseDeleteContext(tc);
777     deleteEnd(d);
778     return GLineNGReturnTK(d);
779   }
780   CloseDeleteContext(tc);
781 
782   if(getForIchiranContext(d) == NG) {
783     freeDic(tc);
784     freeGetIchiranList(allDelCands);
785     deleteEnd(d);
786     return(GLineNGReturnTK(d));
787   }
788 
789   fc = (forichiranContext)d->modec;
790   fc->allkouho = allDelCands;
791 
792   if (!cannaconf.HexkeySelect)
793     inhibit |= ((BYTE)NUMBERING | (BYTE)CHARINSERT);
794   else
795     inhibit |= (BYTE)CHARINSERT;
796 
797   fc->curIkouho = currentkouho;	/* ���ߤΥ����ȸ����ֹ����¸���� */
798   currentkouho = 0;	/* �����ȸ��䤫�鲿���ܤ����ȸ���Ȥ��뤫 */
799 
800   /* ��������˰ܹԤ��� */
801   if((retval = selectOne(d, fc->allkouho, &fc->curIkouho, nelem, BANGOMAX,
802                inhibit, currentkouho, WITHOUT_LIST_CALLBACK,
803 	       NO_CALLBACK, uuSTangoExitCatch,
804 	       uuSTangoQuitCatch, uiUtilIchiranTooSmall)) == NG) {
805     freeDic(tc);
806     freeGetIchiranList(fc->allkouho);
807     deleteEnd(d);
808     return(GLineNGReturnTK(d));
809   }
810 
811   ic = (ichiranContext)d->modec;
812   ic->majorMode = CANNA_MODE_ExtendMode;
813   ic->minorMode = CANNA_MODE_DeleteDicMode;
814   currentModeInfo(d);
815 
816   if(ic->tooSmall) {
817     d->status = AUX_CALLBACK;
818     return(retval);
819   }
820 
821   makeGlineStatus(d);
822   /* d->status = EVERYTIME_CALLBACK; */
823 
824   return(retval);
825 }
826 
827 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
828  * ñ�����μ������                                                        *
829  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
830 
831 static
getDeleteDic(mc)832 getDeleteDic(mc)
833 mountContext mc;
834 {
835   tourokuContext tc = (tourokuContext)mc->next;
836   int i, num = 0;
837   deldicinfo *dic, *srcp;
838 
839   /* �ޤ���ñ�������뼭��ο�������� */
840   for (i = 0; mc->mountList[i]; i++) {
841     if (mc->mountOldStatus[i] != mc->mountNewStatus[i]) {
842       num++;
843     }
844   }
845 
846   dic = (deldicinfo *)malloc((num + 1) * sizeof(deldicinfo));
847   if (dic != (deldicinfo *)NULL) {
848     tc->workDic3 = dic;
849 
850     /* �ɤμ�����ñ��������뤫 */
851     srcp = tc->workDic2;
852     for (i = 0; mc->mountList[i]; i++, srcp++) {
853       if (mc->mountOldStatus[i] != mc->mountNewStatus[i]) {
854         *dic++ = *srcp;
855       }
856     }
857     dic->name = (wchar_t *)0;
858     tc->nworkDic3 = dic - tc->workDic3;
859     return 0;
860   }
861   jrKanjiError ="malloc (uuSDicExitCatch) \244\307\244\255\244\336\244\273"
862 	"\244\363\244\307\244\267\244\277";
863                  /* �Ǥ��ޤ���Ǥ��� */
864   return NG;
865 }
866 
867 
868 static
uuSDicExitCatch(d,retval,env)869 uuSDicExitCatch(d, retval, env)
870 uiContext d;
871 int retval;
872 mode_context env;
873 /* ARGSUSED */
874 {
875   mountContext mc;
876   tourokuContext tc;
877 
878   d->nbytes = 0;
879 
880   popCallback(d); /* ������ pop */
881 
882   mc = (mountContext)d->modec;
883 
884   if (getDeleteDic(mc) == NG) {
885     popMountMode(d);
886     popCallback(d);
887     tc = (tourokuContext)d->modec;
888     freeDic(tc);
889     deleteEnd(d);
890     return GLineNGReturnTK(d);
891   }
892 
893   popMountMode(d);
894   popCallback(d);
895 
896   tc = (tourokuContext)d->modec;
897   /* ����������ʤ��ä��Ȥ��ϡ���å�������Ф���
898      �����Υ��������Ϥ��줿�顢 �����������롣     */
899   if (tc->nworkDic3 == 0) {
900     return canna_alert(d, "\274\255\275\361\244\362\301\252\302\362\244\267"
901 	"\244\306\244\257\244\300\244\265\244\244", acDicSakujoDictionary);
902 		/* ����������Ƥ������� */
903   }
904 
905   return dicSakujoDo(d);
906 }
907 
908 static
uuSDicQuitCatch(d,retval,env)909 uuSDicQuitCatch(d, retval, env)
910 uiContext d;
911 int retval;
912 mode_context env;
913 /* ARGSUSED */
914 {
915   popCallback(d); /* ������ pop */
916 
917   popMountMode(d);
918   popCallback(d);
919 
920   freeWorkDic((tourokuContext)d->modec);
921   return dicSakujoTango(d);
922 }
923 
924 static
dicSakujoDictionary(d)925 dicSakujoDictionary(d)
926 uiContext d;
927 {
928   tourokuContext tc = (tourokuContext)d->modec;
929   mountContext mc;
930   ichiranContext ic;
931   deldicinfo *work;
932   BYTE inhibit = 0;
933   int retval, i, upnelem = tc->nworkDic2;
934   char *dicLbuf, **dicLp, *wptr;
935   BYTE *soldp, *snewp;
936   wchar_t *xxxx[100];
937 
938   retval = d->nbytes = 0;
939   d->status = 0;
940 
941   if (upnelem == 1) {
942     work
943       = (deldicinfo *)malloc((1 /* upnelem(==1) */ + 1) * sizeof(deldicinfo));
944     if (work != (deldicinfo *)NULL) {
945       tc->workDic3 = work;
946       *work++ = *tc->workDic2; /* ��¤�Τ����� */
947       work->name = (wchar_t *)0;
948       tc->nworkDic3 = 1; /* work - tc->workDic3 == 1 */
949       return dicSakujoDo(d);
950     }
951     jrKanjiError = "malloc (dicSakujoDictionary) \244\307\244\255\244\336"
952 	"\244\273\244\363\244\307\244\267\244\277";
953                  /* �Ǥ��ޤ���Ǥ��� */
954     freeDic(tc);
955     deleteEnd(d);
956     return GLineNGReturnTK(d);
957   }
958 
959   if ((dicLbuf = (char *)malloc(ROMEBUFSIZE)) != (char *)NULL) {
960     if ((dicLp = (char **)calloc(upnelem + 1, sizeof(char *)))
961                                                != (char **)NULL) {
962       wptr = dicLbuf;
963       for (work = tc->workDic2; work->name; work++) {
964         i = WCstombs(wptr, work->name, ROMEBUFSIZE);
965         wptr += i;
966         *wptr++ = '\0';
967       }
968       for (wptr = dicLbuf, i = 0; i < upnelem ; i++) {
969         dicLp[i] = wptr;
970         while (*wptr++)
971           /* EMPTY */
972           ;
973       }
974       dicLp[i] = (char *)NULL;
975 
976       /* ���ߤξ��֤Ϥ��٤� off �ˤ��Ƥ��� */
977       if ((soldp = (BYTE *)calloc(upnelem + 1, sizeof(BYTE)))
978                                                != (BYTE *)NULL) {
979         if ((snewp = (BYTE *)calloc(upnelem + 1, sizeof(BYTE)))
980                                                  != (BYTE *)NULL) {
981           if ((retval = getMountContext(d)) != NG) {
982             mc = (mountContext)d->modec;
983             mc->mountOldStatus = soldp;
984             mc->mountNewStatus = snewp;
985             mc->mountList = dicLp;
986 
987             /* selectOnOff ��Ƥ֤���ν��� */
988 
989             mc->curIkouho = 0;
990             if (!cannaconf.HexkeySelect)
991               inhibit |= ((BYTE)NUMBERING | (BYTE)CHARINSERT);
992             else
993               inhibit |= (BYTE)CHARINSERT;
994 
995             retval = setWStrings(xxxx, mc->mountList, 0);
996             if (retval == NG) {
997               popMountMode(d);
998               popCallback(d);
999               deleteEnd(d);
1000               return GLineNGReturnTK(d);
1001             }
1002             if ((retval = selectOnOff(d, xxxx, &mc->curIkouho, upnelem,
1003 		            BANGOMAX, 0, mc->mountOldStatus,
1004 		            NO_CALLBACK, uuSDicExitCatch,
1005                             uuSDicQuitCatch, uiUtilIchiranTooSmall)) == NG) {
1006               popMountMode(d);
1007               popCallback(d);
1008               deleteEnd(d);
1009               return GLineNGReturnTK(d);
1010             }
1011 
1012             ic = (ichiranContext)d->modec;
1013             ic->majorMode = CANNA_MODE_ExtendMode;
1014             ic->minorMode = CANNA_MODE_DeleteDicMode;
1015             currentModeInfo(d);
1016 
1017             /* ��������Ԥ������Ƹ���������Ф��ʤ� */
1018             if (ic->tooSmall) {
1019               jrKanjiError = "\274\255\275\361\260\354\315\367\315\321\244\316"
1020 		"\311\375\244\254\266\271\244\244\244\316\244\307\274\255"
1021 		"\275\361\244\316\301\252\302\362\244\254\244\307\244\255"
1022 		"\244\336\244\273\244\363";
1023                 /* ��������Ѥ����������ΤǼ���������Ǥ��ޤ��� */
1024               ichiranFin(d);
1025               popCallback(d); /* OnOff ��ݥå� */
1026               popMountMode(d);
1027               popCallback(d);
1028               currentModeInfo(d);
1029               freeDic(tc);
1030               deleteEnd(d);
1031               return GLineNGReturnTK(d);
1032             }
1033 
1034             makeGlineStatus(d);
1035             /* d->status = ICHIRAN_EVERYTIME; */
1036 
1037             return(retval);
1038           }
1039           free((char *)snewp);
1040         }
1041         free((char *)soldp);
1042       }
1043       free((char *)dicLp);
1044     }
1045     free(dicLbuf);
1046   }
1047   jrKanjiError = "malloc (dicSakujoDictionary) \244\307\244\255\244\336"
1048 	"\244\273\244\363\244\307\244\267\244\277";
1049      /* �Ǥ��ޤ���Ǥ��� */
1050   freeDic(tc);
1051   deleteEnd(d);
1052   return GLineNGReturnTK(d);
1053 }
1054 
1055 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1056  * ñ����                                                                  *
1057  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1058 
1059 static
uuSDeleteYesCatch(d,retval,env)1060 uuSDeleteYesCatch(d, retval, env)
1061 uiContext d;
1062 int retval;
1063 mode_context env;
1064 /* ARGSUSED */
1065 {
1066   tourokuContext tc;
1067   char dicname[1024];
1068   wchar_t *WStraddbcpy();
1069   deldicinfo *dic;
1070   int bufcnt, l;
1071   extern defaultContext;
1072 
1073   deleteEnd(d);
1074   popCallback(d); /* yesNo ��ݥå� */
1075 
1076   tc = (tourokuContext)d->modec;
1077 
1078   if(defaultContext == -1) {
1079     if((KanjiInit() < 0) || (defaultContext == -1)) {
1080 #ifdef STANDALONE
1081 #ifndef CODED_MESSAGE
1082       jrKanjiError = "���ʴ����Ѵ��Ǥ��ޤ���";
1083 #else
1084       jrKanjiError = "\244\253\244\312\264\301\273\372\312\321\264\271\244\307\244\255\244\336\244\273\244\363";
1085 #endif
1086 #else
1087 #ifndef CODED_MESSAGE
1088       jrKanjiError = "���ʴ����Ѵ������Ф��̿��Ǥ��ޤ���";
1089 #else
1090       jrKanjiError = "\244\253\244\312\264\301\273\372\312\321\264\271\245\265"
1091 	"\241\274\245\320\244\310\304\314\277\256\244\307\244\255\244\336"
1092 	"\244\273\244\363";
1093 #endif
1094 #endif
1095       freeAndPopTouroku(d);
1096       return(GLineNGReturn(d));
1097     }
1098   }
1099 
1100   /* ������ñ��������� */
1101   /* ñ�����Ѥΰ�Ԥ���(�Ƽ�����) */
1102   WStraddbcpy(d->genbuf, tc->yomi_buffer, ROMEBUFSIZE);
1103   l = WStrlen(tc->yomi_buffer);
1104   d->genbuf[l] = (wchar_t)' ';
1105   l += 1;
1106   for (dic = tc->workDic3; dic->name; dic++) {
1107     /* ñ�����Ѥΰ�Ԥ���(�Ƽ����ͭ) */
1108     WStrcpy(d->genbuf + l, dic->hcode);
1109     bufcnt = l + WStrlen(dic->hcode);
1110     d->genbuf[bufcnt] = (wchar_t)' ';
1111     bufcnt += 1;
1112     WStraddbcpy(d->genbuf + bufcnt, tc->tango_buffer,
1113                                                  ROMEBUFSIZE - bufcnt);
1114 
1115     WCstombs(dicname, dic->name, sizeof(dicname));
1116     if (RkwDeleteDic(defaultContext, dicname, d->genbuf) == NG) {
1117       if (errno == EPIPE)
1118         jrKanjiPipeError();
1119       MBstowcs(d->genbuf, "\303\261\270\354\272\357\275\374\244\307\244\255"
1120 	"\244\336\244\273\244\363\244\307\244\267\244\277", 512);
1121 		/* ñ�����Ǥ��ޤ���Ǥ��� */
1122       goto close;
1123     }
1124     if (cannaconf.auto_sync) {
1125       RkwSync(defaultContext, dicname);
1126     }
1127   }
1128 
1129   /* ����δ�λ��ɽ������ */
1130   l = MBstowcs(d->genbuf, "\241\330", ROMEBUFSIZE);
1131 			/* �� */
1132   WStrcpy(d->genbuf + l, tc->tango_buffer);
1133   l += WStrlen(tc->tango_buffer);
1134   l += MBstowcs(d->genbuf + l, "\241\331(", ROMEBUFSIZE - l);
1135 				/* �� */
1136   WStrcpy(d->genbuf + l, tc->yomi_buffer);
1137   l += WStrlen(tc->yomi_buffer);
1138   l += MBstowcs(d->genbuf + l, ")\244\362\274\255\275\361 ", ROMEBUFSIZE - l);
1139 			/* ���� */
1140   dic = tc->workDic3;
1141   WStrcpy(d->genbuf + l, dic->name);
1142   l += WStrlen(dic->name);
1143   for (dic++; dic->name; dic++) {
1144     l += MBstowcs(d->genbuf + l, " \244\310 ", ROMEBUFSIZE - l);
1145 				/* �� */
1146     WStrcpy(d->genbuf + l, dic->name);
1147     l += WStrlen(dic->name);
1148   }
1149   l += MBstowcs(d->genbuf + l, " \244\253\244\351\272\357\275\374\244\267"
1150 	"\244\336\244\267\244\277", ROMEBUFSIZE - l);
1151 			/* ���������ޤ��� */
1152 
1153  close:
1154   makeGLineMessage(d, d->genbuf, WStrlen(d->genbuf));
1155 
1156   freeAndPopTouroku(d);
1157 
1158   currentModeInfo(d);
1159 
1160   return(0);
1161 }
1162 
1163 static
uuSDeleteQuitCatch(d,retval,env)1164 uuSDeleteQuitCatch(d, retval, env)
1165 uiContext d;
1166 int retval;
1167 mode_context env;
1168 /* ARGSUSED */
1169 {
1170   tourokuContext tc = (tourokuContext)env;
1171 
1172   popCallback(d); /* yesNo ��ݥå� */
1173 
1174   if (tc->nworkDic2 == 1) {
1175     freeWorkDic(tc);
1176     return dicSakujoTango(d);
1177   }
1178   freeWorkDic3(tc);
1179   return dicSakujoDictionary(d);
1180 }
1181 
1182 static
uuSDeleteNoCatch(d,retval,env)1183 uuSDeleteNoCatch(d, retval, env)
1184 uiContext d;
1185 int retval;
1186 mode_context env;
1187 /* ARGSUSED */
1188 {
1189   popCallback(d); /* yesNo ��ݥå� */
1190 
1191   freeAndPopTouroku(d);
1192   deleteEnd(d);
1193   currentModeInfo(d);
1194 
1195   GlineClear(d);
1196 
1197   return(retval);
1198 }
1199 
1200 static
dicSakujoDo(d)1201 dicSakujoDo(d)
1202 uiContext d;
1203 {
1204   tourokuContext tc = (tourokuContext)d->modec;
1205   int l;
1206   deldicinfo *dic;
1207 
1208   l = MBstowcs(d->genbuf, "\241\330", ROMEBUFSIZE);
1209 			/* �� */
1210   WStrcpy(d->genbuf + l, tc->tango_buffer);
1211   l += WStrlen(tc->tango_buffer);
1212   l += MBstowcs(d->genbuf + l, "\241\331(", ROMEBUFSIZE - l);
1213 				/* �� */
1214   WStrcpy(d->genbuf + l, tc->yomi_buffer);
1215   l += WStrlen(tc->yomi_buffer);
1216   l += MBstowcs(d->genbuf + l, ")\244\362\274\255\275\361 ", ROMEBUFSIZE - l);
1217 			/* ���� */
1218   dic = tc->workDic3;
1219   WStrcpy(d->genbuf + l, dic->name);
1220   l += WStrlen(dic->name);
1221   for (dic++; dic->name; dic++) {
1222     l += MBstowcs(d->genbuf + l, " \244\310�� ", ROMEBUFSIZE - l);
1223 				/* �� */
1224     WStrcpy(d->genbuf + l, dic->name);
1225     l += WStrlen(dic->name);
1226   }
1227   l += MBstowcs(d->genbuf + l, " \244\253\244\351\272\357\275\374\244\267"
1228 	"\244\336\244\271\244\253?(y/n)", ROMEBUFSIZE - l);
1229 		/* ���������ޤ��� */
1230   if (getYesNoContext(d,
1231 	     NO_CALLBACK, uuSDeleteYesCatch,
1232 	     uuSDeleteQuitCatch, uuSDeleteNoCatch) == NG) {
1233     freeDic(tc);
1234     deleteEnd(d);
1235     return(GLineNGReturnTK(d));
1236   }
1237   makeGLineMessage(d, d->genbuf, WStrlen(d->genbuf));
1238 
1239   return(0);
1240 }
1241 
1242 #ifndef wchar_t
1243 # error "wchar_t is already undefined"
1244 #endif
1245 #undef wchar_t
1246 /*********************************************************************
1247  *                       wchar_t replace end                         *
1248  *********************************************************************/
1249 
1250 #endif /* !NO_EXTEND_MENU */
1251