curses_commands.c revision 1.25 1 /* $NetBSD: curses_commands.c,v 1.25 2021/04/04 09:49:13 rin Exp $ */
2
3 /*-
4 * Copyright 2009 Brett Lymn <blymn (at) NetBSD.org>
5 * Copyright 2021 Roland Illig <rillig (at) NetBSD.org>
6 *
7 * All rights reserved.
8 *
9 * This code has been donated to The NetBSD Foundation by the Author.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include <curses.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35 #include <termios.h>
36 #include <stdarg.h>
37
38 #include "slave.h"
39 #include "curses_commands.h"
40
41 int
42 set_int(char *arg, int *x)
43 {
44 if (sscanf(arg, "%d", x) == 0) {
45 report_count(1);
46 report_error("BAD ARGUMENT");
47 return -1;
48 }
49
50 return 0;
51 }
52
53 int
54 set_uint(char *arg, unsigned int *x)
55 {
56 if (sscanf(arg, "%u", x) == 0) {
57 report_count(1);
58 report_error("BAD ARGUMENT");
59 return -1;
60 }
61
62 return 0;
63 }
64
65 int
66 set_short(char *arg, short *x)
67 {
68 if (sscanf(arg, "%hd", x) == 0) {
69 report_count(1);
70 report_error("BAD ARGUMENT");
71 return -1;
72 }
73
74 return 0;
75 }
76
77 int
78 set_win(char *arg, WINDOW **x)
79 {
80 if (sscanf(arg, "%p", x) == 0) {
81 report_count(1);
82 report_error("BAD ARGUMENT");
83 return -1;
84 }
85
86 return 0;
87 }
88
89 int
90 set_scrn(char *arg, SCREEN **x)
91 {
92 if (sscanf(arg, "%p", x) == 0) {
93 report_count(1);
94 report_error("BAD ARGUMENT");
95 return -1;
96 }
97
98 return 0;
99 }
100
101 #define ARGC(n) \
102 if (check_arg_count(nargs, n) == 1) \
103 return
104
105 #define ARG_SHORT(i, arg) \
106 short arg; \
107 if (set_short(args[i], &arg) != 0) \
108 return
109
110 #define ARG_INT(i, arg) \
111 int arg; \
112 if (set_int(args[i], &arg) != 0) \
113 return
114
115 #define ARG_UINT(i, arg) \
116 unsigned int arg; \
117 if (set_uint(args[i], &arg) != 0) \
118 return
119
120 #define ARG_CHTYPE(i, arg) \
121 chtype arg = ((const chtype *)args[i])[0]
122
123 #define ARG_WCHAR(i, arg) \
124 wchar_t arg = ((const wchar_t *)args[i])[0]
125
126 #define ARG_STRING(i, arg) \
127 const char *arg = args[i]
128
129 /* Only used for legacy interfaces that are missing the 'const'. */
130 #define ARG_MODIFIABLE_STRING(i, arg) \
131 char *arg = args[i]
132
133 #define ARG_CHTYPE_STRING(i, arg) \
134 const chtype *arg = (const chtype *)args[i]
135
136 #define ARG_CCHAR_STRING(i, arg) \
137 const cchar_t *arg = (const cchar_t *)args[i]
138
139 #define ARG_WCHAR_STRING(i, arg) \
140 wchar_t *arg = (wchar_t *)args[i]
141
142 #define ARG_WINDOW(i, arg) \
143 WINDOW *arg; \
144 if (set_win(args[i], &arg) != 0) \
145 return
146
147 #define ARG_SCREEN(i, arg) \
148 SCREEN *arg; \
149 if (set_scrn(args[i], &arg) != 0) \
150 return
151
152 /*
153 * Required by the API, intended for future extensions, but this
154 * implementation does not support the extension.
155 */
156 #define ARG_NULL(i) \
157 (void)0
158
159 #define ARG_IGNORE(i) \
160 (void)0
161
162 void
163 cmd_DRAIN(int nargs, char **args)
164 {
165 ARGC(1);
166 ARG_WINDOW(0, win);
167
168 while (wgetch(win) != ERR);
169 report_count(1);
170 report_return(OK);
171 }
172
173 void
174 cmd_addbytes(int nargs, char **args)
175 {
176 ARGC(2);
177 ARG_STRING(0, str);
178 ARG_INT(1, count);
179
180 report_count(1);
181 report_return(addbytes(str, count));
182 }
183
184
185 void
186 cmd_addch(int nargs, char **args)
187 {
188 ARGC(1);
189 ARG_CHTYPE(0, ch);
190
191 report_count(1);
192 report_return(addch(ch));
193 }
194
195
196 void
197 cmd_addchnstr(int nargs, char **args)
198 {
199 ARGC(2);
200 ARG_CHTYPE_STRING(0, chstr);
201 ARG_INT(1, count);
202
203 report_count(1);
204 report_return(addchnstr(chstr, count));
205 }
206
207
208 void
209 cmd_addchstr(int nargs, char **args)
210 {
211 ARGC(1);
212 ARG_CHTYPE_STRING(0, chstr);
213
214 report_count(1);
215 report_return(addchstr(chstr));
216 }
217
218
219 void
220 cmd_addnstr(int nargs, char **args)
221 {
222 ARGC(2);
223 ARG_STRING(0, str);
224 ARG_INT(1, count);
225
226 report_count(1);
227 report_return(addnstr(str, count));
228 }
229
230
231 void
232 cmd_addstr(int nargs, char **args)
233 {
234 ARGC(1);
235 ARG_STRING(0, str);
236
237 report_count(1);
238 report_return(addstr(str));
239 }
240
241
242 void
243 cmd_attr_get(int nargs, char **args)
244 {
245 attr_t attrs;
246 short colours;
247 int retval;
248
249 ARGC(0);
250
251 retval = attr_get(&attrs, &colours, NULL);
252
253 report_count(3);
254 report_return(retval);
255 report_int(attrs);
256 report_int(colours);
257 }
258
259
260 void
261 cmd_attr_off(int nargs, char **args)
262 {
263 ARGC(1);
264 ARG_INT(0, attrib);
265
266 report_count(1);
267 report_return(attr_off(attrib, NULL));
268 }
269
270
271 void
272 cmd_attr_on(int nargs, char **args)
273 {
274 ARGC(1);
275 ARG_INT(0, attrib);
276
277 report_count(1);
278 report_return(attr_on(attrib, NULL));
279 }
280
281
282 void
283 cmd_attr_set(int nargs, char **args)
284 {
285 ARGC(2);
286 ARG_INT(0, attrib);
287 ARG_SHORT(1, pair);
288
289 report_count(1);
290 report_return(attr_set(attrib, pair, NULL));
291 }
292
293
294 void
295 cmd_attroff(int nargs, char **args)
296 {
297 ARGC(1);
298 ARG_INT(0, attrib);
299
300 report_count(1);
301 report_return(attroff(attrib));
302 }
303
304
305 void
306 cmd_attron(int nargs, char **args)
307 {
308 ARGC(1);
309 ARG_INT(0, attrib);
310
311 report_count(1);
312 report_return(attron(attrib));
313 }
314
315
316 void
317 cmd_attrset(int nargs, char **args)
318 {
319 ARGC(1);
320 ARG_INT(0, attrib);
321
322 report_count(1);
323 report_return(attrset(attrib));
324 }
325
326
327 void
328 cmd_bkgd(int nargs, char **args)
329 {
330 ARGC(1);
331 ARG_CHTYPE(0, ch);
332
333 report_count(1);
334 report_return(bkgd(ch));
335 }
336
337
338 void
339 cmd_bkgdset(int nargs, char **args)
340 {
341 ARGC(1);
342 ARG_CHTYPE(0, ch);
343
344 bkgdset(ch); /* returns void */
345 report_count(1);
346 report_return(OK);
347 }
348
349
350 void
351 cmd_border(int nargs, char **args)
352 {
353 ARGC(8);
354 ARG_INT(0, ls);
355 ARG_INT(1, rs);
356 ARG_INT(2, ts);
357 ARG_INT(3, bs);
358 ARG_INT(4, tl);
359 ARG_INT(5, tr);
360 ARG_INT(6, bl);
361 ARG_INT(7, br);
362
363 report_count(1);
364 report_return(border(ls, rs, ts, bs, tl, tr, bl, br));
365 }
366
367
368 void
369 cmd_clear(int nargs, char **args)
370 {
371 ARGC(0);
372
373 report_count(1);
374 report_return(clear());
375 }
376
377
378 void
379 cmd_clrtobot(int nargs, char **args)
380 {
381 ARGC(0);
382
383 report_count(1);
384 report_return(clrtobot());
385 }
386
387
388 void
389 cmd_clrtoeol(int nargs, char **args)
390 {
391 ARGC(0);
392
393 report_count(1);
394 report_return(clrtoeol());
395 }
396
397
398 void
399 cmd_color_set(int nargs, char **args)
400 {
401 ARGC(2);
402 ARG_SHORT(0, colour_pair);
403 ARG_NULL(1);
404
405 report_count(1);
406 report_return(color_set(colour_pair, NULL));
407 }
408
409
410 void
411 cmd_delch(int nargs, char **args)
412 {
413 ARGC(0);
414
415 report_count(1);
416 report_return(delch());
417 }
418
419
420 void
421 cmd_deleteln(int nargs, char **args)
422 {
423 ARGC(0);
424
425 report_count(1);
426 report_return(deleteln());
427 }
428
429
430 void
431 cmd_echochar(int nargs, char **args)
432 {
433 ARGC(1);
434 ARG_CHTYPE(0, ch);
435
436 /* XXX causes refresh */
437 report_count(1);
438 report_return(echochar(ch));
439 }
440
441
442 void
443 cmd_erase(int nargs, char **args)
444 {
445 ARGC(0);
446
447 report_count(1);
448 report_return(erase());
449 }
450
451
452 void
453 cmd_getch(int nargs, char **args)
454 {
455 ARGC(0);
456
457 /* XXX causes refresh */
458 report_count(1);
459 report_int(getch());
460 }
461
462
463 void
464 cmd_getnstr(int nargs, char **args)
465 {
466 char *string;
467
468 ARGC(1);
469 ARG_INT(0, limit);
470
471 if ((string = malloc(limit + 1)) == NULL) {
472 report_count(1);
473 report_error("MALLOC_FAILED");
474 return;
475 }
476
477 report_count(2);
478 report_return(getnstr(string, limit));
479 report_status(string);
480 free(string);
481 }
482
483
484 void
485 cmd_getstr(int nargs, char **args)
486 {
487 char string[256];
488
489 ARGC(0);
490
491 report_count(2);
492 report_return(getstr(string));
493 report_status(string);
494 }
495
496
497 void
498 cmd_inch(int nargs, char **args)
499 {
500 ARGC(0);
501
502 report_count(1);
503 report_byte(inch());
504 }
505
506
507 void
508 cmd_inchnstr(int nargs, char **args)
509 {
510 chtype *string;
511
512 ARGC(1);
513 ARG_INT(0, limit);
514
515 if ((string = malloc((limit + 1) * sizeof(chtype))) == NULL) {
516 report_count(1);
517 report_error("MALLOC_FAILED");
518 return;
519 }
520
521 report_count(2);
522 report_return(inchnstr(string, limit));
523 report_nstr(string);
524 free(string);
525 }
526
527
528 void
529 cmd_inchstr(int nargs, char **args)
530 {
531 chtype string[256];
532
533 ARGC(0);
534
535 report_count(2);
536 report_return(inchstr(string));
537 report_nstr(string);
538 }
539
540
541 void
542 cmd_innstr(int nargs, char **args)
543 {
544 char *string;
545
546 ARGC(1);
547 ARG_INT(0, limit);
548
549 if ((string = malloc(limit + 1)) == NULL) {
550 report_count(1);
551 report_error("MALLOC_FAILED");
552 return;
553 }
554
555 report_count(2);
556 report_int(innstr(string, limit));
557 report_status(string);
558 free(string);
559 }
560
561
562 void
563 cmd_insch(int nargs, char **args)
564 {
565 ARGC(1);
566 ARG_CHTYPE(0, ch);
567
568 report_count(1);
569 report_return(insch(ch));
570 }
571
572
573 void
574 cmd_insdelln(int nargs, char **args)
575 {
576 ARGC(1);
577 ARG_INT(0, nlines);
578
579 report_count(1);
580 report_return(insdelln(nlines));
581 }
582
583
584 void
585 cmd_insertln(int nargs, char **args)
586 {
587 ARGC(0);
588
589 report_count(1);
590 report_return(insertln());
591 }
592
593
594 void
595 cmd_instr(int nargs, char **args)
596 {
597 char string[256];
598
599 ARGC(0);
600
601 report_count(2);
602 report_return(instr(string));
603 report_status(string);
604 }
605
606
607 void
608 cmd_move(int nargs, char **args)
609 {
610 ARGC(2);
611 ARG_INT(0, y);
612 ARG_INT(1, x);
613
614 report_count(1);
615 report_return(move(y, x));
616 }
617
618
619 void
620 cmd_refresh(int nargs, char **args)
621 {
622 ARGC(0);
623
624 report_count(1);
625 report_return(refresh());
626 }
627
628
629 void
630 cmd_scrl(int nargs, char **args)
631 {
632 ARGC(1);
633 ARG_INT(0, nlines);
634
635 report_count(1);
636 report_return(scrl(nlines));
637 }
638
639
640 void
641 cmd_setscrreg(int nargs, char **args)
642 {
643 ARGC(2);
644 ARG_INT(0, top);
645 ARG_INT(1, bottom);
646
647 report_count(1);
648 report_return(setscrreg(top, bottom));
649 }
650
651
652 void
653 cmd_standend(int nargs, char **args)
654 {
655 ARGC(0);
656
657 report_count(1);
658 report_int(standend());
659 }
660
661
662 void
663 cmd_standout(int nargs, char **args)
664 {
665 ARGC(0);
666
667 report_count(1);
668 report_int(standout());
669 }
670
671
672 void
673 cmd_timeout(int nargs, char **args)
674 {
675 ARGC(1);
676 ARG_INT(0, tval);
677
678 timeout(tval); /* void return */
679 report_count(1);
680 report_return(OK);
681 }
682
683
684 void
685 cmd_underscore(int nargs, char **args)
686 {
687 ARGC(0);
688
689 report_count(1);
690 report_int(underscore());
691 }
692
693
694 void
695 cmd_underend(int nargs, char **args)
696 {
697 ARGC(0);
698
699 report_count(1);
700 report_int(underend());
701 }
702
703
704 void
705 cmd_waddbytes(int nargs, char **args)
706 {
707 ARGC(3);
708 ARG_WINDOW(0, win);
709 ARG_STRING(1, str);
710 ARG_INT(2, count);
711
712 report_count(1);
713 report_return(waddbytes(win, str, count));
714 }
715
716
717 void
718 cmd_waddstr(int nargs, char **args)
719 {
720 ARGC(2);
721 ARG_WINDOW(0, win);
722 ARG_STRING(1, str);
723
724 report_count(1);
725 report_return(waddstr(win, str));
726 }
727
728
729 void
730 cmd_mvaddbytes(int nargs, char **args)
731 {
732 ARGC(4);
733 ARG_INT(0, y);
734 ARG_INT(1, x);
735 ARG_STRING(2, str);
736 ARG_INT(3, count);
737
738 report_count(1);
739 report_return(mvaddbytes(y, x, str, count));
740 }
741
742
743 void
744 cmd_mvaddch(int nargs, char **args)
745 {
746 ARGC(3);
747 ARG_INT(0, y);
748 ARG_INT(1, x);
749 ARG_CHTYPE(2, ch);
750
751 report_count(1);
752 report_return(mvaddch(y, x, ch));
753 }
754
755
756 void
757 cmd_mvaddchnstr(int nargs, char **args)
758 {
759 ARGC(4);
760 ARG_INT(0, y);
761 ARG_INT(1, x);
762 ARG_CHTYPE_STRING(2, chstr);
763 ARG_INT(3, count);
764
765 report_count(1);
766 report_return(mvaddchnstr(y, x, chstr, count));
767 }
768
769
770 void
771 cmd_mvaddchstr(int nargs, char **args)
772 {
773 ARGC(3);
774 ARG_INT(0, y);
775 ARG_INT(1, x);
776 ARG_CHTYPE_STRING(2, chstr);
777
778 report_count(1);
779 report_return(mvaddchstr(y, x, chstr));
780 }
781
782
783 void
784 cmd_mvaddnstr(int nargs, char **args)
785 {
786 ARGC(4);
787 ARG_INT(0, y);
788 ARG_INT(1, x);
789 ARG_STRING(2, str);
790 ARG_INT(3, count);
791
792 report_count(1);
793 report_return(mvaddnstr(y, x, str, count));
794 }
795
796
797 void
798 cmd_mvaddstr(int nargs, char **args)
799 {
800 ARGC(3);
801 ARG_INT(0, y);
802 ARG_INT(1, x);
803 ARG_STRING(2, str);
804
805 report_count(1);
806 report_return(mvaddstr(y, x, str));
807 }
808
809
810 void
811 cmd_mvdelch(int nargs, char **args)
812 {
813 ARGC(2);
814 ARG_INT(0, y);
815 ARG_INT(1, x);
816
817 report_count(1);
818 report_return(mvdelch(y, x));
819 }
820
821
822 void
823 cmd_mvgetch(int nargs, char **args)
824 {
825 ARGC(2);
826 ARG_INT(0, y);
827 ARG_INT(1, x);
828
829 report_count(1);
830 report_int(mvgetch(y, x));
831 }
832
833
834 void
835 cmd_mvgetnstr(int nargs, char **args)
836 {
837 char *string;
838
839 ARGC(3);
840 ARG_INT(0, y);
841 ARG_INT(1, x);
842 ARG_INT(2, count);
843
844 if ((string = malloc(count + 1)) == NULL) {
845 report_count(1);
846 report_error("MALLOC_FAILED");
847 return;
848 }
849
850 report_count(2);
851 report_return(mvgetnstr(y, x, string, count));
852 report_status(string);
853 free(string);
854 }
855
856
857 void
858 cmd_mvgetstr(int nargs, char **args)
859 {
860 char string[256];
861
862 ARGC(2);
863 ARG_INT(0, y);
864 ARG_INT(1, x);
865
866 report_count(2);
867 report_return(mvgetstr(y, x, string));
868 report_status(string);
869 }
870
871
872 void
873 cmd_mvinch(int nargs, char **args)
874 {
875 ARGC(2);
876 ARG_INT(0, y);
877 ARG_INT(1, x);
878
879 report_count(1);
880 report_byte(mvinch(y, x));
881 }
882
883
884 void
885 cmd_mvinchnstr(int nargs, char **args)
886 {
887 chtype *string;
888
889 ARGC(3);
890 ARG_INT(0, y);
891 ARG_INT(1, x);
892 ARG_INT(2, count);
893
894 if ((string = malloc((count + 1) * sizeof(chtype))) == NULL) {
895 report_count(1);
896 report_error("MALLOC_FAILED");
897 return;
898 }
899
900 report_count(2);
901 report_return(mvinchnstr(y, x, string, count));
902 report_nstr(string);
903 free(string);
904 }
905
906
907 void
908 cmd_mvinchstr(int nargs, char **args)
909 {
910 chtype string[256];
911
912 ARGC(2);
913 ARG_INT(0, y);
914 ARG_INT(1, x);
915
916 report_count(2);
917 report_return(mvinchstr(y, x, string));
918 report_nstr(string);
919 }
920
921
922 void
923 cmd_mvinnstr(int nargs, char **args)
924 {
925 char *string;
926
927 ARGC(3);
928 ARG_INT(0, y);
929 ARG_INT(1, x);
930 ARG_INT(2, count);
931
932 if ((string = malloc(count + 1)) == NULL) {
933 report_count(1);
934 report_error("MALLOC_FAILED");
935 return;
936 }
937
938 report_count(2);
939 report_int(mvinnstr(y, x, string, count));
940 report_status(string);
941 free(string);
942 }
943
944
945 void
946 cmd_mvinsch(int nargs, char **args)
947 {
948 ARGC(3);
949 ARG_INT(0, y);
950 ARG_INT(1, x);
951 ARG_CHTYPE(2, ch);
952
953 report_count(1);
954 report_return(mvinsch(y, x, ch));
955 }
956
957
958 void
959 cmd_mvinstr(int nargs, char **args)
960 {
961 char string[256];
962
963 ARGC(2);
964 ARG_INT(0, y);
965 ARG_INT(1, x);
966
967 report_count(2);
968 report_return(mvinstr(y, x, string));
969 report_status(string);
970 }
971
972
973 void
974 cmd_mvwaddbytes(int nargs, char **args)
975 {
976 ARGC(5);
977 ARG_WINDOW(0, win);
978 ARG_INT(1, y);
979 ARG_INT(2, x);
980 ARG_STRING(3, str);
981 ARG_INT(4, count);
982
983 report_count(1);
984 report_return(mvwaddbytes(win, y, x, str, count));
985 }
986
987
988 void
989 cmd_mvwaddch(int nargs, char **args)
990 {
991 ARGC(4);
992 ARG_WINDOW(0, win);
993 ARG_INT(1, y);
994 ARG_INT(2, x);
995 ARG_CHTYPE(3, ch);
996
997 report_count(1);
998 report_return(mvwaddch(win, y, x, ch));
999 }
1000
1001
1002 void
1003 cmd_mvwaddchnstr(int nargs, char **args)
1004 {
1005 ARGC(5);
1006 ARG_WINDOW(0, win);
1007 ARG_INT(1, y);
1008 ARG_INT(2, x);
1009 ARG_CHTYPE_STRING(3, chstr);
1010 ARG_INT(4, count);
1011
1012 report_count(1);
1013 report_return(mvwaddchnstr(win, y, x, chstr, count));
1014 }
1015
1016
1017 void
1018 cmd_mvwaddchstr(int nargs, char **args)
1019 {
1020 ARGC(4);
1021 ARG_WINDOW(0, win);
1022 ARG_INT(1, y);
1023 ARG_INT(2, x);
1024 ARG_CHTYPE_STRING(3, chstr);
1025
1026 report_count(1);
1027 report_return(mvwaddchstr(win, y, x, chstr));
1028 }
1029
1030
1031 void
1032 cmd_mvwaddnstr(int nargs, char **args)
1033 {
1034 ARGC(5);
1035 ARG_WINDOW(0, win);
1036 ARG_INT(1, y);
1037 ARG_INT(2, x);
1038 ARG_STRING(3, str);
1039 ARG_INT(4, count);
1040
1041 report_count(1);
1042 report_return(mvwaddnstr(win, y, x, str, count));
1043 }
1044
1045
1046 void
1047 cmd_mvwaddstr(int nargs, char **args)
1048 {
1049 ARGC(4);
1050 ARG_WINDOW(0, win);
1051 ARG_INT(1, y);
1052 ARG_INT(2, x);
1053 ARG_STRING(3, str);
1054
1055 report_count(1);
1056 report_return(mvwaddstr(win, y, x, str));
1057 }
1058
1059
1060 void
1061 cmd_mvwdelch(int nargs, char **args)
1062 {
1063 ARGC(3);
1064 ARG_WINDOW(0, win);
1065 ARG_INT(1, y);
1066 ARG_INT(2, x);
1067
1068 report_count(1);
1069 report_return(mvwdelch(win, y, x));
1070 }
1071
1072
1073 void
1074 cmd_mvwgetch(int nargs, char **args)
1075 {
1076 ARGC(3);
1077 ARG_WINDOW(0, win);
1078 ARG_INT(1, y);
1079 ARG_INT(2, x);
1080
1081 /* XXX - implicit refresh */
1082 report_count(1);
1083 report_int(mvwgetch(win, y, x));
1084 }
1085
1086
1087 void
1088 cmd_mvwgetnstr(int nargs, char **args)
1089 {
1090 char *string;
1091
1092 ARGC(4);
1093 ARG_WINDOW(0, win);
1094 ARG_INT(1, y);
1095 ARG_INT(2, x);
1096 ARG_INT(3, count);
1097
1098 if ((string = malloc(count + 1)) == NULL) {
1099 report_count(1);
1100 report_error("MALLOC_FAILED");
1101 return;
1102 }
1103
1104 report_count(2);
1105 report_return(mvwgetnstr(win, y, x, string, count));
1106 report_status(string);
1107 free(string);
1108 }
1109
1110
1111 void
1112 cmd_mvwgetstr(int nargs, char **args)
1113 {
1114 char string[256];
1115
1116 ARGC(3);
1117 ARG_WINDOW(0, win);
1118 ARG_INT(1, y);
1119 ARG_INT(2, x);
1120
1121 report_count(2);
1122 report_return(mvwgetstr(win, y, x, string));
1123 report_status(string);
1124 }
1125
1126
1127 void
1128 cmd_mvwinch(int nargs, char **args)
1129 {
1130 ARGC(3);
1131 ARG_WINDOW(0, win);
1132 ARG_INT(1, y);
1133 ARG_INT(2, x);
1134
1135 report_count(1);
1136 report_byte(mvwinch(win, y, x));
1137 }
1138
1139
1140 void
1141 cmd_mvwinsch(int nargs, char **args)
1142 {
1143 ARGC(4);
1144 ARG_WINDOW(0, win);
1145 ARG_INT(1, y);
1146 ARG_INT(2, x);
1147 ARG_CHTYPE(3, ch);
1148
1149 report_count(1);
1150 report_return(mvwinsch(win, y, x, ch));
1151 }
1152
1153
1154 void
1155 cmd_assume_default_colors(int nargs, char **args)
1156 {
1157 ARGC(2);
1158 ARG_SHORT(0, fore);
1159 ARG_SHORT(1, back);
1160
1161 report_count(1);
1162 report_return(assume_default_colors(fore, back));
1163 }
1164
1165
1166 void
1167 cmd_baudrate(int nargs, char **args)
1168 {
1169 ARGC(0);
1170
1171 report_count(1);
1172 report_int(baudrate());
1173 }
1174
1175
1176 void
1177 cmd_beep(int nargs, char **args)
1178 {
1179 ARGC(0);
1180
1181 report_count(1);
1182 report_return(beep());
1183 }
1184
1185
1186 void
1187 cmd_box(int nargs, char **args)
1188 {
1189 ARGC(3);
1190 ARG_WINDOW(0, win);
1191 ARG_CHTYPE(1, vertical);
1192 ARG_CHTYPE(2, horizontal);
1193
1194 report_count(1);
1195 report_return(box(win, vertical, horizontal));
1196 }
1197
1198
1199 void
1200 cmd_can_change_color(int nargs, char **args)
1201 {
1202 ARGC(0);
1203
1204 report_count(1);
1205 report_int(can_change_color());
1206 }
1207
1208
1209 void
1210 cmd_cbreak(int nargs, char **args)
1211 {
1212 ARGC(0);
1213
1214 report_count(1);
1215 report_return(cbreak());
1216 }
1217
1218
1219 void
1220 cmd_clearok(int nargs, char **args)
1221 {
1222 ARGC(2);
1223 ARG_WINDOW(0, win);
1224 ARG_INT(1, flag);
1225
1226 report_count(1);
1227 report_return(clearok(win, flag));
1228 }
1229
1230
1231 void
1232 cmd_color_content(int nargs, char **args)
1233 {
1234 ARGC(1);
1235 ARG_SHORT(0, colour);
1236
1237 short red, green, blue;
1238 int ret = color_content(colour, &red, &green, &blue);
1239
1240 report_count(4);
1241 report_return(ret);
1242 report_int(red);
1243 report_int(green);
1244 report_int(blue);
1245 }
1246
1247
1248 void
1249 cmd_copywin(int nargs, char **args)
1250 {
1251 ARGC(9);
1252 ARG_WINDOW(0, source);
1253 ARG_WINDOW(1, destination);
1254 ARG_INT(2, sminrow);
1255 ARG_INT(3, smincol);
1256 ARG_INT(4, dminrow);
1257 ARG_INT(5, dmincol);
1258 ARG_INT(6, dmaxrow);
1259 ARG_INT(7, dmaxcol);
1260 ARG_INT(8, ovlay);
1261
1262 report_count(1);
1263 report_return(copywin(source, destination, sminrow, smincol, dminrow,
1264 dmincol, dmaxrow, dmaxcol, ovlay));
1265 }
1266
1267
1268 void
1269 cmd_curs_set(int nargs, char **args)
1270 {
1271 ARGC(1);
1272 ARG_INT(0, vis);
1273
1274 report_count(1);
1275 report_int(curs_set(vis));
1276 }
1277
1278
1279 void
1280 cmd_def_prog_mode(int nargs, char **args)
1281 {
1282 ARGC(0);
1283
1284 report_count(1);
1285 report_return(def_prog_mode());
1286 }
1287
1288
1289 void
1290 cmd_def_shell_mode(int nargs, char **args)
1291 {
1292 ARGC(0);
1293
1294 report_count(1);
1295 report_return(def_shell_mode());
1296 }
1297
1298
1299 void
1300 cmd_define_key(int nargs, char **args)
1301 {
1302 ARGC(2);
1303 ARG_MODIFIABLE_STRING(0, sequence);
1304 ARG_INT(1, symbol);
1305
1306 report_count(1);
1307 report_return(define_key(sequence, symbol));
1308 }
1309
1310
1311 void
1312 cmd_delay_output(int nargs, char **args)
1313 {
1314 ARGC(1);
1315 ARG_INT(0, dtime);
1316
1317 report_count(1);
1318 report_return(delay_output(dtime));
1319 }
1320
1321
1322 void
1323 cmd_delscreen(int nargs, char **args)
1324 {
1325 ARGC(1);
1326 ARG_SCREEN(0, scrn);
1327
1328 delscreen(scrn); /* void return */
1329
1330 report_count(1);
1331 report_return(OK);
1332 }
1333
1334
1335 void
1336 cmd_delwin(int nargs, char **args)
1337 {
1338 ARGC(1);
1339 ARG_WINDOW(0, win);
1340
1341 report_count(1);
1342 report_return(delwin(win));
1343 }
1344
1345
1346 void
1347 cmd_derwin(int nargs, char **args)
1348 {
1349 ARGC(5);
1350 ARG_WINDOW(0, win);
1351 ARG_INT(1, lines);
1352 ARG_INT(2, cols);
1353 ARG_INT(3, y);
1354 ARG_INT(4, x);
1355
1356 report_count(1);
1357 report_ptr(derwin(win, lines, cols, y, x));
1358 }
1359
1360
1361 void
1362 cmd_dupwin(int nargs, char **args)
1363 {
1364 ARGC(1);
1365 ARG_WINDOW(0, win);
1366
1367 report_count(1);
1368 report_ptr(dupwin(win));
1369 }
1370
1371
1372 void
1373 cmd_doupdate(int nargs, char **args)
1374 {
1375 ARGC(0);
1376
1377 /* XXX - implicit refresh */
1378 report_count(1);
1379 report_return(doupdate());
1380 }
1381
1382
1383 void
1384 cmd_echo(int nargs, char **args)
1385 {
1386 ARGC(0);
1387
1388 report_count(1);
1389 report_return(echo());
1390 }
1391
1392
1393 void
1394 cmd_endwin(int nargs, char **args)
1395 {
1396 ARGC(0);
1397
1398 report_count(1);
1399 report_return(endwin());
1400 }
1401
1402
1403 void
1404 cmd_erasechar(int nargs, char **args)
1405 {
1406 ARGC(0);
1407
1408 report_count(1);
1409 report_int(erasechar());
1410 }
1411
1412
1413 void
1414 cmd_flash(int nargs, char **args)
1415 {
1416 ARGC(0);
1417
1418 report_count(1);
1419 report_return(flash());
1420 }
1421
1422
1423 void
1424 cmd_flushinp(int nargs, char **args)
1425 {
1426 ARGC(0);
1427
1428 report_count(1);
1429 report_return(flushinp());
1430 }
1431
1432
1433 void
1434 cmd_flushok(int nargs, char **args)
1435 {
1436 ARGC(2);
1437 ARG_WINDOW(0, win);
1438 ARG_INT(1, flag);
1439
1440 report_count(1);
1441 report_return(flushok(win, flag));
1442 }
1443
1444
1445 void
1446 cmd_fullname(int nargs, char **args)
1447 {
1448 char string[256];
1449
1450 ARGC(1);
1451 ARG_STRING(0, termbuf);
1452
1453 report_count(2);
1454 report_status(fullname(termbuf, string));
1455 report_status(string);
1456 }
1457
1458
1459 void
1460 cmd_getattrs(int nargs, char **args)
1461 {
1462 ARGC(1);
1463 ARG_WINDOW(0, win);
1464
1465 report_count(1);
1466 report_int(getattrs(win));
1467 }
1468
1469
1470 void
1471 cmd_getbkgd(int nargs, char **args)
1472 {
1473 ARGC(1);
1474 ARG_WINDOW(0, win);
1475
1476 report_count(1);
1477 report_byte(getbkgd(win));
1478 }
1479
1480
1481 void
1482 cmd_getcury(int nargs, char **args)
1483 {
1484 ARGC(1);
1485 ARG_WINDOW(0, win);
1486
1487 report_count(1);
1488 report_int(getcury(win));
1489 }
1490
1491
1492 void
1493 cmd_getcurx(int nargs, char **args)
1494 {
1495 ARGC(1);
1496 ARG_WINDOW(0, win);
1497
1498 report_count(1);
1499 report_int(getcurx(win));
1500 }
1501
1502
1503 void
1504 cmd_getyx(int nargs, char **args)
1505 {
1506 ARGC(1);
1507 ARG_WINDOW(0, win);
1508
1509 int y, x;
1510 getyx(win, y, x);
1511 report_count(2);
1512 report_int(y);
1513 report_int(x);
1514 }
1515
1516
1517 void
1518 cmd_getbegy(int nargs, char **args)
1519 {
1520 ARGC(1);
1521 ARG_WINDOW(0, win);
1522
1523 report_count(1);
1524 report_int(getbegy(win));
1525 }
1526
1527
1528 void
1529 cmd_getbegx(int nargs, char **args)
1530 {
1531 ARGC(1);
1532 ARG_WINDOW(0, win);
1533
1534 report_count(1);
1535 report_int(getbegx(win));
1536 }
1537
1538
1539 void
1540 cmd_getmaxy(int nargs, char **args)
1541 {
1542 ARGC(1);
1543 ARG_WINDOW(0, win);
1544
1545 report_count(1);
1546 report_int(getmaxy(win));
1547 }
1548
1549
1550 void
1551 cmd_getmaxx(int nargs, char **args)
1552 {
1553 ARGC(1);
1554 ARG_WINDOW(0, win);
1555
1556 report_count(1);
1557 report_int(getmaxx(win));
1558 }
1559
1560
1561 void
1562 cmd_getpary(int nargs, char **args)
1563 {
1564 ARGC(1);
1565 ARG_WINDOW(0, win);
1566
1567 report_count(1);
1568 report_int(getpary(win));
1569 }
1570
1571
1572 void
1573 cmd_getparx(int nargs, char **args)
1574 {
1575 ARGC(1);
1576 ARG_WINDOW(0, win);
1577
1578 report_count(1);
1579 report_int(getparx(win));
1580 }
1581
1582
1583 void
1584 cmd_getparyx(int nargs, char **args)
1585 {
1586 ARGC(1);
1587 ARG_WINDOW(0, win);
1588
1589 int y, x;
1590 report_count(2);
1591 getparyx(win, y, x);
1592 report_int(y);
1593 report_int(x);
1594 }
1595
1596 void
1597 cmd_getmaxyx(int nargs, char **args)
1598 {
1599 ARGC(1);
1600 ARG_WINDOW(0, win);
1601
1602 int y, x;
1603 getmaxyx(win, y, x);
1604
1605 report_count(2);
1606 report_int(y);
1607 report_int(x);
1608 }
1609
1610 void
1611 cmd_getbegyx(int nargs, char **args)
1612 {
1613 ARGC(1);
1614 ARG_WINDOW(0, win);
1615
1616 int y, x;
1617 getbegyx(win, y, x);
1618
1619 report_count(2);
1620 report_int(y);
1621 report_int(x);
1622 }
1623
1624 void
1625 cmd_setsyx(int nargs, char **args)
1626 {
1627 ARGC(2);
1628 ARG_INT(0, y);
1629 ARG_INT(1, x);
1630
1631 report_count(1);
1632 setsyx(y, x);
1633 report_return(OK);
1634 }
1635
1636 void
1637 cmd_getsyx(int nargs, char **args)
1638 {
1639 int y, x;
1640
1641 ARGC(0);
1642
1643 report_count(3);
1644 getsyx(y, x);
1645 report_return(OK);
1646 report_int(y);
1647 report_int(x);
1648 }
1649
1650 void
1651 cmd_gettmode(int nargs, char **args)
1652 {
1653 ARGC(0);
1654
1655 report_count(1);
1656 report_return(gettmode());
1657 }
1658
1659
1660 void
1661 cmd_getwin(int nargs, char **args)
1662 {
1663 FILE *fp;
1664
1665 ARGC(1);
1666 ARG_STRING(0, filename);
1667
1668 if ((fp = fopen(filename, "r")) == NULL) {
1669 report_count(1);
1670 report_error("BAD FILE_ARGUMENT");
1671 return;
1672 }
1673 report_count(1);
1674 report_ptr(getwin(fp));
1675 fclose(fp);
1676 }
1677
1678
1679 void
1680 cmd_halfdelay(int nargs, char **args)
1681 {
1682 ARGC(1);
1683 ARG_INT(0, ms);
1684
1685 report_count(1);
1686 report_return(halfdelay(ms));
1687 }
1688
1689
1690 void
1691 cmd_has_colors(int nargs, char **args)
1692 {
1693 ARGC(0);
1694
1695 report_count(1);
1696 report_int(has_colors());
1697 }
1698
1699
1700 void
1701 cmd_has_ic(int nargs, char **args)
1702 {
1703 ARGC(0);
1704
1705 report_count(1);
1706 report_int(has_ic());
1707 }
1708
1709
1710 void
1711 cmd_has_il(int nargs, char **args)
1712 {
1713 ARGC(0);
1714
1715 report_count(1);
1716 report_int(has_il());
1717 }
1718
1719
1720 void
1721 cmd_hline(int nargs, char **args)
1722 {
1723 ARGC(2);
1724 ARG_CHTYPE(0, ch);
1725 ARG_INT(1, count);
1726
1727 report_count(1);
1728 report_return(hline(ch, count));
1729 }
1730
1731
1732 void
1733 cmd_idcok(int nargs, char **args)
1734 {
1735 ARGC(2);
1736 ARG_WINDOW(0, win);
1737 ARG_INT(1, flag);
1738
1739 report_count(1);
1740 report_return(idcok(win, flag));
1741 }
1742
1743
1744 void
1745 cmd_idlok(int nargs, char **args)
1746 {
1747 ARGC(2);
1748 ARG_WINDOW(0, win);
1749 ARG_INT(1, flag);
1750
1751 report_count(1);
1752 report_return(idlok(win, flag));
1753 }
1754
1755
1756 void
1757 cmd_init_color(int nargs, char **args)
1758 {
1759 ARGC(4);
1760 ARG_SHORT(0, colour);
1761 ARG_SHORT(1, red);
1762 ARG_SHORT(2, green);
1763 ARG_SHORT(3, blue);
1764
1765 report_count(1);
1766 report_return(init_color(colour, red, green, blue));
1767 }
1768
1769
1770 void
1771 cmd_init_pair(int nargs, char **args)
1772 {
1773 ARGC(3);
1774 ARG_SHORT(0, pair);
1775 ARG_SHORT(1, fore);
1776 ARG_SHORT(2, back);
1777
1778 report_count(1);
1779 report_return(init_pair(pair, fore, back));
1780 }
1781
1782
1783 void
1784 cmd_initscr(int nargs, char **args)
1785 {
1786 ARGC(0);
1787
1788 report_count(1);
1789 report_ptr(initscr());
1790 }
1791
1792
1793 void
1794 cmd_intrflush(int nargs, char **args)
1795 {
1796 ARGC(2);
1797 ARG_WINDOW(0, win);
1798 ARG_INT(1, flag);
1799
1800 report_count(1);
1801 report_return(intrflush(win, flag));
1802 }
1803
1804
1805 void
1806 cmd_isendwin(int nargs, char **args)
1807 {
1808 ARGC(0);
1809
1810 report_count(1);
1811 report_int(isendwin());
1812 }
1813
1814
1815 void
1816 cmd_is_linetouched(int nargs, char **args)
1817 {
1818 ARGC(2);
1819 ARG_WINDOW(0, win);
1820 ARG_INT(1, line);
1821
1822 report_count(1);
1823 report_int(is_linetouched(win, line));
1824 }
1825
1826
1827 void
1828 cmd_is_wintouched(int nargs, char **args)
1829 {
1830 ARGC(1);
1831 ARG_WINDOW(0, win);
1832
1833 report_count(1);
1834 report_int(is_wintouched(win));
1835 }
1836
1837
1838 void
1839 cmd_keyok(int nargs, char **args)
1840 {
1841 ARGC(2);
1842 ARG_INT(0, keysym);
1843 ARG_INT(1, flag);
1844
1845 report_count(1);
1846 report_return(keyok(keysym, flag));
1847 }
1848
1849
1850 void
1851 cmd_keypad(int nargs, char **args)
1852 {
1853 ARGC(2);
1854 ARG_WINDOW(0, win);
1855 ARG_INT(1, flag);
1856
1857 report_count(1);
1858 report_return(keypad(win, flag));
1859 }
1860
1861 void
1862 cmd_is_keypad(int nargs, char **args)
1863 {
1864 ARGC(1);
1865 ARG_WINDOW(0, win);
1866
1867 report_count(1);
1868 report_int(is_keypad(win));
1869 }
1870
1871 void
1872 cmd_keyname(int nargs, char **args)
1873 {
1874 ARGC(1);
1875 ARG_UINT(0, key);
1876
1877 report_count(1);
1878 report_status(keyname(key));
1879 }
1880
1881
1882 void
1883 cmd_killchar(int nargs, char **args)
1884 {
1885 ARGC(0);
1886
1887 report_count(1);
1888 report_int(killchar());
1889 }
1890
1891
1892 void
1893 cmd_leaveok(int nargs, char **args)
1894 {
1895 ARGC(2);
1896 ARG_WINDOW(0, win);
1897 ARG_INT(1, flag);
1898
1899 report_count(1);
1900 report_return(leaveok(win, flag));
1901 }
1902
1903 void
1904 cmd_is_leaveok(int nargs, char **args)
1905 {
1906 ARGC(1);
1907 ARG_WINDOW(0, win);
1908
1909 report_count(1);
1910 report_int(is_leaveok(win));
1911 }
1912
1913 void
1914 cmd_meta(int nargs, char **args)
1915 {
1916 ARGC(2);
1917 ARG_WINDOW(0, win);
1918 ARG_INT(1, flag);
1919
1920 report_count(1);
1921 report_return(meta(win, flag));
1922 }
1923
1924
1925 void
1926 cmd_mvcur(int nargs, char **args)
1927 {
1928 ARGC(4);
1929 ARG_INT(0, oldy);
1930 ARG_INT(1, oldx);
1931 ARG_INT(2, y);
1932 ARG_INT(3, x);
1933
1934 report_count(1);
1935 report_return(mvcur(oldy, oldx, y, x));
1936 }
1937
1938
1939 void
1940 cmd_mvderwin(int nargs, char **args)
1941 {
1942 ARGC(3);
1943 ARG_WINDOW(0, win);
1944 ARG_INT(1, y);
1945 ARG_INT(2, x);
1946
1947 report_count(1);
1948 report_return(mvderwin(win, y, x));
1949 }
1950
1951
1952 void
1953 cmd_mvhline(int nargs, char **args)
1954 {
1955 ARGC(4);
1956 ARG_INT(0, y);
1957 ARG_INT(1, x);
1958 ARG_CHTYPE(2, ch);
1959 ARG_INT(3, n);
1960
1961 report_count(1);
1962 report_return(mvhline(y, x, ch, n));
1963 }
1964
1965
1966 void
1967 cmd_mvprintw(int nargs, char **args)
1968 {
1969 ARGC(4);
1970 ARG_INT(0, y);
1971 ARG_INT(1, x);
1972 ARG_STRING(2, fmt); /* Must have a single "%s" in this test. */
1973 ARG_STRING(3, arg);
1974
1975 report_count(1);
1976 report_return(mvprintw(y, x, fmt, arg));
1977 }
1978
1979
1980 void
1981 cmd_mvscanw(int nargs, char **args)
1982 {
1983 int ret;
1984 char string[256];
1985
1986 ARGC(3);
1987 ARG_INT(0, y);
1988 ARG_INT(1, x);
1989 ARG_STRING(2, fmt);
1990
1991 report_count(2);
1992 if (strchr(fmt, 's') != NULL) {
1993 report_return(ret = mvscanw(y, x, fmt, string));
1994 } else {
1995 int val; /* XXX assume 32-bit integer */
1996 report_return(ret = mvscanw(y, x, fmt, &val));
1997 if (ret == ERR)
1998 goto out;
1999 snprintf(string, sizeof(string), fmt, val);
2000 }
2001 out:
2002 /*
2003 * When mvscanw(3) fails, string is not modified.
2004 * Let's ignore the 2nd result for this case.
2005 */
2006 report_status(ret == ERR ? "ERR" : string);
2007 }
2008
2009
2010 void
2011 cmd_mvvline(int nargs, char **args)
2012 {
2013 ARGC(4);
2014 ARG_INT(0, y);
2015 ARG_INT(1, x);
2016 ARG_CHTYPE(2, ch);
2017 ARG_INT(3, n);
2018
2019 report_count(1);
2020 report_return(mvvline(y, x, ch, n));
2021 }
2022
2023
2024 void
2025 cmd_mvwhline(int nargs, char **args)
2026 {
2027 ARGC(5);
2028 ARG_WINDOW(0, win);
2029 ARG_INT(1, y);
2030 ARG_INT(2, x);
2031 ARG_CHTYPE(3, ch);
2032 ARG_INT(4, n);
2033
2034 report_count(1);
2035 report_return(mvwhline(win, y, x, ch, n));
2036 }
2037
2038
2039 void
2040 cmd_mvwvline(int nargs, char **args)
2041 {
2042 ARGC(5);
2043 ARG_WINDOW(0, win);
2044 ARG_INT(1, y);
2045 ARG_INT(2, x);
2046 ARG_CHTYPE(3, ch);
2047 ARG_INT(4, n);
2048
2049 report_count(1);
2050 report_return(mvwvline(win, y, x, ch, n));
2051 }
2052
2053
2054 void
2055 cmd_mvwin(int nargs, char **args)
2056 {
2057 ARGC(3);
2058 ARG_WINDOW(0, win);
2059 ARG_INT(1, y);
2060 ARG_INT(2, x);
2061
2062 report_count(1);
2063 report_return(mvwin(win, y, x));
2064 }
2065
2066
2067 void
2068 cmd_mvwinchnstr(int nargs, char **args)
2069 {
2070 chtype *string;
2071
2072 ARGC(4);
2073 ARG_WINDOW(0, win);
2074 ARG_INT(1, y);
2075 ARG_INT(2, x);
2076 ARG_INT(3, count);
2077
2078 if ((string = malloc((count + 1) * sizeof(chtype))) == NULL) {
2079 report_count(1);
2080 report_error("MALLOC_FAILED");
2081 return;
2082 }
2083
2084 report_count(2);
2085 report_return(mvwinchnstr(win, y, x, string, count));
2086 report_nstr(string);
2087 free(string);
2088 }
2089
2090
2091 void
2092 cmd_mvwinchstr(int nargs, char **args)
2093 {
2094 chtype string[256];
2095
2096 ARGC(3);
2097 ARG_WINDOW(0, win);
2098 ARG_INT(1, y);
2099 ARG_INT(2, x);
2100
2101 report_count(2);
2102 report_return(mvwinchstr(win, y, x, string));
2103 report_nstr(string);
2104 }
2105
2106
2107 void
2108 cmd_mvwinnstr(int nargs, char **args)
2109 {
2110 char *string;
2111
2112 ARGC(4);
2113 ARG_WINDOW(0, win);
2114 ARG_INT(1, y);
2115 ARG_INT(2, x);
2116 ARG_INT(3, count);
2117
2118 if ((string = malloc(count + 1)) == NULL) {
2119 report_count(1);
2120 report_error("MALLOC_FAILED");
2121 return;
2122 }
2123
2124 report_count(2);
2125 report_int(mvwinnstr(win, y, x, string, count));
2126 report_status(string);
2127 free(string);
2128 }
2129
2130
2131 void
2132 cmd_mvwinstr(int nargs, char **args)
2133 {
2134 char string[256];
2135
2136 ARGC(3);
2137 ARG_WINDOW(0, win);
2138 ARG_INT(1, y);
2139 ARG_INT(2, x);
2140
2141 report_count(2);
2142 report_return(mvwinstr(win, y, x, string));
2143 report_status(string);
2144 }
2145
2146
2147 void
2148 cmd_mvwprintw(int nargs, char **args)
2149 {
2150 ARGC(5);
2151 ARG_WINDOW(0, win);
2152 ARG_INT(1, y);
2153 ARG_INT(2, x);
2154 ARG_STRING(3, fmt); /* Must have a single "%s" in this test. */
2155 ARG_STRING(4, arg);
2156
2157 report_count(1);
2158 report_return(mvwprintw(win, y, x, fmt, arg));
2159 }
2160
2161
2162 void
2163 cmd_mvwscanw(int nargs, char **args)
2164 {
2165 char string[256];
2166
2167 ARGC(4);
2168 ARG_WINDOW(0, win);
2169 ARG_INT(1, y);
2170 ARG_INT(2, x);
2171 ARG_STRING(3, fmt); /* Must have a single "%s" in this test. */
2172
2173 report_count(2);
2174 report_int(mvwscanw(win, y, x, fmt, &string));
2175 report_status(string);
2176 }
2177
2178
2179 void
2180 cmd_napms(int nargs, char **args)
2181 {
2182 ARGC(1);
2183 ARG_INT(0, naptime);
2184
2185 report_count(1);
2186 report_return(napms(naptime));
2187 }
2188
2189
2190 void
2191 cmd_newpad(int nargs, char **args)
2192 {
2193 ARGC(2);
2194 ARG_INT(0, y);
2195 ARG_INT(1, x);
2196
2197 report_count(1);
2198 report_ptr(newpad(y, x));
2199 }
2200
2201
2202 void
2203 cmd_newterm(int nargs, char **args)
2204 {
2205 FILE *in, *out;
2206
2207 ARGC(3);
2208 ARG_MODIFIABLE_STRING(0, type);
2209 ARG_STRING(1, in_fname);
2210 ARG_STRING(2, out_fname);
2211
2212 if ((in = fopen(in_fname, "rw")) == NULL) {
2213 report_count(1);
2214 report_error("BAD FILE_ARGUMENT");
2215 return;
2216 }
2217 if ((out = fopen(out_fname, "rw")) == NULL) {
2218 report_count(1);
2219 report_error("BAD FILE_ARGUMENT");
2220 return;
2221 }
2222
2223 report_count(1);
2224 report_ptr(newterm(type, out, in));
2225 }
2226
2227
2228 void
2229 cmd_newwin(int nargs, char **args)
2230 {
2231 ARGC(4);
2232 ARG_INT(0, lines);
2233 ARG_INT(1, cols);
2234 ARG_INT(2, begin_y);
2235 ARG_INT(3, begin_x);
2236
2237 report_count(1);
2238 report_ptr(newwin(lines, cols, begin_y, begin_x));
2239 }
2240
2241
2242 void
2243 cmd_nl(int nargs, char **args)
2244 {
2245 ARGC(0);
2246
2247 report_count(1);
2248 report_return(nl());
2249 }
2250
2251
2252 void
2253 cmd_no_color_attributes(int nargs, char **args)
2254 {
2255 ARGC(0);
2256
2257 report_count(1);
2258 report_int(no_color_attributes());
2259 }
2260
2261
2262 void
2263 cmd_nocbreak(int nargs, char **args)
2264 {
2265 ARGC(0);
2266
2267 report_count(1);
2268 report_return(nocbreak());
2269 }
2270
2271
2272 void
2273 cmd_nodelay(int nargs, char **args)
2274 {
2275 ARGC(2);
2276 ARG_WINDOW(0, win);
2277 ARG_INT(1, flag);
2278
2279 report_count(1);
2280 report_return(nodelay(win, flag));
2281 }
2282
2283
2284 void
2285 cmd_noecho(int nargs, char **args)
2286 {
2287 ARGC(0);
2288
2289 report_count(1);
2290 report_return(noecho());
2291 }
2292
2293
2294 void
2295 cmd_nonl(int nargs, char **args)
2296 {
2297 ARGC(0);
2298
2299 report_count(1);
2300 report_return(nonl());
2301 }
2302
2303
2304 void
2305 cmd_noqiflush(int nargs, char **args)
2306 {
2307 ARGC(0);
2308
2309 noqiflush();
2310 report_count(1);
2311 report_return(OK); /* fake a return, the call returns void */
2312 }
2313
2314
2315 void
2316 cmd_noraw(int nargs, char **args)
2317 {
2318 ARGC(0);
2319
2320 report_count(1);
2321 report_return(noraw());
2322 }
2323
2324
2325 void
2326 cmd_notimeout(int nargs, char **args)
2327 {
2328 ARGC(2);
2329 ARG_WINDOW(0, win);
2330 ARG_INT(1, flag);
2331
2332 report_count(1);
2333 report_return(notimeout(win, flag));
2334 }
2335
2336
2337 void
2338 cmd_overlay(int nargs, char **args)
2339 {
2340 ARGC(2);
2341 ARG_WINDOW(0, source);
2342 ARG_WINDOW(1, dest);
2343
2344 report_count(1);
2345 report_return(overlay(source, dest));
2346 }
2347
2348
2349 void
2350 cmd_overwrite(int nargs, char **args)
2351 {
2352 ARGC(2);
2353 ARG_WINDOW(0, source);
2354 ARG_WINDOW(1, dest);
2355
2356 report_count(1);
2357 report_return(overwrite(source, dest));
2358 }
2359
2360
2361 void
2362 cmd_pair_content(int nargs, char **args)
2363 {
2364 ARGC(1);
2365 ARG_SHORT(0, pair);
2366
2367 short fore, back;
2368 int ret = pair_content(pair, &fore, &back);
2369
2370 report_count(3);
2371 report_return(ret);
2372 report_int(fore);
2373 report_int(back);
2374 }
2375
2376
2377 void
2378 cmd_pechochar(int nargs, char **args)
2379 {
2380 ARGC(2);
2381 ARG_WINDOW(0, pad);
2382 ARG_CHTYPE(1, ch);
2383
2384 report_count(1);
2385 report_return(pechochar(pad, ch));
2386 }
2387
2388
2389 void
2390 cmd_pnoutrefresh(int nargs, char **args)
2391 {
2392 ARGC(7);
2393 ARG_WINDOW(0, pad);
2394 ARG_INT(1, pbeg_y);
2395 ARG_INT(2, pbeg_x);
2396 ARG_INT(3, sbeg_y);
2397 ARG_INT(4, sbeg_x);
2398 ARG_INT(5, smax_y);
2399 ARG_INT(6, smax_x);
2400
2401 report_count(1);
2402 report_return(pnoutrefresh(pad, pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y,
2403 smax_x));
2404 }
2405
2406
2407 void
2408 cmd_prefresh(int nargs, char **args)
2409 {
2410 ARGC(7);
2411 ARG_WINDOW(0, pad);
2412 ARG_INT(1, pbeg_y);
2413 ARG_INT(2, pbeg_x);
2414 ARG_INT(3, sbeg_y);
2415 ARG_INT(4, sbeg_x);
2416 ARG_INT(5, smax_y);
2417 ARG_INT(6, smax_x);
2418
2419 /* XXX causes refresh */
2420 report_count(1);
2421 report_return(prefresh(pad, pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y,
2422 smax_x));
2423 }
2424
2425
2426 void
2427 cmd_printw(int nargs, char **args)
2428 {
2429 ARGC(2);
2430 ARG_STRING(0, fmt); /* Must have a single "%s" in this test. */
2431 ARG_STRING(1, arg);
2432
2433 report_count(1);
2434 report_return(printw(fmt, arg));
2435 }
2436
2437
2438 void
2439 cmd_putwin(int nargs, char **args)
2440 {
2441 ARGC(2);
2442 ARG_WINDOW(0, win);
2443 ARG_STRING(1, filename);
2444
2445 FILE *fp;
2446 if ((fp = fopen(filename, "w")) == NULL) {
2447 report_count(1);
2448 report_error("BAD FILE_ARGUMENT");
2449 return;
2450 }
2451
2452 report_count(1);
2453 report_return(putwin(win, fp));
2454 fclose(fp);
2455 }
2456
2457
2458 void
2459 cmd_qiflush(int nargs, char **args)
2460 {
2461 ARGC(0);
2462
2463 qiflush();
2464 report_count(1);
2465 report_return(OK); /* fake a return because call returns void */
2466 }
2467
2468
2469 void
2470 cmd_raw(int nargs, char **args)
2471 {
2472 ARGC(0);
2473
2474 report_count(1);
2475 report_return(raw());
2476 }
2477
2478
2479 void
2480 cmd_redrawwin(int nargs, char **args)
2481 {
2482 ARGC(1);
2483 ARG_WINDOW(0, win);
2484
2485 report_count(1);
2486 report_return(redrawwin(win));
2487 }
2488
2489
2490 void
2491 cmd_reset_prog_mode(int nargs, char **args)
2492 {
2493 ARGC(0);
2494
2495 report_count(1);
2496 report_return(reset_prog_mode());
2497 }
2498
2499
2500 void
2501 cmd_reset_shell_mode(int nargs, char **args)
2502 {
2503 ARGC(0);
2504
2505 report_count(1);
2506 report_return(reset_shell_mode());
2507 }
2508
2509
2510 void
2511 cmd_resetty(int nargs, char **args)
2512 {
2513 ARGC(0);
2514
2515 report_count(1);
2516 report_return(resetty());
2517 }
2518
2519
2520 void
2521 cmd_resizeterm(int nargs, char **args)
2522 {
2523 ARGC(2);
2524 ARG_INT(0, rows);
2525 ARG_INT(1, cols);
2526
2527 report_count(1);
2528 report_return(resizeterm(rows, cols));
2529 }
2530
2531
2532 void
2533 cmd_savetty(int nargs, char **args)
2534 {
2535 ARGC(0);
2536
2537 report_count(1);
2538 report_return(savetty());
2539 }
2540
2541
2542 void
2543 cmd_scanw(int nargs, char **args)
2544 {
2545 char string[256];
2546
2547 ARGC(0);
2548
2549 report_count(2);
2550 report_return(scanw("%s", string));
2551 report_status(string);
2552 }
2553
2554
2555 void
2556 cmd_scroll(int nargs, char **args)
2557 {
2558 ARGC(1);
2559 ARG_WINDOW(0, win);
2560
2561 report_count(1);
2562 report_return(scroll(win));
2563 }
2564
2565
2566 void
2567 cmd_scrollok(int nargs, char **args)
2568 {
2569 ARGC(2);
2570 ARG_WINDOW(0, win);
2571 ARG_INT(1, flag);
2572
2573 report_count(1);
2574 report_return(scrollok(win, flag));
2575 }
2576
2577
2578 void
2579 cmd_setterm(int nargs, char **args)
2580 {
2581 ARGC(1);
2582 ARG_MODIFIABLE_STRING(0, name);
2583
2584 report_count(1);
2585 report_return(setterm(name));
2586 }
2587
2588
2589 void
2590 cmd_set_term(int nargs, char **args)
2591 {
2592 ARGC(1);
2593 ARG_SCREEN(0, scrn);
2594
2595 report_count(1);
2596 report_ptr(set_term(scrn));
2597 }
2598
2599
2600 void
2601 cmd_start_color(int nargs, char **args)
2602 {
2603 ARGC(0);
2604
2605 report_count(1);
2606 report_return(start_color());
2607 }
2608
2609
2610 void
2611 cmd_subpad(int nargs, char **args)
2612 {
2613 ARGC(5);
2614 ARG_WINDOW(0, pad);
2615 ARG_INT(1, lines);
2616 ARG_INT(2, cols);
2617 ARG_INT(3, begin_y);
2618 ARG_INT(4, begin_x);
2619
2620 report_count(1);
2621 report_ptr(subpad(pad, lines, cols, begin_y, begin_x));
2622 }
2623
2624
2625 void
2626 cmd_subwin(int nargs, char **args)
2627 {
2628 ARGC(5);
2629 ARG_WINDOW(0, win);
2630 ARG_INT(1, lines);
2631 ARG_INT(2, cols);
2632 ARG_INT(3, begin_y);
2633 ARG_INT(4, begin_x);
2634
2635 report_count(1);
2636 report_ptr(subwin(win, lines, cols, begin_y, begin_x));
2637 }
2638
2639
2640 void
2641 cmd_termattrs(int nargs, char **args)
2642 {
2643 ARGC(0);
2644
2645 report_count(1);
2646 report_int(termattrs());
2647 }
2648
2649
2650 void
2651 cmd_term_attrs(int nargs, char **args)
2652 {
2653 ARGC(0);
2654
2655 report_count(1);
2656 report_int(term_attrs());
2657 }
2658
2659
2660 void
2661 cmd_touchline(int nargs, char **args)
2662 {
2663 ARGC(3);
2664 ARG_WINDOW(0, win);
2665 ARG_INT(1, start);
2666 ARG_INT(2, count);
2667
2668 report_count(1);
2669 report_return(touchline(win, start, count));
2670 }
2671
2672
2673 void
2674 cmd_touchoverlap(int nargs, char **args)
2675 {
2676 ARGC(2);
2677 ARG_WINDOW(0, win1);
2678 ARG_WINDOW(1, win2);
2679
2680 report_count(1);
2681 report_return(touchoverlap(win1, win2));
2682 }
2683
2684
2685 void
2686 cmd_touchwin(int nargs, char **args)
2687 {
2688 ARGC(1);
2689 ARG_WINDOW(0, win);
2690
2691 report_count(1);
2692 report_return(touchwin(win));
2693 }
2694
2695
2696 void
2697 cmd_ungetch(int nargs, char **args)
2698 {
2699 ARGC(1);
2700 ARG_INT(0, ch);
2701
2702 report_count(1);
2703 report_return(ungetch(ch));
2704 }
2705
2706
2707 void
2708 cmd_untouchwin(int nargs, char **args)
2709 {
2710 ARGC(1);
2711 ARG_WINDOW(0, win);
2712
2713 report_count(1);
2714 report_return(untouchwin(win));
2715 }
2716
2717
2718 void
2719 cmd_use_default_colors(int nargs, char **args)
2720 {
2721 ARGC(0);
2722
2723 report_count(1);
2724 report_return(use_default_colors());
2725 }
2726
2727
2728 void
2729 cmd_vline(int nargs, char **args)
2730 {
2731 ARGC(2);
2732 ARG_CHTYPE(0, ch);
2733 ARG_INT(1, count);
2734
2735 report_count(1);
2736 report_return(vline(ch, count));
2737 }
2738
2739
2740 static int
2741 internal_vw_printw(WINDOW * win, const char *fmt, ...)
2742 {
2743 va_list va;
2744 int rv;
2745
2746 va_start(va, fmt);
2747 rv = vw_printw(win, fmt, va);
2748 va_end(va);
2749
2750 return rv;
2751 }
2752
2753 void
2754 cmd_vw_printw(int nargs, char **args)
2755 {
2756 ARGC(3);
2757 ARG_WINDOW(0, win);
2758 ARG_STRING(1, fmt); /* Must have a single "%s" in this test. */
2759 ARG_STRING(2, arg);
2760
2761 report_count(1);
2762 report_return(internal_vw_printw(win, fmt, arg));
2763 }
2764
2765
2766 static int
2767 internal_vw_scanw(WINDOW * win, const char *fmt, ...)
2768 {
2769 va_list va;
2770 int rv;
2771
2772 va_start(va, fmt);
2773 rv = vw_scanw(win, fmt, va);
2774 va_end(va);
2775
2776 return rv;
2777 }
2778
2779 void
2780 cmd_vw_scanw(int nargs, char **args)
2781 {
2782 char string[256];
2783
2784 ARGC(2);
2785 ARG_WINDOW(0, win);
2786 ARG_STRING(1, fmt);
2787
2788 report_count(2);
2789 report_int(internal_vw_scanw(win, fmt, string));
2790 report_status(string);
2791 }
2792
2793
2794 void
2795 cmd_vwprintw(int nargs, char **args)
2796 {
2797 cmd_vw_printw(nargs, args);
2798 }
2799
2800
2801 void
2802 cmd_vwscanw(int nargs, char **args)
2803 {
2804 cmd_vw_scanw(nargs, args);
2805 }
2806
2807
2808 void
2809 cmd_waddch(int nargs, char **args)
2810 {
2811 ARGC(2);
2812 ARG_WINDOW(0, win);
2813 ARG_CHTYPE(1, ch);
2814
2815 report_count(1);
2816 report_return(waddch(win, ch));
2817 }
2818
2819
2820 void
2821 cmd_waddchnstr(int nargs, char **args)
2822 {
2823 ARGC(3);
2824 ARG_WINDOW(0, win);
2825 ARG_CHTYPE_STRING(1, chstr);
2826 ARG_INT(2, count);
2827
2828 report_count(1);
2829 report_return(waddchnstr(win, chstr, count));
2830 }
2831
2832
2833 void
2834 cmd_waddchstr(int nargs, char **args)
2835 {
2836 ARGC(2);
2837 ARG_WINDOW(0, win);
2838 ARG_CHTYPE_STRING(1, chstr);
2839
2840 report_count(1);
2841 report_return(waddchstr(win, chstr));
2842 }
2843
2844
2845 void
2846 cmd_waddnstr(int nargs, char **args)
2847 {
2848 ARGC(3);
2849 ARG_WINDOW(0, win);
2850 ARG_STRING(1, str);
2851 ARG_INT(2, count);
2852
2853 report_count(1);
2854 report_return(waddnstr(win, str, count));
2855
2856 }
2857
2858
2859 void
2860 cmd_wattr_get(int nargs, char **args)
2861 {
2862 int attr;
2863 short pair;
2864
2865 ARGC(1);
2866 ARG_WINDOW(0, win);
2867
2868 report_count(3);
2869 report_return(wattr_get(win, &attr, &pair, NULL));
2870 report_int(attr);
2871 report_int(pair);
2872 }
2873
2874
2875 void
2876 cmd_wattr_off(int nargs, char **args)
2877 {
2878 ARGC(2);
2879 ARG_WINDOW(0, win);
2880 ARG_INT(1, attr);
2881
2882 report_count(1);
2883 report_return(wattr_off(win, attr, NULL));
2884 }
2885
2886
2887 void
2888 cmd_wattr_on(int nargs, char **args)
2889 {
2890 ARGC(2);
2891 ARG_WINDOW(0, win);
2892 ARG_INT(1, attr);
2893
2894 report_count(1);
2895 report_return(wattr_on(win, attr, NULL));
2896 }
2897
2898
2899 void
2900 cmd_wattr_set(int nargs, char **args)
2901 {
2902 ARGC(3);
2903 ARG_WINDOW(0, win);
2904 ARG_INT(1, attr);
2905 ARG_SHORT(2, pair);
2906
2907 report_count(1);
2908 report_return(wattr_set(win, attr, pair, NULL));
2909 }
2910
2911
2912 void
2913 cmd_wattroff(int nargs, char **args)
2914 {
2915 ARGC(2);
2916 ARG_WINDOW(0, win);
2917 ARG_INT(1, attr);
2918
2919 report_count(1);
2920 report_return(wattroff(win, attr));
2921 }
2922
2923
2924 void
2925 cmd_wattron(int nargs, char **args)
2926 {
2927 ARGC(2);
2928 ARG_WINDOW(0, win);
2929 ARG_INT(1, attr);
2930
2931 report_count(1);
2932 report_return(wattron(win, attr));
2933 }
2934
2935
2936 void
2937 cmd_wattrset(int nargs, char **args)
2938 {
2939 ARGC(2);
2940 ARG_WINDOW(0, win);
2941 ARG_INT(1, attr);
2942
2943 report_count(1);
2944 report_return(wattrset(win, attr));
2945 }
2946
2947
2948 void
2949 cmd_wbkgd(int nargs, char **args)
2950 {
2951 ARGC(2);
2952 ARG_WINDOW(0, win);
2953 ARG_CHTYPE(1, ch);
2954
2955 report_count(1);
2956 report_return(wbkgd(win, ch));
2957 }
2958
2959
2960 void
2961 cmd_wbkgdset(int nargs, char **args)
2962 {
2963 ARGC(2);
2964 ARG_WINDOW(0, win);
2965 ARG_CHTYPE(1, ch);
2966
2967 wbkgdset(win, ch); /* void return */
2968 report_count(1);
2969 report_return(OK);
2970 }
2971
2972
2973 void
2974 cmd_wborder(int nargs, char **args)
2975 {
2976 ARGC(9);
2977 ARG_WINDOW(0, win);
2978 ARG_INT(1, ls);
2979 ARG_INT(2, rs);
2980 ARG_INT(3, ts);
2981 ARG_INT(4, bs);
2982 ARG_INT(5, tl);
2983 ARG_INT(6, tr);
2984 ARG_INT(7, bl);
2985 ARG_INT(8, br);
2986
2987 report_count(1);
2988 report_return(wborder(win, ls, rs, ts, bs, tl, tr, bl, br));
2989 }
2990
2991
2992 void
2993 cmd_wclear(int nargs, char **args)
2994 {
2995 ARGC(1);
2996 ARG_WINDOW(0, win);
2997
2998 report_count(1);
2999 report_return(wclear(win));
3000 }
3001
3002
3003 void
3004 cmd_wclrtobot(int nargs, char **args)
3005 {
3006 ARGC(1);
3007 ARG_WINDOW(0, win);
3008
3009 report_count(1);
3010 report_return(wclrtobot(win));
3011 }
3012
3013
3014 void
3015 cmd_wclrtoeol(int nargs, char **args)
3016 {
3017 ARGC(1);
3018 ARG_WINDOW(0, win);
3019
3020 report_count(1);
3021 report_return(wclrtoeol(win));
3022
3023 }
3024
3025
3026 void
3027 cmd_wcolor_set(int nargs, char **args)
3028 {
3029 ARGC(3);
3030 ARG_WINDOW(0, win);
3031 ARG_SHORT(1, pair);
3032 ARG_NULL(2);
3033
3034 report_count(1);
3035 report_return(wcolor_set(win, pair, NULL));
3036 }
3037
3038
3039 void
3040 cmd_wdelch(int nargs, char **args)
3041 {
3042 ARGC(1);
3043 ARG_WINDOW(0, win);
3044
3045 report_count(1);
3046 report_return(wdelch(win));
3047 }
3048
3049
3050 void
3051 cmd_wdeleteln(int nargs, char **args)
3052 {
3053 ARGC(1);
3054 ARG_WINDOW(0, win);
3055
3056 report_count(1);
3057 report_return(wdeleteln(win));
3058
3059 }
3060
3061
3062 void
3063 cmd_wechochar(int nargs, char **args)
3064 {
3065 ARGC(2);
3066 ARG_WINDOW(0, win);
3067 ARG_CHTYPE(1, ch);
3068
3069 report_count(1);
3070 report_return(wechochar(win, ch));
3071 }
3072
3073
3074 void
3075 cmd_werase(int nargs, char **args)
3076 {
3077 ARGC(1);
3078 ARG_WINDOW(0, win);
3079
3080 report_count(1);
3081 report_return(werase(win));
3082 }
3083
3084
3085 void
3086 cmd_wgetch(int nargs, char **args)
3087 {
3088 ARGC(1);
3089 ARG_WINDOW(0, win);
3090
3091 report_count(1);
3092 report_int(wgetch(win));
3093 }
3094
3095
3096 void
3097 cmd_wgetnstr(int nargs, char **args)
3098 {
3099 char string[256];
3100
3101 ARGC(2);
3102 ARG_WINDOW(0, win);
3103 ARG_INT(1, count);
3104
3105 report_count(2);
3106 report_return(wgetnstr(win, string, count));
3107 report_status(string);
3108 }
3109
3110
3111 void
3112 cmd_wgetstr(int nargs, char **args)
3113 {
3114 char string[256];
3115
3116 ARGC(1);
3117 ARG_WINDOW(0, win);
3118
3119 string[0] = '\0';
3120
3121 report_count(2);
3122 report_return(wgetstr(win, string));
3123 report_status(string);
3124 }
3125
3126
3127 void
3128 cmd_whline(int nargs, char **args)
3129 {
3130 ARGC(3);
3131 ARG_WINDOW(0, win);
3132 ARG_CHTYPE(1, ch);
3133 ARG_INT(2, count);
3134
3135 report_count(1);
3136 report_return(whline(win, ch, count));
3137 }
3138
3139
3140 void
3141 cmd_winch(int nargs, char **args)
3142 {
3143 ARGC(1);
3144 ARG_WINDOW(0, win);
3145
3146 report_count(1);
3147 report_byte(winch(win));
3148 }
3149
3150
3151 void
3152 cmd_winchnstr(int nargs, char **args)
3153 {
3154 chtype string[256];
3155
3156 ARGC(2);
3157 ARG_WINDOW(0, win);
3158 ARG_INT(1, count);
3159
3160 report_count(2);
3161 report_return(winchnstr(win, string, count));
3162 report_nstr(string);
3163 }
3164
3165
3166 void
3167 cmd_winchstr(int nargs, char **args)
3168 {
3169 chtype string[256];
3170
3171 ARGC(1);
3172 ARG_WINDOW(0, win);
3173
3174 report_count(2);
3175 report_return(winchstr(win, string));
3176 report_nstr(string);
3177 }
3178
3179
3180 void
3181 cmd_winnstr(int nargs, char **args)
3182 {
3183 char string[256];
3184
3185 ARGC(2);
3186 ARG_WINDOW(0, win);
3187 ARG_INT(1, count);
3188
3189 report_count(2);
3190 report_int(winnstr(win, string, count));
3191 report_status(string);
3192 }
3193
3194
3195 void
3196 cmd_winsch(int nargs, char **args)
3197 {
3198 ARGC(2);
3199 ARG_WINDOW(0, win);
3200 ARG_CHTYPE(1, ch);
3201
3202 report_count(1);
3203 report_return(winsch(win, ch));
3204 }
3205
3206
3207 void
3208 cmd_winsdelln(int nargs, char **args)
3209 {
3210 ARGC(2);
3211 ARG_WINDOW(0, win);
3212 ARG_INT(1, count);
3213
3214 report_count(1);
3215 report_return(winsdelln(win, count));
3216 }
3217
3218
3219 void
3220 cmd_winsertln(int nargs, char **args)
3221 {
3222 ARGC(1);
3223 ARG_WINDOW(0, win);
3224
3225 report_count(1);
3226 report_return(winsertln(win));
3227 }
3228
3229
3230 void
3231 cmd_winstr(int nargs, char **args)
3232 {
3233 char string[256];
3234
3235 ARGC(1);
3236 ARG_WINDOW(0, win);
3237
3238 report_count(2);
3239 report_return(winstr(win, string));
3240 report_status(string);
3241 }
3242
3243
3244 void
3245 cmd_wmove(int nargs, char **args)
3246 {
3247 ARGC(3);
3248 ARG_WINDOW(0, win);
3249 ARG_INT(1, y);
3250 ARG_INT(2, x);
3251
3252 report_count(1);
3253 report_return(wmove(win, y, x));
3254 }
3255
3256
3257 void
3258 cmd_wnoutrefresh(int nargs, char **args)
3259 {
3260 ARGC(1);
3261 ARG_WINDOW(0, win);
3262
3263 report_count(1);
3264 report_return(wnoutrefresh(win));
3265 }
3266
3267
3268 void
3269 cmd_wprintw(int nargs, char **args)
3270 {
3271 ARGC(3);
3272 ARG_WINDOW(0, win);
3273 ARG_STRING(1, fmt);
3274 ARG_STRING(2, arg);
3275
3276 report_count(1);
3277 report_return(wprintw(win, fmt, arg));
3278 }
3279
3280
3281 void
3282 cmd_wredrawln(int nargs, char **args)
3283 {
3284 ARGC(3);
3285 ARG_WINDOW(0, win);
3286 ARG_INT(1, beg_line);
3287 ARG_INT(2, num_lines);
3288
3289 report_count(1);
3290 report_return(wredrawln(win, beg_line, num_lines));
3291 }
3292
3293
3294 void
3295 cmd_wrefresh(int nargs, char **args)
3296 {
3297 ARGC(1);
3298 ARG_WINDOW(0, win);
3299
3300 /* XXX - generates output */
3301 report_count(1);
3302 report_return(wrefresh(win));
3303 }
3304
3305
3306 void
3307 cmd_wresize(int nargs, char **args)
3308 {
3309 ARGC(3);
3310 ARG_WINDOW(0, win);
3311 ARG_INT(1, lines);
3312 ARG_INT(2, cols);
3313
3314 report_count(1);
3315 report_return(wresize(win, lines, cols));
3316 }
3317
3318
3319 void
3320 cmd_wscanw(int nargs, char **args)
3321 {
3322 char string[256];
3323
3324 ARGC(2);
3325 ARG_WINDOW(0, win);
3326 ARG_STRING(1, fmt);
3327
3328 report_count(1);
3329 report_return(wscanw(win, fmt, &string));
3330 }
3331
3332
3333 void
3334 cmd_wscrl(int nargs, char **args)
3335 {
3336 ARGC(2);
3337 ARG_WINDOW(0, win);
3338 ARG_INT(1, n);
3339
3340 report_count(1);
3341 report_return(wscrl(win, n));
3342 }
3343
3344
3345 void
3346 cmd_wsetscrreg(int nargs, char **args)
3347 {
3348 ARGC(3);
3349 ARG_WINDOW(0, win);
3350 ARG_INT(1, top);
3351 ARG_INT(2, bottom);
3352
3353 report_count(1);
3354 report_return(wsetscrreg(win, top, bottom));
3355 }
3356
3357
3358 void
3359 cmd_wstandend(int nargs, char **args)
3360 {
3361 ARGC(1);
3362 ARG_WINDOW(0, win);
3363
3364 report_count(1);
3365 report_int(wstandend(win));
3366 }
3367
3368
3369 void
3370 cmd_wstandout(int nargs, char **args)
3371 {
3372 ARGC(1);
3373 ARG_WINDOW(0, win);
3374
3375 report_count(1);
3376 report_int(wstandout(win));
3377 }
3378
3379
3380 void
3381 cmd_wtimeout(int nargs, char **args)
3382 {
3383 ARGC(2);
3384 ARG_WINDOW(0, win);
3385 ARG_INT(1, tval);
3386
3387 wtimeout(win, tval); /* void return */
3388 report_count(1);
3389 report_return(OK);
3390 }
3391
3392
3393 void
3394 cmd_wtouchln(int nargs, char **args)
3395 {
3396 ARGC(4);
3397 ARG_WINDOW(0, win);
3398 ARG_INT(1, line);
3399 ARG_INT(2, n);
3400 ARG_INT(3, changed);
3401
3402 report_count(1);
3403 report_return(wtouchln(win, line, n, changed));
3404 }
3405
3406
3407 void
3408 cmd_wunderend(int nargs, char **args)
3409 {
3410 ARGC(1);
3411 ARG_WINDOW(0, win);
3412
3413 report_count(1);
3414 report_int(wunderend(win));
3415 }
3416
3417
3418 void
3419 cmd_wunderscore(int nargs, char **args)
3420 {
3421 ARGC(1);
3422 ARG_WINDOW(0, win);
3423
3424 report_count(1);
3425 report_int(wunderscore(win));
3426 }
3427
3428
3429 void
3430 cmd_wvline(int nargs, char **args)
3431 {
3432 ARGC(3);
3433 ARG_WINDOW(0, win);
3434 ARG_CHTYPE(1, ch);
3435 ARG_INT(2, n);
3436
3437 report_count(1);
3438 report_return(wvline(win, ch, n));
3439 }
3440
3441
3442 void
3443 cmd_insnstr(int nargs, char **args)
3444 {
3445 ARGC(2);
3446 ARG_STRING(0, str);
3447 ARG_INT(1, n);
3448
3449 report_count(1);
3450 report_return(insnstr(str, n));
3451 }
3452
3453
3454 void
3455 cmd_insstr(int nargs, char **args)
3456 {
3457 ARGC(1);
3458 ARG_STRING(0, str);
3459
3460 report_count(1);
3461 report_return(insstr(str));
3462 }
3463
3464
3465 void
3466 cmd_mvinsnstr(int nargs, char **args)
3467 {
3468 ARGC(4);
3469 ARG_INT(0, y);
3470 ARG_INT(1, x);
3471 ARG_STRING(2, str);
3472 ARG_INT(3, n);
3473
3474 report_count(1);
3475 report_return(mvinsnstr(y, x, str, n));
3476 }
3477
3478
3479 void
3480 cmd_mvinsstr(int nargs, char **args)
3481 {
3482 ARGC(3);
3483 ARG_INT(0, y);
3484 ARG_INT(1, x);
3485 ARG_STRING(2, str);
3486
3487 report_count(1);
3488 report_return(mvinsstr(y, x, str));
3489 }
3490
3491
3492 void
3493 cmd_mvwinsnstr(int nargs, char **args)
3494 {
3495 ARGC(5);
3496 ARG_WINDOW(0, win);
3497 ARG_INT(1, y);
3498 ARG_INT(2, x);
3499 ARG_STRING(3, str);
3500 ARG_INT(4, n);
3501
3502 report_count(1);
3503 report_return(mvwinsnstr(win, y, x, str, n));
3504
3505 }
3506
3507
3508 void
3509 cmd_mvwinsstr(int nargs, char **args)
3510 {
3511 ARGC(4);
3512 ARG_WINDOW(0, win);
3513 ARG_INT(1, y);
3514 ARG_INT(2, x);
3515 ARG_STRING(3, str);
3516
3517 report_count(1);
3518 report_return(mvwinsstr(win, y, x, str));
3519 }
3520
3521
3522 void
3523 cmd_winsnstr(int nargs, char **args)
3524 {
3525 ARGC(3);
3526 ARG_WINDOW(0, win);
3527 ARG_STRING(1, str);
3528 ARG_INT(2, n);
3529
3530 report_count(1);
3531 report_return(winsnstr(win, str, n));
3532 }
3533
3534
3535 void
3536 cmd_winsstr(int nargs, char **args)
3537 {
3538 ARGC(2);
3539 ARG_WINDOW(0, win);
3540 ARG_STRING(1, str);
3541
3542 report_count(1);
3543 report_return(winsstr(win, str));
3544 }
3545
3546
3547 void
3548 cmd_chgat(int nargs, char **args)
3549 {
3550 ARGC(4);
3551 ARG_INT(0, n);
3552 ARG_INT(1, attr);
3553 ARG_INT(2, colour);
3554 ARG_NULL(3);
3555
3556 report_count(1);
3557 report_return(chgat(n, attr, colour, NULL));
3558 }
3559
3560
3561 void
3562 cmd_wchgat(int nargs, char **args)
3563 {
3564 ARGC(5);
3565 ARG_WINDOW(0, win);
3566 ARG_INT(1, n);
3567 ARG_INT(2, attr);
3568 ARG_SHORT(3, colour);
3569 ARG_NULL(4);
3570
3571 report_count(1);
3572 report_return(wchgat(win, n, attr, colour, NULL));
3573 }
3574
3575
3576 void
3577 cmd_mvchgat(int nargs, char **args)
3578 {
3579 ARGC(6);
3580 ARG_INT(0, y);
3581 ARG_INT(1, x);
3582 ARG_INT(2, n);
3583 ARG_INT(3, attr);
3584 ARG_SHORT(4, colour);
3585 ARG_NULL(5);
3586
3587 report_count(1);
3588 report_return(mvchgat(y, x, n, attr, colour, NULL));
3589 }
3590
3591
3592 void
3593 cmd_mvwchgat(int nargs, char **args)
3594 {
3595 ARGC(7);
3596 ARG_WINDOW(0, win);
3597 ARG_INT(1, y);
3598 ARG_INT(2, x);
3599 ARG_INT(3, n);
3600 ARG_INT(4, attr);
3601 ARG_SHORT(5, colour);
3602 ARG_NULL(6);
3603
3604 report_count(1);
3605 report_return(mvwchgat(win, y, x, n, attr, colour, NULL));
3606 }
3607
3608
3609 void
3610 cmd_add_wch(int nargs, char **args)
3611 {
3612 ARGC(1);
3613 ARG_CCHAR_STRING(0, ch);
3614
3615 report_count(1);
3616 report_return(add_wch(ch));
3617 }
3618
3619
3620 void
3621 cmd_wadd_wch(int nargs, char **args)
3622 {
3623 ARGC(2);
3624 ARG_WINDOW(0, win);
3625 ARG_CCHAR_STRING(1, ch);
3626
3627 report_count(1);
3628 report_return(wadd_wch(win, ch));
3629 }
3630
3631
3632 void
3633 cmd_mvadd_wch(int nargs, char **args)
3634 {
3635 ARGC(3);
3636 ARG_INT(0, y);
3637 ARG_INT(1, x);
3638 ARG_CCHAR_STRING(2, ch);
3639
3640 report_count(1);
3641 report_return(mvadd_wch(y, x, ch));
3642 }
3643
3644
3645 void
3646 cmd_mvwadd_wch(int nargs, char **args)
3647 {
3648 ARGC(4);
3649 ARG_WINDOW(0, win);
3650 ARG_INT(1, y);
3651 ARG_INT(2, x);
3652 ARG_CCHAR_STRING(3, ch);
3653
3654 report_count(1);
3655 report_return(mvwadd_wch(win, y, x, ch));
3656 }
3657
3658
3659 void
3660 cmd_add_wchnstr(int nargs, char **args)
3661 {
3662 ARGC(1);
3663 ARG_IGNORE(0);
3664
3665 report_count(1);
3666 report_error("UNSUPPORTED");
3667 }
3668
3669
3670 void
3671 cmd_add_wchstr(int nargs, char **args)
3672 {
3673 ARGC(1);
3674 ARG_IGNORE(0);
3675
3676 report_count(1);
3677 report_error("UNSUPPORTED");
3678 }
3679
3680
3681 void
3682 cmd_wadd_wchnstr(int nargs, char **args)
3683 {
3684 ARGC(1);
3685 ARG_IGNORE(0);
3686
3687 report_count(1);
3688 report_error("UNSUPPORTED");
3689 }
3690
3691
3692 void
3693 cmd_wadd_wchstr(int nargs, char **args)
3694 {
3695 ARGC(1);
3696 ARG_IGNORE(0);
3697
3698 report_count(1);
3699 report_error("UNSUPPORTED");
3700 }
3701
3702
3703 void
3704 cmd_mvadd_wchnstr(int nargs, char **args)
3705 {
3706 ARGC(1);
3707 ARG_IGNORE(0);
3708
3709 report_count(1);
3710 report_error("UNSUPPORTED");
3711 }
3712
3713
3714 void
3715 cmd_mvadd_wchstr(int nargs, char **args)
3716 {
3717 ARGC(1);
3718 ARG_IGNORE(0);
3719
3720 report_count(1);
3721 report_error("UNSUPPORTED");
3722 }
3723
3724
3725 void
3726 cmd_mvwadd_wchnstr(int nargs, char **args)
3727 {
3728 ARGC(1);
3729 ARG_IGNORE(0);
3730
3731 report_count(1);
3732 report_error("UNSUPPORTED");
3733 }
3734
3735
3736 void
3737 cmd_mvwadd_wchstr(int nargs, char **args)
3738 {
3739 ARGC(1);
3740 ARG_IGNORE(0);
3741
3742 report_count(1);
3743 report_error("UNSUPPORTED");
3744 }
3745
3746
3747 void
3748 cmd_addnwstr(int nargs, char **args)
3749 {
3750 ARGC(2);
3751 ARG_WCHAR_STRING(0, wstr);
3752 ARG_INT(1, n);
3753
3754 report_count(1);
3755 report_return(addnwstr(wstr, n));
3756 }
3757
3758
3759 void
3760 cmd_addwstr(int nargs, char **args)
3761 {
3762 ARGC(1);
3763 ARG_WCHAR_STRING(0, wstr);
3764
3765 report_count(1);
3766 report_return(addwstr(wstr));
3767 }
3768
3769
3770 void
3771 cmd_mvaddnwstr(int nargs, char **args)
3772 {
3773 ARGC(4);
3774 ARG_INT(0, y);
3775 ARG_INT(1, x);
3776 ARG_WCHAR_STRING(2, wstr);
3777 ARG_INT(3, n);
3778
3779 report_count(1);
3780 report_return(mvaddnwstr(y, x, wstr, n));
3781 }
3782
3783
3784 void
3785 cmd_mvaddwstr(int nargs, char **args)
3786 {
3787 ARGC(3);
3788 ARG_INT(0, y);
3789 ARG_INT(1, x);
3790 ARG_WCHAR_STRING(2, wstr);
3791
3792 report_count(1);
3793 report_return(mvaddwstr(y, x, wstr));
3794 }
3795
3796
3797 void
3798 cmd_mvwaddnwstr(int nargs, char **args)
3799 {
3800 ARGC(5);
3801 ARG_WINDOW(0, win);
3802 ARG_INT(1, y);
3803 ARG_INT(2, x);
3804 ARG_WCHAR_STRING(3, wstr);
3805 ARG_INT(4, n);
3806
3807 report_count(1);
3808 report_return(mvwaddnwstr(win, y, x, wstr, n));
3809 }
3810
3811
3812 void
3813 cmd_mvwaddwstr(int nargs, char **args)
3814 {
3815 ARGC(4);
3816 ARG_WINDOW(0, win);
3817 ARG_INT(1, y);
3818 ARG_INT(2, x);
3819 ARG_WCHAR_STRING(3, wstr);
3820
3821 report_count(1);
3822 report_return(mvwaddwstr(win, y, x, wstr));
3823 }
3824
3825
3826 void
3827 cmd_waddnwstr(int nargs, char **args)
3828 {
3829 ARGC(3);
3830 ARG_WINDOW(0, win);
3831 ARG_WCHAR_STRING(1, wstr);
3832 ARG_INT(2, n);
3833
3834 report_count(1);
3835 report_return(waddnwstr(win, wstr, n));
3836 }
3837
3838
3839 void
3840 cmd_waddwstr(int nargs, char **args)
3841 {
3842 ARGC(2);
3843 ARG_WINDOW(0, win);
3844 ARG_WCHAR_STRING(1, wstr);
3845
3846 report_count(1);
3847 report_return(waddwstr(win, wstr));
3848 }
3849
3850
3851 void
3852 cmd_echo_wchar(int nargs, char **args)
3853 {
3854 ARGC(1);
3855 ARG_CCHAR_STRING(0, ch);
3856
3857 report_count(1);
3858 report_return(echo_wchar(ch));
3859 }
3860
3861
3862 void
3863 cmd_wecho_wchar(int nargs, char **args)
3864 {
3865 ARGC(2);
3866 ARG_WINDOW(0, win);
3867 ARG_CCHAR_STRING(1, ch);
3868
3869 report_count(1);
3870 report_return(wecho_wchar(win, ch));
3871 }
3872
3873
3874 void
3875 cmd_pecho_wchar(int nargs, char **args)
3876 {
3877 ARGC(2);
3878 ARG_WINDOW(0, pad);
3879 ARG_CCHAR_STRING(1, wch);
3880
3881 report_count(1);
3882 report_return(pecho_wchar(pad, wch));
3883 }
3884
3885
3886 /* insert */
3887 void
3888 cmd_ins_wch(int nargs, char **args)
3889 {
3890 ARGC(1);
3891 ARG_CCHAR_STRING(0, wch);
3892
3893 report_count(1);
3894 report_return(ins_wch(wch));
3895 }
3896
3897
3898 void
3899 cmd_wins_wch(int nargs, char **args)
3900 {
3901 ARGC(2);
3902 ARG_WINDOW(0, win);
3903 ARG_CCHAR_STRING(1, wch);
3904
3905 report_count(1);
3906 report_return(wins_wch(win, wch));
3907 }
3908
3909
3910 void
3911 cmd_mvins_wch(int nargs, char **args)
3912 {
3913 ARGC(3);
3914 ARG_INT(0, y);
3915 ARG_INT(1, x);
3916 ARG_CCHAR_STRING(2, wch);
3917
3918 report_count(1);
3919 report_return(mvins_wch(y, x, wch));
3920 }
3921
3922
3923 void
3924 cmd_mvwins_wch(int nargs, char **args)
3925 {
3926 ARGC(4);
3927 ARG_WINDOW(0, win);
3928 ARG_INT(1, y);
3929 ARG_INT(2, x);
3930 ARG_CCHAR_STRING(3, wch);
3931
3932 report_count(1);
3933 report_return(mvwins_wch(win, y, x, wch));
3934 }
3935
3936
3937 void
3938 cmd_ins_nwstr(int nargs, char **args)
3939 {
3940 ARGC(2);
3941 ARG_WCHAR_STRING(0, wstr);
3942 ARG_INT(1, n);
3943
3944 report_count(1);
3945 report_return(ins_nwstr(wstr, n));
3946 }
3947
3948
3949 void
3950 cmd_ins_wstr(int nargs, char **args)
3951 {
3952 ARGC(1);
3953 ARG_WCHAR_STRING(0, wstr);
3954
3955 report_count(1);
3956 report_return(ins_wstr(wstr));
3957 }
3958
3959
3960 void
3961 cmd_mvins_nwstr(int nargs, char **args)
3962 {
3963 ARGC(4);
3964 ARG_INT(0, y);
3965 ARG_INT(1, x);
3966 ARG_WCHAR_STRING(2, wstr);
3967 ARG_INT(3, n);
3968
3969 report_count(1);
3970 report_return(mvins_nwstr(y, x, wstr, n));
3971 }
3972
3973
3974 void
3975 cmd_mvins_wstr(int nargs, char **args)
3976 {
3977 ARGC(3);
3978 ARG_INT(0, y);
3979 ARG_INT(1, x);
3980 ARG_WCHAR_STRING(2, wstr);
3981
3982 report_count(1);
3983 report_return(mvins_wstr(y, x, wstr));
3984 }
3985
3986
3987 void
3988 cmd_mvwins_nwstr(int nargs, char **args)
3989 {
3990 ARGC(5);
3991 ARG_WINDOW(0, win);
3992 ARG_INT(1, y);
3993 ARG_INT(2, x);
3994 ARG_WCHAR_STRING(3, wstr);
3995 ARG_INT(4, n);
3996
3997 report_count(1);
3998 report_return(mvwins_nwstr(win, y, x, wstr, n));
3999 }
4000
4001
4002 void
4003 cmd_mvwins_wstr(int nargs, char **args)
4004 {
4005 ARGC(4);
4006 ARG_WINDOW(0, win);
4007 ARG_INT(1, y);
4008 ARG_INT(2, x);
4009 ARG_WCHAR_STRING(3, wstr);
4010
4011 report_count(1);
4012 report_return(mvwins_wstr(win, y, x, wstr));
4013 }
4014
4015
4016 void
4017 cmd_wins_nwstr(int nargs, char **args)
4018 {
4019 ARGC(3);
4020 ARG_WINDOW(0, win);
4021 ARG_WCHAR_STRING(1, wstr);
4022 ARG_INT(2, n);
4023
4024 report_count(1);
4025 report_return(wins_nwstr(win, wstr, n));
4026 }
4027
4028
4029 void
4030 cmd_wins_wstr(int nargs, char **args)
4031 {
4032 ARGC(2);
4033 ARG_WINDOW(0, win);
4034 ARG_WCHAR_STRING(1, wstr);
4035
4036 report_count(1);
4037 report_return(wins_wstr(win, wstr));
4038 }
4039
4040
4041 /* input */
4042 void
4043 cmd_get_wch(int nargs, char **args)
4044 {
4045 wchar_t ch;
4046 ARGC(0);
4047
4048 report_count(2);
4049 report_return(get_wch(&ch));
4050 report_wchar(ch);
4051 }
4052
4053
4054 void
4055 cmd_unget_wch(int nargs, char **args)
4056 {
4057 ARGC(1);
4058 ARG_WCHAR(0, wch);
4059
4060 report_count(1);
4061 report_return(unget_wch(wch));
4062 }
4063
4064
4065 void
4066 cmd_mvget_wch(int nargs, char **args)
4067 {
4068 wchar_t ch;
4069
4070 ARGC(2);
4071 ARG_INT(0, y);
4072 ARG_INT(1, x);
4073
4074 report_count(2);
4075 report_return(mvget_wch(y, x, &ch));
4076 report_wchar(ch);
4077 }
4078
4079
4080 void
4081 cmd_mvwget_wch(int nargs, char **args)
4082 {
4083 wchar_t ch;
4084
4085 ARGC(1); /* FIXME: 3 */
4086 ARG_WINDOW(0, win);
4087 ARG_INT(1, y);
4088 ARG_INT(2, x);
4089
4090 report_count(2);
4091 report_return(mvwget_wch(win, y, x, &ch));
4092 report_wchar(ch);
4093 }
4094
4095
4096 void
4097 cmd_wget_wch(int nargs, char **args)
4098 {
4099 wchar_t ch;
4100
4101 ARGC(1);
4102 ARG_WINDOW(0, win);
4103
4104 report_count(2);
4105 report_return(wget_wch(win, &ch));
4106 report_wchar(ch);
4107 }
4108
4109
4110 void
4111 cmd_getn_wstr(int nargs, char **args)
4112 {
4113 wchar_t wstr[256];
4114
4115 ARGC(1);
4116 ARG_INT(0, n);
4117
4118 report_count(2);
4119 report_return(getn_wstr(wstr, n));
4120 report_wstr(wstr);
4121 }
4122
4123
4124 void
4125 cmd_get_wstr(int nargs, char **args)
4126 {
4127 wchar_t wstr[256];
4128
4129 ARGC(0);
4130
4131 report_count(2);
4132 report_return(get_wstr(wstr));
4133 report_wstr(wstr);
4134 }
4135
4136 void
4137 cmd_mvgetn_wstr(int nargs, char **args)
4138 {
4139 wchar_t wstr[256];
4140
4141 ARGC(3);
4142 ARG_INT(0, y);
4143 ARG_INT(1, x);
4144 ARG_INT(2, n);
4145
4146 report_count(2);
4147 report_return(mvgetn_wstr(y, x, wstr, n));
4148 report_wstr(wstr);
4149 }
4150
4151 void
4152 cmd_mvget_wstr(int nargs, char **args)
4153 {
4154 wchar_t wstr[256];
4155
4156 ARGC(2);
4157 ARG_INT(0, y);
4158 ARG_INT(1, x);
4159
4160 report_count(2);
4161 report_return(mvget_wstr(y, x, wstr));
4162 report_wstr(wstr);
4163 }
4164
4165
4166 void
4167 cmd_mvwgetn_wstr(int nargs, char **args)
4168 {
4169 wchar_t wstr[256];
4170
4171 ARGC(4);
4172 ARG_WINDOW(0, win);
4173 ARG_INT(1, y);
4174 ARG_INT(2, x);
4175 ARG_INT(3, n);
4176
4177 report_count(2);
4178 report_return(mvwgetn_wstr(win, y, x, wstr, n));
4179 report_wstr(wstr);
4180 }
4181
4182
4183 void
4184 cmd_mvwget_wstr(int nargs, char **args)
4185 {
4186 wchar_t wstr[256];
4187
4188 ARGC(3);
4189 ARG_WINDOW(0, win);
4190 ARG_INT(1, y);
4191 ARG_INT(2, x);
4192
4193 report_count(2);
4194 report_return(mvwget_wstr(win, y, x, wstr));
4195 report_wstr(wstr);
4196 }
4197
4198
4199 void
4200 cmd_wgetn_wstr(int nargs, char **args)
4201 {
4202 wchar_t wstr[256];
4203
4204 ARGC(2);
4205 ARG_WINDOW(0, win);
4206 ARG_INT(1, n);
4207
4208 report_count(2);
4209 report_return(wgetn_wstr(win, wstr, n));
4210 report_wstr(wstr);
4211 }
4212
4213
4214 void
4215 cmd_wget_wstr(int nargs, char **args)
4216 {
4217 wchar_t wstr[256];
4218
4219 ARGC(1);
4220 ARG_WINDOW(0, win);
4221
4222 report_count(2);
4223 report_return(wget_wstr(win, wstr));
4224 report_wstr(wstr);
4225 }
4226
4227
4228 void
4229 cmd_in_wch(int nargs, char **args)
4230 {
4231 cchar_t wcval;
4232 ARGC(0);
4233
4234 report_count(2);
4235 report_return(in_wch(&wcval));
4236 report_cchar(wcval);
4237 }
4238
4239
4240 void
4241 cmd_mvin_wch(int nargs, char **args)
4242 {
4243 cchar_t wcval;
4244
4245 ARGC(2);
4246 ARG_INT(0, y);
4247 ARG_INT(1, x);
4248
4249 report_count(2);
4250 report_return(mvin_wch(y, x, &wcval));
4251 report_cchar(wcval);
4252 }
4253
4254
4255 void
4256 cmd_mvwin_wch(int nargs, char **args)
4257 {
4258 cchar_t wcval;
4259
4260 ARGC(3);
4261 ARG_WINDOW(0, win);
4262 ARG_INT(1, y);
4263 ARG_INT(2, x);
4264
4265 report_count(2);
4266 report_return(mvwin_wch(win, y, x, &wcval));
4267 report_cchar(wcval);
4268 }
4269
4270
4271 void
4272 cmd_win_wch(int nargs, char **args)
4273 {
4274 cchar_t wcval;
4275
4276 ARGC(1);
4277 ARG_WINDOW(0, win);
4278
4279 report_count(2);
4280 report_return(win_wch(win, &wcval));
4281 report_cchar(wcval);
4282 }
4283
4284
4285 void
4286 cmd_in_wchnstr(int nargs, char **args)
4287 {
4288 ARGC(1);
4289 ARG_IGNORE(0);
4290
4291 report_count(1);
4292 report_error("UNSUPPORTED");
4293 }
4294
4295
4296 void
4297 cmd_in_wchstr(int nargs, char **args)
4298 {
4299 ARGC(1);
4300 ARG_IGNORE(0);
4301
4302 report_count(1);
4303 report_error("UNSUPPORTED");
4304 }
4305
4306
4307 void
4308 cmd_mvin_wchnstr(int nargs, char **args)
4309 {
4310 ARGC(1);
4311 ARG_IGNORE(0);
4312
4313 report_count(1);
4314 report_error("UNSUPPORTED");
4315 }
4316
4317
4318 void
4319 cmd_mvin_wchstr(int nargs, char **args)
4320 {
4321 ARGC(1);
4322 ARG_IGNORE(0);
4323
4324 report_count(1);
4325 report_error("UNSUPPORTED");
4326 }
4327
4328
4329 void
4330 cmd_mvwin_wchnstr(int nargs, char **args)
4331 {
4332 ARGC(1);
4333 ARG_IGNORE(0);
4334
4335 report_count(1);
4336 report_error("UNSUPPORTED");
4337 }
4338
4339
4340 void
4341 cmd_mvwin_wchstr(int nargs, char **args)
4342 {
4343 ARGC(1);
4344 ARG_IGNORE(0);
4345
4346 report_count(1);
4347 report_error("UNSUPPORTED");
4348 }
4349
4350
4351 void
4352 cmd_win_wchnstr(int nargs, char **args)
4353 {
4354 ARGC(1);
4355 ARG_IGNORE(0);
4356
4357 report_count(1);
4358 report_error("UNSUPPORTED");
4359 }
4360
4361
4362 void
4363 cmd_win_wchstr(int nargs, char **args)
4364 {
4365 ARGC(1);
4366 ARG_IGNORE(0);
4367
4368 report_count(1);
4369 report_error("UNSUPPORTED");
4370 }
4371
4372
4373 void
4374 cmd_innwstr(int nargs, char **args)
4375 {
4376 wchar_t wstr[256];
4377
4378 ARGC(1);
4379 ARG_INT(0, n);
4380
4381 report_count(2);
4382 report_int(innwstr(wstr, n));
4383 report_wstr(wstr);
4384 }
4385
4386
4387 void
4388 cmd_inwstr(int nargs, char **args)
4389 {
4390 wchar_t wstr[256];
4391 ARGC(0);
4392
4393 report_count(2);
4394 report_return(inwstr(wstr));
4395 report_wstr(wstr);
4396 }
4397
4398
4399 void
4400 cmd_mvinnwstr(int nargs, char **args)
4401 {
4402 wchar_t wstr[256];
4403
4404 ARGC(3);
4405 ARG_INT(0, y);
4406 ARG_INT(1, x);
4407 ARG_INT(2, n);
4408
4409 report_count(2);
4410 report_int(mvinnwstr(y, x, wstr, n));
4411 report_wstr(wstr);
4412 }
4413
4414
4415 void
4416 cmd_mvinwstr(int nargs, char **args)
4417 {
4418 wchar_t wstr[256];
4419
4420 ARGC(2);
4421 ARG_INT(0, y);
4422 ARG_INT(1, x);
4423
4424 report_count(2);
4425 report_return(mvinwstr(y, x, wstr));
4426 report_wstr(wstr);
4427 }
4428
4429
4430 void
4431 cmd_mvwinnwstr(int nargs, char **args)
4432 {
4433 wchar_t wstr[256];
4434
4435 ARGC(4);
4436 ARG_WINDOW(0, win);
4437 ARG_INT(1, y);
4438 ARG_INT(2, x);
4439 ARG_INT(3, n);
4440
4441 report_count(2);
4442 report_int(mvwinnwstr(win, y, x, wstr, n));
4443 report_wstr(wstr);
4444 }
4445
4446
4447 void
4448 cmd_mvwinwstr(int nargs, char **args)
4449 {
4450 wchar_t wstr[256];
4451
4452 ARGC(3);
4453 ARG_WINDOW(0, win);
4454 ARG_INT(1, y);
4455 ARG_INT(2, x);
4456
4457 report_count(2);
4458 report_return(mvwinwstr(win, y, x, wstr));
4459 report_wstr(wstr);
4460 }
4461
4462
4463 void
4464 cmd_winnwstr(int nargs, char **args)
4465 {
4466 wchar_t wstr[256];
4467
4468 ARGC(2);
4469 ARG_WINDOW(0, win);
4470 ARG_INT(1, n);
4471
4472 report_count(2);
4473 report_int(winnwstr(win, wstr, n));
4474 report_wstr(wstr);
4475 }
4476
4477
4478 void
4479 cmd_winwstr(int nargs, char **args)
4480 {
4481 wchar_t wstr[256];
4482
4483 ARGC(1);
4484 ARG_WINDOW(0, win);
4485
4486 report_count(2);
4487 report_return(winwstr(win, wstr));
4488 report_wstr(wstr);
4489 }
4490
4491
4492 /* cchar handling */
4493 void
4494 cmd_setcchar(int nargs, char **args)
4495 {
4496 cchar_t wcval;
4497
4498 ARGC(4);
4499 ARG_WCHAR_STRING(0, wch);
4500 ARG_INT(1, attrs);
4501 ARG_SHORT(2, color_pair);
4502 ARG_NULL(3);
4503
4504 report_count(2);
4505 report_return(setcchar(&wcval, wch, attrs, color_pair, NULL));
4506 report_cchar(wcval);
4507 }
4508
4509
4510 void
4511 cmd_getcchar(int nargs, char **args)
4512 {
4513 wchar_t wch[256];
4514 attr_t attrs;
4515 short color_pair;
4516
4517 /*
4518 * XXX - not handling passing of wch as NULL
4519 */
4520
4521 ARGC(2);
4522 ARG_CCHAR_STRING(0, wcval);
4523 ARG_NULL(1);
4524
4525 report_count(4);
4526 report_return(getcchar(wcval, wch, &attrs, &color_pair, NULL));
4527 report_wstr(wch);
4528 report_int(attrs);
4529 report_int(color_pair);
4530 }
4531
4532
4533 /* misc */
4534 void
4535 cmd_key_name(int nargs, char **args)
4536 {
4537 ARGC(1);
4538 ARG_WCHAR(0, w);
4539
4540 report_count(1);
4541 report_status(key_name(w));
4542 }
4543
4544
4545 void
4546 cmd_border_set(int nargs, char **args)
4547 {
4548 ARGC(8);
4549 ARG_CCHAR_STRING(0, ls);
4550 ARG_CCHAR_STRING(1, rs);
4551 ARG_CCHAR_STRING(2, ts);
4552 ARG_CCHAR_STRING(3, bs);
4553 ARG_CCHAR_STRING(4, tl);
4554 ARG_CCHAR_STRING(5, tr);
4555 ARG_CCHAR_STRING(6, bl);
4556 ARG_CCHAR_STRING(7, br);
4557
4558 report_count(1);
4559 report_return(border_set(ls, rs, ts, bs, tl, tr, bl, br));
4560 }
4561
4562
4563 void
4564 cmd_wborder_set(int nargs, char **args)
4565 {
4566 ARGC(9);
4567 ARG_WINDOW(0, win);
4568 ARG_CCHAR_STRING(1, ls);
4569 ARG_CCHAR_STRING(2, rs);
4570 ARG_CCHAR_STRING(3, ts);
4571 ARG_CCHAR_STRING(4, bs);
4572 ARG_CCHAR_STRING(5, tl);
4573 ARG_CCHAR_STRING(6, tr);
4574 ARG_CCHAR_STRING(7, bl);
4575 ARG_CCHAR_STRING(8, br);
4576
4577 report_count(1);
4578 report_return(wborder_set(win, ls, rs, ts, bs, tl, tr, bl, br));
4579 }
4580
4581
4582 void
4583 cmd_box_set(int nargs, char **args)
4584 {
4585 ARGC(3);
4586 ARG_WINDOW(0, win);
4587 ARG_CCHAR_STRING(1, verch);
4588 ARG_CCHAR_STRING(2, horch);
4589
4590 report_count(1);
4591 report_return(box_set(win, verch, horch));
4592 }
4593
4594
4595 void
4596 cmd_erasewchar(int nargs, char **args)
4597 {
4598 wchar_t ch;
4599
4600 ARGC(0);
4601
4602 report_count(2);
4603 report_return(erasewchar(&ch));
4604 report_wchar(ch);
4605 }
4606
4607
4608 void
4609 cmd_killwchar(int nargs, char **args)
4610 {
4611 wchar_t ch;
4612
4613 ARGC(0);
4614
4615 report_count(2);
4616 report_return(killwchar(&ch));
4617 report_wchar(ch);
4618 }
4619
4620
4621 void
4622 cmd_hline_set(int nargs, char **args)
4623 {
4624 ARGC(2);
4625 ARG_CCHAR_STRING(0, wch);
4626 ARG_INT(1, n);
4627
4628 report_count(1);
4629 report_return(hline_set(wch, n));
4630 }
4631
4632
4633 void
4634 cmd_mvhline_set(int nargs, char **args)
4635 {
4636 ARGC(4);
4637 ARG_INT(0, y);
4638 ARG_INT(1, x);
4639 ARG_CCHAR_STRING(2, wch);
4640 ARG_INT(3, n);
4641
4642 report_count(1);
4643 report_return(mvhline_set(y, x, wch, n));
4644 }
4645
4646
4647 void
4648 cmd_mvvline_set(int nargs, char **args)
4649 {
4650 ARGC(4);
4651 ARG_INT(0, y);
4652 ARG_INT(1, x);
4653 ARG_CCHAR_STRING(2, wch);
4654 ARG_INT(3, n);
4655
4656 report_count(1);
4657 report_return(mvvline_set(y, x, wch, n));
4658 }
4659
4660
4661 void
4662 cmd_mvwhline_set(int nargs, char **args)
4663 {
4664 ARGC(5);
4665 ARG_WINDOW(0, win);
4666 ARG_INT(1, y);
4667 ARG_INT(2, x);
4668 ARG_CCHAR_STRING(3, wch);
4669 ARG_INT(4, n);
4670
4671 report_count(1);
4672 report_return(mvwhline_set(win, y, x, wch, n));
4673 }
4674
4675
4676 void
4677 cmd_mvwvline_set(int nargs, char **args)
4678 {
4679 ARGC(5);
4680 ARG_WINDOW(0, win);
4681 ARG_INT(1, y);
4682 ARG_INT(2, x);
4683 ARG_CCHAR_STRING(3, wch);
4684 ARG_INT(4, n);
4685
4686 report_count(1);
4687 report_return(mvwvline_set(win, y, x, wch, n));
4688 }
4689
4690
4691 void
4692 cmd_vline_set(int nargs, char **args)
4693 {
4694 ARGC(2);
4695 ARG_CCHAR_STRING(0, wch);
4696 ARG_INT(1, n);
4697
4698 report_count(1);
4699 report_return(vline_set(wch, n));
4700 }
4701
4702
4703 void
4704 cmd_whline_set(int nargs, char **args)
4705 {
4706 ARGC(3);
4707 ARG_WINDOW(0, win);
4708 ARG_CCHAR_STRING(1, wch);
4709 ARG_INT(2, n);
4710
4711 report_count(1);
4712 report_return(whline_set(win, wch, n));
4713 }
4714
4715
4716 void
4717 cmd_wvline_set(int nargs, char **args)
4718 {
4719 ARGC(3);
4720 ARG_WINDOW(0, win);
4721 ARG_CCHAR_STRING(1, wch);
4722 ARG_INT(2, n);
4723
4724 report_count(1);
4725 report_return(wvline_set(win, wch, n));
4726 }
4727
4728
4729 void
4730 cmd_bkgrnd(int nargs, char **args)
4731 {
4732 ARGC(1);
4733 ARG_CCHAR_STRING(0, wch);
4734
4735 report_count(1);
4736 report_return(bkgrnd(wch));
4737 }
4738
4739
4740 void
4741 cmd_bkgrndset(int nargs, char **args)
4742 {
4743 ARGC(1);
4744 ARG_CCHAR_STRING(0, wch);
4745
4746 report_count(1);
4747 bkgrndset(wch);
4748 report_return(OK);
4749 }
4750
4751
4752 void
4753 cmd_getbkgrnd(int nargs, char **args)
4754 {
4755 cchar_t wch;
4756 ARGC(0);
4757
4758 report_count(2);
4759 report_return(getbkgrnd(&wch));
4760 report_cchar(wch);
4761 }
4762
4763
4764 void
4765 cmd_wbkgrnd(int nargs, char **args)
4766 {
4767 ARGC(2);
4768 ARG_WINDOW(0, win);
4769 ARG_CCHAR_STRING(1, wch);
4770
4771 report_count(1);
4772 report_return(wbkgrnd(win, wch));
4773 }
4774
4775
4776 void
4777 cmd_wbkgrndset(int nargs, char **args)
4778 {
4779 ARGC(2);
4780 ARG_WINDOW(0, win);
4781 ARG_CCHAR_STRING(1, wch);
4782
4783 report_count(1);
4784 wbkgrndset(win, wch);
4785 report_return(OK);
4786 }
4787
4788
4789 void
4790 cmd_wgetbkgrnd(int nargs, char **args)
4791 {
4792 cchar_t wch;
4793 ARGC(1);
4794 ARG_WINDOW(0, win);
4795
4796 report_count(2);
4797 report_return(wgetbkgrnd(win, &wch));
4798 report_cchar(wch);
4799 }
4800
4801
4802 void
4803 cmd_immedok(int nargs, char **args)
4804 {
4805 ARGC(2);
4806 ARG_WINDOW(0, win);
4807 ARG_INT(1, bf);
4808
4809 report_count(1);
4810 immedok(win, bf);
4811 report_return(OK);
4812 }
4813
4814 void
4815 cmd_syncok(int nargs, char **args)
4816 {
4817 ARGC(2);
4818 ARG_WINDOW(0, win);
4819 ARG_INT(1, bf);
4820
4821 report_count(1);
4822 report_return(syncok(win, bf));
4823 }
4824
4825 void
4826 cmd_wcursyncup(int nargs, char **args)
4827 {
4828 ARGC(1);
4829 ARG_WINDOW(0, win);
4830
4831 report_count(1);
4832 wcursyncup(win);
4833 report_return(OK);
4834 }
4835
4836 void
4837 cmd_wsyncup(int nargs, char **args)
4838 {
4839 ARGC(1);
4840 ARG_WINDOW(0, win);
4841
4842 report_count(1);
4843 wsyncup(win);
4844 report_return(OK);
4845 }
4846
4847 void
4848 cmd_wsyncdown(int nargs, char **args)
4849 {
4850 ARGC(1);
4851 ARG_WINDOW(0, win);
4852
4853 report_count(1);
4854 wsyncdown(win);
4855 report_return(OK);
4856 }
4857
4858
4859 /* Soft label key routines */
4860 void
4861 cmd_slk_attroff(int nargs, char **args)
4862 {
4863 ARGC(1);
4864 ARG_CHTYPE(0, ch);
4865
4866 report_count(1);
4867 report_return(slk_attroff(ch));
4868 }
4869
4870 void
4871 cmd_slk_attr_off(int nargs, char **args)
4872 {
4873 ARGC(1);
4874 ARG_INT(0, attrs);
4875
4876 report_count(1);
4877 report_return(slk_attr_off(attrs, NULL));
4878 }
4879
4880 void
4881 cmd_slk_attron(int nargs, char **args)
4882 {
4883 ARGC(1);
4884 ARG_CHTYPE(0, ch);
4885
4886 report_count(1);
4887 report_return(slk_attron(ch));
4888 }
4889
4890 void
4891 cmd_slk_attr_on(int nargs, char **args)
4892 {
4893 ARGC(1);
4894 ARG_INT(0, attrs);
4895
4896 report_count(1);
4897 report_return(slk_attr_on(attrs, NULL));
4898 }
4899
4900 void
4901 cmd_slk_attrset(int nargs, char **args)
4902 {
4903 ARGC(1);
4904 ARG_CHTYPE(0, ch);
4905
4906 report_count(1);
4907 report_return(slk_attrset(ch));
4908 }
4909
4910 void
4911 cmd_slk_attr_set(int nargs, char **args)
4912 {
4913 ARGC(2);
4914 ARG_INT(0, attrs);
4915 ARG_SHORT(1, color_pair_number);
4916
4917 report_count(1);
4918 report_return(slk_attr_set(attrs, color_pair_number, NULL));
4919 }
4920
4921 void
4922 cmd_slk_clear(int nargs, char **args)
4923 {
4924 ARGC(0);
4925
4926 report_count(1);
4927 report_return(slk_clear());
4928 }
4929
4930 void
4931 cmd_slk_color(int nargs, char **args)
4932 {
4933 ARGC(1);
4934 ARG_SHORT(0, color_pair_number);
4935
4936 report_count(1);
4937 report_return(slk_color(color_pair_number));
4938 }
4939
4940 void
4941 cmd_slk_label(int nargs, char **args)
4942 {
4943 char *label;
4944
4945 ARGC(1);
4946 ARG_INT(0, labnum);
4947
4948 label = slk_label(labnum);
4949 report_count(1);
4950 if (label == NULL)
4951 report_status("NULL");
4952 else
4953 report_status(label);
4954 }
4955
4956 void
4957 cmd_slk_noutrefresh(int nargs, char **args)
4958 {
4959 ARGC(0);
4960
4961 report_count(1);
4962 report_return(slk_noutrefresh());
4963 }
4964
4965 void
4966 cmd_slk_refresh(int nargs, char **args)
4967 {
4968 ARGC(0);
4969
4970 report_count(1);
4971 report_return(slk_refresh());
4972 }
4973
4974 void
4975 cmd_slk_restore(int nargs, char **args)
4976 {
4977 ARGC(0);
4978
4979 report_count(1);
4980 report_return(slk_restore());
4981 }
4982
4983 void
4984 cmd_slk_set(int nargs, char **args)
4985 {
4986 ARGC(3);
4987 ARG_INT(0, labnum);
4988 ARG_STRING(1, label);
4989 ARG_INT(2, justify);
4990
4991 report_count(1);
4992 report_return(slk_set(labnum, label, justify));
4993 }
4994
4995 void
4996 cmd_slk_touch(int nargs, char **args)
4997 {
4998 ARGC(0);
4999
5000 report_count(1);
5001 report_return(slk_touch());
5002 }
5003
5004 void
5005 cmd_slk_wset(int nargs, char **args)
5006 {
5007 ARGC(3);
5008 ARG_INT(0, labnum);
5009 ARG_WCHAR_STRING(1, label);
5010 ARG_INT(2, justify);
5011
5012 report_count(1);
5013 report_return(slk_wset(labnum, label, justify));
5014 }
5015
5016
5017 void
5018 cmd_slk_init(int nargs, char **args)
5019 {
5020 ARGC(1);
5021 ARG_INT(0, fmt);
5022
5023 report_count(1);
5024 report_return(slk_init(fmt));
5025 }
5026
5027 void
5028 cmd_use_env(int nargs, char **args)
5029 {
5030 ARGC(1);
5031 ARG_IGNORE(0);
5032
5033 report_count(1);
5034 report_error("UNSUPPORTED");
5035 }
5036
5037 void
5038 cmd_ripoffline(int nargs, char **args)
5039 {
5040 ARGC(1);
5041 ARG_IGNORE(0);
5042
5043 report_count(1);
5044 report_error("UNSUPPORTED");
5045 }
5046
5047 void
5048 cmd_filter(int nargs, char **args)
5049 {
5050 ARGC(0);
5051
5052 report_count(1);
5053 filter();
5054 report_return(OK);
5055 }
5056