Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2. ***************************************************************************
  3. * This file comprises part of PDCurses. PDCurses is Public Domain software.
  4. * You may use this code for whatever purposes you desire. This software
  5. * is provided AS IS with NO WARRANTY whatsoever.
  6. * Should this software be used in another application, an acknowledgement
  7. * that PDCurses code is used would be appreciated, but is not mandatory.
  8. *
  9. * Any changes which you make to this software which may improve or enhance
  10. * it, should be forwarded to the current maintainer for the benefit of
  11. * other users.
  12. *
  13. * The only restriction placed on this code is that no distribution of
  14. * modified PDCurses code be made under the PDCurses name, by anyone
  15. * other than the current maintainer.
  16. *
  17. * See the file maintain.er for details of the current maintainer.
  18. ***************************************************************************
  19. */
  20. /*
  21. $Id$
  22. */
  23. /*
  24. *----------------------------------------------------------------------
  25. *                               PDCurses
  26. *----------------------------------------------------------------------
  27. * MH
  28. *       950126  2.2     Added more System V R4 functions
  29. *
  30. *                       Added beta Xwindows port
  31. *
  32. *                       Changed chtype to long
  33. *
  34. *                       Incorporated panels library
  35. *
  36. *                       Support for more and newer versions of compilers
  37. *
  38. * MH
  39. *       930531  2.1     Added support for djgpp
  40. *
  41. *                       Added beta Unix version
  42. *
  43. *                       Added OS/2 DLL support.
  44. *
  45. *                       Changed behaviour of overlay(), overwrite() and typeahead()
  46. *
  47. *       921120  2.0     Changed #if to #ifdef/#if defined to make it
  48. *                       easier to add new platforms/compilers.
  49. *
  50. *                       Added System V colour support.
  51. *
  52. *                       Added OS/2 port.
  53. *-------
  54. * Frotz
  55. *       911221  2.0 pre-beta    Changed back from short to int. (int is the
  56. *                       correct size for the default platform.  Short
  57. *                       might be too short on some platforms.  This
  58. *                       is more portable.  I, also, made this mistake.)
  59. *
  60. *                       Many functions are now macros.  If you want
  61. *                       the real thing, #undef the macro. (X/Open
  62. *                       requirement.)
  63. *
  64. *                       Merged many sources into current release.
  65. *
  66. *                       Added many X/Open routines (not quite all yet).
  67. *
  68. *                       Added internal documentation to all routines.
  69. *
  70. *                       Added a HISTORY file to the environment.
  71. *
  72. *                       Added a CONTRIB file to the environment.
  73. *-------
  74. * bl    900114  1.4     Window origin mod in overlay() and overwrite(), on
  75. *                       public (and very reasonable) request. Swapped
  76. *                       #define'd values of OK and ERR; OK now 1, and
  77. *                       ERR is 0/NULL. Conforms better to UNIX
  78. *                       versions.  borderchars[] removed from WINDOW
  79. *                       struct since the border() functions were
  80. *                       redefined. Use of short wherever possible.
  81. *                       Portability improvements, mispelled name of
  82. *                       [w]setscrreg().
  83. *
  84. *       881005  1.3     All modules lint-checked with MSC '-W3' and
  85. *                       turbo'C' '-w -w-pro' switches. Support for
  86. *                       border(), wborder() functions.
  87. *
  88. *       881002  1.2     Rcsid[] string in all modules, for maintenance.
  89. *
  90. *       880306  1.1     'Raw' output routines, revision info in curses.h.
  91. *
  92. *       870515  1.0     Initial Release.
  93. *
  94. *----------------------------------------------------------------------
  95. */
  96.  
  97. #ifndef  __PDCURSES__
  98. #define __PDCURSES__ 1
  99.  
  100. /*man-start*********************************************************************
  101.  
  102. All defines are "defined" here.  All compiler and environment
  103. specific definitions are defined into generic class defines.
  104. These defines are to be given values so that the code can
  105. rely on #if, rather than a complicated set of #if defined() or
  106. #ifdefs...
  107.  
  108. PDCurses definitions list:  (Only define those needed)
  109.  
  110.         REGISTERWINDOWS True for auto window update registery.
  111.         FAST_VIDEO      True if display is memory mapped, or
  112.                         we can utilize the fast video update routines.
  113.         DOS             True if compiling for DOS.
  114.         OS2             True if compiling for OS/2.
  115.         FLEXOS          True if compiling for Flexos.
  116.         HC              True if using a Metaware compiler.
  117.         TC              True if using a Borland compiler.
  118.         MSC             True if using a Microsoft compiler.
  119.         ANSI            True if the compiler supports ANSI C and
  120.                         (full or mixed) prototypes.
  121.         CPLUSPLUS       True if the compiler supports C++.
  122.  
  123. PDCurses portable platform definitions list:
  124.  
  125.         PDCurses        Enables access to PDCurses-only routines.
  126.         XOPEN           Always true.
  127.         SYSV            True if you are compiling for SYSV portability.
  128.         BSD             True if you are compiling for BSD portability.
  129.         INTERNAL        Enables access to internal PDCurses routines.
  130.         PDCURSES_WCLR   Makes behaviour of wclrtoeol() and wclrtoeof()
  131.                         unique to PDCurses. By default Unix behavior is set.
  132.                         See notes in wclrtoeol() and wclrtoeof().
  133. **man-end**********************************************************************/
  134.  
  135. #define PDCURSES        1       /* PDCurses-only routines       */
  136. #define XOPEN           1       /* X/Open Curses routines       */
  137. #define SYSV            1       /* System V Curses routines     */
  138. #define BSD             1       /* BSD Curses routines          */
  139. #define INTERNAL        1       /* PDCurses Internal routines   */
  140.  
  141.  
  142. #ifdef __MENUET_CURSES__
  143.  
  144. #undef DOS
  145. #undef LINUX
  146. #undef UNIX
  147. #define MENUETOS        1
  148. #define ANSI            1
  149. #define CURSES__32BIT__
  150. #ifdef _cplusplus
  151. #define CPLUSPLUS 1
  152. #endif
  153. #define NO_VSSCANF 1
  154. #endif
  155.  
  156. /*---------------------------------------------------------------------*/
  157. #include <stdio.h>              /* Required by X/Open usage below       */
  158. /*----------------------------------------------------------------------
  159.  *
  160.  *      PDCurses Manifest Constants
  161.  *
  162.  */
  163. #ifndef FALSE                   /* booleans              */
  164. #  define       FALSE   0
  165. #endif
  166. #ifndef TRUE                    /* booleans              */
  167. #  define       TRUE    !FALSE
  168. #endif
  169. #ifndef NULL
  170. #  define NULL  ((void*)0)      /* Null pointer          */
  171. #endif
  172. #ifndef ERR
  173. #  define        ERR    0               /* general error flag    */
  174. #endif
  175. #ifndef OK
  176. #  define        OK     1               /* general OK flag       */
  177. #endif
  178.  
  179.  
  180.  
  181.  
  182. /*----------------------------------------------------------------------
  183.  *
  184.  *      PDCurses Type Declarations
  185.  *
  186.  */
  187. typedef unsigned char bool;     /* PDCurses Boolean type        */
  188. typedef unsigned short chtype;  /* 8-bit attr + 8-bit char      */
  189.  
  190.  
  191.  
  192. /*----------------------------------------------------------------------
  193.  *
  194.  *      PDCurses Structure Definitions:
  195.  *
  196.  */
  197. typedef struct _win             /* definition of a window.         */
  198. {
  199.         int     _cury;          /* current pseudo-cursor           */
  200.         int     _curx;
  201.         int     _maxy;          /* max window coordinates          */
  202.         int     _maxx;
  203.         int     _pmaxy;         /* max physical size               */
  204.         int     _pmaxx;
  205.         int     _begy;          /* origin on screen                */
  206.         int     _begx;
  207.         int     _lastpy;        /* last y coordinate of upper left pad display area */
  208.         int     _lastpx;        /* last x coordinate of upper left pad display area */
  209.         int     _lastsy1;       /* last upper y coordinate of screen window for pad */
  210.         int     _lastsx1;       /* last upper x coordinate of screen window for pad */
  211.         int     _lastsy2;       /* last lower y coordinate of screen window for pad */
  212.         int     _lastsx2;       /* last lower x coordinate of screen window for pad */
  213.         int     _flags;         /* window properties               */
  214.         chtype  _attrs;         /* standard A_STANDOUT attributes and colors  */
  215.         chtype  _bkgd;          /* wrs(4/6/93) background, normally blank */
  216.         int     _tabsize;       /* tab character size              */
  217.         bool    _clear;         /* causes clear at next refresh    */
  218.         bool    _leave;         /* leaves cursor as it happens     */
  219.         bool    _scroll;        /* allows window scrolling         */
  220.         bool    _nodelay;       /* input character wait flag       */
  221.         bool    _immed; /* immediate update flag           */
  222.         bool    _use_keypad;    /* flags keypad key mode active    */
  223.         bool    _use_idl;       /* True if Ins/Del line can be used*/
  224.         bool    _use_idc;       /* True if Ins/Del character can be used*/
  225.         chtype**_y;             /* pointer to line pointer array   */
  226.         int*    _firstch;       /* first changed character in line */
  227.         int*    _lastch;        /* last changed character in line  */
  228.         int     _tmarg; /* top of scrolling region         */
  229.         int     _bmarg; /* bottom of scrolling region      */
  230.         char*   _title;         /* window title                    */
  231.         char    _title_ofs;     /* window title offset from left   */
  232.         chtype  _title_attr;    /* window title attributes         */
  233.         chtype  _blank;         /* window's blank character        */
  234.         int     _parx, _pary;   /* coords relative to parent (0,0) */
  235. struct  _win*   _parent;        /* subwin's pointer to parent win  */
  236. }       WINDOW;
  237.  
  238.  
  239.  
  240. /*----------------------------------------------------------------------
  241. *
  242. *       Private structures that are necessary for correct
  243. *       macro construction.
  244. *
  245. */
  246.  
  247. #ifdef  REGISTERWINDOWS
  248. typedef struct _ref             /* Refresh Window Structure      */
  249. {
  250.         WINDOW* win;
  251. struct  _ref*   next;
  252. struct  _ref*   tail;
  253. }       ACTIVE;
  254.  
  255. typedef struct _wins
  256. {
  257.         WINDOW*         w;      /* pointer to a visible window      */
  258.         struct _wins*   next;   /* Next visible window pointer      */
  259.         struct _wins*   prev;   /* Next visible window pointer      */
  260.         struct _wins*   tail;   /* Last visible window pointer      */
  261.                                 /* Only head window (stdscr) has    */
  262.                                 /* a valid tail pointer.            */
  263. }       WINDS;
  264. #endif
  265.  
  266.  
  267.  
  268.  
  269. typedef struct
  270. {
  271.         bool    alive;          /* TRUE if already opened.          */
  272.         bool    autocr;         /* if lf -> crlf                    */
  273.         bool    cbreak;         /* if terminal unbuffered           */
  274.         bool    echo;           /* if terminal echo                 */
  275.         bool    raw_inp;        /* raw input mode (v. cooked input) */
  276.         bool    raw_out;        /* raw output mode (7 v. 8 bits)    */
  277.         bool    refrbrk;        /* if premature refresh brk allowed */
  278.         bool    orgcbr;         /* original MSDOS ^-BREAK setting   */
  279.         bool    visible_cursor; /* TRUE if cursor is visible        */
  280.         bool    audible;        /* FALSE if the bell is visual      */
  281.         bool    full_redraw;    /* TRUE for bad performance         */
  282.         bool    direct_video;   /* Allow Direct Screen Memory writes*/
  283.         bool    mono;           /* TRUE if current screen is mono.  */
  284.         bool    sizeable;       /* TRUE if adapter is resizeable.   */
  285.         bool    bogus_adapter;  /* TRUE if adapter has insane values*/
  286.         bool    shell;          /* TRUE if reset_prog_mode() needs  */
  287.                                 /*      to be called.               */
  288.         chtype  blank;          /* Background character             */
  289.         chtype  orig_attr;      /* Original screen attributes       */
  290.         int     cursrow;        /* position of physical cursor      */
  291.         int     curscol;        /* position of physical cursor      */
  292.         int     cursor;         /* Current Cursor definition        */
  293.         int     visibility;             /* Visibility of cursor */
  294.         int     video_page;     /* Current PC video page            */
  295.         int     orig_emulation; /* Original cursor emulation value  */
  296.         int     orig_cursor;    /* Original cursor size             */
  297.         int     font;           /* default font size                */
  298.         int     orig_font;      /* Original font size               */
  299.         int     lines;          /* New value for LINES              */
  300.         int     cols;           /* New value for COLS               */
  301.         int     emalloc;        /* 0x0C0C if initscr() is to reset  */
  302.                                 /*     this value to TRUE;          */
  303.                                 /* TRUE only if emalloc()/ecalloc() */
  304.                                 /*     are is to be used;           */
  305.                                 /* FALSE if malloc()/calloc() are   */
  306.                                 /*     to be used.                  */
  307.         int tahead;                     /* Type-ahead value */
  308.         int adapter;                    /* Screen type  */
  309. #ifdef UNIX
  310.         int     adapter;        /* Screen type                      */
  311.         int number_keys;        /* number of function keys */
  312.         char *key_seq[200];     /* key sequence ptr for function keys */
  313.         int key_num[200];       /* key numbers for function keys */
  314. #endif
  315.  
  316. }       SCREEN;
  317.  
  318.  
  319.  
  320.  
  321.  
  322. /* external variables */
  323. extern  int     LINES;          /* terminal height              */
  324. extern  int     COLS;           /* terminal width               */
  325. extern  WINDOW* stdscr;         /* the default screen window    */
  326. extern  SCREEN  _cursvar;       /* curses variables             */
  327.  
  328. #if     defined (INTERNAL) | defined (CURSES_LIBRARY)
  329. extern  WINDOW* curscr;         /* the current screen image     */
  330. extern  int     _default_lines; /* For presetting maximum lines */
  331. #endif
  332.  
  333. #ifdef  REGISTERWINDOWS
  334. extern  ACTIVE* CurWins;        /* Currently Visible Windows    */
  335. #endif
  336.  
  337.  
  338.  
  339.  
  340. /*man-start*********************************************************************
  341.  
  342. PDCurses Text Attributes:
  343.  
  344. To include colour in PDCurses, a number of things had to be sacrificed
  345. from the strict Unix and System V support.
  346. The main problem is fitting all character attributes and colour into
  347. an unsigned char (all 8 bits!). On System V, chtype is a long on
  348. PDCurses it is a short int.
  349.  
  350. The following is the structure of a win->_attrs chtype:
  351.  
  352. -------------------------------------------------
  353. |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
  354. -------------------------------------------------
  355.  colour number |  attrs |   character eg 'a'
  356.  
  357. the high order char is an index into an array of physical colours
  358. (defined in INITPAIR.c). 32 (5 bits) foreground/background colour
  359. combinations combined with 8 (3 bits) attribute modifiers are
  360. available.
  361.  
  362. The available attribute enhancers are bold, reverse and blink.
  363. All other Unix attributes have no effect as attributes. This
  364. limitation may be overcome in future releases by expanding chtype
  365. to a long.
  366.  
  367. **man-end**********************************************************************/
  368.  
  369. /* Video attribute definitions. */
  370. #define A_NORMAL        (chtype)0x0000          /* SysV */
  371. #define A_ALTCHARSET    (chtype)0x0000          /* X/Open       */
  372. #define A_BLINK         (chtype)0x0400          /* X/Open       */
  373. #define A_BLANK         (chtype)0x0000          /* X/Open       */
  374. #define A_BOLD          (chtype)0x0100          /* X/Open       */
  375. #define A_DIM           (chtype)0x0000          /* X/Open       */
  376. #define A_PROTECT       (chtype)0x0000          /* X/Open       */
  377. #define A_REVERSE       (chtype)0x0200          /* X/Open       */
  378. #define A_STANDOUT      ((chtype)(A_REVERSE | A_BOLD))          /* X/Open       */
  379. #define A_UNDERLINE     (chtype)0x0000          /* X/Open       */
  380. #define A_COLOR (chtype)0xF800          /*System V      */
  381. #define A_CHARTEXT      (chtype)(0xFF)                  /* X/Open       */
  382. #define A_ATTRIBUTES    (chtype)(~A_CHARTEXT)                   /* X/Open       */
  383.  
  384. #define CHR_MSK         A_CHARTEXT              /* Obsolete     */
  385. #define ATR_MSK         A_ATTRIBUTES    /* Obsolete     */
  386. #define ATR_NRM         A_NORMAL                        /* Obsolete     */
  387.  
  388. #define ACS_ULCORNER    (chtype)0xda                    /* SysV         */
  389. #define ACS_LLCORNER    (chtype)0xc0                    /* SysV         */
  390. #define ACS_URCORNER    (chtype)0xbf                    /* SysV         */
  391. #define ACS_LRCORNER    (chtype)0xd9                    /* SysV         */
  392. #define ACS_RTEE        (chtype)0xb4                    /* SysV         */
  393. #define ACS_LTEE        (chtype)0xc3                    /* SysV         */
  394. #define ACS_BTEE        (chtype)0xc1                    /* SysV         */
  395. #define ACS_TTEE        (chtype)0xc2                    /* SysV         */
  396. #define ACS_HLINE       (chtype)0xc4                    /* SysV         */
  397. #define ACS_VLINE       (chtype)0xb3                    /* SysV         */
  398. #define ACS_PLUS        (chtype)0xc5                    /* SysV         */
  399. #define ACS_S1  (chtype)0x2d                    /* SysV         */
  400. #define ACS_S9  (chtype)0x5f                    /* SysV         */
  401. #define ACS_DIAMOND     (chtype)0xc5                    /* SysV         */
  402. #define ACS_CKBOARD     (chtype)0xb2                    /* SysV         */
  403. #define ACS_DEGREE      (chtype)0xf8                    /* SysV         */
  404. #define ACS_PLMINUS     (chtype)0xf1                    /* SysV         */
  405. #define ACS_BULLET      (chtype)0xf9                    /* SysV         */
  406. #define ACS_LARROW      (chtype)0x3c                    /* SysV         */
  407. #define ACS_RARROW      (chtype)0x3e                    /* SysV         */
  408. #define ACS_DARROW      (chtype)0x76                    /* SysV         */
  409. #define ACS_UARROW      (chtype)0x5e                    /* SysV         */
  410. #define ACS_BOARD       (chtype)0x23                    /* SysV         */
  411. #define ACS_LANTERN     (chtype)0x23                    /* SysV         */
  412. #define ACS_BLOCK       (chtype)0x23                    /* SysV         */
  413.  
  414. #  define COLOR_BLACK           0
  415. #  define COLOR_BLUE            1
  416. #  define COLOR_GREEN           2
  417. #  define COLOR_CYAN            3
  418. #  define COLOR_RED             4
  419. #  define COLOR_MAGENTA         5
  420. #  define COLOR_YELLOW          6
  421. #  define COLOR_WHITE           7
  422.  
  423. #define COLOR_PAIR(n)  (((n) << 11) & A_ATTRIBUTES)
  424. #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 11)
  425.  
  426. extern int COLORS,COLOR_PAIRS;
  427. /*----------------------------------------------------------------------
  428.  *
  429.  *      Function and Keypad Key Definitions.
  430.  *      Many are just for compatibility.
  431.  *
  432.  */
  433. #define KEY_MIN         0x101   /* Minimum curses key value      */
  434. #define KEY_BREAK       0x101   /* Not on PC KBD                 */
  435. #define KEY_DOWN        0x102   /* Down arrow key                */
  436. #define KEY_UP          0x103   /* Up arrow key                  */
  437. #define KEY_LEFT        0x104   /* Left arrow key                */
  438. #define KEY_RIGHT       0x105   /* Right arrow key               */
  439. #define KEY_HOME        0x106   /* home key                      */
  440. #define KEY_BACKSPACE   0x107   /* not on pc                     */
  441. #define KEY_F0          0x108   /* function keys. space for      */
  442. #define KEY_F(n)    (KEY_F0+(n))/* 64 keys are reserved.         */
  443. #define KEY_DL          0x148   /* not on pc                     */
  444. #define KEY_IL          0x149   /* insert line                   */
  445. #define KEY_DC          0x14a   /* delete character              */
  446. #define KEY_IC          0x14b   /* insert char or enter ins mode */
  447. #define KEY_EIC         0x14c   /* exit insert char mode         */
  448. #define KEY_CLEAR       0x14d   /* clear screen                  */
  449. #define KEY_EOS         0x14e   /* clear to end of screen        */
  450. #define KEY_EOL         0x14f   /* clear to end of line          */
  451. #define KEY_SF          0x150   /* scroll 1 line forward         */
  452. #define KEY_SR          0x151   /* scroll 1 line back (reverse)  */
  453. #define KEY_NPAGE       0x152   /* next page                     */
  454. #define KEY_PPAGE       0x153   /* previous page                 */
  455. #define KEY_STAB        0x154   /* set tab                       */
  456. #define KEY_CTAB        0x155   /* clear tab                     */
  457. #define KEY_CATAB       0x156   /* clear all tabs                */
  458. #define KEY_ENTER       0x157   /* enter or send (unreliable)    */
  459. #define KEY_SRESET      0x158   /* soft/reset (partial/unreliable)*/
  460. #define KEY_RESET       0x159   /* reset/hard reset (unreliable) */
  461. #define KEY_PRINT       0x15a   /* print/copy                    */
  462. #define KEY_LL          0x15b   /* home down/bottom (lower left) */
  463. #define KEY_ABORT       0x15c   /* abort/terminate key (any)     */
  464. #define KEY_SHELP       0x15d   /* short help                    */
  465. #define KEY_LHELP       0x15e   /* long help                     */
  466. #define KEY_BTAB        0x15f   /* Back tab key                  */
  467. #define KEY_BEG         0x160   /* beg(inning) key               */
  468. #define KEY_CANCEL      0x161   /* cancel key                    */
  469. #define KEY_CLOSE       0x162   /* close key                     */
  470. #define KEY_COMMAND     0x163   /* cmd (command) key             */
  471. #define KEY_COPY        0x164   /* copy key                      */
  472. #define KEY_CREATE      0x165   /* create key                    */
  473. #define KEY_END         0x166   /* end key                       */
  474. #define KEY_EXIT        0x167   /* exit key                      */
  475. #define KEY_FIND        0x168   /* find key                      */
  476. #define KEY_HELP        0x169   /* help key                      */
  477. #define KEY_MARK        0x16a   /* mark key                      */
  478. #define KEY_MESSAGE     0x16b   /* message key                   */
  479. #define KEY_MOVE        0x16c   /* move key                      */
  480. #define KEY_NEXT        0x16d   /* next object key               */
  481. #define KEY_OPEN        0x16e   /* open key                      */
  482. #define KEY_OPTIONS     0x16f   /* options key                   */
  483. #define KEY_PREVIOUS    0x170   /* previous object key           */
  484. #define KEY_REDO        0x171   /* redo key                      */
  485. #define KEY_REFERENCE   0x172   /* ref(erence) key               */
  486. #define KEY_REFRESH     0x173   /* refresh key                   */
  487. #define KEY_REPLACE     0x174   /* replace key                   */
  488. #define KEY_RESTART     0x175   /* restart key                   */
  489. #define KEY_RESUME      0x176   /* resume key                    */
  490. #define KEY_SAVE        0x177   /* save key                      */
  491. #define KEY_SBEG        0x178   /* shifted beginning key         */
  492. #define KEY_SCANCEL     0x179   /* shifted cancel key            */
  493. #define KEY_SCOMMAND    0x17a   /* shifted command key           */
  494. #define KEY_SCOPY       0x17b   /* shifted copy key              */
  495. #define KEY_SCREATE     0x17c   /* shifted create key            */
  496. #define KEY_SDC         0x17d   /* shifted delete char key       */
  497. #define KEY_SDL         0x17e   /* shifted delete line key       */
  498. #define KEY_SELECT      0x17f   /* select key                    */
  499. #define KEY_SEND        0x180   /* shifted end key               */
  500. #define KEY_SEOL        0x181   /* shifted clear line key        */
  501. #define KEY_SEXIT       0x182   /* shifted exit key              */
  502. #define KEY_SFIND       0x183   /* shifted find key              */
  503. #define KEY_SHOME       0x184   /* shifted home key              */
  504. #define KEY_SIC         0x185   /* shifted input key             */
  505. #define KEY_SLEFT       0x187   /* shifted left arrow key        */
  506. #define KEY_SMESSAGE    0x188   /* shifted message key           */
  507. #define KEY_SMOVE       0x189   /* shifted move key              */
  508. #define KEY_SNEXT       0x18a   /* shifted next key              */
  509. #define KEY_SOPTIONS    0x18b   /* shifted options key           */
  510. #define KEY_SPREVIOUS   0x18c   /* shifted prev key              */
  511. #define KEY_SPRINT      0x18d   /* shifted print key             */
  512. #define KEY_SREDO       0x18e   /* shifted redo key              */
  513. #define KEY_SREPLACE    0x18f   /* shifted replace key           */
  514. #define KEY_SRIGHT      0x190   /* shifted right arrow           */
  515. #define KEY_SRSUME      0x191   /* shifted resume key            */
  516. #define KEY_SSAVE       0x192   /* shifted save key              */
  517. #define KEY_SSUSPEND    0x193   /* shifted suspend key           */
  518. #define KEY_SUNDO       0x194   /* shifted undo key              */
  519. #define KEY_SUSPEND     0x195   /* suspend key                   */
  520. #define KEY_UNDO        0x196   /* undo key                      */
  521.  
  522. /* PDCurses specific key definitions */
  523.  
  524. #define ALT_0           0x197   /* Alt-0                PC only  */
  525. #define ALT_1           0x198   /* Alt-1                PC only  */
  526. #define ALT_2           0x199   /* Alt-2                PC only  */
  527. #define ALT_3           0x19a   /* Alt-3                PC only  */
  528. #define ALT_4           0x19b   /* Alt-4                PC only  */
  529. #define ALT_5           0x19c   /* Alt-5                PC only  */
  530. #define ALT_6           0x19d   /* Alt-6                PC only  */
  531. #define ALT_7           0x19e   /* Alt-7                PC only  */
  532. #define ALT_8           0x19f   /* Alt-8                PC only  */
  533. #define ALT_9           0x1a0   /* Alt-9                PC only  */
  534. #define ALT_A           0x1a1   /* Alt-A                PC only  */
  535. #define ALT_B           0x1a2   /* Alt-B                PC only  */
  536. #define ALT_C           0x1a3   /* Alt-C                PC only  */
  537. #define ALT_D           0x1a4   /* Alt-D                PC only  */
  538. #define ALT_E           0x1a5   /* Alt-E                PC only  */
  539. #define ALT_F           0x1a6   /* Alt-F                PC only  */
  540. #define ALT_G           0x1a7   /* Alt-G                PC only  */
  541. #define ALT_H           0x1a8   /* Alt-H                PC only  */
  542. #define ALT_I           0x1a9   /* Alt-I                PC only  */
  543. #define ALT_J           0x1aa   /* Alt-J                PC only  */
  544. #define ALT_K           0x1ab   /* Alt-K                PC only  */
  545. #define ALT_L           0x1ac   /* Alt-L                PC only  */
  546. #define ALT_M           0x1ad   /* Alt-M                PC only  */
  547. #define ALT_N           0x1ae   /* Alt-N                PC only  */
  548. #define ALT_O           0x1af   /* Alt-O                PC only  */
  549. #define ALT_P           0x1b0   /* Alt-P                PC only  */
  550. #define ALT_Q           0x1b1   /* Alt-Q                PC only  */
  551. #define ALT_R           0x1b2   /* Alt-R                PC only  */
  552. #define ALT_S           0x1b3   /* Alt-S                PC only  */
  553. #define ALT_T           0x1b4   /* Alt-T                PC only  */
  554. #define ALT_U           0x1b5   /* Alt-U                PC only  */
  555. #define ALT_V           0x1b6   /* Alt-V                PC only  */
  556. #define ALT_W           0x1b7   /* Alt-W                PC only  */
  557. #define ALT_X           0x1b8   /* Alt-X                PC only  */
  558. #define ALT_Y           0x1b9   /* Alt-Y                PC only  */
  559. #define ALT_Z           0x1ba   /* Alt-Z                PC only  */
  560. #define CTL_LEFT        0x1bb   /* Control-Left-Arrow   PC only  */
  561. #define CTL_RIGHT       0x1bc   /* Control-Right-Arrow  PC only  */
  562. #define CTL_PGUP        0x1bd   /* Control-PgUp         PC only  */
  563. #define CTL_PGDN        0x1be   /* Control-PgDn         PC only  */
  564. #define CTL_HOME        0x1bf   /* Control-Home         PC only  */
  565. #define CTL_END         0x1c0   /* Control-End          PC only  */
  566. #define KEY_BACKTAB     0x1c1   /* Back-tab             PC only  */
  567.  
  568. #define KEY_A1          0x1c2   /* upper left on Virtual keypad  */
  569. #define KEY_A2          0x1c3   /* upper middle on Virt. keypad  */
  570. #define KEY_A3          0x1c4   /* upper right on Vir. keypad    */
  571. #define KEY_B1          0x1c5   /* middle left on Virt. keypad   */
  572. #define KEY_B2          0x1c6   /* center on Virt. keypad        */
  573. #define KEY_B3          0x1c7   /* middle right on Vir. keypad   */
  574. #define KEY_C1          0x1c8   /* lower left on Virt. keypad    */
  575. #define KEY_C2          0x1c9   /* lower middle on Virt. keypad  */
  576. #define KEY_C3          0x1ca   /* lower right on Vir. keypad    */
  577. #define PADSLASH        0x1cb   /* slash on keypad               */
  578. #define PADENTER        0x1cc   /* enter on keypad               */
  579. #define CTL_PADENTER    0x1cd   /* ctl-enter on keypad           */
  580. #define ALT_PADENTER    0x1ce   /* alt-enter on keypad           */
  581. #define SHF_PADSTOP     0x1cf   /* shift-stop on keypad          */
  582. #define PADSTAR         0x1d0   /* star on keypad                */
  583. #define PADMINUS        0x1d1   /* minus on keypad               */
  584. #define PADPLUS         0x1d2   /* plus on keypad                */
  585. #define CTL_PADSTOP     0x1d3   /* ctl-stop on keypad            */
  586. #define CTL_PADCENTER   0x1d4   /* ctl-enter on keypad           */
  587. #define CTL_PADPLUS     0x1d5   /* ctl-plus on keypad            */
  588. #define CTL_PADMINUS    0x1d6   /* ctl-minus on keypad           */
  589. #define CTL_PADSLASH    0x1d7   /* ctl-slash on keypad           */
  590. #define CTL_PADSTAR     0x1d8   /* ctl-star on keypad            */
  591. #define ALT_PADPLUS     0x1d9   /* alt-plus on keypad            */
  592. #define ALT_PADMINUS    0x1da   /* alt-minus on keypad           */
  593. #define ALT_PADSLASH    0x1db   /* alt-slash on keypad           */
  594. #define ALT_PADSTAR     0x1dc   /* alt-star on keypad            */
  595. #define CTL_INS         0x1dd   /* ctl-insert                    */
  596. #define ALT_DEL         0x1de   /* alt-delete                    */
  597. #define ALT_INS         0x1df   /* alt-insert                    */
  598. #define CTL_UP          0x1e0   /* ctl-up arrow                  */
  599. #define CTL_DOWN        0x1e1   /* ctl-down arrow                */
  600. #define CTL_TAB         0x1e2   /* ctl-tab                       */
  601. #define ALT_TAB         0x1e3   /* alt-tab                       */
  602. #define ALT_MINUS       0x1e4   /* alt-minus                     */
  603. #define ALT_EQUAL       0x1e5   /* alt-equal                     */
  604. #define ALT_HOME        0x1e6   /* alt-home                      */
  605. #define ALT_PGUP        0x1e7   /* alt-pgup                      */
  606. #define ALT_PGDN        0x1e8   /* alt-pgdn                      */
  607. #define ALT_END         0x1e9   /* alt-end                       */
  608. #define ALT_UP          0x1ea   /* alt-up arrow                  */
  609. #define ALT_DOWN        0x1eb   /* alt-down arrow                */
  610. #define ALT_RIGHT       0x1ec   /* alt-right arrow               */
  611. #define ALT_LEFT        0x1ed   /* alt-left arrow                */
  612. #define ALT_ENTER       0x1ee   /* alt-enter                     */
  613. #define ALT_ESC         0x1ef   /* alt-escape                    */
  614. #define ALT_BQUOTE      0x1f0   /* alt-back quote                */
  615. #define ALT_LBRACKET    0x1f1   /* alt-left bracket              */
  616. #define ALT_RBRACKET    0x1f2   /* alt-right bracket             */
  617. #define ALT_SEMICOLON   0x1f3   /* alt-semi-colon                */
  618. #define ALT_FQUOTE      0x1f4   /* alt-forward quote             */
  619. #define ALT_COMMA       0x1f5   /* alt-comma                     */
  620. #define ALT_STOP        0x1f6   /* alt-stop                      */
  621. #define ALT_FSLASH      0x1f7   /* alt-forward slash             */
  622. #define ALT_BKSP        0x1f8   /* alt-backspace                 */
  623. #define CTL_BKSP        0x1f9   /* ctl-backspace                 */
  624. #define CTL_PAD0        0x1fa   /* ctl-keypad 0                  */
  625. #define CTL_PAD1        0x1fb   /* ctl-keypad 1                  */
  626. #define CTL_PAD2        0x1fc   /* ctl-keypad 2                  */
  627. #define CTL_PAD3        0x1fd   /* ctl-keypad 3                  */
  628. #define CTL_PAD4        0x1fe   /* ctl-keypad 4                  */
  629. #define CTL_PAD5        0x1ff   /* ctl-keypad 5                  */
  630. #define CTL_PAD6        0x200   /* ctl-keypad 6                  */
  631. #define CTL_PAD7        0x201   /* ctl-keypad 7                  */
  632. #define CTL_PAD8        0x202   /* ctl-keypad 8                  */
  633. #define CTL_PAD9        0x203   /* ctl-keypad 9                  */
  634. #define CTL_DEL         0x204   /* clt-delete                    */
  635. #define ALT_BSLASH      0x205   /* alt-back slash                */
  636. #define CTL_ENTER       0x206   /* ctl-enter                     */
  637. #define KEY_MOUSE       0x207 /* "mouse" key  */
  638. #define KEY_MAX         KEY_MOUSE  /* Maximum curses key         */
  639.  
  640.  
  641. /*----------------------------------------------------------------------
  642. *       PDCurses function declarations
  643. */
  644. #ifdef ANSI
  645. #  ifdef   CPLUSPLUS
  646.      extern "C" {
  647. #  endif
  648. int     addchnstr( chtype *, int );
  649. int     baudrate( void );
  650. int     beep( void );
  651. int     border( chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  652. char    breakchar( void );
  653. int     can_change_color ( void );
  654. int     clearok( WINDOW*, bool );
  655. int     color_content( int, short*, short*, short* );
  656. int     copywin( WINDOW*, WINDOW*, int, int, int, int, int, int, int );
  657. int     curs_set( int );
  658. int     cursoff( void );
  659. int     curson( void );
  660. int     def_prog_mode( void );
  661. int     def_shell_mode( void );
  662. int     delay_output(  int  );
  663. int     delwin( WINDOW* );
  664. WINDOW* derwin( WINDOW*, int, int, int, int );
  665. int     doupdate( void );
  666. WINDOW* dupwin( WINDOW* );
  667. int     endwin( void );
  668. char    erasechar( void );
  669. int     fixterm( void );
  670. int     flash( void );
  671. int     flushinp( void );
  672. int     gettmode( void );
  673. bool    has_colors( void );
  674. int     hline( chtype, int );
  675. int     inchnstr( chtype *, int );
  676. int     init_color( short, short, short, short );
  677. int     init_pair( short, short, short );
  678. WINDOW* initscr( void );
  679. int     intrflush(  WINDOW*, bool  );
  680. int     is_linetouched(WINDOW *,int);
  681. int     is_wintouched(WINDOW *);
  682. char*   keyname(  int  );
  683. char    killchar( void );
  684. char*   longname( void );
  685. int     meta( WINDOW*, bool );
  686. int     mvaddrawch( int, int, chtype );
  687. int     mvaddrawstr( int, int, char* );
  688. int     mvcur( int, int, int, int );
  689. int     mvderwin( WINDOW*, int, int );
  690. int     mvinsrawch( int, int, chtype );
  691. int     mvprintw( int, int, char*,... );
  692. int     mvscanw( int, int, char*,... );
  693. int     mvwin( WINDOW*, int, int );
  694. int     mvwinsrawch( WINDOW*, int, int, chtype );
  695. int     mvwprintw( WINDOW*, int, int, char*,... );
  696. int     mvwscanw( WINDOW*, int, int, char*,... );
  697. WINDOW* newpad( int, int );
  698. SCREEN* newterm( char*, FILE*, FILE* );
  699. WINDOW* newwin( int, int, int, int );
  700. int     noraw( void );
  701. int     overlay( WINDOW*, WINDOW* );
  702. int     overwrite( WINDOW*, WINDOW* );
  703. int     pair_content( int, short*, short* );
  704. int     pnoutrefresh( WINDOW*, int, int, int, int, int, int );
  705. int     prefresh( WINDOW*, int, int, int, int, int, int );
  706. int     printw( char*,... );
  707. int     raw( void );
  708. int     refresh( void );
  709. int     reset_prog_mode( void );
  710. int     reset_shell_mode( void );
  711. int     resetterm( void );
  712. int     resetty( void );
  713. int     saveoldterm( void );
  714. int     saveterm( void );
  715. int     savetty( void );
  716. int     scanw( char*,... );
  717. int     scroll( WINDOW* );
  718. SCREEN* set_term( SCREEN* );
  719. int     start_color( void );
  720. WINDOW* subpad( WINDOW*, int, int, int, int );
  721. WINDOW* subwin( WINDOW*, int, int, int, int );
  722. int     tabsize( int );
  723. chtype  termattrs( void );
  724. char*   termname( void );
  725. int     touchline( WINDOW*, int ,int );
  726. int     touchwin( WINDOW* );
  727. int     typeahead( int );
  728. char*   unctrl( chtype );
  729. int     vline( chtype, int );
  730. int     waddchnstr( WINDOW*, chtype*, int );
  731. int     waddnstr( WINDOW*, char*, int );
  732. int     waddrawstr( WINDOW*, char* );
  733. int     waddstr( WINDOW*, char* );
  734. int     wattroff( WINDOW*, chtype );
  735. int     wattron( WINDOW*, chtype );
  736. int     wattrset( WINDOW*, chtype );
  737. int     wbkgd(WINDOW*, chtype);
  738. void    wbkgdset(WINDOW*, chtype);
  739. int     wborder( WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  740. int     wclear( WINDOW* );
  741. int     wclrtobot( WINDOW* );
  742. int     wclrtoeol( WINDOW* );
  743. int     wdelch( WINDOW* );
  744. int     wdeleteln( WINDOW* );
  745. int     werase( WINDOW* );
  746. int     wgetch( WINDOW* );
  747. int     wgetnstr( WINDOW*, char*, int );
  748. int     wgetstr( WINDOW*, char* );
  749. int     whline( WINDOW*, chtype, int );
  750. int     winchnstr( WINDOW*, chtype*, int );
  751. int     winnstr( WINDOW*, char*, int );
  752. int     winsch( WINDOW*, chtype );
  753. int     winsdelln( WINDOW*, int );
  754. int     winsertln( WINDOW* );
  755. int     winsnstr( WINDOW*, char*, int );
  756. int     wmove( WINDOW*, int, int );
  757. int     wnoutrefresh( WINDOW* );
  758. char    wordchar( void );
  759. int     wprintw( WINDOW*, char*,... );
  760. int     wredrawln( WINDOW*, int ,int );
  761. int     wrefresh( WINDOW* );
  762. int     wscanw( WINDOW*, char*,... );
  763. int     wscrl( WINDOW*, int );
  764. int     wsetscrreg( WINDOW*, int, int );
  765. int     wtabsize( WINDOW*, int );
  766. int     wtouchln(WINDOW *, int, int, int);
  767. int     ungetch( int );
  768. int     wvline( WINDOW*, chtype, int );
  769.  
  770. #ifdef     PDCURSES
  771. int     raw_output( bool );
  772. int     resize_screen( int );
  773. WINDOW* resize_window( WINDOW*, int, int );
  774. int     win_print( WINDOW*, int );
  775. #endif
  776.  
  777. /*
  778. *       Keep the compiler happy with our macros below...
  779. */
  780. int     PDC_chadd( WINDOW*, chtype, bool, bool );
  781. int     PDC_chins( WINDOW*, chtype, bool );
  782.  
  783. #  ifdef   CPLUSPLUS
  784.      }
  785. #  endif
  786. #endif
  787.  
  788.  
  789. #ifndef max
  790. #define max(a,b) (((a) > (b)) ? (a) : (b))
  791. #endif
  792. #ifndef min
  793. #define min(a,b) (((a) < (b)) ? (a) : (b))
  794. #endif
  795.  
  796. /*
  797. *       Functions defined as macros
  798. */
  799.  
  800. #define addch( c )              waddch( stdscr, c )
  801. #define addchstr( c )           addchnstr( c, -1 )
  802. #define addstr(str)             waddstr( stdscr, str )
  803. #define addnstr(str, n)         waddnstr( stdscr, str, n )
  804. #define attroff(attr)           wattroff( stdscr, attr )
  805. #define attron(attr)            wattron( stdscr, attr )
  806. #define attrset(attr)           wattrset( stdscr, attr )
  807. #define bkgd(c)                 wbkgd(stdscr,c)
  808. #define bkgdset(c)              wbkgdset(stdscr,c)
  809. #define border(ls,rs,ts,bs,tl,tr,bl,br)  wborder(stdscr,ls,rs,ts,bs,tl,tr,bl,br)
  810. #define box( w, v, h )          wborder( w, v, v, h, h, 0, 0, 0, 0 )
  811. #define clear()                 (clearok( stdscr, TRUE )==ERR?ERR:wclear( stdscr ))
  812. #define clrtobot()              wclrtobot( stdscr )
  813. #define clrtoeol()              wclrtoeol( stdscr )
  814. #define delch()                 wdelch( stdscr )
  815. #define deleteln()              wdeleteln( stdscr )
  816. #define derwin(w,nl,nc,by,bx)   subwin((w),(nl),(nc),(by+(w)->_begy),(bx+(w)->_begx))
  817. #define echochar(c)             (addch((chtype)c)==ERR?ERR:refresh())
  818. #define erase()                 werase( stdscr )
  819. #define getbegx(w)              (w)->_begx
  820. #define getbegy(w)              (w)->_begy
  821. #define getbegyx(w,y,x)         ( y = (w)->_begy, x = (w)->_begx )
  822. #define getch()                 wgetch(stdscr)
  823. #define getmaxx(w)              (w)->_maxx
  824. #define getmaxy(w)              (w)->_maxy
  825. #define getmaxyx(w,y,x)         ( y = (w)->_maxy, x = (w)->_maxx )
  826. #define getparx(w)              (w)->_parx
  827. #define getpary(w)              (w)->_pary
  828. #define getparyx(w,y,x)         ( y = (w)->_pary, x = (w)->_parx )
  829. #define getstr(str)             wgetstr( stdscr, str )
  830. #define getyx(w,y,x)            ( y = (w)->_cury, x = (w)->_curx )
  831. #define has_colors()            ((_cursvar.mono) ? FALSE : TRUE)
  832. #define idcok(w,flag)           OK
  833. #define idlok(w,flag)           OK
  834. #define inch()                  (stdscr->_y[stdscr->_cury][stdscr->_curx])
  835. #define inchstr( c )            inchnstr( c, stdscr->_maxx-stdscr->_curx )
  836. #define innstr(str,n)           winnstr(stdscr,(str),(n))
  837. #define insch( c )              winsch( stdscr, c )
  838. #define insdelln(n)             winsdelln(stdscr,n)
  839. #define insertln()              winsertln( stdscr )
  840. #define insnstr(s,n)            winsnstr(stdscr,s,n)
  841. #define insstr(s)               winsnstr(stdscr,s,(-1))
  842. #define instr(str)              winnstr(stdscr,(str),stdscr->_maxx)
  843. #define isendwin()              ((_cursvar.alive) ? FALSE : TRUE)
  844. #define keypad(w,flag)          (w->_use_keypad  = flag)
  845. #define leaveok(w,flag)         (w->_leave   = flag)
  846. #define move(y,x)               wmove( stdscr, y, x )
  847. #define mvaddch(y,x,c)          (move( y, x )==ERR?ERR:addch( c ))
  848. #define mvaddchstr(y,x,c)       (move( y, x )==ERR?ERR:addchnstr( c, -1 ))
  849. #define mvaddchnstr(y,x,c,n)    (move( y, x )==ERR?ERR:addchnstr( c, n ))
  850. #define mvaddstr(y,x,str)       (move( y, x )==ERR?ERR:addstr( str ))
  851. #define mvdelch(y,x)            (move( y, x )==ERR?ERR:wdelch( stdscr ))
  852. #define mvgetch(y,x)            (move( y, x )==ERR?ERR:wgetch(stdscr))
  853. #define mvgetstr(y,x,str)       (move( y, x )==ERR?ERR:wgetstr( stdscr, str ))
  854. #define mvinch(y,x)             (move( y, x )==ERR?ERR:(stdscr->_y[y][x]))
  855. #define mvinchstr(y,x,c)        (move( y, x )==ERR?ERR:inchnstr( c, stdscr->_maxx-stdscr->_curx ))
  856. #define mvinchnstr(y,x,c,n)     (move( y, x )==ERR?ERR:inchnstr( c, n ))
  857. #define mvinsch(y,x,c)          (move( y, x )==ERR?ERR:winsch( stdscr, c ))
  858. #define mvinsnstr(y,x,s,n)      (move( y, x )==ERR?ERR:winsnstr(stdscr,s,n))
  859. #define mvinsstr(y,x,s)         (move( y, x )==ERR?ERR:winsnstr(stdscr,s,(-1)))
  860. #define mvinstr(y,x,str)        (move( y, x )==ERR?ERR:winnstr(stdscr,(str),stdscr->_maxx))
  861. #define mvinnstr(y,x,str,n)     (move( y, x )==ERR?ERR:winnstr(stdscr,(str),(n)))
  862. #define mvwaddch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:waddch( w, c ))
  863. #define mvwaddchstr(w,y,x,c)    (wmove( w, y, x )==ERR?ERR:waddchnstr( w, c, -1 ))
  864. #define mvwaddchnstr(w,y,x,c,n) (wmove( w, y, x )==ERR?ERR:waddchnstr( w, c, n ))
  865. #define mvwaddrawch(w,y,x,c)    (wmove( w, y, x )==ERR?ERR:waddrawch( w, c ))
  866. #define mvwaddrawstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddrawstr( w, str ))
  867. #define mvwaddstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:waddstr( w, str ))
  868. #define mvwdelch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wdelch( w ))
  869. #define mvwgetch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wgetch( w ))
  870. #define mvwgetstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:wgetstr( w, str ))
  871. #define mvwinch(w,y,x)          (wmove( w, y, x )==ERR?ERR:((w)->_y[y][x]))
  872. #define mvwinchstr(w,y,x,c)     (wmove( w, y, x )==ERR?ERR:winchnstr( w, c, (w)->_maxx-(w)->_curx ))
  873. #define mvwinchnstr(w,y,x,c,n)  (wmove( w, y, x )==ERR?ERR:winchnstr( w, c, n ))
  874. #define mvwinsch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:winsch( w, c ))
  875. #define mvwinstr(w,y,x,str)     (wmove( w, y, x )==ERR?ERR:winnstr(w,str,(w)->_maxx))
  876. #define mvwinnstr(w,y,x,str,n)  (wmove( w, y, x )==ERR?ERR:winnstr(w,str,n))
  877. #define mvwinsnstr(w,y,x,s,n)   (wmove( w, y, x )==ERR?ERR:winsnstr(w,s,n))
  878. #define mvwinsstr(w,y,x,s)      (wmove( w, y, x )==ERR?ERR:winsnstr(w,s,(-1)))
  879. #define napms(ms)               delay_output(ms)
  880. #define nl()                    (_cursvar.autocr = TRUE)
  881. #define nonl()                  (_cursvar.autocr = FALSE)
  882. #define notimeout(w,flag)       (OK)
  883. #define pechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:prefresh(w))
  884. #define redrawwin(w)            wredrawln((w),0,(win)->_maxy)
  885. #define refrbrk(flag)           (_cursvar.refrbrk = flag)
  886. #define refresh()               wrefresh( stdscr )
  887. #define scrl(n)                 wscrl(stdscr,n)
  888. #define scroll(w)               wscrl((w),1)
  889. #define scrollok(w,flag)        ((w)->_scroll  = flag)
  890. #define setscrreg(top, bot)     wsetscrreg( stdscr, top, bot )
  891. #define standend()              wattrset(stdscr, A_NORMAL)
  892. #define standout()              wattrset(stdscr, A_STANDOUT)
  893. #define touchline(w,y,n)        wtouchln((w),(y),(n),TRUE)
  894. #define touchwin(w)             wtouchln((w),0,(w)->_maxy,TRUE)
  895. #define traceoff()              {trace_on = FALSE;}
  896. #define traceon()               {trace_on = TRUE;}
  897. #define untouchwin(w)           wtouchln((w),0,((w)->_maxy),FALSE)
  898. #define waddch(w, c)            PDC_chadd( w, (chtype)c, (bool)!(_cursvar.raw_out), TRUE )
  899. #define waddchstr(w, c)         (waddchnstr( w, c, -1 ) )
  900. #define wclear(w)               ( werase( w )==ERR?ERR:((w)->_clear = TRUE))
  901. #define wechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:wrefresh(w))
  902. #define winch(w)                ((w)->_y[(w)->_cury][(w)->_curx])
  903. #define winchstr(w, c)          (winchnstr( w, c, (w)->_maxx-(w)->_curx ) )
  904. #define winsstr(w,str)          winsnstr((w),(str),(-1))
  905. #define winstr(w,str)           winnstr((w),str,(w)->_maxx)
  906. #define wstandend(w)            wattrset(w, A_NORMAL)
  907. #define wstandout(w)            wattrset(w, A_STANDOUT)
  908.  
  909. #ifndef UNIX
  910. #define cbreak()                (_cursvar.cbreak = TRUE)
  911. #define nocbreak()              (_cursvar.cbreak = FALSE)
  912. #define crmode()                (_cursvar.cbreak = TRUE)
  913. #define nocrmode()              (_cursvar.cbreak = FALSE)
  914. #define echo()                  (_cursvar.echo = TRUE)
  915. #define noecho()                (_cursvar.echo = FALSE)
  916. #define nodelay(w,flag)         (w->_nodelay = flag)
  917. #endif
  918.  
  919. #ifdef     PDCURSES
  920. #define addrawch( c )           waddrawch( stdscr, c )
  921. #define addrawstr(str)          waddrawstr( stdscr, str )
  922. #define insrawch( c )           winsrawch( stdscr, c )
  923. #define waddrawch(w, c)         PDC_chadd( w, (chtype)c, FALSE, TRUE )
  924. #define winsrawch(w, c)         PDC_chins( w, (chtype)c, FALSE )
  925.  
  926. /*
  927.  *      FYI: Need to document these functions...
  928.  */
  929. #define title(s,a)              wtitle( stdscr, s, (chtype)a )
  930. #define titleofs(ofs)           wtitleofs( stdscr, ofs )
  931. #define wtitle(w,s,a)           (w->_title = s, w->_title_attr = (chtype)a)
  932. #define wtitleofs(w,ofs)        (w->_title_ofs = ofs)
  933. #endif
  934.  
  935. /*
  936.  *      Load up curspriv.h.     This should be in the same place as
  937.  *      stdlib.h.  We allow anyone who defines CURSES_LIBRARY to have
  938.  *      access to our internal routines.  This provides quick
  939.  *      PC applications at the expense of portability.
  940.  */
  941. #if defined     (CURSES_LIBRARY) | defined( INTERNAL)
  942. #  include <curspriv.h>
  943. #  include <stdlib.h>
  944. #endif
  945.  
  946. #endif  /* __PDCURSES__ */
  947.