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

  1. Newsgroups: comp.sources.misc
  2. From: M.Hessling@gu.edu.au (Mark Hessling)
  3. Subject:  v33i088:  pdcurses - Public Domain curses library for DOS and OS/2 v2.0, Part08/11
  4. Message-ID: <1992Nov19.040620.7906@sparky.imd.sterling.com>
  5. X-Md4-Signature: f19926f4a01fdb1d95ecca984a8d1db7
  6. Date: Thu, 19 Nov 1992 04:06:20 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 88
  11. Archive-name: pdcurses/part08
  12. Environment: DOS,OS/2,ANSI-C
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  nonport/curson.c portable/curs_set.c portable/def_prog.c
  19. #   portable/delwin.c portable/noraw.c portable/raw.c
  20. #   portable/reset_pr.c portable/reset_sh.c portable/scroll.c
  21. #   portable/setscrrg.c portable/unctrl.c portable/wclrtobo.c
  22. #   portable/wclrtoeo.c portable/winch.c portable/wsetscrr.c
  23. #   private/_addwin.c private/_chgattr.c private/_fixcurs.c
  24. #   private/_getcbrk.c private/_rawgetc.c private/_setcrsr.c
  25. #   private/_sgetnl.c private/_sysgetc.c tools/manext.def
  26. # Wrapped by kent@sparky on Wed Nov 18 21:44:09 1992
  27. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  28. echo If this archive is complete, you will see the following message:
  29. echo '          "shar: End of archive 8 (of 11)."'
  30. if test -f 'nonport/curson.c' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'nonport/curson.c'\"
  32. else
  33.   echo shar: Extracting \"'nonport/curson.c'\" \(1679 characters\)
  34.   sed "s/^X//" >'nonport/curson.c' <<'END_OF_FILE'
  35. X#define    CURSES_LIBRARY    1
  36. X#include <curses.h>
  37. X#undef    curson
  38. X
  39. X#ifndef    NDEBUG
  40. Xchar *rcsid_curson = "$Header: c:/curses/nonport/RCS/curson.c%v 2.0 1992/11/15 03:18:26 MH Rel $";
  41. X#endif
  42. X
  43. X
  44. X
  45. X
  46. X/*man-start*********************************************************************
  47. X
  48. X  curson()    - Turns on the hardware cursor.
  49. X
  50. X  PDCurses Description:
  51. X     Turns on the hardware curses, it does nothing if it is already on.
  52. X
  53. X  PDCurses Return Value:
  54. X     Returns OK upon success, ERR upon failure.
  55. X
  56. X  Portability:
  57. X     PDCurses    int curson( void );
  58. X
  59. X**man-end**********************************************************************/
  60. X
  61. Xint    curson(void)
  62. X{
  63. X    if    (!_cursvar.visible_cursor)
  64. X    {
  65. X        _cursvar.visible_cursor = TRUE;
  66. X/*        PDC_fix_cursor(_cursvar.orig_emulation);*/
  67. X        if (_cursvar.bogus_adapter)
  68. X        {
  69. X            PDC_set_cursor_mode((_cursvar.cursor & 0xff00) >> 8,
  70. X                     (_cursvar.cursor & 0x00ff));
  71. X        }
  72. X        else
  73. X        {
  74. X#ifdef     OS2
  75. X            PDC_set_cursor_mode((_cursvar.cursor & 0xff00) >> 8,
  76. X                         (_cursvar.cursor & 0x00ff));
  77. X#else
  78. X            switch (_cursvar.adapter) {
  79. X            case _MDA:
  80. X            case _CGA:
  81. X            case _EGACOLOR:
  82. X            case _EGAMONO:
  83. X            case _VGACOLOR:
  84. X            case _VGAMONO:
  85. X            case _MDS_GENIUS:
  86. X/*                PDC_set_cursor_mode(_cursvar.font - 2, _cursvar.font - 1);*/
  87. X                PDC_set_cursor_mode((_cursvar.cursor & 0xff00) >> 8,
  88. X                         (_cursvar.cursor & 0x00ff));
  89. X                break;
  90. X            case _MCGACOLOR:
  91. X            case _MCGAMONO:
  92. X/*                PDC_set_cursor_mode(_cursvar.font - 1, _cursvar.font - 2);*/
  93. X                PDC_set_cursor_mode((_cursvar.cursor & 0xff00) >> 8,
  94. X                         (_cursvar.cursor & 0x00ff));
  95. X                break;
  96. X            case _FLEXOS:
  97. X                PDC_set_cursor_mode(_cursvar.visible_cursor, 0);
  98. X                break;
  99. X            default:
  100. X                break;
  101. X            }
  102. X#endif
  103. X        }
  104. X    }
  105. X    return( OK );
  106. X}
  107. END_OF_FILE
  108.   if test 1679 -ne `wc -c <'nonport/curson.c'`; then
  109.     echo shar: \"'nonport/curson.c'\" unpacked with wrong size!
  110.   fi
  111.   # end of 'nonport/curson.c'
  112. fi
  113. if test -f 'portable/curs_set.c' -a "${1}" != "-c" ; then 
  114.   echo shar: Will not clobber existing file \"'portable/curs_set.c'\"
  115. else
  116.   echo shar: Extracting \"'portable/curs_set.c'\" \(1835 characters\)
  117.   sed "s/^X//" >'portable/curs_set.c' <<'END_OF_FILE'
  118. X#define    CURSES_LIBRARY    1
  119. X#include <curses.h>
  120. X#undef curs_set
  121. X
  122. X#ifndef    NDEBUG
  123. Xchar *rcsid_curs_set = "$Header: c:/curses/portable/RCS/curs_set.c%v 2.0 1992/11/15 03:29:14 MH Rel $";
  124. X#endif
  125. X
  126. X
  127. X/*man-start*********************************************************************
  128. X
  129. X  curs_set()    - set visibility of cursor.
  130. X
  131. X  X/Open Description:
  132. X     This routine is used to set the visibility of the cursor. The cursor
  133. X     can be made invisible, normal or highly visible by setting the
  134. X     parameter to 0, 1 or 2 respectively. If an invalid value is passed
  135. X     the function will set the cursor to "normal".
  136. X
  137. X  X/Open Return Value:
  138. X     No return value.
  139. X
  140. X  X/Open Errors:
  141. X     No errors are defined for this function.
  142. X
  143. X  Portability:
  144. X     PDCurses    int curs_set( int visibility );
  145. X     SYS V Curses    int curs_set( int visibility );
  146. X
  147. X**man-end**********************************************************************/
  148. X
  149. Xint    curs_set(int visibility)
  150. X{
  151. X#ifdef OS2
  152. X VIOCURSORINFO pvioCursorInfo;
  153. X#endif
  154. X int start,end,hidden=0;
  155. X
  156. X    switch(visibility)
  157. X    {
  158. X        case 0:  /* invisible */
  159. X#ifdef OS2
  160. X            start = _cursvar.font / 4;
  161. X            end = _cursvar.font;
  162. X#else
  163. X            start = 32;
  164. X            end = 33;
  165. X#endif
  166. X            hidden = (-1);
  167. X            break;
  168. X        case 2:  /* highly visible */
  169. X            start = _cursvar.font / 4;   /* 3/4 high block */
  170. X            end = _cursvar.font;
  171. X            break;
  172. X        default:  /* normal visibility */
  173. X            start = _cursvar.font - 2;
  174. X            end = _cursvar.font;
  175. X            break;
  176. X    }
  177. X#ifdef OS2
  178. X    pvioCursorInfo.yStart = (USHORT)start;
  179. X    pvioCursorInfo.cEnd = (USHORT)end;
  180. X    pvioCursorInfo.cx = (USHORT)1;
  181. X    pvioCursorInfo.attr = hidden;
  182. X    VioSetCurType((PVIOCURSORINFO)&pvioCursorInfo,0);
  183. X#endif
  184. X#ifdef DOS
  185. X    regs.h.ah = 0x01;
  186. X    regs.h.al = (unsigned char)_cursvar.scrnmode;  /* if not set, some BIOSes hang */
  187. X    regs.h.ch = (unsigned char)start;
  188. X    regs.h.cl = (unsigned char)end;
  189. X    int86(0x10, ®s, ®s);
  190. X#endif
  191. X    return( OK );
  192. X}
  193. END_OF_FILE
  194.   if test 1835 -ne `wc -c <'portable/curs_set.c'`; then
  195.     echo shar: \"'portable/curs_set.c'\" unpacked with wrong size!
  196.   fi
  197.   # end of 'portable/curs_set.c'
  198. fi
  199. if test -f 'portable/def_prog.c' -a "${1}" != "-c" ; then 
  200.   echo shar: Will not clobber existing file \"'portable/def_prog.c'\"
  201. else
  202.   echo shar: Extracting \"'portable/def_prog.c'\" \(1615 characters\)
  203.   sed "s/^X//" >'portable/def_prog.c' <<'END_OF_FILE'
  204. X#ifdef NO_MEMORY_H
  205. X#include <memory.h>
  206. X#endif
  207. X#define    CURSES_LIBRARY    1
  208. X#include <curses.h>
  209. X#undef    def_prog_mode
  210. X
  211. X#ifndef    NDEBUG
  212. Xchar *rcsid_def_prog = "$Header: c:/curses/portable/RCS/def_prog.c%v 2.0 1992/11/15 03:28:48 MH Rel $";
  213. X#endif
  214. X
  215. X
  216. X
  217. X
  218. X/*man-start*********************************************************************
  219. X
  220. X  def_prog_mode()    - Save terminal mode
  221. X
  222. X  X/Open Description:
  223. X     Save the current terminal modes as the "program" (in CURSES) or
  224. X     "shell" (not in CURSES) state for use by the reset_prog_mode()
  225. X     and reset_shell_mode() functions.  This is done automatically by
  226. X     initscr().
  227. X
  228. X  PDCurses Description:
  229. X     PDCurses maintains a WINDOW* that contains the original user's
  230. X     screen upon startup.  This might be useful for returning the
  231. X     user's environment to its (near) original state.
  232. X
  233. X     This is unimplemented at this time.
  234. X
  235. X  X/Open Return Value:
  236. X     The def_prog_mode() function returns OK on success and ERR on error.
  237. X
  238. X  X/Open Errors:
  239. X     No errors are defined for this function.
  240. X
  241. X  Portability:
  242. X     PDCurses    int def_prog_mode( void );
  243. X     X/Open Dec '88    int def_prog_mode( void );
  244. X     BSD Curses
  245. X        SYS V Curses    int def_prog_mode( void );
  246. X
  247. X**man-end**********************************************************************/
  248. X
  249. Xint    def_prog_mode(void)
  250. X{
  251. X#ifdef    FLEXOS
  252. X    _flexos_16bitmode();
  253. X#endif
  254. X    c_pr_tty.been_set = TRUE;
  255. X#if     defined DOS || defined OS2
  256. X#  if    SMALL || MEDIUM
  257. X    movedata( FP_SEG(&_cursvar),        FP_OFF(&_cursvar),
  258. X          FP_SEG(&c_pr_tty.saved),     FP_OFF(&c_pr_tty.saved),
  259. X          sizeof(SCREEN) );
  260. X
  261. X#  else
  262. X    memcpy(&c_pr_tty.saved, &_cursvar, sizeof(SCREEN));
  263. X#  endif
  264. X#endif
  265. X
  266. X    return( OK );
  267. X}
  268. END_OF_FILE
  269.   if test 1615 -ne `wc -c <'portable/def_prog.c'`; then
  270.     echo shar: \"'portable/def_prog.c'\" unpacked with wrong size!
  271.   fi
  272.   # end of 'portable/def_prog.c'
  273. fi
  274. if test -f 'portable/delwin.c' -a "${1}" != "-c" ; then 
  275.   echo shar: Will not clobber existing file \"'portable/delwin.c'\"
  276. else
  277.   echo shar: Extracting \"'portable/delwin.c'\" \(1639 characters\)
  278.   sed "s/^X//" >'portable/delwin.c' <<'END_OF_FILE'
  279. X#define    CURSES_LIBRARY    1
  280. X#include <curses.h>
  281. X#undef    delwin
  282. X
  283. X#ifndef    NDEBUG
  284. Xchar *rcsid_delwin = "$Header: c:/curses/portable/RCS/delwin.c%v 2.0 1992/11/15 03:29:17 MH Rel $";
  285. X#endif
  286. X
  287. X
  288. X
  289. X
  290. X/*man-start*********************************************************************
  291. X
  292. X  delwin()    - delete window
  293. X
  294. X  X/Open Description:
  295. X     Deletes the named window, freeing all memory associated with it.
  296. X     In the case of overlapping windows, subwindows should be deleted
  297. X     before the main window.
  298. X
  299. X  PDCurses Description:
  300. X     This routine will also attempt to remove the passed window from
  301. X     the visible window's list.  This is a list of windows that are
  302. X     "visible" and will always be refreshed at the next doupdate()
  303. X     call.
  304. X
  305. X  X/Open Return Value:
  306. X     The delwin() function returns OK on success and ERR on error.
  307. X
  308. X  PDCurses Errors:
  309. X     It is an error to call this function with a NULL window pointer.
  310. X
  311. X  Portability:
  312. X     PDCurses    int delwin( WINDOW* win );
  313. X     X/Open Dec '88    int delwin( WINDOW* win );
  314. X     BSD Curses    int delwin( WINDOW* win );
  315. X     SYS V Curses    int delwin( WINDOW* win );
  316. X**man-end**********************************************************************/
  317. X
  318. Xint    delwin(WINDOW *win)
  319. X{
  320. Xextern    void    (*fre)( void* );
  321. X    int    i;
  322. X
  323. X    if (win == (WINDOW *)NULL)
  324. X        return( ERR );
  325. X
  326. X#ifdef    REGISTERWINDOWS
  327. X    _rmwin(win);        /* Remove from the visible windows list... */
  328. X#endif
  329. X
  330. X    /*
  331. X     * FYI:  Subwindow's use 'parent's' lines
  332. X     */
  333. X    if (!(win->_flags & _SUBWIN))
  334. X    {
  335. X        for (i = 0; i < win->_pmaxy && win->_y[i]; i++)
  336. X        {
  337. X            if (win->_y[i] != NULL)
  338. X                (*fre)(win->_y[i]);
  339. X        }
  340. X    }
  341. X    (*fre)(win->_firstch);
  342. X    (*fre)(win->_lastch);
  343. X    (*fre)(win->_y);
  344. X    (*fre)(win);
  345. X    return( OK );
  346. X}
  347. END_OF_FILE
  348.   if test 1639 -ne `wc -c <'portable/delwin.c'`; then
  349.     echo shar: \"'portable/delwin.c'\" unpacked with wrong size!
  350.   fi
  351.   # end of 'portable/delwin.c'
  352. fi
  353. if test -f 'portable/noraw.c' -a "${1}" != "-c" ; then 
  354.   echo shar: Will not clobber existing file \"'portable/noraw.c'\"
  355. else
  356.   echo shar: Extracting \"'portable/noraw.c'\" \(1811 characters\)
  357.   sed "s/^X//" >'portable/noraw.c' <<'END_OF_FILE'
  358. X#define CURSES_LIBRARY    1
  359. X#include <curses.h>
  360. X#undef  noraw
  361. X
  362. X#ifndef NDEBUG
  363. Xchar *rcsid_noraw = "$Header: c:/curses/portable/RCS/noraw.c%v 2.0 1992/11/15 03:29:06 MH Rel $";
  364. X#endif
  365. X
  366. X
  367. X
  368. X
  369. X/*man-start*********************************************************************
  370. X
  371. X  noraw()    - disable raw mode
  372. X
  373. X  X/Open Description:
  374. X        The terminal in placed into or out of raw mode.  Raw mode is
  375. X        similar to cbreak mode, in that characters typed are immediately
  376. X        passed through to the user program.  The differences are that in
  377. X        raw mode, the INTR, QUIT, SUSP, and STOP characters are passed
  378. X        through without being interpreted, and without generating a
  379. X        signal.  The behaviour of the BREAK key depends on other
  380. X        parameters of the terminal drive that are not set by curses.
  381. X
  382. X  PDCurses Description:
  383. X        Raw mode in the traditional sense refers to input handling.
  384. X        Contrast noraw_output() which disables 8bit characters.
  385. X
  386. X        FYI:    PDCurses does NOT provide signal(3) support,
  387. X         this must be done by the application.
  388. X
  389. X  X/Open Return Value:
  390. X        The noraw() function returns OK on success and ERR on error.
  391. X
  392. X  X/Open Errors:
  393. X        No errors are defined for this function.
  394. X
  395. X  Portability:
  396. X        PDCurses        int noraw( void );
  397. X        X/Open Dec '88  int noraw( void );
  398. X        BSD Curses      int noraw( void );
  399. X        SYS V Curses    int noraw( void );
  400. X
  401. X**man-end**********************************************************************/
  402. X
  403. Xint     noraw(void)
  404. X{
  405. X#ifdef OS2
  406. X    KBDINFO KbdInfo;
  407. X
  408. X    KbdGetStatus(&KbdInfo,0);
  409. X    KbdInfo.fsMask |= KEYBOARD_ASCII_MODE;
  410. X    KbdInfo.fsMask &= ~KEYBOARD_BINARY_MODE;
  411. X    KbdSetStatus(&KbdInfo,0);
  412. X#endif
  413. X    _cursvar.raw_inp = FALSE;
  414. X    PDC_set_ctrl_break(_cursvar.orgcbr);    /* restore original ^BREAK status */
  415. X    return( OK );
  416. X}
  417. END_OF_FILE
  418.   if test 1811 -ne `wc -c <'portable/noraw.c'`; then
  419.     echo shar: \"'portable/noraw.c'\" unpacked with wrong size!
  420.   fi
  421.   # end of 'portable/noraw.c'
  422. fi
  423. if test -f 'portable/raw.c' -a "${1}" != "-c" ; then 
  424.   echo shar: Will not clobber existing file \"'portable/raw.c'\"
  425. else
  426.   echo shar: Extracting \"'portable/raw.c'\" \(1788 characters\)
  427.   sed "s/^X//" >'portable/raw.c' <<'END_OF_FILE'
  428. X#define CURSES_LIBRARY    1
  429. X#include <curses.h>
  430. X#undef  raw
  431. X
  432. X#ifndef NDEBUG
  433. Xchar *rcsid_raw = "$Header: c:/curses/portable/RCS/raw.c%v 2.0 1992/11/15 03:29:25 MH Rel $";
  434. X#endif
  435. X
  436. X
  437. X
  438. X
  439. X/*man-start*********************************************************************
  440. X
  441. X  raw()    - enable raw mode
  442. X
  443. X  X/Open Description:
  444. X        The terminal in placed into or out of raw mode.  Raw mode is
  445. X        similar to cbreak mode, in that characters typed are immediately
  446. X        passed through to the user program.  The differences are that in
  447. X        raw mode, the INTR, QUIT, SUSP, and STOP characters are passed
  448. X        through without being interpreted, and without generating a
  449. X        signal.  The behaviour of the BREAK key depends on other
  450. X        parameters of the terminal drive that are not set by curses.
  451. X
  452. X  PDCurses Description:
  453. X        Raw mode in the traditional sense refers to input handling.
  454. X        Contrast raw_output() which enables 8bit characters.
  455. X
  456. X        FYI:    PDCurses does NOT provide signal(3) support,
  457. X         this must be done by the application.
  458. X
  459. X  X/Open Return Value:
  460. X        This function returns OK on success and ERR on error.
  461. X
  462. X  X/Open Errors:
  463. X        No errors are defined for this function.
  464. X
  465. X  Portability:
  466. X        PDCurses        int raw( void );
  467. X        X/Open Dec '88  int raw( void );
  468. X        BSD Curses      int raw( void );
  469. X        SYS V Curses    int raw( void );
  470. X
  471. X**man-end**********************************************************************/
  472. X
  473. Xint     raw(void)
  474. X{
  475. X#ifdef OS2
  476. X    KBDINFO KbdInfo;
  477. X
  478. X    KbdGetStatus(&KbdInfo,0);
  479. X    KbdInfo.fsMask |= KEYBOARD_BINARY_MODE;
  480. X    KbdInfo.fsMask &= ~KEYBOARD_ASCII_MODE;
  481. X    KbdSetStatus(&KbdInfo,0);
  482. X#endif
  483. X    _cursvar.raw_inp = TRUE;
  484. X    PDC_set_ctrl_break(FALSE);      /* disallow ^BREAK on disk I/O */
  485. X/*    flushinp(); */
  486. X    return( OK );
  487. X}
  488. END_OF_FILE
  489.   if test 1788 -ne `wc -c <'portable/raw.c'`; then
  490.     echo shar: \"'portable/raw.c'\" unpacked with wrong size!
  491.   fi
  492.   # end of 'portable/raw.c'
  493. fi
  494. if test -f 'portable/reset_pr.c' -a "${1}" != "-c" ; then 
  495.   echo shar: Will not clobber existing file \"'portable/reset_pr.c'\"
  496. else
  497.   echo shar: Extracting \"'portable/reset_pr.c'\" \(1980 characters\)
  498.   sed "s/^X//" >'portable/reset_pr.c' <<'END_OF_FILE'
  499. X#include <string.h>
  500. X#define    CURSES_LIBRARY    1
  501. X#include <curses.h>
  502. X#undef    reset_prog_mode
  503. X
  504. X#ifndef NDEBUG
  505. Xchar *rcsid_reset_pr = "$Header: c:/curses/portable/RCS/reset_pr.c%v 2.0 1992/11/15 03:29:11 MH Rel $";
  506. X#endif
  507. X
  508. X/*man-start*********************************************************************
  509. X
  510. X  reset_prog_mode()    - restore terminal mode
  511. X
  512. X  X/Open Description:
  513. X     Restore the terminal to "program" (in curses) or "shell" (out
  514. X     of curses) state.  These are done automatically by endwin()
  515. X     and doupdate() after an endwin(), so they would normally not
  516. X     be called before these functions.
  517. X
  518. X  PDCurses Description:
  519. X     Under the Flexos platform, PDCurses operates in 16-bit mode.
  520. X     Normally, the Flexos shell operates in 8-bit mode.
  521. X
  522. X  X/Open Return Value:
  523. X     The reset_prog_mode() routine returns OK on success otherwise ERR
  524. X     is returned.
  525. X
  526. X  Portability:
  527. X     PDCurses    int reset_prog_mode( void );
  528. X     X/Open Dec '88    int reset_prog_mode( void );
  529. X     SysV Curses    int reset_prog_mode( void );
  530. X     BSD Curses    int reset_prog_mode( void );
  531. X
  532. X**man-end**********************************************************************/
  533. X
  534. Xint    reset_prog_mode(void)
  535. X{
  536. X    if    (c_pr_tty.been_set == TRUE)
  537. X    {
  538. X#if     defined(DOS) || defined(OS2)
  539. X#  if    SMALL || MEDIUM
  540. X    movedata( FP_SEG(&c_pr_tty.saved),        FP_OFF(&c_pr_tty.saved),
  541. X          FP_SEG(&_cursvar),    FP_OFF(&_cursvar),
  542. X          sizeof(SCREEN) );
  543. X#  else
  544. X        memcpy(&_cursvar, &c_pr_tty.saved, sizeof(SCREEN));
  545. X#  endif
  546. X#endif
  547. X        mvcur(0, 0, c_pr_tty.saved.cursrow, c_pr_tty.saved.curscol);
  548. X        if (PDC_get_ctrl_break() != c_pr_tty.saved.orgcbr)
  549. X            PDC_set_ctrl_break(c_pr_tty.saved.orgcbr);
  550. X        if (c_pr_tty.saved.raw_out)
  551. X            raw();
  552. X        if (c_pr_tty.saved.visible_cursor)
  553. X            curson();
  554. X        _cursvar.font = PDC_get_font();
  555. X        PDC_set_font(c_pr_tty.saved.font);
  556. X        if (!PDC_scrn_modes_equal (PDC_get_scrn_mode(),  c_pr_tty.saved.scrnmode))
  557. X            PDC_set_scrn_mode(c_pr_tty.saved.scrnmode);
  558. X
  559. X        PDC_set_rows(c_pr_tty.saved.lines);
  560. X    }
  561. X#ifdef    FLEXOS
  562. X    _flexos_16bitmode();
  563. X#endif
  564. X    return( OK );
  565. X}
  566. END_OF_FILE
  567.   if test 1980 -ne `wc -c <'portable/reset_pr.c'`; then
  568.     echo shar: \"'portable/reset_pr.c'\" unpacked with wrong size!
  569.   fi
  570.   # end of 'portable/reset_pr.c'
  571. fi
  572. if test -f 'portable/reset_sh.c' -a "${1}" != "-c" ; then 
  573.   echo shar: Will not clobber existing file \"'portable/reset_sh.c'\"
  574. else
  575.   echo shar: Extracting \"'portable/reset_sh.c'\" \(1989 characters\)
  576.   sed "s/^X//" >'portable/reset_sh.c' <<'END_OF_FILE'
  577. X#include <string.h>
  578. X#define    CURSES_LIBRARY    1
  579. X#include <curses.h>
  580. X#undef    reset_shell_mode
  581. X
  582. X#ifndef NDEBUG
  583. Xchar *rcsid_reset_sh = "$Header: c:/curses/portable/RCS/reset_sh.c%v 2.0 1992/11/15 03:29:12 MH Rel $";
  584. X#endif
  585. X
  586. X
  587. X
  588. X
  589. X/*man-start*********************************************************************
  590. X
  591. X  reset_shell_mode()    - restore terminal mode
  592. X
  593. X  X/Open Description:
  594. X     Restore the terminal to "program" (in curses) or "shell" (out
  595. X     of curses) state.  These are done automatically by endwin()
  596. X     and doupdate() after an endwin(), so they would normally not
  597. X     be called before these functions.
  598. X
  599. X  PDCurses Description:
  600. X     Under the Flexos platform, PDCurses operates in 16-bit mode.
  601. X     Normally, the Flexos shell operates in 8-bit mode.
  602. X
  603. X  X/Open Return Value:
  604. X     The reset_shell_mode() routine returns OK on success otherwise ERR
  605. X     is returned.
  606. X
  607. X  Portability:
  608. X     PDCurses    int reset_shell_mode( void );
  609. X     X/Open Dec '88    int reset_shell_mode( void );
  610. X     SysV Curses    int reset_shell_mode( void );
  611. X     BSD Curses    int reset_shell_mode( void );
  612. X
  613. X**man-end**********************************************************************/
  614. X
  615. Xint    reset_shell_mode(void)
  616. X{
  617. X    if    (c_sh_tty.been_set == TRUE)
  618. X    {
  619. X#if     defined(DOS) || defined(OS2)
  620. X#  if    SMALL || MEDIUM
  621. X    movedata( FP_SEG(&c_sh_tty.saved),        FP_OFF(&c_sh_tty.saved),
  622. X          FP_SEG(&_cursvar),    FP_OFF(&_cursvar),
  623. X          sizeof(SCREEN) );
  624. X#  else
  625. X        memcpy(&_cursvar, &c_sh_tty.saved, sizeof(SCREEN));
  626. X#  endif
  627. X#endif
  628. X        mvcur(0, 0, c_sh_tty.saved.cursrow, c_sh_tty.saved.curscol);
  629. X        if (PDC_get_ctrl_break() != c_sh_tty.saved.orgcbr)
  630. X            PDC_set_ctrl_break(c_sh_tty.saved.orgcbr);
  631. X        if (c_sh_tty.saved.raw_out)
  632. X            raw();
  633. X        if (c_sh_tty.saved.visible_cursor)
  634. X            curson();
  635. X        _cursvar.font = PDC_get_font();
  636. X        PDC_set_font(c_sh_tty.saved.font);
  637. X        if (!PDC_scrn_modes_equal (PDC_get_scrn_mode(),  c_sh_tty.saved.scrnmode))
  638. X            PDC_set_scrn_mode(c_sh_tty.saved.scrnmode);
  639. X        PDC_set_rows(c_sh_tty.saved.lines);
  640. X    }
  641. X#ifdef    FLEXOS
  642. X    _flexos_8bitmode();
  643. X#endif
  644. X    return( OK );
  645. X}
  646. END_OF_FILE
  647.   if test 1989 -ne `wc -c <'portable/reset_sh.c'`; then
  648.     echo shar: \"'portable/reset_sh.c'\" unpacked with wrong size!
  649.   fi
  650.   # end of 'portable/reset_sh.c'
  651. fi
  652. if test -f 'portable/scroll.c' -a "${1}" != "-c" ; then 
  653.   echo shar: Will not clobber existing file \"'portable/scroll.c'\"
  654. else
  655.   echo shar: Extracting \"'portable/scroll.c'\" \(1959 characters\)
  656.   sed "s/^X//" >'portable/scroll.c' <<'END_OF_FILE'
  657. X#define    CURSES_LIBRARY    1
  658. X#include <curses.h>
  659. X#undef    scroll
  660. X
  661. X#ifndef    NDEBUG
  662. Xchar *rcsid_scroll = "$Header: c:/curses/portable/RCS/scroll.c%v 2.0 1992/11/15 03:28:49 MH Rel $";
  663. X#endif
  664. X
  665. X
  666. X
  667. X
  668. X
  669. X/*man-start*********************************************************************
  670. X
  671. X  scroll()    - scroll window
  672. X
  673. X  X/Open Description:
  674. X     The window is scrolled up one line.  THis involves moving the
  675. X     lines in the window data strcture.
  676. X
  677. X  PDCurses Description:
  678. X     No additional functionality at this time.  Thought it might be
  679. X     be nice to provide reverse scrolling, or scrolling 'n' lines
  680. X     in a positive (down) or negative (up) direction in a future
  681. X     release for the PC platform.
  682. X
  683. X  X/Open Return Value:
  684. X     The scroll() function returns OK on succes and ERR on error.
  685. X
  686. X  PDCurses Errors:
  687. X     It is an error to pass a NULL* window.
  688. X
  689. X  Portability:
  690. X     PDCurses    int scroll( WINDOW* win );
  691. X     X/Open Dec '88    int scroll( WINDOW* win );
  692. X     SysV Curses    int scroll( WINDOW* win );
  693. X     BSD Curses    int scroll( WINDOW* win );
  694. X
  695. X**man-end**********************************************************************/
  696. X
  697. Xint    scroll(WINDOW *win)
  698. X{
  699. X    int    i;
  700. X    chtype*    ptr;
  701. X    chtype*    temp;
  702. Xstatic    chtype    blank;
  703. X
  704. X    if (win == (WINDOW *)NULL)
  705. X        return( ERR );
  706. X
  707. X    blank = win->_blank | win->_attrs;
  708. X
  709. X    /*
  710. X     * Check if window scrolls    and cursor in region.
  711. X     */
  712. X    if ((!win->_scroll) ||
  713. X        (win->_cury < win->_tmarg) ||
  714. X        (win->_cury > win->_bmarg))
  715. X    {
  716. X        return( ERR );
  717. X    }
  718. X
  719. X    temp = win->_y[win->_tmarg];
  720. X    for (i = win->_tmarg; (i < win->_bmarg); i++)
  721. X    {
  722. X        win->_y[i] = win->_y[i + 1];    /* re-arrange line
  723. X                             * pointers */
  724. X        win->_firstch[i] = 0;
  725. X        win->_lastch[i] = win->_maxx - 1;
  726. X    }
  727. X
  728. X    for (ptr = temp; (ptr - temp < win->_maxx); ptr++)
  729. X        *ptr = blank;                /* make a blank line */
  730. X
  731. X    win->_y[win->_bmarg] = temp;
  732. X    if (win->_cury > win->_tmarg)            /* if not on top line */
  733. X        win->_cury--;                /* cursor scrolls too */
  734. X
  735. X    win->_firstch[win->_bmarg] = 0;
  736. X    win->_lastch[win->_bmarg] = win->_maxx - 1;
  737. X    return( OK );
  738. X}
  739. END_OF_FILE
  740.   if test 1959 -ne `wc -c <'portable/scroll.c'`; then
  741.     echo shar: \"'portable/scroll.c'\" unpacked with wrong size!
  742.   fi
  743.   # end of 'portable/scroll.c'
  744. fi
  745. if test -f 'portable/setscrrg.c' -a "${1}" != "-c" ; then 
  746.   echo shar: Will not clobber existing file \"'portable/setscrrg.c'\"
  747. else
  748.   echo shar: Extracting \"'portable/setscrrg.c'\" \(1860 characters\)
  749.   sed "s/^X//" >'portable/setscrrg.c' <<'END_OF_FILE'
  750. X#define    CURSES_LIBRARY    1
  751. X#include <curses.h>
  752. X#undef    setscrreg
  753. X
  754. X#ifndef    NDEBUG
  755. Xchar *rcsid_setscrrg = "$Header: c:/curses/portable/RCS/setscrrg.c%v 2.0 1992/11/15 03:29:15 MH Rel $";
  756. X#endif
  757. X
  758. X
  759. X
  760. X
  761. X/*man-start*********************************************************************
  762. X
  763. X  setscrreg()    - set scrolling region
  764. X
  765. X  X/Open Description:    setscrreg(), wsetscrreg()
  766. X     These functions allow the suer to set a software scrolling region
  767. X     in a window.  The parameters 'top' and 'bot' are the line numbers
  768. X     of the top and bottom margin of the scrolling region.  (Line 0 is
  769. X     the top line of the window.)  If this option and scrollok() are
  770. X     enabled, an attempt to move off the bottom margin will cause all
  771. X     lines in the scrolling region to scroll up one line.  Only the
  772. X     text of the window is scrolled.
  773. X
  774. X  PDCurses Description:
  775. X     PDCurses implements the standard OK and ERR return values.
  776. X
  777. X     FYI: setscrreg() is also defined as a macro.
  778. X
  779. X  X/Open Return Value:
  780. X     No return values are defined for these functions.
  781. X
  782. X  PDCurses Errors:
  783. X     It is an error to pass a NULL WINDOW pointer.
  784. X     The top and bottom coordinates must be inside the passed window
  785. X     and must bound the window's cursor position.  e.g.  The cursor
  786. X     cannot be above or below the top or bottom margins.
  787. X
  788. X  Portability:
  789. X     PDCurses    int setscrreg( int top, int bottom );
  790. X     X/Open Dec '88    int setscrreg( int top, int bottom );
  791. X     SysV Curses    int setscrreg( int top, int bottom );
  792. X     BSD Curses    int setscrreg( int top, int bottom );
  793. X
  794. X**man-end**********************************************************************/
  795. X
  796. Xint    setscrreg(int top, int bottom)
  797. X{
  798. X    if (stdscr == (WINDOW *)NULL)
  799. X        return (ERR);
  800. X
  801. X    if ((0 <= top) &&
  802. X        (top <= stdscr->_cury) &&
  803. X        (stdscr->_cury <= bottom) &&
  804. X        (bottom < LINES))
  805. X    {
  806. X        stdscr->_tmarg = top;
  807. X        stdscr->_bmarg = bottom;
  808. X        return (OK);
  809. X    }
  810. X    else
  811. X    {
  812. X        return (ERR);
  813. X    }
  814. X}
  815. END_OF_FILE
  816.   if test 1860 -ne `wc -c <'portable/setscrrg.c'`; then
  817.     echo shar: \"'portable/setscrrg.c'\" unpacked with wrong size!
  818.   fi
  819.   # end of 'portable/setscrrg.c'
  820. fi
  821. if test -f 'portable/unctrl.c' -a "${1}" != "-c" ; then 
  822.   echo shar: Will not clobber existing file \"'portable/unctrl.c'\"
  823. else
  824.   echo shar: Extracting \"'portable/unctrl.c'\" \(1843 characters\)
  825.   sed "s/^X//" >'portable/unctrl.c' <<'END_OF_FILE'
  826. X#define    CURSES_LIBRARY    1
  827. X#include <curses.h>
  828. X#undef    unctrl
  829. X
  830. X#ifndef    NDEBUG
  831. Xchar *rcsid_unctrl = "$Header: c:/curses/portable/RCS/unctrl.c%v 2.0 1992/11/15 03:29:19 MH Rel $";
  832. X#endif
  833. X
  834. X
  835. X
  836. X
  837. Xstatic char strbuf[3] = {0, 0, 0};
  838. X
  839. X/*man-start*********************************************************************
  840. X
  841. X  unctrl()    - convert character to printable form
  842. X
  843. X  X/Open Description:
  844. X     The unctrl routine expands the character c into a character
  845. X     string which is a printable representation of the character.
  846. X
  847. X     Control characters are displayed in the ^X notation.  Printing
  848. X     characters are displayed normally.
  849. X
  850. X  PDCurses Description:
  851. X     The conversion from a control character to a two-character
  852. X     sequence is done by the unctrl() function. In the BSD version
  853. X     of curses it is done by a macro, which uses a publicly
  854. X     available translation table. Some ill-behaved application
  855. X     programs use the table directly, and since it does not exist
  856. X     in this curses version such application will link with an
  857. X     error message complainting about undefined symbols.
  858. X
  859. X  X/Open Return Value:
  860. X     The unctrl() function returns OK on success and ERR on error.
  861. X
  862. X  X/Open Errors:
  863. X     No errors are defined for this function.
  864. X
  865. X  Portability:
  866. X     PDCurses    char* unctrl( chtype c );
  867. X     X/Open Dec '88    char* unctrl( chtype c );
  868. X     BSD Curses    char* unctrl( chtype c );
  869. X     SYS V Curses    char* unctrl( chtype c );
  870. X
  871. X**man-end**********************************************************************/
  872. X
  873. Xchar*    unctrl(chtype c)
  874. X{
  875. X    chtype    ic = c;
  876. X
  877. X    ic &= A_CHARTEXT;
  878. X    if (ic >= 0x20 && ic != 0x7f)        /* normal characters */
  879. X    {
  880. X        strbuf[0] = (char) ic;
  881. X        strbuf[1] = '\0';
  882. X        return( strbuf );
  883. X    }
  884. X    strbuf[0] = '^';    /* '^' prefix */
  885. X    if (c == 0x7f)
  886. X    {
  887. X        /*
  888. X         * 0x7f == DEL
  889. X         */
  890. X        strbuf[1] = '?';
  891. X    }
  892. X    else
  893. X    {
  894. X        /*
  895. X         * other control
  896. X         */
  897. X        strbuf[1] = (char)(ic + '@');
  898. X    }
  899. X    return( strbuf );
  900. X}
  901. END_OF_FILE
  902.   if test 1843 -ne `wc -c <'portable/unctrl.c'`; then
  903.     echo shar: \"'portable/unctrl.c'\" unpacked with wrong size!
  904.   fi
  905.   # end of 'portable/unctrl.c'
  906. fi
  907. if test -f 'portable/wclrtobo.c' -a "${1}" != "-c" ; then 
  908.   echo shar: Will not clobber existing file \"'portable/wclrtobo.c'\"
  909. else
  910.   echo shar: Extracting \"'portable/wclrtobo.c'\" \(1876 characters\)
  911.   sed "s/^X//" >'portable/wclrtobo.c' <<'END_OF_FILE'
  912. X#define    CURSES_LIBRARY    1
  913. X#include <curses.h>
  914. X#undef    wclrtobot
  915. X
  916. X#ifndef    NDEBUG
  917. Xchar *rcsid_wclrtobo = "$Header: c:/curses/portable/RCS/wclrtobo.c%v 2.0 1992/11/15 03:28:56 MH Rel $";
  918. X#endif
  919. X
  920. X
  921. X
  922. X
  923. X/*man-start*********************************************************************
  924. X
  925. X  wclrtobot()    - erase window
  926. X
  927. X  X/Open Description:
  928. X     All lines below the cursor in this window are erased.  The current
  929. X     line to the right of the cursor, inclusive, is also erased.
  930. X
  931. X     NOTE:  clrtobot() is a macro.
  932. X
  933. X  PDCurses Description:
  934. X     There is no additional PDCurses functionality.
  935. X
  936. X  X/Open Return Value:
  937. X     The wclrtobot() function returns OK on success and ERR on error.
  938. X
  939. X  PDCurses Errors:
  940. X     It is an error to call this function with a NULL window pointer.
  941. X
  942. X  Portability:
  943. X     PDCurses    int wclrtobot( WINDOW* win );
  944. X     X/Open Dec '88    int wclrtobot( WINDOW* win );
  945. X     BSD Curses    int wclrtobot( WINDOW* win );
  946. X     SYS V Curses    int wclrtobot( WINDOW* win );
  947. X
  948. X**man-end**********************************************************************/
  949. X
  950. Xint    wclrtobot(WINDOW *win)
  951. X{
  952. X    int    y;
  953. X    int    minx;
  954. Xstatic    int    startx;
  955. Xstatic    chtype    blank;
  956. Xstatic    chtype*    ptr;
  957. Xstatic    chtype*    end;
  958. Xstatic    chtype*    maxx;
  959. X
  960. X    if  (win == (WINDOW *)NULL)
  961. X        return( ERR );
  962. X
  963. X    blank    = win->_blank | win->_attrs;
  964. X    startx    = win->_curx;
  965. X
  966. X    for (y = win->_cury; y <= win->_bmarg; y++)
  967. X    {
  968. X        minx    = _NO_CHANGE;
  969. X        end    = &win->_y[y][win->_maxx - 1];
  970. X        for (ptr = &win->_y[y][startx]; ptr <= end; ptr++)
  971. X        {
  972. X            if (*ptr != blank)
  973. X            {
  974. X                maxx = ptr;
  975. X                if (minx == _NO_CHANGE)
  976. X                {
  977. X                    minx = (int) (ptr - win->_y[y]);
  978. X                }
  979. X                *ptr = blank;
  980. X            }
  981. X        }
  982. X        if (minx != _NO_CHANGE)
  983. X        {
  984. X            if ((win->_firstch[y] > minx) ||
  985. X                (win->_firstch[y] == _NO_CHANGE))
  986. X            {
  987. X                win->_firstch[y] = minx;
  988. X                if (win->_lastch[y] < maxx - win->_y[y])
  989. X                {
  990. X                    win->_lastch[y] = (int) (maxx - win->_y[y]);
  991. X                }
  992. X            }
  993. X        }
  994. X        startx = 0;
  995. X    }
  996. X    return( OK );
  997. X}
  998. END_OF_FILE
  999.   if test 1876 -ne `wc -c <'portable/wclrtobo.c'`; then
  1000.     echo shar: \"'portable/wclrtobo.c'\" unpacked with wrong size!
  1001.   fi
  1002.   # end of 'portable/wclrtobo.c'
  1003. fi
  1004. if test -f 'portable/wclrtoeo.c' -a "${1}" != "-c" ; then 
  1005.   echo shar: Will not clobber existing file \"'portable/wclrtoeo.c'\"
  1006. else
  1007.   echo shar: Extracting \"'portable/wclrtoeo.c'\" \(1838 characters\)
  1008.   sed "s/^X//" >'portable/wclrtoeo.c' <<'END_OF_FILE'
  1009. X#define    CURSES_LIBRARY    1
  1010. X#include <curses.h>
  1011. X#undef    wclrtoeol
  1012. X
  1013. X#ifndef    NDEBUG
  1014. Xchar *rcsid_wclrtoeo = "$Header: c:/curses/portable/RCS/wclrtoeo.c%v 2.0 1992/11/15 03:29:03 MH Rel $";
  1015. X#endif
  1016. X
  1017. X
  1018. X
  1019. X
  1020. X/*man-start*********************************************************************
  1021. X
  1022. X  wclrtoeol()    - erase line to right of cursor in window
  1023. X
  1024. X  X/Open Description:
  1025. X     The current line to the right of the cursor, inclusive, is erased.
  1026. X
  1027. X     NOTE: clrtoeol() is a macro.
  1028. X
  1029. X  PDCurses Description:
  1030. X     In addition to the X/Open specification, there also exist
  1031. X     mv[w]clrtoeol() versions which first position the cursor
  1032. X     then perform the [w]clrtoeol call.
  1033. X
  1034. X  X/Open Return Value:
  1035. X     The wclrtoeol() function returns OK on success and ERR on error.
  1036. X
  1037. X  PDCurses Errors:
  1038. X     It is an error to call this function with a NULL window pointer.
  1039. X
  1040. X  Portability:
  1041. X     PDCurses    int wclrtoeol( WINDOW* win );
  1042. X     X/Open Dec '88    int wclrtoeol( WINDOW* win );
  1043. X     BSD Curses    int wclrtoeol( WINDOW* win );
  1044. X     SYS V Curses    int wclrtoeol( WINDOW* win );
  1045. X
  1046. X**man-end**********************************************************************/
  1047. X
  1048. Xint    wclrtoeol(WINDOW *win)
  1049. X{
  1050. X    int    y;
  1051. X    int    x;
  1052. X    int    minx;
  1053. X    chtype    blank;
  1054. X    chtype*    maxx;
  1055. X    chtype*    ptr;
  1056. X    chtype*    end;
  1057. X
  1058. X    if (win == (WINDOW *)NULL)
  1059. X        return( ERR );
  1060. X
  1061. X    y    = win->_cury;
  1062. X    x    = win->_curx;
  1063. X    blank    = win->_blank | win->_attrs;
  1064. X    end    = &win->_y[y][win->_maxx - 1];
  1065. X    minx    = _NO_CHANGE;
  1066. X    maxx    = &win->_y[y][x];
  1067. X
  1068. X    for (ptr = maxx; ptr <= end; ptr++)
  1069. X    {
  1070. X        if (*ptr != blank)
  1071. X        {
  1072. X            maxx = ptr;
  1073. X            if (minx == _NO_CHANGE)
  1074. X            {
  1075. X                minx = (int) (ptr - win->_y[y]);
  1076. X            }
  1077. X            *ptr = blank;
  1078. X        }
  1079. X    }
  1080. X
  1081. X    if (minx != _NO_CHANGE)
  1082. X    {
  1083. X        if ((win->_firstch[y] > minx) ||
  1084. X            (win->_firstch[y] == _NO_CHANGE))
  1085. X        {
  1086. X            win->_firstch[y] = minx;
  1087. X        }
  1088. X        if (win->_lastch[y] < maxx - win->_y[y])
  1089. X        {
  1090. X            win->_lastch[y] = (int) (maxx - win->_y[y]);
  1091. X        }
  1092. X    }
  1093. X    return( OK );
  1094. X}
  1095. END_OF_FILE
  1096.   if test 1838 -ne `wc -c <'portable/wclrtoeo.c'`; then
  1097.     echo shar: \"'portable/wclrtoeo.c'\" unpacked with wrong size!
  1098.   fi
  1099.   # end of 'portable/wclrtoeo.c'
  1100. fi
  1101. if test -f 'portable/winch.c' -a "${1}" != "-c" ; then 
  1102.   echo shar: Will not clobber existing file \"'portable/winch.c'\"
  1103. else
  1104.   echo shar: Extracting \"'portable/winch.c'\" \(1677 characters\)
  1105.   sed "s/^X//" >'portable/winch.c' <<'END_OF_FILE'
  1106. X#define    CURSES_LIBRARY    1
  1107. X#include <curses.h>
  1108. X#undef    winch
  1109. X
  1110. X#ifndef    NDEBUG
  1111. Xchar *rcsid_winch = "$Header: c:/curses/portable/RCS/winch.c%v 2.0 1992/11/15 03:29:08 MH Rel $";
  1112. X#endif
  1113. X
  1114. X
  1115. X
  1116. X
  1117. X/*man-start*********************************************************************
  1118. X
  1119. X  winch()    - return character from window
  1120. X
  1121. X  X/Open Description:
  1122. X     The character at the current position in the named window is
  1123. X     returned.  If any attributes are set for that position, their
  1124. X     values will be bitwise-OR'ed into the value returned.  The
  1125. X     pre-defined constants A_CHARTEXT and A_ATTRIBUTES, defined in
  1126. X     <curses.h>, can be used with the & (bitwise-AND) operator to
  1127. X     extract the character or attribute alone.
  1128. X
  1129. X     NOTE: inch(), winch(), mvinch() and mvwinch() are macros.
  1130. X
  1131. X  PDCurses Description:
  1132. X     There is no additional PDCurses functionality.  This routine
  1133. X     is here as a documentation placeholder.  No code will be
  1134. X     executed in this module, unless the user #undefs winch.
  1135. X
  1136. X  X/Open Return Value:
  1137. X     Upon successfull completion, the inch(), mvinch(), mvwinch(),
  1138. X     and winch() functions return the character at the selected
  1139. X     position.  Otherwise, the mvinch() and mvwinch() functions
  1140. X     return ERR.
  1141. X
  1142. X  PDCurses Errors:
  1143. X     It is an error to call this function with a NULL window pointer.
  1144. X     It is also an error to address a position that is outside the
  1145. X     bounds of the specified window.
  1146. X
  1147. X  Portability:
  1148. X     PDCurses    chtype winch( WINDOW* win );
  1149. X     X/Open Dec '88    chtype winch( WINDOW* win );
  1150. X     BSD Curses    
  1151. X     SYS V Curses    int winch( WINDOW* win );
  1152. X
  1153. X**man-end**********************************************************************/
  1154. X
  1155. Xchtype    winch(WINDOW *win)
  1156. X{
  1157. X    return( win->_y[win->_cury][win->_curx] );
  1158. X}
  1159. END_OF_FILE
  1160.   if test 1677 -ne `wc -c <'portable/winch.c'`; then
  1161.     echo shar: \"'portable/winch.c'\" unpacked with wrong size!
  1162.   fi
  1163.   # end of 'portable/winch.c'
  1164. fi
  1165. if test -f 'portable/wsetscrr.c' -a "${1}" != "-c" ; then 
  1166.   echo shar: Will not clobber existing file \"'portable/wsetscrr.c'\"
  1167. else
  1168.   echo shar: Extracting \"'portable/wsetscrr.c'\" \(1922 characters\)
  1169.   sed "s/^X//" >'portable/wsetscrr.c' <<'END_OF_FILE'
  1170. X#define    CURSES_LIBRARY    1
  1171. X#include <curses.h>
  1172. X#undef    wsetscrreg
  1173. X
  1174. X#ifndef    NDEBUG
  1175. Xchar *rcsid_wsetscrr = "$Header: c:/curses/portable/RCS/wsetscrr.c%v 2.0 1992/11/15 03:29:29 MH Rel $";
  1176. X#endif
  1177. X
  1178. X
  1179. X
  1180. X
  1181. X/*man-start*********************************************************************
  1182. X
  1183. X  wsetscrreg()    - set scrolling region
  1184. X
  1185. X  X/Open Description:    setscrreg(), wsetscrreg()
  1186. X     These functions allow the suer to set a software scrolling region
  1187. X     in a window.  The parameters 'top' and 'bot' are the line numbers
  1188. X     of the top and bottom margin of the scrolling region.  (Line 0 is
  1189. X     the top line of the window.)  If this option and scrollok() are
  1190. X     enabled, an attempt to move off the bottom margin will cause all
  1191. X     lines in the scrolling region to scroll up one line.  Only the
  1192. X     text of the window is scrolled.
  1193. X
  1194. X  PDCurses Description:
  1195. X     PDCurses implements the standard OK and ERR return values.
  1196. X
  1197. X     FYI: setscrreg() is also defined as a macro.
  1198. X
  1199. X  X/Open Return Value:
  1200. X     No return values are defined for these functions.
  1201. X
  1202. X  PDCurses Errors:
  1203. X     It is an error to pass a NULL WINDOW pointer.
  1204. X     The top and bottom coordinates must be inside the passed window
  1205. X     and must bound the window's cursor position.  e.g.  The cursor
  1206. X     cannot be above or below the top or bottom margins.
  1207. X
  1208. X  Portability:
  1209. X     PDCurses    int wsetscrreg( WINDOW* win, int top, int bottom );
  1210. X     X/Open Dec '88    int wsetscrreg( WINDOW* win, int top, int bottom );
  1211. X     SysV Curses    int wsetscrreg( WINDOW* win, int top, int bottom );
  1212. X     BSD Curses    int wsetscrreg( WINDOW* win, int top, int bottom );
  1213. X
  1214. X**man-end**********************************************************************/
  1215. X
  1216. Xint    wsetscrreg(WINDOW *win, int top, int bottom)
  1217. X{
  1218. X    if (win == (WINDOW *)NULL)
  1219. X        return (ERR);
  1220. X
  1221. X    if ((0 <= top) &&
  1222. X        (top <= win->_cury) &&
  1223. X        (win->_cury <= bottom) &&
  1224. X        (bottom < win->_maxy))
  1225. X    {
  1226. X        win->_tmarg = top;
  1227. X        win->_bmarg = bottom;
  1228. X        return (OK);
  1229. X    }
  1230. X    else
  1231. X    {
  1232. X        return (ERR);
  1233. X    }
  1234. X}
  1235. END_OF_FILE
  1236.   if test 1922 -ne `wc -c <'portable/wsetscrr.c'`; then
  1237.     echo shar: \"'portable/wsetscrr.c'\" unpacked with wrong size!
  1238.   fi
  1239.   # end of 'portable/wsetscrr.c'
  1240. fi
  1241. if test -f 'private/_addwin.c' -a "${1}" != "-c" ; then 
  1242.   echo shar: Will not clobber existing file \"'private/_addwin.c'\"
  1243. else
  1244.   echo shar: Extracting \"'private/_addwin.c'\" \(2004 characters\)
  1245.   sed "s/^X//" >'private/_addwin.c' <<'END_OF_FILE'
  1246. X#ifndef NO_MEMORY_H
  1247. X#include <memory.h>
  1248. X#endif
  1249. X#define    CURSES_LIBRARY    1
  1250. X#include <curses.h>
  1251. X
  1252. X#ifdef    REGISTERWINDOWS
  1253. X#ifndef NDEBUG
  1254. Xchar *rcsid__addwin = "$Header: c:/curses/private/RCS/_addwin.c%v 2.0 1992/11/15 03:24:18 MH Rel $";
  1255. X#endif
  1256. X
  1257. X
  1258. X
  1259. X
  1260. X/*man-start*********************************************************************
  1261. X
  1262. X  PDC_addwin()    - adds window
  1263. X
  1264. X  PDCurses Description:
  1265. X     This routine adds the passed window pointer after the specified
  1266. X     window.     If the specified window is NULL, then the passed
  1267. X     window pointer is inserted first in the list.
  1268. X
  1269. X     If the 'after' window is not on the visible list, then 'win'
  1270. X     will be added to the end of the list.
  1271. X
  1272. X  PDCurses Return Value:
  1273. X     This routine will return OK upon success and otherwise ERR will be
  1274. X     returned.
  1275. X
  1276. X  PDCurses Errors:
  1277. X     An error will occur if we are unable to allocate a new WINDS
  1278. X     structure.
  1279. X
  1280. X  Portability:
  1281. X     PDCurses    int    PDC_addwin( WINDOW* win, WINDOW* after );
  1282. X
  1283. X**man-end**********************************************************************/
  1284. X
  1285. Xint    _addwin(WINDOW *win, WINDOW *after)
  1286. X{
  1287. Xextern    void*    (*mallc)( size_t );
  1288. Xextern    void*    (*callc)( size_t, size_t );
  1289. Xextern    void    (*fre)( void* );
  1290. X
  1291. X    WINDS  *root = _cursvar.visible;
  1292. X    WINDS  *wlst = PDC_findwin(after);
  1293. X    WINDS  *new  = (*mallc)(sizeof(WINDS));
  1294. X
  1295. X    if (new == (WINDOW *)NULL)
  1296. X        return( ERR );
  1297. X
  1298. X    PDC_rmwin(win);
  1299. X    memset(new, 0, sizeof(WINDS));
  1300. X    new->w = win;
  1301. X    if (wlst == (WINDS *)NULL)
  1302. X    {
  1303. X        if (root == (WINDS *)NULL)
  1304. X            _cursvar.visible = new;
  1305. X        else
  1306. X        {
  1307. X            root->tail->next = new;
  1308. X            new->prev = root->tail;
  1309. X            root->tail = new;
  1310. X        }
  1311. X    }
  1312. X    else
  1313. X    {
  1314. X        if (root->next == NULL)
  1315. X        {
  1316. X            root->next = new;
  1317. X            new->prev = root;
  1318. X        }
  1319. X        else
  1320. X        if (wlst == root->tail)
  1321. X        {
  1322. X            root->tail->next = new;
  1323. X            new->prev = root->tail;
  1324. X            root->tail = new;
  1325. X        }
  1326. X        else
  1327. X        {
  1328. X            new->prev = wlst;
  1329. X            new->next = wlst->next;
  1330. X            if (wlst->next == NULL)
  1331. X            {
  1332. X                wlst->next = new;
  1333. X                root->tail = new;
  1334. X            }
  1335. X            else
  1336. X            {
  1337. X                wlst->next->prev = new;
  1338. X                wlst->next = new;
  1339. X            }
  1340. X        }
  1341. X    }
  1342. X    return( OK );
  1343. X}
  1344. X#endif
  1345. END_OF_FILE
  1346.   if test 2004 -ne `wc -c <'private/_addwin.c'`; then
  1347.     echo shar: \"'private/_addwin.c'\" unpacked with wrong size!
  1348.   fi
  1349.   # end of 'private/_addwin.c'
  1350. fi
  1351. if test -f 'private/_chgattr.c' -a "${1}" != "-c" ; then 
  1352.   echo shar: Will not clobber existing file \"'private/_chgattr.c'\"
  1353. else
  1354.   echo shar: Extracting \"'private/_chgattr.c'\" \(1656 characters\)
  1355.   sed "s/^X//" >'private/_chgattr.c' <<'END_OF_FILE'
  1356. X#define    CURSES_LIBRARY    1
  1357. X#include <curses.h>
  1358. X
  1359. X#ifndef    NDEBUG
  1360. Xchar *rcsid__chgattr = "$Header: c:/curses/private/RCS/_chgattr.c%v 2.0 1992/11/15 03:24:20 MH Rel $";
  1361. X#endif
  1362. X
  1363. X
  1364. X
  1365. X
  1366. X/*man-start*********************************************************************
  1367. X
  1368. X  PDC_chg_attrs()    - Change attributes in a rectangle
  1369. X
  1370. X  PDCurses Description:
  1371. X     This routine will change the attribute(s) from a starting (y,x)
  1372. X     position to an ending (y,x) position to the specified attribute.
  1373. X
  1374. X  PDCurses Return Value:
  1375. X     This function returns OK on success and ERR on error.
  1376. X
  1377. X  PDCurses Errors:
  1378. X     It is an error to call this function with a NULL window pointer.
  1379. X     It is also an error to pass rectangular coordinates that lay
  1380. X     outside of window.
  1381. X
  1382. X  Portability:
  1383. X     PDCurses    int PDC_chg_attrs( WINDOW* w, chtype attr,
  1384. X                     int sy, int sx,
  1385. X                     int ey, int ex );
  1386. X
  1387. X**man-end**********************************************************************/
  1388. X
  1389. Xint    PDC_chg_attrs(WINDOW *w, chtype attr, int sy, int sx, int ey, int ex)
  1390. X{
  1391. X    chtype    oldattr = w->_attrs;
  1392. X    int    c;
  1393. X    int    l;
  1394. X
  1395. X    if (w == (WINDOW *)NULL)        return( ERR );
  1396. X    if (sy > w->_maxy)    return( ERR );
  1397. X    if (sx > w->_maxx)    return( ERR );
  1398. X    if (ey >= w->_maxy)    ey = w->_maxy - 1;
  1399. X    if (ex >= w->_maxx)    ex = w->_maxx - 1;
  1400. X
  1401. X    wattrset(w, attr);
  1402. X    for (l = sy; l <= ey; l++)
  1403. X    {
  1404. X        for (c = sx; c <= ex; c++)
  1405. X            w->_y[l][c] = (w->_y[l][c] & A_CHARTEXT) | attr;
  1406. X
  1407. X        if (w->_firstch[l] == _NO_CHANGE)
  1408. X        {
  1409. X            w->_firstch[l] = sx;
  1410. X            w->_lastch[l] = ex;
  1411. X        }
  1412. X        else
  1413. X        if (w->_firstch[l] != _NO_CHANGE)
  1414. X        {
  1415. X            if (sx < w->_firstch[l])
  1416. X                w->_firstch[l] = sx;
  1417. X            if (ex > w->_lastch[l])
  1418. X                w->_lastch[l] = ex;
  1419. X        }
  1420. X    }
  1421. X    w->_attrs = oldattr;
  1422. X    return( OK );
  1423. X}
  1424. END_OF_FILE
  1425.   if test 1656 -ne `wc -c <'private/_chgattr.c'`; then
  1426.     echo shar: \"'private/_chgattr.c'\" unpacked with wrong size!
  1427.   fi
  1428.   # end of 'private/_chgattr.c'
  1429. fi
  1430. if test -f 'private/_fixcurs.c' -a "${1}" != "-c" ; then 
  1431.   echo shar: Will not clobber existing file \"'private/_fixcurs.c'\"
  1432. else
  1433.   echo shar: Extracting \"'private/_fixcurs.c'\" \(1915 characters\)
  1434.   sed "s/^X//" >'private/_fixcurs.c' <<'END_OF_FILE'
  1435. X#define    CURSES_LIBRARY    1
  1436. X#include <curses.h>
  1437. X
  1438. X#ifndef    NDEBUG
  1439. Xchar *rcsid__fixcurs = "$Header: c:/curses/private/RCS/_fixcurs.c%v 2.0 1992/11/15 03:24:21 MH Rel $";
  1440. X#endif
  1441. X
  1442. X
  1443. X
  1444. X
  1445. X/*man-start*********************************************************************
  1446. X
  1447. X  PDC_fix_cursor()    - Fix the cursor start and stop scan lines (if necessary)
  1448. X
  1449. X  PDCurses Description:
  1450. X     This is a private PDCurses routine.
  1451. X
  1452. X     This routine will fix the cursor shape for certain video adapters.
  1453. X     Normally, the values used are correct, but some adapters choke.
  1454. X     The most noticable choke is on a monochrome adapter.  The "correct"
  1455. X     scan lines will result in the cursor being set in the middle of the
  1456. X     character cell, rather than at the bottom.
  1457. X
  1458. X     The passed flag indicates whether the cursor is visible or not.
  1459. X
  1460. X     This only applies to the DOS platform.
  1461. X
  1462. X  PDCurses Return Value:
  1463. X     This function returns OK on success and ERR on error.
  1464. X
  1465. X  PDCurses Errors:
  1466. X     No errors are defined for this function.
  1467. X
  1468. X  Portability:
  1469. X     PDCurses    int PDC_fix_cursor( int flag );
  1470. X
  1471. X**man-end**********************************************************************/
  1472. X
  1473. Xint    PDC_fix_cursor(int flag)
  1474. X{
  1475. X#ifdef    FLEXOS
  1476. X    return( OK );
  1477. X#endif
  1478. X#ifdef    DOS
  1479. X    char far*    INFO = (char far *) 0x0487L;
  1480. X
  1481. X    if (_cursvar.bogus_adapter)
  1482. X        return( OK );
  1483. X
  1484. X    switch (_cursvar.adapter)
  1485. X    {
  1486. X    case _EGACOLOR:
  1487. X    case _EGAMONO:
  1488. X    case _MDS_GENIUS:        /* Some clones look like a Genius;-)  */
  1489. X        if (flag & 0x01)
  1490. X            *INFO |= 0x01;            /* Enable  emnulation */
  1491. X        else
  1492. X            *INFO &= (*INFO & ~0x01);    /* Disable emnulation */
  1493. X        break;
  1494. X
  1495. X    case _VGACOLOR:
  1496. X    case _VGAMONO:
  1497. X        if (flag & 0x01)
  1498. X            regs.x.ax = 0x1200;        /* Enable  emulation */
  1499. X        else
  1500. X            regs.x.ax = 0x1201;        /* Disable emulation */
  1501. X        regs.h.bl = 0x34;
  1502. X        int86(0x10, ®s, ®s);
  1503. X
  1504. X        break;
  1505. X
  1506. X    case _MCGACOLOR:
  1507. X    case _MCGAMONO:
  1508. X    case _MDA:
  1509. X    case _CGA:
  1510. X    case _NONE:
  1511. X    default:
  1512. X        break;
  1513. X    }
  1514. X    return( OK );
  1515. X#endif
  1516. X#ifdef     OS2
  1517. X        return( OK );
  1518. X#endif
  1519. X}
  1520. END_OF_FILE
  1521.   if test 1915 -ne `wc -c <'private/_fixcurs.c'`; then
  1522.     echo shar: \"'private/_fixcurs.c'\" unpacked with wrong size!
  1523.   fi
  1524.   # end of 'private/_fixcurs.c'
  1525. fi
  1526. if test -f 'private/_getcbrk.c' -a "${1}" != "-c" ; then 
  1527.   echo shar: Will not clobber existing file \"'private/_getcbrk.c'\"
  1528. else
  1529.   echo shar: Extracting \"'private/_getcbrk.c'\" \(1949 characters\)
  1530.   sed "s/^X//" >'private/_getcbrk.c' <<'END_OF_FILE'
  1531. X#define    CURSES_LIBRARY    1
  1532. X#define NEEDS_OS2       1
  1533. X#include <curses.h>
  1534. X
  1535. X#ifndef    NDEBUG
  1536. Xchar *rcsid__getcbrk = "$Header: c:/curses/private/RCS/_getcbrk.c%v 2.0 1992/11/15 03:24:20 MH Rel $";
  1537. X#endif
  1538. X
  1539. X#ifdef OS2
  1540. X#  if defined(CURSES__32BIT__) || defined (CSET2)
  1541. X#     include <signal.h>
  1542. X#  else
  1543. X#     define INCL_DOSSIGNALS
  1544. X#     define INCL_NOCOMMON
  1545. X#     include <bsedos.h>
  1546. X#  endif
  1547. X#endif
  1548. X
  1549. X
  1550. X/*man-start*********************************************************************
  1551. X
  1552. X  PDC_get_ctrl_break()    - return OS control break state
  1553. X
  1554. X  PDCurses Description:
  1555. X     This is a private PDCurses routine.
  1556. X
  1557. X     Returns the current OS Control Break Check state.
  1558. X
  1559. X  PDCurses Return Value:
  1560. X     DOS:
  1561. X         This function returns TRUE on if the Control Break
  1562. X         Check is enabled otherwise FALSE is returned.
  1563. X
  1564. X     FLEXOS:
  1565. X         This function returns TRUE on if the Keyboard Mode
  1566. X         allows a break to bre reported otherwise FALSE is returned.
  1567. X
  1568. X  PDCurses Errors:
  1569. X     No errors are defined for this function.
  1570. X
  1571. X  Portability:
  1572. X     PDCurses    bool    PDC_get_ctrl_break( void );
  1573. X
  1574. X**man-end**********************************************************************/
  1575. X
  1576. Xbool    PDC_get_ctrl_break(void)
  1577. X{
  1578. X#ifdef    FLEXOS
  1579. X    return ((kbmode & 0x01) ? TRUE : FALSE);
  1580. X#endif
  1581. X#ifdef    DOS
  1582. X    regs.h.ah = 0x33;
  1583. X    regs.h.al = 0x00;
  1584. X    int86(0x21, ®s, ®s);
  1585. X    return ((bool) regs.h.dl);
  1586. X#endif
  1587. X#ifdef    OS2
  1588. X#  if defined(CURSES__32BIT__) || defined(CSET2)
  1589. X    void (*oldAction) (int);
  1590. X    oldAction = signal (SIGINT, SIG_DFL);
  1591. X    if (oldAction == SIG_ERR) return FALSE;
  1592. X    else signal (SIGINT, oldAction);
  1593. X    return (oldAction != SIG_IGN);
  1594. X#  else
  1595. X    PFNSIGHANDLER oldHandler, oldHandler1;
  1596. X    USHORT oldAction, oldAction1;
  1597. X    /* get the current state, and set to ignore */
  1598. X    DosSetSigHandler((PFNSIGHANDLER) NULL, &oldHandler, &oldAction,
  1599. X        SIGA_IGNORE, SIG_CTRLBREAK);
  1600. X    /* restore the previous state */
  1601. X    DosSetSigHandler(oldHandler, &oldHandler1, &oldAction1,
  1602. X        oldAction, SIG_CTRLBREAK);
  1603. X    return(oldAction != SIGA_IGNORE);
  1604. X#  endif
  1605. X#endif
  1606. X}
  1607. END_OF_FILE
  1608.   if test 1949 -ne `wc -c <'private/_getcbrk.c'`; then
  1609.     echo shar: \"'private/_getcbrk.c'\" unpacked with wrong size!
  1610.   fi
  1611.   # end of 'private/_getcbrk.c'
  1612. fi
  1613. if test -f 'private/_rawgetc.c' -a "${1}" != "-c" ; then 
  1614.   echo shar: Will not clobber existing file \"'private/_rawgetc.c'\"
  1615. else
  1616.   echo shar: Extracting \"'private/_rawgetc.c'\" \(1992 characters\)
  1617.   sed "s/^X//" >'private/_rawgetc.c' <<'END_OF_FILE'
  1618. X#define    CURSES_LIBRARY    1
  1619. X#include <curses.h>
  1620. X
  1621. X#ifndef    NDEBUG
  1622. Xchar *rcsid__rawgetc = "$Header: c:/curses/private/RCS/_rawgetc.c%v 2.0 1992/11/15 03:24:31 MH Rel $";
  1623. X#endif
  1624. X
  1625. X
  1626. X
  1627. X
  1628. X/*man-start*********************************************************************
  1629. X
  1630. X  PDC_rawgetch()    - Returns the next uninterpreted character (if available).
  1631. X
  1632. X  PDCurses Description:
  1633. X     Gets a character without any interpretation at all and returns
  1634. X     it. If keypad mode is active for the designated window,
  1635. X     function key translation will be performed.  Otherwise,
  1636. X     function keys are ignored.  If nodelay mode is active in the
  1637. X     window, then PDC_rawgetch() returns -1 if no character is
  1638. X     available.
  1639. X
  1640. X     WARNING:  It is unknown whether the FUNCTION key translation
  1641. X           is performed at this level. --Frotz 911130 BUG
  1642. X
  1643. X  PDCurses Return Value:
  1644. X     This function returns OK on success and ERR on error.
  1645. X
  1646. X  PDCurses Errors:
  1647. X     No errors are defined for this function.
  1648. X
  1649. X  Portability:
  1650. X     PDCurses    int    PDC_rawgetch( void );
  1651. X
  1652. X**man-end**********************************************************************/
  1653. X
  1654. Xint    PDC_rawgetch(void)
  1655. X{
  1656. Xextern    int    c_pindex;            /* putter index */
  1657. Xextern    int    c_gindex;            /* getter index */
  1658. Xextern    int    c_ungind;            /* wungetch() push index */
  1659. Xextern    chtype    c_ungch[NUNGETCH];        /* array of ungotten chars */
  1660. Xextern    WINDOW*    _getch_win_;
  1661. X/* extern    WINDOW*    w;*/   /* w defined in wgetch() as static - _getch_win_ */
  1662. X                        /* is the same window - all references to w changed*/
  1663. X                        /* to _getch_win_ - marked with @@ */
  1664. X
  1665. X    signed    c;
  1666. X    signed    oldc;
  1667. X
  1668. X    if (_getch_win_ == (WINDOW *)NULL)   /* @@ */
  1669. X        return( -1 );
  1670. X
  1671. X    if (_getch_win_->_nodelay && !typeahead(stdin)) /* @@ */
  1672. X        return( -1 );
  1673. X
  1674. X    while (1)        /* loop to get valid char */
  1675. X    {
  1676. X        c = PDC_get_bios_key();
  1677. X        oldc = c;
  1678. X        /*
  1679. X         * Return the key if it is not a special key.
  1680. X         */
  1681. X        if ((c = PDC_validchar(c)) >= 0)
  1682. X        {        /* get & check next char */
  1683. X            return( c );
  1684. X        }
  1685. X        if (_getch_win_->_use_keypad)
  1686. X            return( oldc );
  1687. X    }
  1688. X}
  1689. END_OF_FILE
  1690.   if test 1992 -ne `wc -c <'private/_rawgetc.c'`; then
  1691.     echo shar: \"'private/_rawgetc.c'\" unpacked with wrong size!
  1692.   fi
  1693.   # end of 'private/_rawgetc.c'
  1694. fi
  1695. if test -f 'private/_setcrsr.c' -a "${1}" != "-c" ; then 
  1696.   echo shar: Will not clobber existing file \"'private/_setcrsr.c'\"
  1697. else
  1698.   echo shar: Extracting \"'private/_setcrsr.c'\" \(1880 characters\)
  1699.   sed "s/^X//" >'private/_setcrsr.c' <<'END_OF_FILE'
  1700. X#define    CURSES_LIBRARY    1
  1701. X#include <curses.h>
  1702. X
  1703. X#ifndef    NDEBUG
  1704. Xchar *rcsid__setcrsr = "$Header: c:/curses/private/RCS/_setcrsr.c%v 2.0 1992/11/15 03:24:36 MH Rel $";
  1705. X#endif
  1706. X
  1707. X
  1708. X
  1709. X
  1710. X/*man-start*********************************************************************
  1711. X
  1712. X  PDC_set_cursor_mode()    - Set the cursor start and stop scan lines.
  1713. X
  1714. X  PDCurses Description:
  1715. X     Sets the cursor type to begin in scan line startrow and end in
  1716. X     scan line endrow.  Both values should be 0-31.
  1717. X
  1718. X  PDCurses Return Value:
  1719. X     This function returns OK on success and ERR on error.
  1720. X
  1721. X  PDCurses Errors:
  1722. X     No errors are defined for this function.
  1723. X
  1724. X  Portability:
  1725. X     PDCurses    int PDC_set_cursor_mode( int startrow, int endrow );
  1726. X
  1727. X**man-end**********************************************************************/
  1728. X
  1729. Xint    PDC_set_cursor_mode( int startrow, int endrow )
  1730. X{
  1731. X#ifdef    FLEXOS
  1732. X    /*
  1733. X     * Under FLEXOS, this routine translates the input parameters in the
  1734. X     * following way:
  1735. X     *
  1736. X     * startrow --> visible_cursor endrow     -->    cursor type:
  1737. X     * underline = 0; block = 1;
  1738. X     *
  1739. X     * VCWM_CURSOR       0x0100       bit - 8 Cursor off VCWM_BLOCK    
  1740. X     * 0x0200       bit - 9 Block Cursor    
  1741. X     *
  1742. X     */
  1743. X    unsigned short mybuff = 0;
  1744. X
  1745. X    retcode = s_getfield(T_VIRCON, VC_MODE, 1L, (void far *) &mybuff, 2L);
  1746. X    if (retcode < 0L)
  1747. X        return( ERR );
  1748. X    if (startrow)
  1749. X        mybuff &= ~VCWM_CURSOR;
  1750. X    else
  1751. X        mybuff |= VCWM_CURSOR;
  1752. X
  1753. X    if (endrow)
  1754. X        mybuff |= VCWM_BLOCK;
  1755. X    else
  1756. X        mybuff &= ~VCWM_BLOCK;
  1757. X
  1758. X    retcode = s_setfield(T_VIRCON, VC_MODE, 1L, (void far *) &mybuff, 2L);
  1759. X    return( (retcode < 0L) ? ERR : OK );
  1760. X#endif
  1761. X#ifdef    DOS
  1762. X    regs.h.ah = 0x01;
  1763. X    regs.h.ch = (unsigned char) startrow;
  1764. X    regs.h.cl = (unsigned char) endrow;
  1765. X    int86(0x10, ®s, ®s);
  1766. X    return( OK );
  1767. X#endif
  1768. X#ifdef    OS2
  1769. X    VIOCURSORINFO cursorInfo;
  1770. X
  1771. X    cursorInfo.yStart = startrow;
  1772. X    cursorInfo.cEnd = endrow;
  1773. X    cursorInfo.cx = 1;
  1774. X    cursorInfo.attr = 0;
  1775. X    return (VioSetCurType (&cursorInfo, 0) == 0);
  1776. X#endif
  1777. X}
  1778. END_OF_FILE
  1779.   if test 1880 -ne `wc -c <'private/_setcrsr.c'`; then
  1780.     echo shar: \"'private/_setcrsr.c'\" unpacked with wrong size!
  1781.   fi
  1782.   # end of 'private/_setcrsr.c'
  1783. fi
  1784. if test -f 'private/_sgetnl.c' -a "${1}" != "-c" ; then 
  1785.   echo shar: Will not clobber existing file \"'private/_sgetnl.c'\"
  1786. else
  1787.   echo shar: Extracting \"'private/_sgetnl.c'\" \(1950 characters\)
  1788.   sed "s/^X//" >'private/_sgetnl.c' <<'END_OF_FILE'
  1789. X#define    CURSES_LIBRARY    1
  1790. X#include <curses.h>
  1791. X
  1792. X#if    BUG68K
  1793. X#ifndef NDEBUG
  1794. Xchar *rcsid__sgetnl = "$Header: c:/curses/private/RCS/_sgetnl.c%v 2.0 1992/11/15 03:24:38 MH Rel $";
  1795. X#endif
  1796. X
  1797. Xvoid c_setnl( char* );        /* conv nl -> CTRL-\ */
  1798. Xvoid c_getnl( char* );        /* conv CTRL-\ -> nl */
  1799. X/*man-start*********************************************************************
  1800. X
  1801. X  _setnl()    - BUG68K: set newline for 68000 C compiler
  1802. X
  1803. X  PDCurses Description:
  1804. X     This is a private PDCurses function.
  1805. X
  1806. X     This function circumvents a problem in the 68000 C library: If
  1807. X     the standard sprintf is used, it will ignore any newlines in
  1808. X     the format string. Therefore this routine changes the newlines
  1809. X     to CTRL-\ characters, to be restored later by the getnl()
  1810. X     function.
  1811. X
  1812. X  PDCurses Return Value:
  1813. X     This function does not return a value.
  1814. X
  1815. X  PDCurses Errors:
  1816. X     There are no defined errors for this routine.
  1817. X
  1818. X  Portability:
  1819. X     PDCurses    void    c_setnl( char* fmt );  /* BUG68K only */
  1820. X
  1821. X**man-end**********************************************************************/
  1822. X
  1823. Xvoid    _setnl(char *fmt)
  1824. X{
  1825. X    while (*fmt)
  1826. X    {
  1827. X        if (*fmt == '\n')
  1828. X            *fmt = 0x1c;
  1829. X        fmt++;
  1830. X    }
  1831. X}
  1832. X
  1833. X
  1834. X
  1835. X
  1836. X/*----------------------------------------------------------------------
  1837. X$ _getnl()    - BUG68K: get newline for 68000 C compiler
  1838. X$
  1839. X$ PDCurses Description:
  1840. X$    This is a private PDCurses function.
  1841. X$
  1842. X$    This function circumvents a problem in the 68000 C library: If
  1843. X$    the standard sprintf is used, it will ignore any newlines in
  1844. X$    the format string. Therefore this routine changes CTRL-\
  1845. X$    characters (already set by setnl()) back to newlines.
  1846. X$
  1847. X$ PDCurses Return Value:
  1848. X$    This function does not return a value.
  1849. X$
  1850. X$ PDCurses Errors:
  1851. X$    There are no defined errors for this routine.
  1852. X$
  1853. X$ Portability:
  1854. X$    PDCurses    void    c_getnl( char* fmt );  /* BUG68K only */
  1855. X$
  1856. X$----------------------------------------------------------------------
  1857. X*/
  1858. Xvoid    _getnl(fmt)
  1859. Xchar*    fmt;
  1860. X{
  1861. X    while (*fmt)
  1862. X    {
  1863. X        if (*fmt == 0x1c)
  1864. X            *fmt = '\n';
  1865. X    }
  1866. X}
  1867. X#endif
  1868. END_OF_FILE
  1869.   if test 1950 -ne `wc -c <'private/_sgetnl.c'`; then
  1870.     echo shar: \"'private/_sgetnl.c'\" unpacked with wrong size!
  1871.   fi
  1872.   # end of 'private/_sgetnl.c'
  1873. fi
  1874. if test -f 'private/_sysgetc.c' -a "${1}" != "-c" ; then 
  1875.   echo shar: Will not clobber existing file \"'private/_sysgetc.c'\"
  1876. else
  1877.   echo shar: Extracting \"'private/_sysgetc.c'\" \(1701 characters\)
  1878.   sed "s/^X//" >'private/_sysgetc.c' <<'END_OF_FILE'
  1879. X#define    CURSES_LIBRARY    1
  1880. X#include <curses.h>
  1881. X
  1882. X#ifndef    NDEBUG
  1883. Xchar *rcsid__sysgetc = "$Header: c:/curses/private/RCS/_sysgetc.c%v 2.0 1992/11/15 03:24:39 MH Rel $";
  1884. X#endif
  1885. X
  1886. X
  1887. X
  1888. X
  1889. X/*man-start*********************************************************************
  1890. X
  1891. X  PDC_sysgetch()    - Return a character using default system routines.
  1892. X
  1893. X  PDCurses Description:
  1894. X     This is a private PDCurses function.
  1895. X
  1896. X     Gets a character without normal ^S, ^Q, ^P and ^C interpretation
  1897. X     and returns it.  If keypad mode is active for the designated
  1898. X     window, function key translation will be performed. Otherwise,
  1899. X     function keys are ignored. If nodelay mode is active in the
  1900. X     window, then sysgetch() returns -1 if no character is
  1901. X     available.
  1902. X
  1903. X  PDCurses Return Value:
  1904. X     This function returns OK upon success otherwise ERR is returned.
  1905. X
  1906. X  PDCurses Errors:
  1907. X     No errors are defined for this routine.
  1908. X
  1909. X  Portability:
  1910. X     PDCurses    int    PDC_sysgetch( void );
  1911. X
  1912. X**man-end**********************************************************************/
  1913. X
  1914. Xint    PDC_sysgetch(void)
  1915. X{
  1916. Xextern    WINDOW*    _getch_win_;
  1917. X/* extern    WINDOW*    w;*/   /* w defined in wgetch() as static - _getch_win_ */
  1918. X                        /* is the same window - all references to w changed*/
  1919. X                        /* to _getch_win_ - marked with @@ */
  1920. X
  1921. X    signed    c;
  1922. X
  1923. X    if (_getch_win_ == (WINDOW *)NULL)  /* @@ */
  1924. X        return (-1);
  1925. X
  1926. X    if (_getch_win_->_nodelay && !typeahead(stdin))
  1927. X        return (-1);
  1928. X
  1929. X    while (1)
  1930. X    {
  1931. X        c = PDC_get_bios_key();
  1932. X#if    defined (DOS) || defined (OS2)
  1933. X        /*
  1934. X         * Return the key if it is not a special key.
  1935. X         */
  1936. X        if (c & A_CHARTEXT)
  1937. X            return (c & A_CHARTEXT);
  1938. X#endif
  1939. X        if ((c = PDC_validchar(c)) >= 0)
  1940. X        {
  1941. X            return (c);        /* get & check next char */
  1942. X        }
  1943. X    }
  1944. X}
  1945. END_OF_FILE
  1946.   if test 1701 -ne `wc -c <'private/_sysgetc.c'`; then
  1947.     echo shar: \"'private/_sysgetc.c'\" unpacked with wrong size!
  1948.   fi
  1949.   # end of 'private/_sysgetc.c'
  1950. fi
  1951. if test -f 'tools/manext.def' -a "${1}" != "-c" ; then 
  1952.   echo shar: Will not clobber existing file \"'tools/manext.def'\"
  1953. else
  1954.   echo shar: Extracting \"'tools/manext.def'\" \(72 characters\)
  1955.   sed "s/^X//" >'tools/manext.def' <<'END_OF_FILE'
  1956. XNAME manext windowcompat
  1957. X
  1958. XDESCRIPTION 'test'
  1959. X
  1960. XPROTMODE
  1961. X
  1962. XSTACKSIZE 32767
  1963. END_OF_FILE
  1964.   if test 72 -ne `wc -c <'tools/manext.def'`; then
  1965.     echo shar: \"'tools/manext.def'\" unpacked with wrong size!
  1966.   fi
  1967.   # end of 'tools/manext.def'
  1968. fi
  1969. echo shar: End of archive 8 \(of 11\).
  1970. cp /dev/null ark8isdone
  1971. MISSING=""
  1972. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1973.     if test ! -f ark${I}isdone ; then
  1974.     MISSING="${MISSING} ${I}"
  1975.     fi
  1976. done
  1977. if test "${MISSING}" = "" ; then
  1978.     echo You have unpacked all 11 archives.
  1979.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1980. else
  1981.     echo You still must unpack the following archives:
  1982.     echo "        " ${MISSING}
  1983. fi
  1984. exit 0
  1985. exit 0 # Just in case...
  1986.