1 /*
2  *  $Id: select_ele.c,v 1.4 2002/03/30 01:45:41 hiroo Exp $
3  */
4 
5 /*
6  * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
7  * This file is part of FreeWnn.
8  *
9  * Copyright Kyoto University Research Institute for Mathematical Sciences
10  *                 1987, 1988, 1989, 1990, 1991, 1992
11  * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
12  * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
13  * Copyright FreeWnn Project 1999, 2000, 2002
14  *
15  * Maintainer:  FreeWnn Project   <freewnn@tomo.gr.jp>
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 2 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30  */
31 
32 /* ��Ĥ����Ǥ�桼�����˼��Ф��Ƥ�餦����Υ롼���� */
33 #if HAVE_CONFIG_H
34 #  include <config.h>
35 #endif
36 
37 #define DD_MAX 512
38 
39 #include <stdio.h>
40 #if STDC_HEADERS
41 #  include <string.h>
42 #elif HAVE_STRINGS_H
43 #  include <strings.h>
44 #endif /* STDC_HEADERS */
45 
46 #include "commonhd.h"
47 #include "sdefine.h"
48 #include "sheader.h"
49 #include "buffer.h"
50 #include "jslib.h"
51 #include "jllib.h"
52 
53 #define printh(mm)\
54   if(state == 0){\
55     printf("%c.",((mm - dd[cc]) > 9)? mm - dd[cc] - 10 + 'A':\
56                                       mm - dd[cc] + '0');\
57     printf("%s", data[mm]);\
58   }else{\
59     printf("%c.",((mm > 9)? mm - 10  + 'A':mm + '0'));\
60     printf("%s", data[mm]);}
61 
62 
63 #define kouho_len(x) (strlen(x) + 4)
64 
65 /*
66 #define WIDTH (maxlength - disp_mode_length - 6)
67 */
68 #define LEND c_b->vlen + 1
69 #define WIDTH (LEND - 7)
70 
71 static char **data;             /* mojiretu data area */
72 static int dd[512];             /* gamen no sentou to naru youso wo motte iru */
73 static int dd_size;             /* dd no size */
74 static char *msg;
75 static int msg_len;
76 static int cc;                  /* ima no gamen */
77 static int mm;                  /* hyouji mojiretu */
78 static int state;               /* choose whether to number all or not */
79                                 /* 0: line by line */
80                                 /* 1: all */
81 static int kosuu;               /* kosuu of elements */
82 
83 static void display_all (), display ();
84 static void reverse ();
85 static void clear_it ();
86 static int find_cc (), set_kouho (), change_decimal (), findcp ();
87 
88 int
select_one_element(c,kosuu1,init,msg1,msg_len1,state1,key_tbl)89 select_one_element (c, kosuu1, init, msg1, msg_len1, state1, key_tbl)
90      char **c;                  /*ɽ��ʸ���������Υݥ��� */
91      int kosuu1;
92      int state1;
93      int init;
94      char *msg1;
95      int msg_len1;
96      int (**key_tbl) ();
97 {
98   int oldmm;                    /* hitotu mae no mm */
99   int d;
100   int c1;
101   int ret;
102 
103   extern int henkan_off ();
104 
105   int not_redrawtmp = not_redraw;
106   not_redraw = 1;               /* ��ɥ����ʤ� */
107   push_cursor ();
108   kk_cursor_invisible ();       /* ���������ä� */
109 
110   kosuu = kosuu1;
111   data = c;
112   msg = msg1;
113   msg_len = msg_len1;
114   state = state1;
115 
116   dd_size = set_kouho (kosuu);
117   cc = find_cc (init);
118 
119   mm = init;
120   display_all (mm, cc);
121   for (;;)
122     {
123       c1 = keyin ();
124       if (!ONEBYTE_CHAR (c1))
125         continue;
126       oldmm = mm;
127       d = change_decimal (c1);
128       if (state == 0)
129         {
130           if (d >= 0 && d < dd[cc + 1] - dd[cc])
131             {
132               not_redraw = not_redrawtmp;
133               pop_cursor ();
134               return (d + dd[cc]);
135             }
136         }
137       else
138         {
139           if (d >= 0 && d < kosuu)
140             {
141               not_redraw = not_redrawtmp;
142               pop_cursor ();
143               return (d);
144             }
145         }
146       if ((c1 < 256) && (key_tbl[c1] != NULL))
147         {
148 
149           if (henkan_off == key_tbl[c1])
150             {                   /* added by T.S 10 Jan. '88 */
151               henkan_off ();    /* What a mess!!  */
152               throw_c (LEND);   /* not beautiful!! */
153               flush ();
154               continue;
155             }
156           else if ((ret = (*key_tbl[c1]) ()) == 1)
157             {
158               not_redraw = not_redrawtmp;
159               pop_cursor ();
160               return (mm);
161             }
162           else if (ret == -1)
163             {
164               not_redraw = not_redrawtmp;
165               pop_cursor ();
166               return (-1);
167             }
168         }
169       else
170         {
171           ring_bell ();
172         }
173       if (mm < dd[cc] || mm >= dd[cc + 1])
174         {
175           cc = find_cc (mm);
176           display_all (mm, cc);
177         }
178       else
179         {
180           if (mm != oldmm)
181             {
182               clear_it (oldmm, cc);
183               reverse (mm, cc);
184             }
185         }
186     }
187 }
188 
189 static int
find_mm(cc_num,banme)190 find_mm (cc_num, banme)
191      int cc_num, banme;
192 {
193   if (dd[cc_num + 1] - dd[cc_num] > banme)
194     {
195       return (dd[cc_num] + banme);
196     }
197   else
198     {
199       return (dd[cc_num + 1] - 1);
200     }
201 }
202 
203 static int
find_cc(mm)204 find_cc (mm)
205      int mm;
206 {
207   int k;
208   for (k = dd_size - 1; k >= 0; k--)
209     {
210       if (dd[k] <= mm)
211         {
212           return (k);
213         }
214     }
215   return (0);
216 }
217 
218 static void
display_all(mm,cc)219 display_all (mm, cc)
220      int mm, cc;
221 {
222   int cp;
223   int k;
224 
225   throw_c (0);
226   clr_line ();
227   printf (msg);
228   for (k = dd[cc]; k < dd[cc + 1]; k++)
229     {
230       cp = findcp (k, cc);
231       throw_c (cp);
232       if (k == mm)
233         h_r_on ();
234       printh (k);
235       if (k == mm)
236         h_r_off ();
237     }
238   throw_c (WIDTH);
239   printf ("%3d/%-3d", dd[cc + 1], dd[dd_size]);
240   flush ();
241 }
242 
243 static int
findcp(mm,cc)244 findcp (mm, cc)
245      int mm, cc;
246 {
247   int k;
248   int cp = msg_len;
249 
250   for (k = dd[cc]; k < mm; k++)
251     {
252       cp += kouho_len (data[k]);
253     }
254   return (cp);
255 }
256 
257 static void
clear_it(mm,cc)258 clear_it (mm, cc)
259      int mm, cc;
260 {
261   int cp;
262 
263   cp = findcp (mm, cc);
264   throw_c (cp);
265   printh (mm);
266   flush ();
267 }
268 
269 static void
reverse(mm,cc)270 reverse (mm, cc)
271      int mm, cc;
272 {
273   int cp;
274 
275   cp = findcp (mm, cc);
276   throw_c (cp);
277   h_r_on ();
278   printh (mm);
279   h_r_off ();
280   throw_c (LEND);
281   flush ();
282 }
283 static int
set_kouho()284 set_kouho ()
285 {
286   int cp = msg_len;
287   int k;
288   int pt = 0;
289 
290   dd[pt++] = 0;
291   for (k = 0; k < kosuu; k++)
292     {
293       if ((cp >= (WIDTH - kouho_len (data[k])) && (dd[pt - 1] != k)) || (k - dd[pt - 1]) >= min (max_ichiran_kosu, (10 + 26)))
294         {
295           /* limit of selection is alphabet26 + number10 */
296           dd[pt++] = k;
297           cp = msg_len;
298         }
299       cp += kouho_len (data[k]);
300     }
301   dd[pt] = k;
302   return (pt);
303 }
304 
305 static int
change_decimal(c1)306 change_decimal (c1)
307      int c1;
308 {
309   if (c1 >= '0' && c1 <= '9')
310     {
311       return (c1 - '0');
312     }
313   if (c1 >= 'A' && c1 <= 'Z')
314     {
315       return (c1 - 'A' + 10);
316     }
317   if (c1 >= 'a' && c1 <= 'z')
318     {
319       return (c1 - 'a' + 10);
320     }
321   return (-1);
322 }
323 
324 int
forward_select()325 forward_select ()
326 {
327   if (mm < kosuu - 1)
328     {
329       mm++;
330     }
331   else
332     {
333       mm = 0;
334     }
335   return (0);
336 }
337 
338 int
backward_select()339 backward_select ()
340 {
341   if (mm > 0)
342     {
343       mm--;
344     }
345   else
346     {
347       mm = kosuu - 1;
348     }
349   return (0);
350 }
351 
352 int
lineend_select()353 lineend_select ()
354 {
355   mm = dd[cc + 1] - 1;
356   return (0);
357 }
358 
359 int
linestart_select()360 linestart_select ()
361 {
362   mm = dd[cc];
363   return (0);
364 }
365 
366 int
select_select()367 select_select ()
368 {
369   return (1);                   /* return mm from upper function */
370 }
371 
372 int
quit_select()373 quit_select ()
374 {
375   return (-1);
376 }
377 
378 int
previous_select()379 previous_select ()
380 {
381   if (cc > 0)
382     {
383       mm = find_mm (cc - 1, mm - dd[cc]);
384     }
385   else
386     {
387       mm = find_mm (dd_size - 1, mm - dd[cc]);
388     }
389   return (0);
390 }
391 
392 int
next_select()393 next_select ()
394 {
395   if (cc < dd_size - 1)
396     {
397       mm = find_mm (cc + 1, mm - dd[cc]);
398     }
399   else
400     {
401       mm = find_mm (0, mm - dd[cc]);
402     }
403   return (0);
404 }
405 
406 int
redraw_select()407 redraw_select ()
408 {
409   display_all (mm, cc);
410   return (0);
411 }
412 
413 
414 
415 
416 /* these are function for select element with displaying all one element
417    in a line */
418 static int lc;                  /* line count */
419 static int lc_offset = 0;       /* title count */
420 static int sc;                  /* screen count */
421 
422 void
set_lc_offset(line)423 set_lc_offset (line)
424      int line;
425 {
426   lc_offset = line;
427 }
428 
429 int
select_line_element(c,kosuu1,init,msg1,msg_len1,state1,key_tbl)430 select_line_element (c, kosuu1, init, msg1, msg_len1, state1, key_tbl)
431      char **c;                  /*ɽ��ʸ���������Υݥ��� */
432      int kosuu1;
433      int init;
434      char *msg1;
435      int msg_len1;
436      int state1;
437      int (**key_tbl) ();
438 {
439   int c1;
440   int ret;
441 
442   int not_redrawtmp = not_redraw;
443   not_redraw = 1;               /* ��ɥ����ʤ� */
444   push_cursor ();
445 
446   data = c;
447   msg = msg1;
448   msg_len = msg_len1;
449   state = state1;
450   kosuu = kosuu1;
451 
452   lc = init;
453   sc = 0;
454   for (;;)
455     {
456       display (lc, sc);
457       c1 = keyin ();
458       if (!ONEBYTE_CHAR (c1))
459         continue;
460 /*
461     d = change_decimal(c1);
462     if(d >= 0 && d < kosuu){
463       not_redraw = not_redrawtmp;
464       pop_cursor();
465       return(d);
466     }
467 */
468       if ((c1 < 256) && (key_tbl[c1] != NULL))
469         {
470           if ((ret = (*key_tbl[c1]) ()) == 1)
471             {
472               not_redraw = not_redrawtmp;
473               pop_cursor ();
474               return (lc);
475             }
476           else if (ret == -1)
477             {
478               not_redraw = not_redrawtmp;
479               pop_cursor ();
480               return (-1);
481             }
482         }
483       else
484         {
485           ring_bell ();
486         }
487     }
488 }
489 
490 int
cnt_of_screen(lc)491 cnt_of_screen (lc)
492      int lc;
493 {
494   return (strlen (data[lc]) / st_colum (1) + 1);
495 }
496 
497 
498 static void
display(lc,sc)499 display (lc, sc)
500      int lc, sc;
501 {
502   int eof = 0;
503   char *c;
504   char *start = 0;
505   char *end;
506   char buf[1024];
507   throw_c (0);
508   clr_line ();
509   if (sc >= cnt_of_screen (lc))
510     {
511       sc = cnt_of_screen (lc) - 1;
512     }
513   for (c = data[lc]; *c;)
514     {
515       if (start == 0)
516         {
517           if (c >= st_colum (sc) + data[lc])
518             start = c;
519         }
520       else
521         {
522           if (c > st_colum (sc) + (c_b->vlen - 2) + data[lc])
523             {
524               eof = 1;
525               break;
526             }
527         }
528       if (*c & 0x80)
529         {
530           c += 2;
531         }
532       else
533         {
534           c++;
535         }
536     }
537   end = c;
538   if (start == 0)
539     {
540 /*
541     printf("Error sc = %d",sc);
542     flush();
543 */
544       return;
545     }
546   strncpy (buf, start, end - start);
547   buf[end - start] = 0;
548   if (sc != 0)
549     {
550       printf ("%c", '$');
551     }
552   else
553     {
554       printf ("%c", ' ');
555     }
556   printf ("%s", buf);
557   if (eof != 0)
558     {
559       printf ("%c", '$');
560     }
561   else
562     {
563       printf ("%c", ' ');
564     }
565 
566   flush ();
567 }
568 
569 int
st_colum(x)570 st_colum (x)
571      int x;
572 {
573   return (((c_b->vlen - 2) * 3 / 4) * x);
574 }
575 
576 
577 int
next_select_line()578 next_select_line ()
579 {
580   if (lc < kosuu - 1)
581     {
582       lc++;
583     }
584   else
585     {
586       lc = 0;
587     }
588   return (0);
589 }
590 
591 int
previous_select_line()592 previous_select_line ()
593 {
594   if (lc > 0)
595     {
596       lc--;
597     }
598   else
599     {
600       lc = kosuu - 1;
601     }
602   return (0);
603 }
604 
605 int
select_select_line()606 select_select_line ()
607 {
608   return (1);
609 }
610 
611 int
linestart_select_line()612 linestart_select_line ()
613 {
614   sc = 0;
615   return (0);
616 }
617 
618 int
lineend_select_line()619 lineend_select_line ()
620 {
621   sc = cnt_of_screen (lc) - 1;
622   return (0);
623 }
624 
625 int
quit_select_line()626 quit_select_line ()
627 {
628   return (-1);
629 }
630 
631 int
forward_select_line()632 forward_select_line ()
633 {
634   if (sc < cnt_of_screen (lc) - 1)
635     {
636       sc++;
637     }
638   return (0);
639 }
640 
641 int
backward_select_line()642 backward_select_line ()
643 {
644   if (sc > 0)
645     {
646       sc--;
647     }
648   return (0);
649 }
650 
651 int
redraw_select_line()652 redraw_select_line ()
653 {
654   display (lc, sc);
655   return (0);
656 }
657 
658 /*
659  *
660  *  Functions Called during select element (dictionaries).
661  *
662  */
663 
664 /* jishodel for kensaku */
665 int
kdicdel()666 kdicdel ()
667 {
668   char buf[512];
669 
670   /*
671      sprintf(buf, "���� %s �������ޤ���(Y/N)", dicinfo[lc-lc_offset].fname);
672    */
673   sprintf (buf, "%s%s%s", MSG_GET (31), dicinfo[lc - lc_offset].fname, MSG_GET (24));
674   if (yes_or_no (buf) == 1)
675     {
676       if (jl_dic_delete (bun_data_, dicinfo[lc - lc_offset].dic_no) == -1)
677         {
678           errorkeyin ();
679           return (0);
680         }
681       return (1);
682     }
683   return (0);
684 }
685 
686 
687 int
kdicuse()688 kdicuse ()
689 {
690   char buf[512];
691 
692   if (dicinfo[lc - lc_offset].enablef)
693     {
694       /*
695          sprintf(buf, "���� %s �λ��Ѥ���ߤ��ޤ���(Y/N)", dicinfo[lc-lc_offset].fname);
696        */
697       sprintf (buf, "%s%s%s", MSG_GET (31), dicinfo[lc - lc_offset].fname, MSG_GET (26));
698     }
699   else
700     {
701       /*
702          sprintf(buf, "���� %s �λ��Ѥ�Ƴ����ޤ���(Y/N)", dicinfo[lc-lc_offset].fname);
703        */
704       sprintf (buf, "%s%s%s", MSG_GET (31), dicinfo[lc - lc_offset].fname, MSG_GET (32));
705     }
706   if (yes_or_no (buf) == 1)
707     {
708       if (jl_dic_use (bun_data_, dicinfo[lc - lc_offset].dic_no, !dicinfo[lc - lc_offset].enablef) == -1)
709         {
710           errorkeyin ();
711           return (0);
712         }
713       return (1);
714     }
715   return (0);
716 }
717 
718 /* jishodel for kensaku */
719 int
kdiccom()720 kdiccom ()
721 {
722   w_char com[512];
723 #ifdef nodef
724   char st[32];
725 #endif
726   int v = 1;
727 
728   com[0] = 0;
729 #ifdef nodef
730   if (dicinfo[lc - lc_offset].hindo == -1)
731     {
732       v = 1;
733     }
734   else
735     {
736       /*
737          if(kana_in("1:���� 2:���� �ɤ���˥����Ȥ��åȤ��ޤ�����>" ,UNDER_LINE_MODE  , com , 512) == -1)return(0);
738        */
739       if (kana_in (MSG_GET (33), UNDER_LINE_MODE, com, 512) == -1)
740         return (0);
741       if (wchartochar (com, st) || sscanf (st, "%d", &v) <= 0 || (v != 1 && v != 2))
742         {
743           /*
744              print_msg_getc("1 �� 2 ����ꤷ�Ʋ�������(ǡ��?)");
745            */
746           print_msg_getc (MSG_GET (34));
747           return (0);
748         }
749     }
750 #endif
751   com[0] = 0;
752   /*
753      if(kana_in("������: " ,UNDER_LINE_MODE  , com , 512) == -1)return(0);
754    */
755   if (kana_in (MSG_GET (35), UNDER_LINE_MODE, com, 512) == -1)
756     return (0);
757   if (v == 1)
758     {
759       if (jl_dic_comment_set (bun_data_, dicinfo[lc - lc_offset].dic_no, com) == -1)
760         {
761           errorkeyin ();
762           return (0);
763         }
764     }
765   else
766     {
767 #ifdef nodef
768       if (jl_hindo_comment_set (bun_data_, dicinfo[lc - lc_offset].dic_no, com) == -1)
769         {
770           errorkeyin ();
771           return (0);
772         }
773 #endif
774     }
775   return (1);
776 }
777 
778 /*
779  *
780  *  Functions Called during select element (dic_entries).
781  *
782  */
783 
784 /* Defined in kensaku.c */
785 extern struct wnn_jdata *word_searched;
786 
787 int
kworddel()788 kworddel ()
789 {
790   char buf[512];
791   int type;
792 
793   type = dicinfo[find_dic_by_no (word_searched[lc].dic_no)].type;
794   if (type != WNN_UD_DICT && type != WNN_REV_DICT && type != BWNN_REV_DICT && type != CWNN_REV_DICT)
795     {
796       /*
797          print_msg_getc("��������μ���Υ���ȥ�Ϻ������ޤ���(ǡ��?)");
798        */
799       print_msg_getc (MSG_GET (21));
800       return (0);
801     }
802   if (dicinfo[find_dic_by_no (word_searched[lc].dic_no)].rw == WNN_DIC_RDONLY)
803     {
804       /*
805          print_msg_getc("�꡼�ɥ���꡼�μ���Υ���ȥ�Ϻ������ޤ���(ǡ��?)");
806        */
807       print_msg_getc (MSG_GET (22));
808       return (0);
809     }
810 
811   /*
812      strcpy(buf, "��");
813    */
814   strcpy (buf, MSG_GET (23));
815   sStrcpy (buf + strlen (buf), word_searched[lc].kanji);
816   /*
817      sprintf(buf + strlen(buf), "�פ������ޤ���(Y/N)");
818    */
819   sprintf (buf + strlen (buf), MSG_GET (24));
820   if (yes_or_no (buf) == 1)
821     {
822       if (jl_word_delete (bun_data_, word_searched[lc].dic_no, word_searched[lc].serial) == -1)
823         {
824           errorkeyin ();
825           return (0);
826         }
827       return (1);
828     }
829   return (0);
830 }
831 
832 int
kworduse()833 kworduse ()
834 {
835   char buf[512];
836 
837   if (dicinfo[find_dic_by_no (word_searched[lc].dic_no)].hindo_rw == WNN_DIC_RDONLY)
838     {
839       /*
840          print_msg_getc("�꡼�ɥ���꡼�����٤��ѹ�����ޤ���(ǡ��?)");
841        */
842       print_msg_getc (MSG_GET (25));
843       return (0);
844     }
845   /*
846      strcpy(buf, "��");
847    */
848   strcpy (buf, MSG_GET (23));
849   sStrcpy (buf + strlen (buf), word_searched[lc].kanji);
850   if (word_searched[lc].hindo == -1 || (word_searched[lc].int_hindo == -1 && !word_searched[lc].int_ima))
851     {
852       /*
853          sprintf(buf + strlen(buf), "�פλ��Ѥ�Ƴ����ޤ���(Y/N)");
854        */
855       sprintf (buf + strlen (buf), MSG_GET (32));
856     }
857   else
858     {
859       /*
860          sprintf(buf + strlen(buf), "�פλ��Ѥ���ߤ��ޤ���(Y/N)");
861        */
862       sprintf (buf + strlen (buf), MSG_GET (26));
863     }
864   if (yes_or_no (buf) == 1)
865     {
866       if (jl_word_use (bun_data_, word_searched[lc].dic_no, word_searched[lc].serial) == -1)
867         {
868           errorkeyin ();
869           return (0);
870         }
871       return (1);
872     }
873   return (0);
874 }
875 
876 int
kwordcom()877 kwordcom ()
878 {
879   w_char com[512];
880   int type;
881   com[0] = 0;
882 
883   type = dicinfo[find_dic_by_no (word_searched[lc].dic_no)].type;
884   if (type != WNN_UD_DICT && type != WNN_REV_DICT && type != BWNN_REV_DICT && type != CWNN_REV_DICT)
885     {
886       /*
887          print_msg_getc("�����������Υ���ȥ�Υ����Ȥ��ѹ�����ޤ���(ǡ��?)");
888        */
889       print_msg_getc (MSG_GET (36));
890 
891     }
892   if (dicinfo[find_dic_by_no (word_searched[lc].dic_no)].rw == WNN_DIC_RDONLY)
893     {
894       /*
895          print_msg_getc("�꡼�ɥ���꡼����Υ���ȥ�Υ����Ȥ��ѹ�����ޤ���(ǡ��?)");
896        */
897       print_msg_getc (MSG_GET (37));
898       return (0);
899     }
900 
901   /*
902      if(kana_in(" ������: " ,UNDER_LINE_MODE  , com , 512) == -1)return(0);
903    */
904   if (kana_in (MSG_GET (35), UNDER_LINE_MODE, com, 512) == -1)
905     return (0);
906   if (jl_word_comment_set (bun_data_, word_searched[lc].dic_no, word_searched[lc].serial, com) == -1)
907     {
908       errorkeyin ();
909       return (0);
910     }
911   return (1);
912 
913 }
914 
915 static int
call_hindo_set(ima,hindo)916 call_hindo_set (ima, hindo)
917      int ima;
918      int hindo;
919 {
920   if (js_hindo_set (bun_data_->env, word_searched[lc].dic_no, word_searched[lc].serial, ima, hindo) == -1)
921     {
922       errorkeyin ();
923       return (0);
924     }
925   return (1);
926 }
927 
928 int
kwordima()929 kwordima ()
930 {
931   if (word_searched[lc].ima)
932     {
933       if (call_hindo_set (WNN_IMA_OFF, WNN_HINDO_NOP))
934         return (1);
935     }
936   else
937     {
938       if (call_hindo_set (WNN_IMA_ON, WNN_HINDO_NOP))
939         return (1);
940     }
941   return (0);
942 }
943 
944 int
kwordhindo()945 kwordhindo ()
946 {
947   int cur_hindo;
948   w_char kana_buf[512];
949   char st[32];
950   int newhindo;
951   char message[80];
952 
953   if (dicinfo[find_dic_by_no (word_searched[lc].dic_no)].hindo_rw == WNN_DIC_RDONLY)
954     {
955       print_msg_getc (MSG_GET (25));
956       return (0);
957     }
958   cur_hindo = word_searched[lc].hindo;
959 
960   sprintf (message, MSG_GET (46), MSG_GET (99), cur_hindo);
961 Retry:
962   kana_buf[0] = 0;
963   if (kana_in (message, UNDER_LINE_MODE, kana_buf, 1024) == -1)
964     return (0);
965   if (wchartochar (kana_buf, st) || sscanf (st, "%d", &newhindo) <= 0)
966     {
967       print_msg_getc (MSG_GET (47));
968       goto Retry;
969     }
970   else if (newhindo < 0)
971     {
972       print_msg_getc (MSG_GET (48));
973       goto Retry;
974     }
975   return (call_hindo_set (WNN_HINDO_NOP, newhindo));
976 }
977 
978 /*
979   Local Variables:
980   eval: (setq kanji-flag t)
981   eval: (setq kanji-fileio-code 0)
982   eval: (mode-line-kanji-code-update)
983   End:
984 */
985