home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume33 / pdcurses / part01 < prev    next >
Encoding:
Text File  |  1992-11-19  |  54.5 KB  |  1,392 lines

  1. Newsgroups: comp.sources.misc
  2. From: M.Hessling@gu.edu.au (Mark Hessling)
  3. Subject:  v33i081:  pdcurses - Public Domain curses library for DOS and OS/2 v2.0, Part01/11
  4. Message-ID: <csm-v33i081=pdcurses.215551@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: d837022ffc855a0ee7792cdf9c2d611f
  6. Date: Thu, 19 Nov 1992 03:59:11 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: M.Hessling@gu.edu.au (Mark Hessling)
  10. Posting-number: Volume 33, Issue 81
  11. Archive-name: pdcurses/part01
  12. Environment: DOS,OS/2,ANSI-C
  13.  
  14.                               PDCurses 2.0
  15.                    (Public Domain Curses for DOS and OS/2)
  16.  
  17. PDCurses is a public domain C library that is compatible with Unix 
  18. System V 3.2 curses written for most of the popular DOS and OS/2 
  19. C compilers.
  20.  
  21. PDCurses v2.0 is an almost total rewrite of PCCurses 1.4 done by John
  22. 'Frotz' Fa'atuai, the previous maintainer.
  23.  
  24. This version has been tested with Microsoft C v6.0, QuickC v2.0 and
  25. Borland C++ 2.0 under DOS and Microsoft C v6.0 and TopSpeed c v3.02
  26. under OS/2 2.0. Also the library has been compiled successfully with
  27. emx 0.8e, C Set/2 and Watcom 9.
  28.  
  29. If you wish to be kept up-to-date with changes to PDCurses, contact
  30. Robert Wolf at rwolf@dretor.dciem.dnd.ca and ask to be placed on the
  31. PDCurses mailing list.
  32. ----------------------------------------------------------------------
  33. #! /bin/sh
  34. # This is a shell archive.  Remove anything before this line, then feed it
  35. # into a shell via "sh file" or similar.  To overwrite existing files,
  36. # type "sh file -c".
  37. # Contents:  README curses.h demos doc flexos nonport portable
  38. #   portable/newterm.c private tools
  39. # Wrapped by kent@sparky on Wed Nov 18 21:44:05 1992
  40. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  41. echo If this archive is complete, you will see the following message:
  42. echo '          "shar: End of archive 1 (of 11)."'
  43. if test -f 'README' -a "${1}" != "-c" ; then 
  44.   echo shar: Will not clobber existing file \"'README'\"
  45. else
  46.   echo shar: Extracting \"'README'\" \(5305 characters\)
  47.   sed "s/^X//" >'README' <<'END_OF_FILE'
  48. X
  49. X                             PDCurses 2.0
  50. X                  (Public Domain Curses for DOS and OS/2)
  51. X
  52. X
  53. XINTRODUCTION:
  54. X
  55. X    Well, here it finally is; PDCurses v2.0.
  56. X    
  57. X    PDCurses v2.0 is an almost total rewrite of PCCurses 1.4 done by John
  58. X    'Frotz' Fa'atuai, the previous maintainer.
  59. X    
  60. X    This version has been tested with Microsoft C v6.0, QuickC v2.0 and
  61. X    Borland C++ 2.0 under DOS and Microsoft C v6.0 and TopSpeed c v3.02
  62. X    under OS/2 2.0. Also the library has been compiled successfully with
  63. X    emx 0.8e, C Set/2 and Watcom 9.
  64. X    Most testing was done with the large memory model where applicable.
  65. X    The large memory model is probably the best model to use.
  66. X    
  67. X    The amount of testing has not been as extensive as I would have
  68. X    liked, but demands on releasing a product have outweighed the
  69. X    product's quality. Nothing new with that !!
  70. X    Hopefully with wider circulation, more bugs will be fixed more quickly.
  71. X    
  72. X    I have included just 1 makefile which is suitable for dmake 3.8 for
  73. X    both DOS and OS/2. The makefile does not rely on customisation of the
  74. X    dmake.ini file.
  75. X    
  76. X    If you discover bugs, and especially if you have fixes, please let me
  77. X    know ASAP.
  78. X    
  79. X    The source to the library is distributed as a zip file made with zip
  80. X    1.9. You will need Info-ZIP unzip 5.0 to unzip.
  81. X    Follow the directions below to compile the library.
  82. X
  83. XDIRECTIONS:
  84. X
  85. X    1.Create a new directory in which to unzip pdcurs20.zip. This will
  86. X      create a curses directory and a number of subdirectories containing
  87. X      source code for the library and utilities and the documentation.
  88. X
  89. X    2.Make changes to the makefile where necessary:
  90. X      Change the MODEL or model macro to the appropriate value (if it
  91. X      applies to your compiler). Use model for Borland compilers.
  92. X
  93. X      Change any paths in the defined macros to be suitable for your
  94. X      compiler.
  95. X
  96. X    3.Invoke DMAKE [-e environment_options] [target]
  97. X    
  98. X      where environment_options are:
  99. X
  100. X        OS (host operating system)
  101. X        COMP (compiler)
  102. X        OPT (optimised version or debug version) - optional. default Y
  103. X        TOS (target operating system) - optional. default OS
  104. X
  105. X        see the makefile for valid combinations
  106. X
  107. X        targets: all, demos, lcursesd.lib, manual...
  108. X        
  109. X        NB. dmake is case sensitive with targets, so those environments
  110. X        that use an upper case model value (eg MSC) MUST specify the
  111. X        library target as for eg. Lcursesd.lib
  112. X
  113. X        The makefile is by default set up for Borland C++. The use of
  114. X        -e environment_options override these defaults. Of you prefer
  115. X        you can just change the defaults in the makefile and invoke it
  116. X        without the -e switch.
  117. X
  118. XOTHER NOTES:
  119. X
  120. X    The documentation for the library is built into each source file,
  121. X    a couple of specific doc files and the header files. A program is
  122. X    supplied (manext) to build the manual. This program gets compiled
  123. X    when you build the documentation.
  124. X    
  125. X    To generate the library response file correctly, I had to write a
  126. X    quick and dirty program (buildlrf) to achive this. Originally the
  127. X    makefiles just had statements like: "echo -+$(OBJ)\$* & >> $(LRF)"
  128. X    which appended a suitable line to the response file. Unfortunately
  129. X    under some combinations of makefiles and command processors (eg.
  130. X    nmake and 4DOS) the & would get treated as stderr and the echo
  131. X    command would fail.
  132. X    
  133. X    The original source for PDCurses that I received from the previous
  134. X    maintainer contained support for the FLEXOS operating system. Not
  135. X    having access to it, I could not test the changes I made so its
  136. X    support has fallen by the wayside. If you really need to have PDCurses
  137. X    running under FLEXOS, contact me and I will see what can be arranged.
  138. X
  139. XCOMPILER-SPECIFIC NOTES:
  140. X
  141. X    Microsoft C
  142. X    -----------
  143. X    It is possible with MSC 6.0 to build the OS/2 libraries and demo
  144. X    programs from within DOS. This is the only case where it is possible
  145. X    to specifiy the value of TOS on the command line to be OS2 and the
  146. X    value of OS be DOS.
  147. X
  148. X    C Set/2
  149. X    -------
  150. X    I have only tested the library using the migration libraries. I doubt
  151. X    that the demo programs will work without them.
  152. X
  153. X    emx
  154. X    ---
  155. X    Testing has been done with 0.8e of emx together with the 16_to_32
  156. X    libraries.
  157. X    The emx\lib directory should include the vio32.lib and kbd32.lib
  158. X    libraries from the 16_to_32 package.
  159. X
  160. XBUGS and UNFINISHED BUSINESS:
  161. X
  162. X    PDC_set_ctrl_break() function does not work under OS/2.
  163. X    wprint() and PDC_Print() do not work under OS/2.
  164. X    The file todo.man in the doc directory also lists those functions of
  165. X    System V 3.2 curses not yet implemented. Any volunteers ?
  166. X
  167. XACKNOWLEGEMENTS:
  168. X
  169. X    John 'Frotz' Fa'atuai, the previous maintainer for providing an
  170. X    excellent base for further development.
  171. X    John Burnell (johnb@kea.am.dsir.govt.nz), for the OS/2 port.
  172. X    John Steele, Jason (finally NOT a John) Schumate....
  173. X    for various fixes and suggestions.
  174. X    Eberhardt Mattes (author of emx) for allowing code based on his
  175. X    C library to be included with PDCurses.
  176. X    Several others for their support, moral and actual.
  177. X
  178. X
  179. XGood luck, Mark
  180. X
  181. X------------------------------------------------------------------------
  182. XMark Hessling                          email: M.Hessling@itc.gu.edu.au
  183. XDBA, ITS                               phone: + 61 7 875 7691
  184. XGriffith University                    fax:   + 61 7 875 7787
  185. XNathan 4111
  186. XQld Australia                          *** PDCurses maintainer ***
  187. X------------------------------------------------------------------------
  188. END_OF_FILE
  189.   if test 5305 -ne `wc -c <'README'`; then
  190.     echo shar: \"'README'\" unpacked with wrong size!
  191.   fi
  192.   # end of 'README'
  193. fi
  194. if test -f 'curses.h' -a "${1}" != "-c" ; then 
  195.   echo shar: Will not clobber existing file \"'curses.h'\"
  196. else
  197.   echo shar: Extracting \"'curses.h'\" \(41892 characters\)
  198.   sed "s/^X//" >'curses.h' <<'END_OF_FILE'
  199. X/* $Header: c:/curses/RCS/curses.h%v 2.0 1992/11/16 22:40:30 MH Rel $
  200. X*----------------------------------------------------------------------
  201. X*                PDCurses
  202. X*----------------------------------------------------------------------
  203. X* MH
  204. X*    921120    2.0    Changed #if to #ifdef/#if defined to make it
  205. X*            easier to add new platforms/compilers.
  206. X*
  207. X*            Added System V colour support.
  208. X*
  209. X*            Added OS/2 port.
  210. X*-------
  211. X* Frotz
  212. X*    911221    2.0 pre-beta    Changed back from short to int. (int is the
  213. X*            correct size for the default platform.  Short
  214. X*            might be too short on some platforms.  This
  215. X*            is more portable.  I, also, made this mistake.)
  216. X*
  217. X*            Many functions are now macros.  If you want
  218. X*            the real thing, #undef the macro. (X/Open
  219. X*            requirement.)
  220. X*
  221. X*            Merged many sources into current release.
  222. X*
  223. X*            Added many X/Open routines (not quite all yet).
  224. X*
  225. X*            Added internal documentation to all routines.
  226. X*
  227. X*            Added a HISTORY file to the environment.
  228. X*
  229. X*            Added a CONTRIB file to the environment.
  230. X*-------
  231. X* bl    900114    1.4    Window origin mod in overlay() and overwrite(), on
  232. X*            public (and very reasonable) request. Swapped
  233. X*            #define'd values of OK and ERR; OK now 1, and
  234. X*            ERR is 0/NULL. Conforms better to UNIX
  235. X*            versions.  borderchars[] removed from WINDOW
  236. X*            struct since the border() functions were
  237. X*            redefined. Use of short wherever possible.
  238. X*            Portability improvements, mispelled name of
  239. X*            [w]setscrreg().
  240. X*
  241. X*    881005    1.3    All modules lint-checked with MSC '-W3' and
  242. X*            turbo'C' '-w -w-pro' switches. Support for
  243. X*            border(), wborder() functions.
  244. X*
  245. X*    881002    1.2    Rcsid[] string in all modules, for maintenance.
  246. X*
  247. X*    880306    1.1    'Raw' output routines, revision info in curses.h.
  248. X*
  249. X*    870515    1.0    Initial Release.
  250. X*
  251. X*----------------------------------------------------------------------
  252. X*/
  253. X
  254. X#ifndef  __PDCURSES__
  255. X#define    __PDCURSES__ 1
  256. X
  257. X/*man-start*********************************************************************
  258. X
  259. XAll defines are "defined" here.  All compiler and environment
  260. Xspecific definitions are defined into generic class defines.
  261. XThese defines are to be given values so that the code can
  262. Xrely on #if, rather than a complicated set of #if defined() or
  263. X#ifdefs...
  264. X
  265. XPDCurses definitions list:  (Only define those needed)
  266. X
  267. X    REGISTERWINDOWS True for auto window update registery.
  268. X    FAST_VIDEO      True if display is memory mapped, or
  269. X                    we can utilize the fast video update routines.
  270. X    DOS             True if compiling for DOS.
  271. X    OS2             True if compiling for OS/2.
  272. X    FLEXOS          True if compiling for Flexos.
  273. X    HC              True if using a Metaware compiler.
  274. X    TC              True if using a Borland compiler.
  275. X    MSC             True if using a Microsoft compiler.
  276. X    ANSI            True if the compiler supports ANSI C and
  277. X                    (full or mixed) prototypes.
  278. X    CPLUSPLUS       True if the compiler supports C++.
  279. X
  280. XPDCurses portable platform definitions list:
  281. X
  282. X    PDCurses        Enables access to PDCurses-only routines.
  283. X    XOPEN           Always true.
  284. X    SYSV            True if you are compiling for SYSV portability.
  285. X    BSD             True if you are compiling for BSD portability.
  286. X    INTERNAL        Enables access to internal PDCurses routines.
  287. X**man-end**********************************************************************/
  288. X
  289. X#define    PDCURSES    1    /* PDCurses-only routines    */
  290. X#define    XOPEN        1    /* X/Open Curses routines    */
  291. X#define    SYSV        1    /* System V Curses routines    */
  292. X#define    BSD        1    /* BSD Curses routines        */
  293. X#define    INTERNAL    1    /* PDCurses Internal routines    */
  294. X
  295. X
  296. X/*----------------------------------------
  297. X*       BORLAND COMPILERS       Turbo C[++], Borland C[++]
  298. X*
  299. X*       Borland definitions:
  300. X*               TC
  301. X*               DOS
  302. X*               FLEXOS
  303. X*               CPLUSPLUS
  304. X*
  305. X*               __TURBOC__ & __MSDOS__ are predefined by compiler.
  306. X*/
  307. X#ifdef __TURBOC__              /* Borland gives defines this as a value*/
  308. X#  define TC    __TURBOC__     /* Define a value for TC                */
  309. X#  define ANSI  1              /* Borland supports ANSI C prototypes   */
  310. X#  ifdef __MSDOS__
  311. X#    define DOS 6              /* Major release of DOS supported       */
  312. X#    include <bios.h>
  313. X#    include <dos.h>
  314. X#  endif
  315. X#  ifdef __FLEXOS__            /* define this on the command line      */
  316. X#    define FLEXOS 2           /* or latest major release value.       */
  317. X#  endif
  318. X#  if __TURBOC__ >= 0x290
  319. X#    ifdef  __BCPLUSPLUS__
  320. X#      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  321. X#    endif
  322. X#    ifdef  __TCPLUSPLUS__
  323. X#      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  324. X#    endif
  325. X#    ifdef  __CPLUSPLUS__
  326. X#      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  327. X#    endif
  328. X#  endif
  329. X#endif
  330. X
  331. X
  332. X/*----------------------------------------
  333. X*       METAWARE COMPILERS      High C
  334. X*
  335. X*       Metaware definitions:
  336. X*               HC
  337. X*               DOS
  338. X*               FLEXOS
  339. X*/
  340. X#ifdef __HIGHC__
  341. X#  define HC    1
  342. X#  pragma off(prototype_override_warnings)
  343. X#  define ANSI  1              /* Metaware supports ANSI C prototypes  */
  344. X#  ifdef __MSDOS__
  345. X#    define DOS 6              /* Major release of DOS supported       */
  346. X#    include <bios.h>
  347. X#    include <dos.h>
  348. X#  endif
  349. X#  ifdef __FLEXOS__            /* define this on the command line      */
  350. X#    define FLEXOS 2           /* or latest major release value.       */
  351. X#  endif
  352. X#endif
  353. X
  354. X/*----------------------------------------
  355. X*       MICROSOFT COMPILERS      MSC
  356. X*
  357. X*       Microsoft definitions:
  358. X*               MSC
  359. X*               DOS || OS2
  360. X*/
  361. X#ifdef _MSC_VER                                 /* defined by compiler */
  362. X#  define MSC   1
  363. X#  define ANSI  1              /* Microsoft supports ANSI C prototypes */
  364. X#  ifdef __OS2__                /* You will have to define in makefile */
  365. X#    define USE_OS2_H 1             /* Use the os2.h for the compiler  */
  366. X#    define OS2 2                   /* Major release of OS/2 supported */
  367. X#    define INCL_VIO
  368. X#    define INCL_KBD
  369. X#    include <os2.h>
  370. X#    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  371. X#    define FARKeyword far
  372. X#    define APIRET USHORT
  373. X#    undef MSDOS                        /* have to undef this for OS/2 */
  374. X#  endif
  375. X#  ifdef MSDOS          /* defined by compiler (for both DOS and OS/2) */
  376. X#    define DOS 6                    /* Major release of DOS supported */
  377. X#    include <bios.h>
  378. X#    include <dos.h>
  379. X#    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  380. X#  endif
  381. X#endif
  382. X
  383. X/*----------------------------------------
  384. X*       TOPSPEED compilers     TSC
  385. X*
  386. X*       TOPSPEED definitions:
  387. X*               TSC
  388. X*               DOS || OS2
  389. X*/
  390. X#ifdef __TSC__                   /* You may have to define in makefile */
  391. X#  define TSC   1
  392. X#  define ANSI  1              /* TopSpeed supports ANSI C prototypes  */
  393. X#  ifdef __OS2__
  394. X#    define OS2 2                   /* Major release of OS/2 supported */
  395. X#    include <cursos2.h>
  396. X#  endif
  397. X#endif
  398. X
  399. X/*----------------------------------------
  400. X*       IBM C Set/2 Compiler   CSET2
  401. X*
  402. X*       IBM definitions:
  403. X*               CSET2
  404. X*               OS2
  405. X*/
  406. X#ifdef __IBMC__
  407. X#  define CSET2 1
  408. X#  define ANSI  1               /* C Set/2 supports ANSI C prototypes  */
  409. X#  ifdef __OS2__
  410. X#    define OS2 2                   /* Major release of OS/2 supported */
  411. X#    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  412. X#    define INCL_VIO
  413. X#    define INCL_KBD
  414. X#    include <os2.h>
  415. X#  endif
  416. X#endif
  417. X
  418. X/*----------------------------------------
  419. X*       GNU compilers     emx
  420. X*
  421. X*       emx definitions:
  422. X*               EMX
  423. X*               OS2
  424. X*/
  425. X#ifdef __EMX__                   /* You may have to define in makefile */
  426. X#  define EMX   1
  427. X#  define ANSI  1                   /* GNU supports ANSI C prototypes  */
  428. X#  ifdef __OS2__
  429. X#    define OS2 2                   /* Major release of OS/2 supported */
  430. X#    define CURSES__32BIT__
  431. X#    include <cursos2.h>
  432. X#  endif
  433. X#endif
  434. X
  435. X/*----------------------------------------
  436. X*       Watcom C/386 9.0X compiler
  437. X*
  438. X*       WATCOM definitions:
  439. X*               WATCOMC
  440. X*               OS2
  441. X*/
  442. X#ifdef __WATCOMC__
  443. X#  define WATCOMC  1
  444. X#  define ANSI  1          /* Watcom C/386 supports ANSI C prototypes  */
  445. X#  ifdef __OS2__
  446. X#    define OS2 2                   /* Major release of OS/2 supported */
  447. X#    define CURSES__32BIT__
  448. X#    define NO_MEMORY_H      /* this compiler does not have a memory.h */
  449. X#    define INCL_VIO
  450. X#    define INCL_KBD
  451. X#    include <os2.h>
  452. X#  endif
  453. X#endif
  454. X
  455. X/*---------------------------------------------------------------------*/
  456. X
  457. X#include <stdio.h>        /* Required by X/Open usage below    */
  458. X
  459. X
  460. X
  461. X/*----------------------------------------------------------------------
  462. X *
  463. X *    PDCurses Manifest Constants
  464. X *
  465. X */
  466. X#ifndef FALSE            /* booleans         */
  467. X#  define    FALSE    0
  468. X#endif
  469. X#ifndef    TRUE            /* booleans         */
  470. X#  define    TRUE    !FALSE
  471. X#endif
  472. X#ifndef    NULL
  473. X#  define NULL    ((void*)0)    /* Null pointer         */
  474. X#endif
  475. X#define     ERR    0        /* general error flag     */
  476. X#define     OK    1        /* general OK flag     */
  477. X
  478. X
  479. X
  480. X
  481. X/*----------------------------------------------------------------------
  482. X *
  483. X *    PDCurses Type Declarations
  484. X *
  485. X */
  486. Xtypedef unsigned char bool;    /* PDCurses Boolean type    */
  487. Xtypedef unsigned short chtype;    /* 8-bit attr + 8-bit char    */
  488. X
  489. X
  490. X
  491. X
  492. X/*----------------------------------------------------------------------
  493. X *
  494. X *    PDCurses Structure Definitions:
  495. X *
  496. X */
  497. Xtypedef struct _win        /* definition of a window.       */
  498. X{
  499. X    int    _cury;        /* current pseudo-cursor       */
  500. X    int    _curx;
  501. X    int    _maxy;        /* max window coordinates       */
  502. X    int    _maxx;
  503. X    int    _pmaxy;        /* max physical size           */
  504. X    int    _pmaxx;
  505. X    int    _begy;        /* origin on screen           */
  506. X    int    _begx;
  507. X    int    _flags;        /* window properties           */
  508. X    chtype    _attrs;        /* standard A_STANDOUT attributes and colors  */
  509. X    int    _tabsize;    /* tab character size           */
  510. X    bool    _clear;        /* causes clear at next refresh       */
  511. X    bool    _leave;        /* leaves cursor as it happens       */
  512. X    bool    _scroll;    /* allows window scrolling       */
  513. X    bool    _nodelay;    /* input character wait flag       */
  514. X    bool    _use_keypad;    /* flags keypad key mode active       */
  515. X    bool    _use_idl;    /* True if Ins/Del line can be used*/
  516. X    chtype**_y;        /* pointer to line pointer array   */
  517. X    int*    _firstch;    /* first changed character in line */
  518. X    int*    _lastch;    /* last changed character in line  */
  519. X    int    _tmarg;    /* top of scrolling region       */
  520. X    int    _bmarg;    /* bottom of scrolling region       */
  521. X    chtype    _borderchars[8];/* non-std border chars           */
  522. X    char*    _title;        /* window title               */
  523. X    char    _title_ofs;    /* window title offset from left   */
  524. X    chtype    _title_attr;    /* window title attributes       */
  525. X    chtype    _blank;        /* window's blank character       */
  526. Xstruct    _win*    _parent;    /* subwin's pointer to parent win  */
  527. X}    WINDOW;
  528. X
  529. X
  530. X
  531. X/*----------------------------------------------------------------------
  532. X*
  533. X*    Private structures that are necessary for correct
  534. X*    macro construction.
  535. X*
  536. X*/
  537. X
  538. X#ifdef    REGISTERWINDOWS
  539. Xtypedef struct _ref        /* Refresh Window Structure     */
  540. X{
  541. X    WINDOW*    win;
  542. Xstruct    _ref*    next;
  543. Xstruct    _ref*    tail;
  544. X}    ACTIVE;
  545. X
  546. Xtypedef struct _wins
  547. X{
  548. X    WINDOW*        w;    /* pointer to a visible window        */
  549. X    struct _wins*    next;    /* Next visible window pointer        */
  550. X    struct _wins*    prev;    /* Next visible window pointer        */
  551. X    struct _wins*    tail;    /* Last visible window pointer        */
  552. X                /* Only head window (stdscr) has    */
  553. X                /* a valid tail pointer.        */
  554. X}    WINDS;
  555. X#endif
  556. X
  557. X
  558. X
  559. X
  560. Xtypedef struct
  561. X{
  562. X    bool    alive;        /* TRUE if already opened.        */
  563. X    bool    autocr;        /* if lf -> crlf            */
  564. X    bool    cbreak;        /* if terminal unbuffered        */
  565. X    bool    echo;        /* if terminal echo            */
  566. X    bool    raw_inp;    /* raw input mode (v. cooked input) */
  567. X    bool    raw_out;    /* raw output mode (7 v. 8 bits)    */
  568. X    bool    refrbrk;    /* if premature refresh brk allowed */
  569. X    bool    orgcbr;        /* original MSDOS ^-BREAK setting   */
  570. X    bool    visible_cursor; /* TRUE if cursor is visible        */
  571. X    bool    audible;    /* FALSE if the bell is visual        */
  572. X    bool    full_redraw;    /* TRUE for bad performance        */
  573. X    bool    direct_video;    /* Allow Direct Screen Memory writes*/
  574. X    bool    mono;        /* TRUE if current screen is mono.  */
  575. X    bool    sizeable;    /* TRUE if adapter is resizeable.   */
  576. X    bool    bogus_adapter;    /* TRUE if adapter has insane values*/
  577. X    bool    shell;        /* TRUE if reset_prog_mode() needs  */
  578. X                /*    to be called.            */
  579. X    chtype    blank;        /* Background character            */
  580. X    chtype    orig_attr;    /* Original screen attributes        */
  581. X    int    cursrow;    /* position of physical cursor        */
  582. X    int    curscol;    /* position of physical cursor        */
  583. X    int    cursor;        /* Current Cursor definition        */
  584. X    int    video_page;    /* Current PC video page        */
  585. X    int    orig_emulation; /* Original cursor emulation value  */
  586. X    int    orig_cursor;    /* Original cursor size            */
  587. X    int    font;        /* default font size            */
  588. X    int    orig_font;    /* Original font size            */
  589. X    int    lines;        /* New value for LINES            */
  590. X    int    cols;        /* New value for COLS            */
  591. X    int    emalloc;    /* 0x0C0C if initscr() is to reset  */
  592. X                /*     this value to TRUE;        */
  593. X                /* TRUE only if emalloc()/ecalloc() */
  594. X                /*     are is to be used;        */
  595. X                /* FALSE if malloc()/calloc() are   */
  596. X                /*     to be used.            */
  597. X#ifdef OS2
  598. X    VIOMODEINFO scrnmode;    /* default screen mode            */
  599. X    VIOCONFIGINFO adapter;    /* Screen type                */
  600. X#else
  601. X    int    scrnmode;    /* default screen mode            */
  602. X    int    adapter;    /* Screen type                */
  603. X    unsigned video_seg;    /* video base segment            */
  604. X    unsigned video_ofs;    /* video base offset            */
  605. X#endif
  606. X#ifdef    REGISTERWINDOWS
  607. X    WINDS*    visible;    /* List of visible windows        */
  608. X    bool    refreshall;    /* Refresh all registered windows?  */
  609. X#endif
  610. X
  611. X}    SCREEN;
  612. X
  613. X
  614. X
  615. X
  616. X
  617. X/* external variables */
  618. Xextern    int    LINES;        /* terminal height        */
  619. Xextern    int    COLS;        /* terminal width        */
  620. Xextern    WINDOW*    stdscr;        /* the default screen window    */
  621. Xextern    SCREEN    _cursvar;    /* curses variables        */
  622. X
  623. X#if    defined (INTERNAL) | defined (CURSES_LIBRARY)
  624. Xextern    WINDOW*    curscr;        /* the current screen image    */
  625. Xextern    WINDOW*    tmpwin;        /* the temporary screen image    */
  626. Xextern    int    _default_lines;    /* For presetting maximum lines    */
  627. X#endif
  628. X
  629. X#ifdef    REGISTERWINDOWS
  630. Xextern    ACTIVE*    CurWins;    /* Currently Visible Windows    */
  631. X#endif
  632. X
  633. X
  634. X
  635. X
  636. X/*man-start*********************************************************************
  637. X
  638. XPDCurses Text Attributes:
  639. X
  640. XTo include colour in PDCurses, a number of things had to be sacrificed
  641. Xfrom the strict Unix and System V support.
  642. XThe main problem is fitting all character attributes and colour into
  643. Xan unsigned char (all 8 bits!). On System V, chtype is a long on
  644. XPDCurses it is a short int.
  645. X
  646. XThe following is the structure of a win->_attrs chtype:
  647. X
  648. X-------------------------------------------------
  649. X|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
  650. X-------------------------------------------------
  651. X colour number |  attrs |   character eg 'a'
  652. X
  653. Xthe high order char is an index into an array of physical colours
  654. X(defined in INITPAIR.c). 32 (5 bits) foreground/background colour
  655. Xcombinations combined with 8 (3 bits) attribute modifiers are
  656. Xavailable.
  657. X
  658. XThe available attribute enhancers are bold, reverse and blink.
  659. XAll other Unix attributes have no effect as attributes. This
  660. Xlimitation may be overcome in future releases by expanding chtype
  661. Xto a long.
  662. X
  663. X**man-end**********************************************************************/
  664. X
  665. X/* Video attribute definitions. */
  666. X#define A_NORMAL    (chtype)0x0000        /* SysV */
  667. X#define A_ALTCHARSET    (chtype)0x0000        /* X/Open    */
  668. X#define A_BLINK        (chtype)0x0400        /* X/Open    */
  669. X#define A_BLANK        (chtype)0x0000        /* X/Open    */
  670. X#define A_BOLD        (chtype)0x0100        /* X/Open    */
  671. X#define A_DIM        (chtype)0x0000        /* X/Open    */
  672. X#define A_PROTECT    (chtype)0x0000        /* X/Open    */
  673. X#define A_REVERSE    (chtype)0x0200        /* X/Open    */
  674. X#define A_STANDOUT    ((chtype)(A_REVERSE | A_BOLD))        /* X/Open    */
  675. X#define A_UNDERLINE    (chtype)0x0000        /* X/Open    */
  676. X#define A_COLOR    (chtype)0xF800        /*System V    */
  677. X
  678. X#define CHR_MSK        (chtype)(0xFF)        /* Obsolete    */
  679. X#define ATR_MSK        (chtype)(~CHR_MSK)    /* Obsolete    */
  680. X#define ATR_NRM        A_NORMAL            /* Obsolete    */
  681. X#define A_CHARTEXT    CHR_MSK            /* X/Open    */
  682. X#define A_ATTRIBUTES    ATR_MSK            /* X/Open    */
  683. X
  684. X/* ALTCHARSET definitions from jshumate@logds1.wr.aflc.af.mil */
  685. X#define ACS_ULCORNER    (chtype)0xda            /* SysV        */
  686. X#define ACS_LLCORNER    (chtype)0xc0            /* SysV        */
  687. X#define ACS_URCORNER    (chtype)0xbf            /* SysV        */
  688. X#define ACS_LRCORNER    (chtype)0xd9            /* SysV        */
  689. X#define ACS_RTEE    (chtype)0xb4            /* SysV        */
  690. X#define ACS_LTEE    (chtype)0xc3            /* SysV        */
  691. X#define ACS_BTEE    (chtype)0xc1            /* SysV        */
  692. X#define ACS_TTEE    (chtype)0xc2            /* SysV        */
  693. X#define ACS_HLINE    (chtype)0xc4            /* SysV        */
  694. X#define ACS_VLINE    (chtype)0xb3            /* SysV        */
  695. X#define ACS_PLUS    (chtype)0xc5            /* SysV        */
  696. X#define ACS_S1    (chtype)0x2d            /* SysV        */
  697. X#define ACS_S9    (chtype)0x5f            /* SysV        */
  698. X#define ACS_DIAMOND    (chtype)0xc5            /* SysV        */
  699. X#define ACS_CKBOARD    (chtype)0xb2            /* SysV        */
  700. X#define ACS_DEGREE    (chtype)0xf8            /* SysV        */
  701. X#define ACS_PLMINUS    (chtype)0xf1            /* SysV        */
  702. X#define ACS_BULLET    (chtype)0xf9            /* SysV        */
  703. X#define ACS_LARROW    (chtype)0x3c            /* SysV        */
  704. X#define ACS_RARROW    (chtype)0x3e            /* SysV        */
  705. X#define ACS_DARROW    (chtype)0x76            /* SysV        */
  706. X#define ACS_UARROW    (chtype)0x5e            /* SysV        */
  707. X#define ACS_BOARD    (chtype)0x23            /* SysV        */
  708. X#define ACS_LANTERN    (chtype)0x23            /* SysV        */
  709. X#define ACS_BLOCK    (chtype)0x23            /* SysV        */
  710. X
  711. X/* the following definitions can be used if you have set raw_output()
  712. X   or are using the PDCurses *raw*() functions                        */
  713. X#if 0
  714. X#define ACS_DIAMOND    (chtype)0x04            /* SysV        */
  715. X#define ACS_LARROW    (chtype)0x1b            /* SysV        */
  716. X#define ACS_RARROW    (chtype)0x1a            /* SysV        */
  717. X#define ACS_DARROW    (chtype)0x19            /* SysV        */
  718. X#define ACS_UARROW    (chtype)0x18            /* SysV        */
  719. X#define ACS_BOARD    (chtype)0xb0            /* SysV        */
  720. X#define ACS_LANTERN    (chtype)0x0f            /* SysV        */
  721. X#define ACS_BLOCK    (chtype)0xdb            /* SysV        */
  722. X#endif
  723. X
  724. X/* colour attributes */
  725. X#define COLOR_BLACK        0
  726. X#define COLOR_BLUE        1
  727. X#define COLOR_GREEN        2
  728. X#define COLOR_CYAN        3
  729. X#define COLOR_RED        4
  730. X#define COLOR_MAGENTA        5
  731. X#define COLOR_YELLOW        6
  732. X#define COLOR_WHITE        7
  733. X
  734. X#define COLOR_PAIR(n)  (((n) << 11) & A_ATTRIBUTES)
  735. X#define PAIR_NUMBER(n) (((n) & A_COLOR) >> 11)
  736. X
  737. Xextern int COLORS,COLOR_PAIRS;
  738. X/*----------------------------------------------------------------------
  739. X *
  740. X *    Function and Keypad Key Definitions.
  741. X *    Many are just for compatibility.
  742. X *
  743. X */
  744. X#define KEY_MIN         0x101   /* Minimum curses key value      */
  745. X#define KEY_BREAK       0x101   /* Not on PC KBD                 */
  746. X#define KEY_DOWN        0x102   /* Down arrow key                */
  747. X#define KEY_UP          0x103   /* Up arrow key                  */
  748. X#define KEY_LEFT        0x104   /* Left arrow key                */
  749. X#define KEY_RIGHT       0x105   /* Right arrow key               */
  750. X#define KEY_HOME        0x106   /* home key                      */
  751. X#define KEY_BACKSPACE   0x107   /* not on pc                     */
  752. X#define KEY_F0          0x108   /* function keys. space for      */
  753. X#define KEY_F(n)    (KEY_F0+(n))/* 64 keys are reserved.         */
  754. X#define KEY_DL          0x148   /* not on pc                     */
  755. X#define KEY_IL          0x149   /* insert line                   */
  756. X#define KEY_DC          0x14a   /* delete character              */
  757. X#define KEY_IC          0x14b   /* insert char or enter ins mode */
  758. X#define KEY_EIC         0x14c   /* exit insert char mode         */
  759. X#define KEY_CLEAR       0x14d   /* clear screen                  */
  760. X#define KEY_EOS         0x14e   /* clear to end of screen        */
  761. X#define KEY_EOL         0x14f   /* clear to end of line          */
  762. X#define KEY_SF          0x150   /* scroll 1 line forward         */
  763. X#define KEY_SR          0x151   /* scroll 1 line back (reverse)  */
  764. X#define KEY_NPAGE       0x152   /* next page                     */
  765. X#define KEY_PPAGE       0x153   /* previous page                 */
  766. X#define KEY_STAB        0x154   /* set tab                       */
  767. X#define KEY_CTAB        0x155   /* clear tab                     */
  768. X#define KEY_CATAB       0x156   /* clear all tabs                */
  769. X#define KEY_ENTER       0x157   /* enter or send (unreliable)    */
  770. X#define KEY_SRESET      0x158   /* soft/reset (partial/unreliable)*/
  771. X#define KEY_RESET       0x159   /* reset/hard reset (unreliable) */
  772. X#define KEY_PRINT       0x15a   /* print/copy                    */
  773. X#define KEY_LL          0x15b   /* home down/bottom (lower left) */
  774. X#define KEY_ABORT       0x15c   /* abort/terminate key (any)     */
  775. X#define KEY_SHELP       0x15d   /* short help                    */
  776. X#define KEY_LHELP       0x15e   /* long help                     */
  777. X#define KEY_BTAB        0x15f   /* Back tab key                  */
  778. X#define KEY_BEG         0x160   /* beg(inning) key               */
  779. X#define KEY_CANCEL      0x161   /* cancel key                    */
  780. X#define KEY_CLOSE       0x162   /* close key                     */
  781. X#define KEY_COMMAND     0x163   /* cmd (command) key             */
  782. X#define KEY_COPY        0x164   /* copy key                      */
  783. X#define KEY_CREATE      0x165   /* create key                    */
  784. X#define KEY_END         0x166   /* end key                       */
  785. X#define KEY_EXIT        0x167   /* exit key                      */
  786. X#define KEY_FIND        0x168   /* find key                      */
  787. X#define KEY_HELP        0x169   /* help key                      */
  788. X#define KEY_MARK        0x16a   /* mark key                      */
  789. X#define KEY_MESSAGE     0x16b   /* message key                   */
  790. X#define KEY_MOVE        0x16c   /* move key                      */
  791. X#define KEY_NEXT        0x16d   /* next object key               */
  792. X#define KEY_OPEN        0x16e   /* open key                      */
  793. X#define KEY_OPTIONS     0x16f   /* options key                   */
  794. X#define KEY_PREVIOUS    0x170   /* previous object key           */
  795. X#define KEY_REDO        0x171   /* redo key                      */
  796. X#define KEY_REFERENCE   0x172   /* ref(erence) key               */
  797. X#define KEY_REFRESH     0x173   /* refresh key                   */
  798. X#define KEY_REPLACE     0x174   /* replace key                   */
  799. X#define KEY_RESTART     0x175   /* restart key                   */
  800. X#define KEY_RESUME      0x176   /* resume key                    */
  801. X#define KEY_SAVE        0x177   /* save key                      */
  802. X#define KEY_SBEG        0x178   /* shifted beginning key         */
  803. X#define KEY_SCANCEL     0x179   /* shifted cancel key            */
  804. X#define KEY_SCOMMAND    0x17a   /* shifted command key           */
  805. X#define KEY_SCOPY       0x17b   /* shifted copy key              */
  806. X#define KEY_SCREATE     0x17c   /* shifted create key            */
  807. X#define KEY_SDC         0x17d   /* shifted delete char key       */
  808. X#define KEY_SDL         0x17e   /* shifted delete line key       */
  809. X#define KEY_SELECT      0x17f   /* select key                    */
  810. X#define KEY_SEND        0x180   /* shifted end key               */
  811. X#define KEY_SEOL        0x181   /* shifted clear line key        */
  812. X#define KEY_SEXIT       0x182   /* shifted exit key              */
  813. X#define KEY_SFIND       0x183   /* shifted find key              */
  814. X#define KEY_SHOME       0x184   /* shifted home key              */
  815. X#define KEY_SIC         0x185   /* shifted input key             */
  816. X#define KEY_SLEFT       0x187   /* shifted left arrow key        */
  817. X#define KEY_SMESSAGE    0x188   /* shifted message key           */
  818. X#define KEY_SMOVE       0x189   /* shifted move key              */
  819. X#define KEY_SNEXT       0x18a   /* shifted next key              */
  820. X#define KEY_SOPTIONS    0x18b   /* shifted options key           */
  821. X#define KEY_SPREVIOUS   0x18c   /* shifted prev key              */
  822. X#define KEY_SPRINT      0x18d   /* shifted print key             */
  823. X#define KEY_SREDO       0x18e   /* shifted redo key              */
  824. X#define KEY_SREPLACE    0x18f   /* shifted replace key           */
  825. X#define KEY_SRIGHT      0x190   /* shifted right arrow           */
  826. X#define KEY_SRSUME      0x191   /* shifted resume key            */
  827. X#define KEY_SSAVE       0x192   /* shifted save key              */
  828. X#define KEY_SSUSPEND    0x193   /* shifted suspend key           */
  829. X#define KEY_SUNDO       0x194   /* shifted undo key              */
  830. X#define KEY_SUSPEND     0x195   /* suspend key                   */
  831. X#define KEY_UNDO        0x196   /* undo key                      */
  832. X
  833. X/* PDCurses specific key definitions */
  834. X
  835. X#define ALT_0           0x197   /* Alt-0                PC only  */
  836. X#define ALT_1           0x198   /* Alt-1                PC only  */
  837. X#define ALT_2           0x199   /* Alt-2                PC only  */
  838. X#define ALT_3           0x19a   /* Alt-3                PC only  */
  839. X#define ALT_4           0x19b   /* Alt-4                PC only  */
  840. X#define ALT_5           0x19c   /* Alt-5                PC only  */
  841. X#define ALT_6           0x19d   /* Alt-6                PC only  */
  842. X#define ALT_7           0x19e   /* Alt-7                PC only  */
  843. X#define ALT_8           0x19f   /* Alt-8                PC only  */
  844. X#define ALT_9           0x1a0   /* Alt-9                PC only  */
  845. X#define ALT_A           0x1a1   /* Alt-A                PC only  */
  846. X#define ALT_B           0x1a2   /* Alt-B                PC only  */
  847. X#define ALT_C           0x1a3   /* Alt-C                PC only  */
  848. X#define ALT_D           0x1a4   /* Alt-D                PC only  */
  849. X#define ALT_E           0x1a5   /* Alt-E                PC only  */
  850. X#define ALT_F           0x1a6   /* Alt-F                PC only  */
  851. X#define ALT_G           0x1a7   /* Alt-G                PC only  */
  852. X#define ALT_H           0x1a8   /* Alt-H                PC only  */
  853. X#define ALT_I           0x1a9   /* Alt-I                PC only  */
  854. X#define ALT_J           0x1aa   /* Alt-J                PC only  */
  855. X#define ALT_K           0x1ab   /* Alt-K                PC only  */
  856. X#define ALT_L           0x1ac   /* Alt-L                PC only  */
  857. X#define ALT_M           0x1ad   /* Alt-M                PC only  */
  858. X#define ALT_N           0x1ae   /* Alt-N                PC only  */
  859. X#define ALT_O           0x1af   /* Alt-O                PC only  */
  860. X#define ALT_P           0x1b0   /* Alt-P                PC only  */
  861. X#define ALT_Q           0x1b1   /* Alt-Q                PC only  */
  862. X#define ALT_R           0x1b2   /* Alt-R                PC only  */
  863. X#define ALT_S           0x1b3   /* Alt-S                PC only  */
  864. X#define ALT_T           0x1b4   /* Alt-T                PC only  */
  865. X#define ALT_U           0x1b5   /* Alt-U                PC only  */
  866. X#define ALT_V           0x1b6   /* Alt-V                PC only  */
  867. X#define ALT_W           0x1b7   /* Alt-W                PC only  */
  868. X#define ALT_X           0x1b8   /* Alt-X                PC only  */
  869. X#define ALT_Y           0x1b9   /* Alt-Y                PC only  */
  870. X#define ALT_Z           0x1ba   /* Alt-Z                PC only  */
  871. X#define CTL_LEFT        0x1bb   /* Control-Left-Arrow   PC only  */
  872. X#define CTL_RIGHT       0x1bc   /* Control-Right-Arrow  PC only  */
  873. X#define CTL_PGUP        0x1bd   /* Control-PgUp         PC only  */
  874. X#define CTL_PGDN        0x1be   /* Control-PgDn         PC only  */
  875. X#define CTL_HOME        0x1bf   /* Control-Home         PC only  */
  876. X#define CTL_END         0x1c0   /* Control-End          PC only  */
  877. X#define KEY_BACKTAB     0x1c1   /* Back-tab             PC only  */
  878. X
  879. X#ifdef FLEXOS
  880. X#define KEY_A1          KEY_HOME/* upper left on Virtual keypad  */
  881. X#define KEY_A2          KEY_UP  /* upper middle on Virt. keypad  */
  882. X#define KEY_A3          KEY_PPAGE/* upper right on Vir. keypad   */
  883. X#define KEY_B1          KEY_LEFT/* middle left on Virt. keypad   */
  884. X#define KEY_B2          0x00    /* center on Virt. keypad        */
  885. X#define KEY_B3          KEY_RIGHT/* middle right on Vir. keypad  */
  886. X#define KEY_C1          KEY_LL  /* lower left on Virt. keypad    */
  887. X#define KEY_C2          KEY_DOWN /* lower middle on Virt. keypad */
  888. X#define KEY_C3          KEY_NPAGE /* lower right on Vir. keypad  */
  889. X#define KEY_MAX         KEY_BACKTAB /* Maximum curses key        */
  890. X#endif
  891. X
  892. X
  893. X#if defined(DOS)  || defined (OS2)
  894. X#define KEY_A1          0x1c2   /* upper left on Virtual keypad  */
  895. X#define KEY_A2          0x1c3   /* upper middle on Virt. keypad  */
  896. X#define KEY_A3          0x1c4   /* upper right on Vir. keypad    */
  897. X#define KEY_B1          0x1c5   /* middle left on Virt. keypad   */
  898. X#define KEY_B2          0x1c6   /* center on Virt. keypad        */
  899. X#define KEY_B3          0x1c7   /* middle right on Vir. keypad   */
  900. X#define KEY_C1          0x1c8   /* lower left on Virt. keypad    */
  901. X#define KEY_C2          0x1c9   /* lower middle on Virt. keypad  */
  902. X#define KEY_C3          0x1ca   /* lower right on Vir. keypad    */
  903. X#define PADSLASH        0x1cb   /* slash on keypad               */
  904. X#define PADENTER        0x1cc   /* enter on keypad               */
  905. X#define CTL_PADENTER    0x1cd   /* ctl-enter on keypad           */
  906. X#define ALT_PADENTER    0x1ce   /* alt-enter on keypad           */
  907. X#define SHF_PADSTOP     0x1cf   /* shift-stop on keypad          */
  908. X#define PADSTAR         0x1d0   /* star on keypad                */
  909. X#define PADMINUS        0x1d1   /* minus on keypad               */
  910. X#define PADPLUS         0x1d2   /* plus on keypad                */
  911. X#define CTL_PADSTOP     0x1d3   /* ctl-stop on keypad            */
  912. X#define CTL_PADCENTER   0x1d4   /* ctl-enter on keypad           */
  913. X#define CTL_PADPLUS     0x1d5   /* ctl-plus on keypad            */
  914. X#define CTL_PADMINUS    0x1d6   /* ctl-minus on keypad           */
  915. X#define CTL_PADSLASH    0x1d7   /* ctl-slash on keypad           */
  916. X#define CTL_PADSTAR     0x1d8   /* ctl-star on keypad            */
  917. X#define ALT_PADPLUS     0x1d9   /* alt-plus on keypad            */
  918. X#define ALT_PADMINUS    0x1da   /* alt-minus on keypad           */
  919. X#define ALT_PADSLASH    0x1db   /* alt-slash on keypad           */
  920. X#define ALT_PADSTAR     0x1dc   /* alt-star on keypad            */
  921. X#define CTL_INS         0x1dd   /* ctl-insert                    */
  922. X#define ALT_DEL         0x1de   /* alt-delete                    */
  923. X#define ALT_INS         0x1df   /* alt-insert                    */
  924. X#define CTL_UP          0x1e0   /* ctl-up arrow                  */
  925. X#define CTL_DOWN        0x1e1   /* ctl-down arrow                */
  926. X#define CTL_TAB         0x1e2   /* ctl-tab                       */
  927. X#define ALT_TAB         0x1e3   /* alt-tab                       */
  928. X#define ALT_MINUS       0x1e4   /* alt-minus                     */
  929. X#define ALT_EQUAL       0x1e5   /* alt-equal                     */
  930. X#define ALT_HOME        0x1e6   /* alt-home                      */
  931. X#define ALT_PGUP        0x1e7   /* alt-pgup                      */
  932. X#define ALT_PGDN        0x1e8   /* alt-pgdn                      */
  933. X#define ALT_END         0x1e9   /* alt-end                       */
  934. X#define ALT_UP          0x1ea   /* alt-up arrow                  */
  935. X#define ALT_DOWN        0x1eb   /* alt-down arrow                */
  936. X#define ALT_RIGHT       0x1ec   /* alt-right arrow               */
  937. X#define ALT_LEFT        0x1ed   /* alt-left arrow                */
  938. X#define ALT_ENTER       0x1ee   /* alt-enter                     */
  939. X#define ALT_ESC         0x1ef   /* alt-escape                    */
  940. X#define ALT_BQUOTE      0x1f0   /* alt-back quote                */
  941. X#define ALT_LBRACKET    0x1f1   /* alt-left bracket              */
  942. X#define ALT_RBRACKET    0x1f2   /* alt-right bracket             */
  943. X#define ALT_SEMICOLON   0x1f3   /* alt-semi-colon                */
  944. X#define ALT_FQUOTE      0x1f4   /* alt-forward quote             */
  945. X#define ALT_COMMA       0x1f5   /* alt-comma                     */
  946. X#define ALT_STOP        0x1f6   /* alt-stop                      */
  947. X#define ALT_FSLASH      0x1f7   /* alt-forward slash             */
  948. X#define ALT_BKSP        0x1f8   /* alt-backspace                 */
  949. X#define CTL_BKSP        0x1f9   /* ctl-backspace                 */
  950. X#define CTL_PAD0        0x1fa   /* ctl-keypad 0                  */
  951. X#define CTL_PAD1        0x1fb   /* ctl-keypad 1                  */
  952. X#define CTL_PAD2        0x1fc   /* ctl-keypad 2                  */
  953. X#define CTL_PAD3        0x1fd   /* ctl-keypad 3                  */
  954. X#define CTL_PAD4        0x1fe   /* ctl-keypad 4                  */
  955. X#define CTL_PAD5        0x1ff   /* ctl-keypad 5                  */
  956. X#define CTL_PAD6        0x200   /* ctl-keypad 6                  */
  957. X#define CTL_PAD7        0x201   /* ctl-keypad 7                  */
  958. X#define CTL_PAD8        0x202   /* ctl-keypad 8                  */
  959. X#define CTL_PAD9        0x203   /* ctl-keypad 9                  */
  960. X#define CTL_DEL         0x204   /* clt-delete                    */
  961. X#define ALT_BSLASH      0x205   /* alt-back slash                */
  962. X#define CTL_ENTER       0x206   /* ctl-enter                     */
  963. X#define KEY_MAX         CTL_ENTER  /* Maximum curses key         */
  964. X#endif
  965. X
  966. X
  967. X
  968. X/*----------------------------------------------------------------------
  969. X*       PDCurses function declarations
  970. X*/
  971. X#ifdef ANSI
  972. X#  ifdef   CPLUSPLUS
  973. X     extern "C" {
  974. X#  endif
  975. Xbool    typeahead( FILE* );
  976. Xchar    erasechar( void );
  977. Xchar    killchar( void );
  978. Xchar    wordchar( void );
  979. Xchar*   longname( void );
  980. Xchar*   unctrl( chtype );
  981. Xint     baudrate( void );
  982. Xint     beep( void );
  983. Xint     border( chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  984. Xint     can_change_color ( void );
  985. Xint     clearok( WINDOW*, bool );
  986. Xint     color_content( int, short*, short*, short* );
  987. Xint     def_prog_mode( void );
  988. Xint     def_shell_mode( void );
  989. Xint     delwin( WINDOW* );
  990. Xint     delay_output(  int  );
  991. Xint     doupdate( void );
  992. Xint     endwin( void );
  993. Xint     flash( void );
  994. Xint     flushinp( void );
  995. Xint     has_colors( void );
  996. Xint     init_color( int, short, short, short );
  997. Xint     init_pair( int, short, short );
  998. Xint     intrflush(  WINDOW*, bool  );
  999. Xchar *  keyname(  int  );
  1000. Xint     mvaddrawch( int, int, chtype );
  1001. Xint     mvaddrawstr( int, int, char* );
  1002. Xint     mvcur( int, int, int, int );
  1003. Xint     mvinsrawch( int, int, chtype );
  1004. Xint     mvprintw( int, int, char*,... );
  1005. Xint     mvwin( WINDOW*, int, int );
  1006. Xint     mvwinsrawch( WINDOW*, int, int, chtype );
  1007. Xint     mvwprintw( WINDOW*, int, int, char*,... );
  1008. Xint     newline( WINDOW*, int );
  1009. Xint     noraw( void );
  1010. Xint     overlay( WINDOW*, WINDOW* );
  1011. Xint     overwrite( WINDOW*, WINDOW* );
  1012. Xint     pair_content( int, short*, short* );
  1013. Xint     pnoutrefresh( WINDOW*, int, int, int, int, int, int );
  1014. Xint     prefresh( WINDOW*, int, int, int, int, int, int );
  1015. Xint     printw( char*,... );
  1016. Xint     raw( void );
  1017. Xint     refresh( void );
  1018. Xint     resetterm( void );
  1019. Xint     resetty( void );
  1020. Xint     reset_prog_mode( void );
  1021. Xint     reset_shell_mode( void );
  1022. Xint     saveoldterm( void );
  1023. Xint     saveterm( void );
  1024. Xint     savetty( void );
  1025. Xint     scroll( WINDOW* );
  1026. Xint     start_color( void );
  1027. Xint     tabsize( int );
  1028. Xint     touchline( WINDOW*, int ,int );
  1029. Xint     touchwin( WINDOW* );
  1030. Xint     waddrawstr( WINDOW*, char* );
  1031. Xint     waddstr( WINDOW*, char* );
  1032. Xint     wattroff( WINDOW*, int );
  1033. Xint     wattron( WINDOW*, int );
  1034. Xint     wattrset( WINDOW*, int );
  1035. Xint     wborder( WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  1036. Xint     wbox( WINDOW*, int, int, int, int, chtype, chtype );
  1037. Xint     wclrtobot( WINDOW* );
  1038. Xint     wclrtoeol( WINDOW* );
  1039. Xint     wdelch( WINDOW* );
  1040. Xint     wdeleteln( WINDOW* );
  1041. Xint     werase( WINDOW* );
  1042. Xint     wgetch( WINDOW* );
  1043. Xint     wgetstr( WINDOW*, char* );
  1044. Xint     winsch( WINDOW*, chtype );
  1045. Xint     winsertln( WINDOW* );
  1046. Xint     wmove( WINDOW*, int, int );
  1047. Xint     wnoutrefresh( WINDOW* );
  1048. Xint     wprintw( WINDOW*, char*,... );
  1049. Xint     wrefresh( WINDOW* );
  1050. Xint     wsetscrreg( WINDOW*, int, int );
  1051. Xint     wtabsize( WINDOW*, int );
  1052. Xint     wungetch( chtype );
  1053. XSCREEN* newterm( char*, FILE*, FILE* );
  1054. XSCREEN* set_term( SCREEN* );
  1055. XWINDOW* initscr( void );
  1056. XWINDOW* newpad( int, int );
  1057. XWINDOW* newwin( int, int, int, int );
  1058. XWINDOW* subwin( WINDOW*, int, int, int, int );
  1059. Xint     meta( WINDOW*, bool );
  1060. Xint     gettmode( void );
  1061. Xint     fixterm( void );
  1062. Xint     cursoff( void );
  1063. Xint     curson( void );
  1064. Xint     curs_set( int );
  1065. X
  1066. X#ifdef     PDCURSES
  1067. Xint     resize( int );
  1068. Xint     win_print( WINDOW*, int );
  1069. XWINDOW* resize_win( WINDOW*, int, int );
  1070. Xint     raw_output( bool );
  1071. X#endif
  1072. X
  1073. Xint     scanw( char*,... );
  1074. Xint     mvscanw( int, int, char*,... );
  1075. Xint     mvwscanw( WINDOW*, int, int, char*,... );
  1076. Xint     wscanw( WINDOW*, char*,... );
  1077. X
  1078. X/*
  1079. X*       Keep the compiler happy with our macros below...
  1080. X*/
  1081. Xint     PDC_chadd( WINDOW*, chtype, bool, bool );
  1082. Xint     PDC_chins( WINDOW*, chtype, bool );
  1083. X
  1084. X#  ifdef   CPLUSPLUS
  1085. X     }
  1086. X#  endif
  1087. X#endif
  1088. X
  1089. X
  1090. X
  1091. X/*
  1092. X*       Functions defined as macros
  1093. X*/
  1094. X#ifndef max
  1095. X#define max(a,b) (((a) > (b)) ? (a) : (b))
  1096. X#endif
  1097. X#ifndef min
  1098. X#define min(a,b) (((a) < (b)) ? (a) : (b))
  1099. X#endif
  1100. X
  1101. X
  1102. X#define addch( c )              waddch( stdscr, c )
  1103. X#define addstr(str)             waddstr( stdscr, str )
  1104. X#define attroff(attr)           wattroff( stdscr, (chtype)attr )
  1105. X#define attron(attr)            wattron( stdscr, (chtype)attr )
  1106. X#define attrset(attr)           wattrset( stdscr, (chtype)attr )
  1107. X#define box( w, v, h )          wbox( w, 0, 0, 0, 0, v, h )
  1108. X#define can_change_color()      FALSE
  1109. X#define cbreak()                (_cursvar.cbreak = TRUE)
  1110. X#define clear()                 (clearok( stdscr, TRUE )==ERR?ERR:wclear( stdscr ))
  1111. X#define clrtobot()              wclrtobot( stdscr )
  1112. X#define clrtoeol()              wclrtoeol( stdscr )
  1113. X#define crmode()                (_cursvar.cbreak = TRUE)
  1114. X#define delch()                 wdelch( stdscr )
  1115. X#define deleteln()              wdeleteln( stdscr )
  1116. X#define erase()                 werase( stdscr )
  1117. X#define getch()                 wgetch(stdscr)
  1118. X#define getstr(str)             wgetstr( stdscr, str )
  1119. X#define getyx(w,y,x)            ( y = (w)->_cury, x = (w)->_curx )
  1120. X#define getbegyx(w,y,x)         ( y = (w)->_begy, x = (w)->_begx )
  1121. X#define getmaxyx(w,y,x)         ( y = (w)->_maxy, x = (w)->_maxx )
  1122. X#define has_colors()            ((_cursvar.mono) ? FALSE : TRUE)
  1123. X#define has_ic()                TRUE
  1124. X#define has_il()                TRUE
  1125. X#define idlok()                 OK
  1126. X#define inch()                  (stdscr->_y[stdscr->_cury][stdscr->_curx])
  1127. X#define insch( c )              winsch( stdscr, c )
  1128. X#define insertln()              winsertln( stdscr )
  1129. X#define isendwin()              ((_cursvar.alive) ? FALSE : TRUE)
  1130. X#define keypad(w,flag)          (w->_use_keypad  = flag)
  1131. X#define leaveok(w,flag)         (w->_leave   = flag)
  1132. X#define move(y,x)               wmove( stdscr, y, x )
  1133. X#define mvaddch(y,x,c)          (move( y, x )==ERR?ERR:addch( c ))
  1134. X#define mvaddstr(y,x,str)       (move( y, x )==ERR?ERR:addstr( str ))
  1135. X#define mvdelch(y,x)            (move( y, x )==ERR?ERR:wdelch( stdscr ))
  1136. X#define mvgetch(y,x)            (move( y, x )==ERR?ERR:wgetch(stdscr))
  1137. X#define mvgetstr(y,x,str)       {move( y, x )==ERR?ERR:wgetstr( stdscr, str ))
  1138. X#define mvinch(y,x)             (wmove(stdscr,y,x)==ERR?ERR:(w->_y[y][x]))
  1139. X#define mvinsch(y,x,c)          (move( y, x )==ERR?ERR:winsch( stdscr, c ))
  1140. X#define mvwaddch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:waddch( w, c ))
  1141. X#define mvwaddstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:waddstr( w, str ))
  1142. X#define mvwaddrawch(w,y,x,c)    (wmove( w, y, x )==ERR?ERR:waddrawch( w, c ))
  1143. X#define mvwaddrawstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddrawstr( w, str ))
  1144. X#define mvwdelch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wdelch( w ))
  1145. X#define mvwgetch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wgetch( w ))
  1146. X#define mvwgetstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:wgetstr( w, str ))
  1147. X#define mvwinch(w,y,x)          (wmove(w,y,x)==ERR?ERR:(w->_y[y][x]))
  1148. X#define mvwinsch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:winsch( w, c ))
  1149. X#define napms(ms)               delay_output(ms)
  1150. X#define nl()                    (_cursvar.autocr = TRUE)
  1151. X#define nocbreak()              (_cursvar.cbreak = FALSE)
  1152. X#define nocrmode()              (_cursvar.cbreak = FALSE)
  1153. X#define nodelay(w,flag)         (w->_nodelay = flag)
  1154. X#define noecho()                (_cursvar.echo = FALSE)
  1155. X#define echo()                  (_cursvar.echo = TRUE)
  1156. X#define nonl()                  (_cursvar.autocr = FALSE)
  1157. X#define refrbrk(flag)           (_cursvar.refrbrk = flag)
  1158. X#define refresh()               wrefresh( stdscr )
  1159. X#define scrollok(w,flag)        (w->_scroll  = flag)
  1160. X#define setscrreg(top, bot)     wsetscrreg( stdscr, top, bot )
  1161. X#define standend()              wstandend( stdscr )
  1162. X#define standout()              wstandout( stdscr )
  1163. X#define ungetch(c)              wungetch(c)
  1164. X#define waddch(w, c)            PDC_chadd( w, (chtype)c, (bool)!(_cursvar.raw_out), TRUE )
  1165. X#define wclear(w)               ( werase( w )==ERR?ERR:(w->_clear = TRUE))
  1166. X#define winch(w)                (w->_y[w->_cury][w->_curx])
  1167. X#define wstandend(w)            (wattroff(w, A_STANDOUT)==ERR?ERR:(w->_attrs = 0))
  1168. X#define wstandout(w)            wattrset(w, A_STANDOUT);
  1169. X#define echochar(c)             (addch((chtype)c)==ERR?ERR:refresh())
  1170. X#define wechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:wrefresh(w))
  1171. X#define pechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:prefresh(w))
  1172. X
  1173. X#ifdef     PDCURSES
  1174. X#define addrawch( c )           waddrawch( stdscr, c )
  1175. X#define addrawstr(str)          waddrawstr( stdscr, str )
  1176. X#define insrawch( c )           winsrawch( stdscr, c )
  1177. X#define waddrawch(w, c)         PDC_chadd( w, (chtype)c, FALSE, TRUE )
  1178. X#define winsrawch(w, c)         PDC_chins( w, (chtype)c, FALSE )
  1179. X
  1180. X/*
  1181. X *      FYI: Need to document these functions...
  1182. X */
  1183. X#define title(s,a)              wtitle( stdscr, s, (chtype)a )
  1184. X#define titleofs(ofs)           wtitleofs( stdscr, ofs )
  1185. X#define wtitle(w,s,a)           (w->_title = s, w->_title_attr = (chtype)a)
  1186. X#define wtitleofs(w,ofs)        (w->_title_ofs = ofs)
  1187. X#endif
  1188. X
  1189. X/*
  1190. X *      Load up curspriv.h.     This should be in the same place as
  1191. X *      curses.h.  We allow anyone who defines CURSES_LIBRARY to have
  1192. X *      access to our internal routines.  This provides quick
  1193. X *      PC applications at the expense of portability.
  1194. X */
  1195. X#if defined     (CURSES_LIBRARY) | defined( INTERNAL)
  1196. X#  include <curspriv.h>
  1197. X#  include <stdlib.h>
  1198. X#endif
  1199. X
  1200. X#endif  /* __PDCURSES__ */
  1201. END_OF_FILE
  1202.   if test 41892 -ne `wc -c <'curses.h'`; then
  1203.     echo shar: \"'curses.h'\" unpacked with wrong size!
  1204.   fi
  1205.   # end of 'curses.h'
  1206. fi
  1207. if test ! -d 'demos' ; then
  1208.     echo shar: Creating directory \"'demos'\"
  1209.     mkdir 'demos'
  1210. fi
  1211. if test ! -d 'doc' ; then
  1212.     echo shar: Creating directory \"'doc'\"
  1213.     mkdir 'doc'
  1214. fi
  1215. if test ! -d 'flexos' ; then
  1216.     echo shar: Creating directory \"'flexos'\"
  1217.     mkdir 'flexos'
  1218. fi
  1219. if test ! -d 'nonport' ; then
  1220.     echo shar: Creating directory \"'nonport'\"
  1221.     mkdir 'nonport'
  1222. fi
  1223. if test ! -d 'portable' ; then
  1224.     echo shar: Creating directory \"'portable'\"
  1225.     mkdir 'portable'
  1226. fi
  1227. if test -f 'portable/newterm.c' -a "${1}" != "-c" ; then 
  1228.   echo shar: Will not clobber existing file \"'portable/newterm.c'\"
  1229. else
  1230.   echo shar: Extracting \"'portable/newterm.c'\" \(3226 characters\)
  1231.   sed "s/^X//" >'portable/newterm.c' <<'END_OF_FILE'
  1232. X#include <stdlib.h>
  1233. X#ifndef NO_MEMORY_H
  1234. X#include <memory.h>
  1235. X#endif
  1236. X#define    CURSES_LIBRARY    1
  1237. X#include <curses.h>
  1238. X#undef    newterm
  1239. X
  1240. X#ifndef    NDEBUG
  1241. Xchar *rcsid_newterm = "$Header: c:/curses/portable/RCS/newterm.c%v 2.0 1992/11/15 03:29:03 MH Rel $";
  1242. X#endif
  1243. X
  1244. X#if    EMALLOC
  1245. Xvoid*    emalloc( size_t );
  1246. Xvoid*    ecalloc( size_t, size_t );
  1247. Xvoid    efree( void* );
  1248. X#endif
  1249. X
  1250. X
  1251. X
  1252. X
  1253. X#if 0
  1254. X/*man-start*********************************************************************
  1255. X
  1256. X  newterm()    - open new terminal
  1257. X
  1258. X  X/Open Description:
  1259. X     A program which outputs to more than one terminal should use
  1260. X     for each terminal instead of initscr().  The newterm() function
  1261. X     should be called once for each terminal.  It returns a value of
  1262. X     type SCREEN* which should be saved as a reference to that terminal.
  1263. X     The arguments are the type of of terminal to be used in place of
  1264. X     TERM (environment variable), a file pointer for output to the
  1265. X     terminal and another file pointer for input from the terminal.  The
  1266. X     program must also call endwin() for each terminal no longer being
  1267. X     used.
  1268. X
  1269. X  PDCurses Description:
  1270. X     This routine is a quick hack.  It is basically a copy of initscr()
  1271. X     with the appropriate arguments being passed.  There is no formal
  1272. X     support yet for dual monitor systems.  This is almost, but not
  1273. X     quiet, a NOP.
  1274. X
  1275. X     outfd and infd are ignored, but required for portability.
  1276. X
  1277. X  X/Open Return Value:
  1278. X     The newterm() function returns stdscr on success otherwise ERR is
  1279. X     returned.
  1280. X
  1281. X  X/Open Errors:
  1282. X     No errors are defined for this function.
  1283. X
  1284. X  PDCurses Errors:
  1285. X     It is an error to open the same SCREEN more than once.
  1286. X
  1287. X  Portability:
  1288. X     PDCurses    SCREEN* newtern( char* type, FILE outfd, FILE infd );
  1289. X     X/Open Dec '88    SCREEN* newtern( char* type, FILE outfd, FILE infd );
  1290. X     BSD Curses    
  1291. X     SYS V Curses    SCREEN* newtern( char* type, FILE outfd, FILE infd );
  1292. X
  1293. X**man-end**********************************************************************/
  1294. X
  1295. XSCREEN*    newterm( char *type, FILE *outfd, FILE *infd )
  1296. X{
  1297. X#ifdef    TC
  1298. X#  pragma argsused
  1299. X#endif
  1300. Xextern    void*    mallc();    /* malloc(size)        */
  1301. Xextern    void*    callc();    /* calloc(num,size)    */
  1302. Xextern    void    fre();        /* free(ptr)        */
  1303. X
  1304. Xextern    void*    malloc();
  1305. Xextern    void*    calloc();
  1306. Xextern    void    free();
  1307. X
  1308. X    if  (_cursvar.alive)
  1309. X        return( ERR );
  1310. X
  1311. X    if  (_cursvar.emalloc == EMALLOC_MAGIC)
  1312. X    {
  1313. X#if    EMALLOC
  1314. X        memset(&_cursvar, 0, sizeof(SCREEN));
  1315. X        _cursvar.emalloc = TRUE;
  1316. X        mallc = emalloc;
  1317. X        callc = ecalloc;
  1318. X        fre   = efree;
  1319. X#endif
  1320. X    }
  1321. X    else
  1322. X    {
  1323. X        memset(&_cursvar, 0, sizeof(SCREEN));
  1324. X        mallc = malloc;
  1325. X        callc = calloc;
  1326. X        fre   = free;
  1327. X    }
  1328. X    PDC_scr_open(&_cursvar, 0);
  1329. X    _cursvar.orig_cursor = _cursvar.cursor;
  1330. X    _cursvar.orig_font = PDC_get_font();
  1331. X    _cursvar.orgcbr = PDC_get_ctrl_break();
  1332. X    _cursvar.blank = ' ';
  1333. X#ifdef    FLEXOS
  1334. X    _flexos_16bitmode();
  1335. X#endif
  1336. X    savetty();
  1337. X    LINES = PDC_get_rows();
  1338. X    COLS = PDC_get_columns();
  1339. X
  1340. X    if ((tmpwin = newwin(LINES, COLS, 0, 0)) == (WINDOW *) ERR)
  1341. X    {
  1342. X        return( ERR );
  1343. X    }
  1344. X    if ((curscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *) ERR)
  1345. X    {
  1346. X        return( ERR );
  1347. X    }
  1348. X    if ((stdscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *) ERR)
  1349. X    {
  1350. X        return( ERR );
  1351. X    }
  1352. X    curscr->_clear = FALSE;
  1353. X#ifdef    REGISTERWINDOWS
  1354. X    _cursvar.refreshall = FALSE;
  1355. X    _inswin(stdscr, (WINDOW *)NULL);
  1356. X#endif
  1357. X    _cursvar.alive = TRUE;
  1358. X    return( &_cursvar );
  1359. X}
  1360. X#endif
  1361. END_OF_FILE
  1362.   if test 3226 -ne `wc -c <'portable/newterm.c'`; then
  1363.     echo shar: \"'portable/newterm.c'\" unpacked with wrong size!
  1364.   fi
  1365.   # end of 'portable/newterm.c'
  1366. fi
  1367. if test ! -d 'private' ; then
  1368.     echo shar: Creating directory \"'private'\"
  1369.     mkdir 'private'
  1370. fi
  1371. if test ! -d 'tools' ; then
  1372.     echo shar: Creating directory \"'tools'\"
  1373.     mkdir 'tools'
  1374. fi
  1375. echo shar: End of archive 1 \(of 11\).
  1376. cp /dev/null ark1isdone
  1377. MISSING=""
  1378. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1379.     if test ! -f ark${I}isdone ; then
  1380.     MISSING="${MISSING} ${I}"
  1381.     fi
  1382. done
  1383. if test "${MISSING}" = "" ; then
  1384.     echo You have unpacked all 11 archives.
  1385.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1386. else
  1387.     echo You still must unpack the following archives:
  1388.     echo "        " ${MISSING}
  1389. fi
  1390. exit 0
  1391. exit 0 # Just in case...
  1392.