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