home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sources / misc / 4093 < prev    next >
Encoding:
Text File  |  1992-11-18  |  55.0 KB  |  1,992 lines

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