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