1 /*
2 * Copyright (c) 1994 Sony Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Except as contained in this notice, the name of Sony Corporation
24 * shall not be used in advertising or otherwise to promote the sale, use
25 * or other dealings in this Software without prior written authorization
26 * from Sony Corporation.
27 *
28 */
29
30 /*
31 * $SonyRCSfile: stat_conv.c,v $
32 * $SonyRevision: 1.1 $
33 * $SonyDate: 1994/06/03 08:03:28 $
34 */
35
36
37
38 #include <stdlib.h>
39 #include <string.h>
40 #include "common.h"
41 #include "key.h"
42 #include "rk.h"
43
44 #include "sj3.h"
45
46 int rkerrbell = 0;
47 static int delkey = -1;
48 static int bskey;
49
50 #define SPAN_FLUSH 0
51 #define SPAN_END 1
52
53 void
save_span(int mode)54 save_span(int mode)
55 {
56 Conversion *cv;
57
58 cv = GetConversion ();
59 switch (mode) {
60 case SPAN_FLUSH:
61 cv->span_point = 0;
62 cv->ha_point = 0;
63 cv->out_point = 0;
64 save_span_p ();
65 break;
66 case SPAN_END:
67 if (cv->out_point < cv->out_epoint) {
68 Clear_EOL();
69 cv->out_point = cv->out_epoint;
70 cv->ha_point = cv->ha_epoint;
71 }
72 break;
73 default:
74 break;
75 }
76 }
77
78 void
save_span_p()79 save_span_p()
80 {
81 Conversion *cv;
82
83 cv = GetConversion ();
84 cv->span_p[cv->span_point] = &(cv->out_buf[cv->out_point]);
85 cv->span_l[cv->span_point] = 0;
86 }
87
88 int
isspaned()89 isspaned()
90 {
91 Conversion *cv;
92
93 cv = GetConversion ();
94 if (cv->out_buf[0] != '\0')
95 return (1);
96 else
97 return (0);
98 }
99
100
101
102 void
buffers_clear()103 buffers_clear()
104 {
105 Conversion *cv;
106
107 cv = GetConversion ();
108 pointer_clear ();
109 if (flush_conversion)
110 cv->CurBun = -1;
111 else
112 cv->CurBun = 0;
113 }
114
115 void
pointer_clear()116 pointer_clear()
117 {
118 Conversion *cv;
119
120 cv = GetConversion ();
121 cv->ha_point = cv->ha_epoint = 0;
122 *(cv->Halpha) = '\0';
123 os_point = 0;
124 cv->out_point = cv->out_epoint = 0;
125 *(cv->out_buf) = '\0';
126 cv->Kanji = 0;
127 save_span (SPAN_FLUSH);
128 sj3_rkclear();
129 }
130
131 typedef struct _SaveSet {
132 wchar16_t out_buf[BUFFLENGTH * 2];
133 u_short out_mode[BUFFLENGTH * 2];
134 u_short out_point;
135 u_short ha_point;
136 wchar16_t Halpha[BUFFLENGTH];
137 u_char in_mode[BUFFLENGTH * 2];
138 } SaveSet;
139
140 static SaveSet save_set0;
141
142 void
StoreSaveSet()143 StoreSaveSet()
144 {
145 Conversion *cv;
146 SaveSet *sv;
147
148 cv = GetConversion ();
149 if (cv->out_point) {
150 sv = &save_set0;
151 sv->out_point = cv->out_point;
152 sv->ha_point = cv->ha_point;
153 memcpy (sv->out_mode, cv->out_mode,
154 cv->out_point * sizeof(u_short));
155 memcpy (sv->in_mode, cv->in_mode,
156 cv->out_point * sizeof(u_char));
157 wscpy (sv->Halpha, cv->Halpha);
158 wscpy (sv->out_buf, cv->out_buf);
159 }
160 }
161
162 void
RestoreSaveSet()163 RestoreSaveSet()
164 {
165 Conversion *cv;
166 SaveSet *sv;
167
168 sv = &save_set0;
169 if (sv->out_point) {
170 cv = GetConversion ();
171 cv->out_point = sv->out_point;
172 cv->ha_point = sv->ha_point;
173 memcpy (cv->out_mode, sv->out_mode,
174 sv->out_point * sizeof(u_short));
175 memcpy (cv->in_mode, sv->in_mode,
176 sv->out_point * sizeof(u_char));
177 wscpy (cv->Halpha, sv->Halpha);
178 wscpy (cv->out_buf, sv->out_buf);
179 }
180 }
181
182 int
history_empty()183 history_empty()
184 {
185 SaveSet *sv;
186
187 sv = &save_set0;
188 if (sv->out_point)
189 return (0);
190 else
191 return (1);
192 }
193
194 void
History()195 History()
196 {
197 Conversion *cv;
198 SaveSet *sv;
199
200 sv = &save_set0;
201 if (sv->out_point) {
202 RestoreSaveSet ();
203 cv = GetConversion ();
204 if (flush_conversion)
205 cv->CurBun = -1;
206 else
207 cv->CurBun = 0;
208 }
209 }
210
211 void
ClearBuffer()212 ClearBuffer()
213 {
214 Clear_EOL();
215 Ccheck ();
216 Cclear (1);
217 all_set_up ();
218 }
219
220
221
222 void
SetCflag()223 SetCflag()
224 {
225 Conversion *cv;
226
227 cv = GetConversion ();
228 cv->Cflag = 1;
229 }
230
231 void
ClearCflag()232 ClearCflag()
233 {
234 Conversion *cv;
235
236 cv = GetConversion ();
237 cv->Cflag = 0;
238 }
239
240 int
IsCflag()241 IsCflag()
242 {
243 Conversion *cv;
244
245 cv = GetConversion ();
246 return (cv->Cflag);
247 }
248
249 void
exec_kettei()250 exec_kettei()
251 {
252 Conversion *cv;
253 int len;
254 wchar16_t kanji[BUFFLENGTH * 2];
255
256 cv = GetConversion ();
257 save_span(SPAN_END);
258 if (cv->Kanji != 0) {
259 len = Bkanji (kanji);
260 Ccheck ();
261 Cclear (1);
262 master_write (kanji, len);
263 if (cv->word_regist) {
264 cv->word_regist = 0;
265 }
266 else {
267 if (is_bstudy ()) {
268 cl_gakusyuu ();
269 }
270 }
271 } else if (isspaned ()) {
272 if (BuffYes ()) {
273 Ccheck ();
274 Cclear (1);
275 }
276 if (!BuffYes ())
277 vbackchar (cv->out_point);
278 if (cv->out_point)
279 master_write (cv->out_buf, cv->out_point);
280
281 if (BuffYes ())
282 master_flush ();
283 StoreSaveSet ();
284 }
285 buffers_clear ();
286 ResetHenkan ();
287 SetCflag ();
288 }
289
290 int
set_rkebell(struct wordent word[])291 set_rkebell(struct wordent word[])
292 {
293 if (match (word[1].word_str, WCOn))
294 rkerrbell = 1;
295 if (match (word[1].word_str, WCOff))
296 rkerrbell = 0;
297 return 0;
298 }
299
300
301
302 void
ChangeBuffMode()303 ChangeBuffMode()
304 {
305 Conversion *cv;
306
307 cv = GetConversion ();
308 if (cv->BuffMode == BUFF) {
309 sj3_rkebell(0);
310 cv->BuffMode = UNBUFF;
311 } else {
312 sj3_rkebell(rkerrbell);
313 cv->BuffMode = BUFF;
314 }
315 }
316
317 int
BuffYes()318 BuffYes()
319 {
320 Conversion *cv;
321
322 cv = GetConversion ();
323 if (cv->BuffMode == BUFF)
324 return (1);
325 else
326 return (0);
327 }
328
329
330
331 #define STAT_HENKAN 1
332 #define STAT_MUHENKAN 2
333
334 int
IsHenkan()335 IsHenkan()
336 {
337 Conversion *cv;
338
339 cv = GetConversion ();
340 return (cv->henkanflag);
341 }
342
343 int
IsMuhenkan()344 IsMuhenkan()
345 {
346 Conversion *cv;
347
348 cv = GetConversion ();
349 return (cv->henkanflag & STAT_MUHENKAN);
350 }
351
352 void
SetMuhenkan()353 SetMuhenkan()
354 {
355 Conversion *cv;
356
357 cv = GetConversion ();
358 cv->henkanflag |= STAT_MUHENKAN;
359 }
360
361 void
SetHenkan()362 SetHenkan()
363 {
364 Conversion *cv;
365
366 cv = GetConversion ();
367 cv->henkanflag = STAT_HENKAN;
368 }
369
370 void
ResetHenkan()371 ResetHenkan()
372 {
373 Conversion *cv;
374
375 cv = GetConversion ();
376 cv->henkanflag = 0;
377 }
378
379 void
all_set_up()380 all_set_up()
381 {
382 buffers_clear ();
383 SetCflag ();
384 ResetHenkan ();
385 }
386
387
388 static int convertflag;
389 static int small;
390
391 void
stat_conv_on()392 stat_conv_on()
393 {
394 convertflag = 1;
395 }
396
397 void
stat_init()398 stat_init()
399 {
400 stat_conv_on ();
401 all_set_up ();
402 disp_mode ();
403 small = 0;
404 }
405
406 int
get_pseq()407 get_pseq()
408 {
409 return (write_pseq (1));
410 }
411
412 void
stat_conv()413 stat_conv()
414 {
415 Conversion *cv;
416 int inc;
417 int i;
418 u_short svlen;
419
420 cv = GetConversion ();
421 cv->word_regist = 0;
422 while (convertflag) {
423 if ((inc = inkey ()) == EOF)
424 break;
425
426
427
428
429 cv = GetConversion ();
430 if (allways_buff)
431 cv->BuffMode = BUFF;
432 more:
433 switch (keyvalue) {
434
435
436 case KEY_NORMAL:
437 small = 0;
438 if (inc == EOF)
439 break;
440 if (IsHenkan ()) {
441 if (is_bsdel (inc)) {
442 Bdelete ();
443 break;
444 } else if (inc < ' ' && inc != '\n' &&
445 inc != '\r' && inc != '\t' &&
446 !IsESC (inc) && !isintr (inc)){
447 beep ();
448 break;
449 } else {
450 exec_kettei ();
451 }
452 }
453
454 save_obuf();
455 svlen = cv->Vlen;
456 while (exec_romaji(inc)) {
457 if (os_point > 0 && svlen != cv->Vlen) {
458 i = svlen - cv->Vlen;
459 svlen = cv->Vlen;
460 vprintU(osave_buf, 1);
461 if (i > 0)
462 Clear_EOL();
463 Cgoto(svlen);
464 }
465 inc = inkey();
466 if (keyvalue != KEY_NORMAL &&
467 (exec_romaji(0)==0||keyvalue == KEY_CONV)){
468 restore_obuf();
469 goto more;
470 }
471 }
472 restore_obuf();
473 if (is_del(inc) && (!IsCflag() && isspaned())) {
474 if (cv->out_point < cv->out_epoint) {
475 move_cur(KEY_RIGHT);
476 inc = bskey;
477 goto more;
478 }
479 } else
480 exec_ctrl(inc);
481 break;
482 case KEY_KETTEI:
483 small = 0;
484 if (!IsCflag ()) {
485 exec_kettei ();
486 } else if (cv->Imode != MODE_HALPHA || BuffYes ()) {
487 if (cv->Imode != MODE_HALPHA)
488 exec_mode (KEY_HALPHA);
489 if (BuffYes ())
490 ChangeBuffMode ();
491 disp_mode ();
492 }
493 break;
494 case KEY_CONV:
495 small = 0;
496 if (!no_flush)
497 exec_kettei ();
498 convertflag = 0;
499 break;
500 case KEY_CANCEL:
501 small = 0;
502 if (!IsCflag ())
503 ClearBuffer ();
504 else if ((inc = get_pseq ()) != 0)
505 exec_ctrl(inc);
506 break;
507 case KEY_RECONV:
508 small = 0;
509 if (IsCflag ()) {
510 if (history_empty ()) {
511 if ((inc = get_pseq ()) != 0)
512 exec_ctrl(inc);
513 break;
514 } else {
515 History ();
516 Csave ();
517 ClearCflag ();
518 }
519 } else {
520 if (IsHenkan ()) {
521 History ();
522 ResetHenkan ();
523 } else {
524 beep ();
525 break;
526
527 }
528 }
529 exec_henkan ();
530 SetHenkan ();
531 break;
532 case KEY_HENKAN:
533 small = 0;
534 if (!IsCflag ()) {
535 if (IsMuhenkan ()) {
536 exec_henkan ();
537 SetHenkan ();
538 }
539 if (IsHenkan ()) {
540 exec_douon ();
541 } else {
542 save_span (SPAN_END);
543 Ccheck ();
544 StoreSaveSet ();
545 exec_henkan ();
546 SetHenkan ();
547 }
548 } else if ((inc = write_pseq (3)) >= ' ' && inc <= '~')
549 exec_ctrl(inc);
550 else if (cv->Imode != MODE_ZHIRA || !BuffYes ()) {
551 if (cv->Imode != MODE_ZHIRA) {
552 exec_mode (KEY_ZHIRA);
553 }
554 if (!BuffYes ()) {
555 ChangeBuffMode ();
556 }
557 disp_mode ();
558 }
559 break;
560 case KEY_MUHENKAN:
561 small = 0;
562 if (flush_conversion && !IsCflag () &&
563 cv->CurBun == -1) {
564 if (IsHenkan ()) {
565 exec_muhenkan (0);
566 SetHenkan ();
567 } else {
568 save_span (SPAN_END);
569 Ccheck ();
570 exec_muhenkan (1);
571 SetHenkan ();
572 SetMuhenkan ();
573 }
574 break;
575 }
576 case KEY_TOGGLE:
577 case KEY_ZHIRA:
578 case KEY_HALPHA:
579 case KEY_ZALPHA:
580 case KEY_HKATA:
581 case KEY_ZKATA:
582 case KEY_CODE:
583 small = 0;
584 if (cv->CurBun == -1)
585 exec_kettei ();
586 else if (IsHenkan ()) {
587 Bchange (keyvalue);
588 break;
589 }
590 if (keyvalue == KEY_TOGGLE)
591 keyvalue = toggle_mode (cv->Imode);
592 exec_mode (keyvalue);
593 disp_mode ();
594 break;
595 case KEY_WRAP:
596 small = 0;
597 if (IsHenkan ())
598 wrap_douon (0);
599 else if ((inc = get_pseq ()) != 0)
600 exec_ctrl(inc);
601 break;
602 case KEY_WRAPBACK:
603 small = 0;
604 if (IsHenkan ())
605 wrap_douon (1);
606 else if ((inc = get_pseq ()) != 0)
607 exec_ctrl(inc);
608 break;
609 case KEY_LEFT:
610 case KEY_RIGHT:
611 case KEY_UP:
612 case KEY_DOWN:
613 if (IsHenkan ()) {
614 switch (keyvalue) {
615 case KEY_LEFT:
616 Bleft ();
617 small = 0;
618 break;
619 case KEY_RIGHT:
620 Bright ();
621 small = 0;
622 break;
623 case KEY_UP:
624 small = Bbig ();
625 break;
626 case KEY_DOWN:
627 small = Bsmall (small);
628 break;
629 }
630 } else if (cv->Imode == MODE_CODE) {
631 small = 0;
632 if (BuffYes () && IsCflag ()) {
633 Csave ();
634 ClearCflag ();
635 }
636 kigou ();
637 if (flush_conversion)
638 exec_kettei ();
639 } else if (!IsCflag() && (keyvalue == KEY_LEFT ||
640 keyvalue == KEY_RIGHT)) {
641 small = 0;
642 move_cur(keyvalue);
643 } else if (!BuffYes() && cv->Imode == MODE_HALPHA) {
644 small = 0;
645 write_pseq(0);
646
647 } else if (IsCflag() && (inc = get_pseq ()) != 0) {
648 small = 0;
649 exec_ctrl(inc);
650 }
651 break;
652 case KEY_TOP:
653 case KEY_END:
654 if (IsHenkan ()) {
655 switch (keyvalue) {
656 case KEY_TOP:
657 Btop ();
658 small = 0;
659 break;
660 case KEY_END:
661 Blast ();
662 small = 0;
663 break;
664 }
665 } else if (!IsCflag()) {
666 small = 0;
667 move_cur(keyvalue);
668 } else if ((inc = get_pseq ()) != 0) {
669 small = 0;
670 exec_ctrl(inc);
671 }
672 break;
673 case KEY_EDIT:
674 case KEY_TOROKU:
675 case KEY_SYOUKYO:
676 small = 0;
677 if (IsCflag () && (inc = get_pseq ()) != 0)
678 exec_ctrl(inc);
679 case KEY_ETC:
680 case KEY_HELP:
681 case KEY_SJRC:
682 case KEY_RECONNECT:
683 small = 0;
684 i = exec_etc (keyvalue);
685 disp_mode ();
686 if (i != KEY_NORMAL) {
687 keyvalue = i;
688 goto more;
689 }
690 break;
691 case KEY_BUFFER:
692 small = 0;
693 if (BuffYes ())
694 exec_kettei ();
695 ChangeBuffMode ();
696 disp_mode ();
697 break;
698 case KEY_HA_KET:
699 small = 0;
700 if (!IsCflag ()) {
701 if (cv->Imode != MODE_HALPHA || BuffYes ()) {
702 if (BuffYes ()) {
703 exec_kettei ();
704 ChangeBuffMode ();
705 }
706 if (cv->Imode != MODE_HALPHA)
707 exec_mode (KEY_HALPHA);
708 disp_mode ();
709 }
710 } else if ((inc = get_pseq ()) != 0)
711 exec_ctrl(inc);
712 break;
713 case KEY_FLUSH:
714 small = 0;
715 if (!IsCflag ()) {
716 exec_kettei ();
717 } else if ((inc = get_pseq ()) != 0)
718 exec_ctrl(inc);
719 break;
720 default:
721 small = 0;
722 if ((inc = get_pseq ()) != 0)
723 exec_ctrl(inc);
724 break;
725 }
726 if (keyvalue == KEY_CONV) {
727 if (!no_flush)
728 exec_kettei ();
729 convertflag = 0;
730 }
731 }
732 }
733
734
735 void
save_obuf()736 save_obuf()
737 {
738 Conversion *cv;
739 int i, cur;
740
741 cv = GetConversion();
742
743 if (cv->out_point < cv->out_epoint) {
744
745
746 cur = cv->out_point;
747 if (!(cv->out_mode[cur] & OMODE_MASK)) {
748 chhstr(cv->Halpha, cv->out_buf, cv->out_mode, cur);
749 cv->ha_epoint = wslen(cv->Halpha);
750 }
751 cv->ha_point = getipos(cur);
752 hs_point = 0;
753 for (i = cv->ha_point; i < cv->ha_epoint; i++)
754 hsave_buf[hs_point++] = cv->Halpha[i];
755 hsave_buf[hs_point] = '\0';
756
757
758 os_point = 0;
759 for (i = cv->out_point; i < cv->out_epoint; i++) {
760 osave_buf[os_point] = cv->out_buf[i];
761 osave_mode[os_point] = cv->out_mode[i];
762 isave_mode[os_point] = cv->in_mode[i];
763 os_point++;
764 }
765 osave_buf[os_point] = '\0';
766 }
767 }
768
769
770 void
restore_obuf()771 restore_obuf()
772 {
773 Conversion *cv;
774 int i;
775
776 cv = GetConversion();
777
778 cv->out_epoint = cv->out_point;
779 cv->ha_epoint = cv->ha_point;
780
781
782 if (os_point > 0) {
783 for (i = 0; i < (unsigned int)os_point; i++) {
784 cv->out_buf[cv->out_epoint] = osave_buf[i];
785 cv->out_mode[cv->out_epoint] = osave_mode[i];
786 cv->in_mode[cv->out_epoint] = isave_mode[i];
787 cv->out_epoint++;
788 }
789 cv->out_buf[cv->out_epoint] = '\0';
790 for (i = 0; i < (unsigned int)hs_point; i++)
791 cv->Halpha[cv->ha_epoint++] = hsave_buf[i];
792 cv->Halpha[cv->ha_epoint] = '\0';
793 }
794 }
795
796 void
exec_ctrl(int c)797 exec_ctrl(int c)
798 {
799 Conversion *cv;
800 wchar16_t s[3];
801
802 cv = GetConversion ();
803
804 *s = c;
805 s[1] = 0;
806 exec_kettei();
807 if (c == ' ' && keyvalue == KEY_HENKAN && cv->Imode & MODE_ZEN) {
808 s[0] = 0xa1a1;
809 s[1] = 0;
810 master_write (s, 1);
811 } else
812 master_write (s, 1);
813
814
815 if (IsGoto (c) && (BuffYes() || cv->Imode != MODE_HALPHA)) {
816 cv->BuffMode = UNBUFF;
817 cv->Imode = MODE_HALPHA;
818 disp_mode();
819 sj3_rkebell(0);
820 }
821
822 if (IsTrap (c)) {
823 *s = inkey ();
824 if (keyvalue != KEY_NORMAL)
825 *s = pars_seq[0];
826 master_write (s, 1);
827 }
828 }
829
830 void
exec_mode(int key)831 exec_mode(int key)
832 {
833 Conversion *cv;
834
835 cv = GetConversion ();
836 if (key == KEY_MUHENKAN)
837 key = eval_muhenkan ();
838 if (key == KEY_CODE) {
839 if (cv->Imode == MODE_CODE)
840 ChangeCode();
841 else
842 cv->Imode = MODE_CODE;
843 } else
844 cv->Imode = eval_mode(key);
845 }
846
847 int
toggle_mode(int mod)848 toggle_mode(int mod)
849 {
850 int value;
851
852 switch (mod) {
853 case MODE_ZHIRA:
854 value = KEY_ZKATA;
855 break;
856 case MODE_ZKATA:
857 value = KEY_HKATA;
858 break;
859 case MODE_HKATA:
860 value = KEY_ZALPHA;
861 break;
862 case MODE_ZALPHA:
863 value = KEY_HALPHA;
864 break;
865 default:
866 value = KEY_ZHIRA;
867 break;
868 }
869 return (value);
870 }
871
872 int
eval_mode(int key)873 eval_mode(int key)
874 {
875 int mod;
876
877 switch (key) {
878 case KEY_ZHIRA:
879 mod = MODE_ZHIRA;
880 break;
881 case KEY_ZKATA:
882 mod = MODE_ZKATA;
883 break;
884 case KEY_HKATA:
885 mod = MODE_HKATA;
886 break;
887 case KEY_ZALPHA:
888 mod = MODE_ZALPHA;
889 break;
890 default:
891 mod = MODE_HALPHA;
892 break;
893 }
894 return (mod);
895 }
896
897 int
IsESC(wchar16_t c)898 IsESC(wchar16_t c)
899 {
900 if (c == ESC)
901 return (1);
902 else
903 return (0);
904 }
905
906 void
Strncpy(wchar16_t * d,wchar16_t * s,int len)907 Strncpy(wchar16_t *d, wchar16_t *s, int len)
908 {
909 if ((len > 0) && (s != (wchar16_t *) NULL))
910 (void)wsncpy(d, s, len);
911 }
912
913 int
is_bsdel(int c)914 is_bsdel(int c)
915 {
916 if (is_bs (c) || is_del (c))
917 return (1);
918 else
919 return (0);
920 }
921
922 void
clear_del()923 clear_del()
924 {
925 delkey = -1;
926 }
927
928 void
set_bs(int c)929 set_bs(int c)
930 {
931 bskey = c;
932 }
933
934 void
set_del(int c)935 set_del(int c)
936 {
937 delkey = c;
938 }
939
940 int
is_bs(int c)941 is_bs(int c)
942 {
943 if (c == bskey)
944 return (1);
945 else
946 return (0);
947 }
948
949 int
is_del(int c)950 is_del(int c)
951 {
952 if (c == delkey)
953 return (1);
954 else
955 return (0);
956 }
957
958 static Conversion *saved_conversion;
959
960 void
SaveConversion()961 SaveConversion()
962 {
963 saved_conversion = GetConversion ();
964 }
965
966 int
AnotherConversion()967 AnotherConversion()
968 {
969 if (saved_conversion == GetConversion ())
970 return (0);
971 else
972 return (1);
973 }
974