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

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: M.Hessling@gu.edu.au (Mark Hessling)
  4. Subject:  v33i086:  pdcurses - Public Domain curses library for DOS and OS/2 v2.0, Part06/11
  5. Message-ID: <1992Nov19.040424.7480@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: d45a941076ef5ca9821df6abc6b3c457
  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:04:24 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 1988
  14.  
  15. Submitted-by: M.Hessling@gu.edu.au (Mark Hessling)
  16. Posting-number: Volume 33, Issue 86
  17. Archive-name: pdcurses/part06
  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/resize.c portable/doupdate.c portable/hascolor.c
  25. #   portable/mvprintw.c portable/mvwprint.c portable/mvwscanw.c
  26. #   portable/newpad.c portable/newwin.c portable/overlay.c
  27. #   portable/overwrit.c portable/prefresh.c portable/subwin.c
  28. #   private/_chins.c private/_gbiosky.c private/_getrows.c
  29. #   private/_scroll.c private/_scropen.c private/_setfont.c
  30. # Wrapped by kent@sparky on Wed Nov 18 21:44:08 1992
  31. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  32. echo If this archive is complete, you will see the following message:
  33. echo '          "shar: End of archive 6 (of 11)."'
  34. if test -f 'nonport/resize.c' -a "${1}" != "-c" ; then 
  35.   echo shar: Will not clobber existing file \"'nonport/resize.c'\"
  36. else
  37.   echo shar: Extracting \"'nonport/resize.c'\" \(2953 characters\)
  38.   sed "s/^X//" >'nonport/resize.c' <<'END_OF_FILE'
  39. X#define    CURSES_LIBRARY    1
  40. X#include <curses.h>
  41. X#undef    resize
  42. X
  43. X#ifndef NDEBUG
  44. Xchar *rcsid_resize = "$Header: c:/curses/nonport/RCS/resize.c%v 2.0 1992/11/15 03:18:27 MH Rel $";
  45. X#endif
  46. X
  47. X
  48. X
  49. X
  50. X/*man-start*********************************************************************
  51. X
  52. X  resize()    - Resizes PDCurses; Changes video text size if necessary.
  53. X
  54. X  PDCurses Description:
  55. X     Does necessary initializations for the PDCurses package when
  56. X     doing screen size changes. The user is responsible for
  57. X     deleting and/or resizing windows after this call is made.
  58. X
  59. X     See the call _resize_win().
  60. X
  61. X     WARNING: This routine deallocated the existing stdscr, curscr
  62. X     and modifies LINES, COLS and other internal PDCurses
  63. X     variables.
  64. X
  65. X  PDCurses Return Value:
  66. X     The resize() function returns OK on success and ERR on error.
  67. X
  68. X  PDCurses Errors:
  69. X     It is an error to call this function before calling initscr().
  70. X     Also, an error will be generated if we fail to create a newly
  71. X     sized replacement window for _cursvar.tmpwin, curscr, or stdscr.
  72. X     This will typically happen when increasing the window size.
  73. X
  74. X     NOTE:  If this happens, the previously successfully allocated
  75. X     windows are left alone.  i.e. The resize is NOT cancelled for
  76. X     those windows.
  77. X
  78. X  PDCurses BUGS:
  79. X
  80. X     At this time, there is no support for any 40-column screen modes.
  81. X
  82. X  Portability:
  83. X     PDCurses    int    resize( int newlines );
  84. X
  85. X**man-end**********************************************************************/
  86. X
  87. Xint    resize(int newlines)
  88. X{
  89. X    WINDOW*    tmp;
  90. X
  91. X    if (stdscr == (WINDOW *)NULL)
  92. X        return(ERR);
  93. X
  94. X#ifdef    FLEXOS
  95. X    /*
  96. X     * Under FlexOS, this is functionally equivalent to a recallable
  97. X     * initscr() because FlexOS does not yet support determination of
  98. X     * screen fonts and therefore font loading and therefore text mode
  99. X     * screen resolution changes...
  100. X     */
  101. X    return( ERR );
  102. X#endif
  103. X#if !defined(OS2)
  104. X    switch (_cursvar.adapter)
  105. X    {
  106. X    case _EGACOLOR:
  107. X        if (newlines >= 43)        PDC_set_font(_FONT8);
  108. X        else                PDC_set_80x25();
  109. X        break;
  110. X
  111. X    case _VGACOLOR:
  112. X        if    (newlines > 28)        PDC_set_font(_FONT8);
  113. X        else    if (newlines > 25)    PDC_set_font(_FONT14);
  114. X        else                PDC_set_80x25();
  115. X        break;
  116. X
  117. X    default:
  118. X        break;
  119. X    }
  120. X#endif
  121. X#ifdef     OS2
  122. X    if (newlines >= 43)        PDC_set_font(_FONT8);
  123. X    else    if (newlines > 25)    PDC_set_font(_FONT14);
  124. X    else                PDC_set_80x25();
  125. X#endif
  126. X    _cursvar.lines = LINES = PDC_get_rows();
  127. X    _cursvar.cols  = COLS  = PDC_get_columns();
  128. X
  129. X    if (curscr->_pmaxy > LINES)
  130. X    {
  131. X        PDC_scroll(0, 0, curscr->_pmaxy - 1, COLS - 1, 0, _cursvar.orig_attr);
  132. X    }
  133. X    else
  134. X    {
  135. X        PDC_scroll(0, 0, LINES - 1, COLS - 1, 0, _cursvar.orig_attr);
  136. X    }
  137. X    if ((tmp = resize_win(tmpwin, LINES, COLS)) != (WINDOW *) NULL)
  138. X    {
  139. X        tmpwin = tmp;
  140. X    }
  141. X    else
  142. X    {
  143. X        return (ERR);
  144. X    }
  145. X    if ((tmp = resize_win(curscr, LINES, COLS)) != (WINDOW *) NULL)
  146. X    {
  147. X        curscr = tmp;
  148. X    }
  149. X    else
  150. X    {
  151. X        return (ERR);
  152. X    }
  153. X    if ((tmp = resize_win(stdscr, LINES, COLS)) != (WINDOW *) NULL)
  154. X    {
  155. X        stdscr = tmp;
  156. X        touchwin(stdscr);
  157. X        wnoutrefresh(stdscr);
  158. X    }
  159. X    else
  160. X    {
  161. X        return (ERR);
  162. X    }
  163. X    return (OK);
  164. X}
  165. END_OF_FILE
  166.   if test 2953 -ne `wc -c <'nonport/resize.c'`; then
  167.     echo shar: \"'nonport/resize.c'\" unpacked with wrong size!
  168.   fi
  169.   # end of 'nonport/resize.c'
  170. fi
  171. if test -f 'portable/doupdate.c' -a "${1}" != "-c" ; then 
  172.   echo shar: Will not clobber existing file \"'portable/doupdate.c'\"
  173. else
  174.   echo shar: Extracting \"'portable/doupdate.c'\" \(2951 characters\)
  175.   sed "s/^X//" >'portable/doupdate.c' <<'END_OF_FILE'
  176. X#define    CURSES_LIBRARY    1
  177. X#include <curses.h>
  178. X#undef    doupdate
  179. X
  180. X#ifndef    NDEBUG
  181. Xchar *rcsid_doupdate = "$Header: c:/curses/portable/RCS/doupdate.c%v 2.0 1992/11/15 03:28:50 MH Rel $";
  182. X#endif
  183. X
  184. XWINDOW *twin;            /* used by many routines */
  185. X
  186. X
  187. X/*man-start*********************************************************************
  188. X
  189. X  doupdate()    - do effiecient refresh
  190. X
  191. X  X/Open Description: (part of the wnoutrefresh() description.)
  192. X     These two routines allow multiple updates with more efficiency
  193. X     than wrefresh() alone.  In addition to all of the window
  194. X     structures representing the terminal screen: a physical screen,
  195. X     describing what is actually on the screen and a virtual screen,
  196. X     describing what the programmer wants to have on  the screen.
  197. X
  198. X     The wrefresh() function works by first calling wnoutrefresh(),
  199. X     which copies the named window to the virtual screen.  It then
  200. X     calls doupdate(), which compares the virtual screen to the
  201. X     physical screen and does the actual update.  If the programmer
  202. X     wishes to output several windows at once, a series of cals to
  203. X     wrefresh() will result in alternating calls to wnoutrefresh()
  204. X     and doupdate(), causing several bursts of output to the
  205. X     screen.  By first calling wnoutrefresh() for each window, it
  206. X     is then possible to call doupdate() once.  This results in
  207. X     only one burst of output, with probably fewer total characters
  208. X     transmitted and certainly less CPU time used.
  209. X
  210. X  PDCurses Description:
  211. X     In addition to the above, if REGISTERWINDOWS is TRUE when the
  212. X     library was compiled, any windows registered (true by default
  213. X     with PDCurses and _cursvar.refreshall is TRUE, then all
  214. X     registered windows will be called via wnoutrefresh() before
  215. X     the actual screen update begins.
  216. X
  217. X  X/Open Return Value:
  218. X     The doupdate() function returns OK on success and ERR on error.
  219. X
  220. X  X/Open Errors:
  221. X     No errors are defined for this function.
  222. X
  223. X  Portability:
  224. X     PDCurses    int doupdate( void );
  225. X     X/Open Dec '88    int doupdate( void );
  226. X     BSD Curses    int doupdate( void );
  227. X     SYS V Curses    int doupdate( void );
  228. X
  229. X**man-end**********************************************************************/
  230. X
  231. Xint    doupdate(void)
  232. X{
  233. Xregister int    i;
  234. X#ifdef    REGISTERWINDOWS
  235. X    WINDS*    next = _cursvar.visible;
  236. X
  237. X    if (_cursvar.refreshall)
  238. X    {
  239. X        while (next != NULL)
  240. X        {
  241. X            if (next->w->_parent != NULL)
  242. X            {
  243. X                touchwin(next->w->_parent);
  244. X                wnoutrefresh(next->w->_parent);
  245. X            }
  246. X            touchwin(next->w);
  247. X            wnoutrefresh(next->w);
  248. X            next = next->next;
  249. X        }
  250. X    }
  251. X#endif
  252. X    if  (_cursvar.shell)
  253. X        reset_prog_mode();
  254. X
  255. X    twin = tmpwin;
  256. X    if (twin == (WINDOW *)NULL)
  257. X        return( ERR );
  258. X
  259. X    if (curscr->_clear)
  260. X    {
  261. X        PDC_clr_update(curscr);
  262. X    }
  263. X    else
  264. X    {
  265. X        if (twin->_clear)
  266. X        {
  267. X            PDC_clr_update(twin);
  268. X        }
  269. X        else
  270. X        {
  271. X            for (i = 0; i < LINES; i++)
  272. X            {
  273. X                if (twin->_firstch[i] != _NO_CHANGE)
  274. X                    if (PDC_transform_line(i))
  275. X                        break;
  276. X            }
  277. X        }
  278. X    }
  279. X    curscr->_curx = twin->_curx;
  280. X    curscr->_cury = twin->_cury;
  281. X    PDC_gotoxy(curscr->_cury, curscr->_curx);
  282. X    return( OK );
  283. X}
  284. END_OF_FILE
  285.   if test 2951 -ne `wc -c <'portable/doupdate.c'`; then
  286.     echo shar: \"'portable/doupdate.c'\" unpacked with wrong size!
  287.   fi
  288.   # end of 'portable/doupdate.c'
  289. fi
  290. if test -f 'portable/hascolor.c' -a "${1}" != "-c" ; then 
  291.   echo shar: Will not clobber existing file \"'portable/hascolor.c'\"
  292. else
  293.   echo shar: Extracting \"'portable/hascolor.c'\" \(763 characters\)
  294.   sed "s/^X//" >'portable/hascolor.c' <<'END_OF_FILE'
  295. X#define    CURSES_LIBRARY    1
  296. X#include <curses.h>
  297. X#undef has_colors
  298. X
  299. X#ifndef    NDEBUG
  300. Xchar *rcsid_hascolor = "$Header: c:/curses/portable/RCS/hascolor.c%v 2.0 1992/11/15 03:28:54 MH Rel $";
  301. X#endif
  302. X
  303. X
  304. X
  305. X
  306. X/*man-start*********************************************************************
  307. X
  308. X  has_colors()    - Indicates if the terminal supports color.
  309. X
  310. X  PDCurses Description:
  311. X
  312. X     This routine indicates if the terminal supports and can maniplulate
  313. X     color.
  314. X
  315. X  PDCurses Return Value:
  316. X     This function returns TRUE on success and FALSE on error.
  317. X
  318. X  PDCurses Errors:
  319. X     N/A
  320. X
  321. X  Portability:
  322. X     PDCurses    int has_colors( void );
  323. X
  324. X**man-end**********************************************************************/
  325. X
  326. Xint has_colors(void)
  327. X{
  328. X    if (_cursvar.mono)
  329. X        return(FALSE);
  330. X    return(TRUE);
  331. X}
  332. END_OF_FILE
  333.   if test 763 -ne `wc -c <'portable/hascolor.c'`; then
  334.     echo shar: \"'portable/hascolor.c'\" unpacked with wrong size!
  335.   fi
  336.   # end of 'portable/hascolor.c'
  337. fi
  338. if test -f 'portable/mvprintw.c' -a "${1}" != "-c" ; then 
  339.   echo shar: Will not clobber existing file \"'portable/mvprintw.c'\"
  340. else
  341.   echo shar: Extracting \"'portable/mvprintw.c'\" \(2365 characters\)
  342.   sed "s/^X//" >'portable/mvprintw.c' <<'END_OF_FILE'
  343. X#include <stdarg.h>
  344. X#include <string.h>
  345. X#define    CURSES_LIBRARY    1
  346. X#include <curses.h>
  347. X#undef    mvprintw
  348. X
  349. X#ifndef    NDEBUG
  350. Xchar *rcsid_mvprintw = "$Header: c:/curses/portable/RCS/mvprintw.c%v 2.0 1992/11/15 03:29:31 MH Rel $";
  351. X#endif
  352. X
  353. X
  354. X
  355. X
  356. X
  357. X/*man-start*********************************************************************
  358. X
  359. X  mvprintw()    - formatted write to a window
  360. X
  361. X  X/Open Description:
  362. X     The printw routine adds a string to the default window
  363. X     starting at the current cursor position.  This routine causes
  364. X     the string that would normally be output by printf to be
  365. X     output by addstr.
  366. X
  367. X     The routine wprintw adds a string to the specified window
  368. X     starting at the current cursor position.  This routine causes
  369. X     the string that would normally be output by printf to be
  370. X     output by waddstr.
  371. X
  372. X     The routine mvprintw adds a string to the default window
  373. X     starting at the specified cursor position.  This routine
  374. X     causes the string that would normally be output by printf to
  375. X     be output by addstr.
  376. X
  377. X     The routine mvwprintw adds a string to the specified window
  378. X     starting at the specified cursor position.  This routine
  379. X     causes the string that would normally be output by printf to
  380. X     be output by waddstr.
  381. X
  382. X     All these routines are analogous to printf.  It is advisable
  383. X     to use the field width options of printf to avoid leaving
  384. X     unwanted characters on the screen from earlier calls.
  385. X
  386. X  PDCurses Description:
  387. X     The old Bjorn Larssen code for the 68K platform has been removed
  388. X     from this module.
  389. X
  390. X  X/Open Return Value:
  391. X     The mvprintw() function returns OK on success and ERR on error.
  392. X
  393. X  X/Open Errors:
  394. X     No errors are defined for this function.
  395. X
  396. X  Portability:
  397. X     PDCurses    int mvprintw( int y, int x, char* fmt, ... );
  398. X     X/Open Dec '88    int mvprintw( int y, int x, char* fmt, ... );
  399. X     BSD Curses    int mvprintw( int y, int x, char* fmt, ... );
  400. X     SYS V Curses    int mvprintw( int y, int x, char* fmt, ... );
  401. X
  402. X**man-end**********************************************************************/
  403. X
  404. Xint    mvprintw(int y, int x, char *fmt, ...)
  405. X{
  406. X    int    retval = ERR;
  407. X    va_list args;
  408. X
  409. X    if (stdscr == (WINDOW *)NULL)
  410. X        return (retval);
  411. X
  412. X    if (wmove(stdscr, y, x) == ERR)
  413. X        return( retval );
  414. X
  415. X    va_start(args, fmt);
  416. X    vsprintf(c_printscanbuf, fmt, args);
  417. X    va_end(args);
  418. X
  419. X    if (waddstr(stdscr, c_printscanbuf) == ERR)
  420. X        return( retval );
  421. X    retval = (strlen(c_printscanbuf));
  422. X    return( retval );
  423. X}
  424. END_OF_FILE
  425.   if test 2365 -ne `wc -c <'portable/mvprintw.c'`; then
  426.     echo shar: \"'portable/mvprintw.c'\" unpacked with wrong size!
  427.   fi
  428.   # end of 'portable/mvprintw.c'
  429. fi
  430. if test -f 'portable/mvwprint.c' -a "${1}" != "-c" ; then 
  431.   echo shar: Will not clobber existing file \"'portable/mvwprint.c'\"
  432. else
  433.   echo shar: Extracting \"'portable/mvwprint.c'\" \(2414 characters\)
  434.   sed "s/^X//" >'portable/mvwprint.c' <<'END_OF_FILE'
  435. X#include <stdarg.h>
  436. X#include <string.h>
  437. X#define    CURSES_LIBRARY    1
  438. X#include <curses.h>
  439. X#undef    mvwprintw
  440. X
  441. X#ifndef    NDEBUG
  442. Xchar *rcsid_mvwprint = "$Header: c:/curses/portable/RCS/mvwprint.c%v 2.0 1992/11/15 03:29:32 MH Rel $";
  443. X#endif
  444. X
  445. X
  446. X
  447. X
  448. X
  449. X/*man-start*********************************************************************
  450. X
  451. X  mvwprintw()    - formatted write to a window
  452. X
  453. X  X/Open Description:
  454. X     The printw routine adds a string to the default window
  455. X     starting at the current cursor position.  This routine causes
  456. X     the string that would normally be output by printf to be
  457. X     output by addstr.
  458. X
  459. X     The routine wprintw adds a string to the specified window
  460. X     starting at the current cursor position.  This routine causes
  461. X     the string that would normally be output by printf to be
  462. X     output by waddstr.
  463. X
  464. X     The routine mvprintw adds a string to the default window
  465. X     starting at the specified cursor position.  This routine
  466. X     causes the string that would normally be output by printf to
  467. X     be output by addstr.
  468. X
  469. X     The routine mvwprintw adds a string to the specified window
  470. X     starting at the specified cursor position.  This routine
  471. X     causes the string that would normally be output by printf to
  472. X     be output by waddstr.
  473. X
  474. X     All these routines are analogous to printf.  It is advisable
  475. X     to use the field width options of printf to avoid leaving
  476. X     unwanted characters on the screen from earlier calls.
  477. X
  478. X  PDCurses Description:
  479. X     The old Bjorn Larssen code for the 68K platform has been removed
  480. X     from this module.
  481. X
  482. X  X/Open Return Value:
  483. X     The mvprintw() function returns OK on success and ERR on error.
  484. X
  485. X  X/Open Errors:
  486. X     No errors are defined for this function.
  487. X
  488. X  Portability:
  489. X     PDCurses    int mvwprintw(WINDOW* win, int y, int x, char *fmt, ...)
  490. X     X/Open Dec '88    int mvwprintw(WINDOW* win, int y, int x, char *fmt, ...)
  491. X     BSD Curses    int mvwprintw(WINDOW* win, int y, int x, char *fmt, ...)
  492. X     SYS V Curses    int mvwprintw(WINDOW* win, int y, int x, char *fmt, ...)
  493. X
  494. X**man-end**********************************************************************/
  495. X
  496. Xint    mvwprintw(WINDOW * win, int y, int x, char *fmt, ...)
  497. X{
  498. X    int    retval = ERR;
  499. X    va_list args;
  500. X
  501. X    if (win == (WINDOW *)NULL)
  502. X        return (retval);
  503. X
  504. X    if (wmove(win, y, x) == ERR)
  505. X        return (retval);
  506. X
  507. X    va_start(args, fmt);
  508. X    vsprintf(c_printscanbuf, fmt, args);
  509. X    va_end(args);
  510. X
  511. X    if (waddstr(win, c_printscanbuf) == ERR)
  512. X        return (retval);
  513. X    retval = (strlen(c_printscanbuf));
  514. X    return (retval);
  515. X}
  516. END_OF_FILE
  517.   if test 2414 -ne `wc -c <'portable/mvwprint.c'`; then
  518.     echo shar: \"'portable/mvwprint.c'\" unpacked with wrong size!
  519.   fi
  520.   # end of 'portable/mvwprint.c'
  521. fi
  522. if test -f 'portable/mvwscanw.c' -a "${1}" != "-c" ; then 
  523.   echo shar: Will not clobber existing file \"'portable/mvwscanw.c'\"
  524. else
  525.   echo shar: Extracting \"'portable/mvwscanw.c'\" \(2341 characters\)
  526.   sed "s/^X//" >'portable/mvwscanw.c' <<'END_OF_FILE'
  527. X#include <stdarg.h>
  528. X#include <string.h>
  529. X#define    CURSES_LIBRARY    1
  530. X#include <curses.h>
  531. X#undef    mvwscanw
  532. X
  533. X#ifndef    NDEBUG
  534. Xchar *rcsid_mvwscanw = "$Header: c:/curses/portable/RCS/mvwscanw.c%v 2.0 1992/11/15 03:29:02 MH Rel $";
  535. X#endif
  536. X
  537. X
  538. X
  539. X/*man-start*********************************************************************
  540. X
  541. X  mvwscanw()    - read formatted from window
  542. X
  543. X  X/Open Description:
  544. X     These routines correspond to scanf.  The function scanw reads
  545. X     input from the default window.  The function wscanw reads
  546. X     input from the specified window.  The function mvscanw moves
  547. X     the cursor to the specified position and then reads input from
  548. X     the default window.  The function mvwscanw moves the cursor to
  549. X     the specified position and then reads input from the specified
  550. X     window.
  551. X
  552. X     For all the functions, the routine wgetstr is called to get a
  553. X     string from the window, and the resulting line is used as
  554. X     input for the scan.  All character interpretation is carried
  555. X     out according to the scanf function rules.
  556. X
  557. X  PDCurses Description:
  558. X     The old Bjorn Larssen code for the 68K platform has been removed
  559. X     from this module.
  560. X
  561. X  X/Open Return Value:
  562. X     Upon successful completion, the scanw, mvscanw, mvwscanw and
  563. X     wscanw functions return the number of items successfully
  564. X     matched.  On end-of-file, they return EOF.  Otherwise they
  565. X     return ERR.
  566. X
  567. X  PDCurses Errors:
  568. X     No errors.
  569. X
  570. X  Portability:
  571. X     PDCurses    int mvwscanw(WINDOW* win, int y, int x, char *fmt, ...);
  572. X     X/Open Dec '88    int mvwscanw(WINDOW* win, int y, int x, char *fmt, ...);
  573. X     BSD Curses    int mvwscanw(WINDOW* win, int y, int x, char *fmt, ...);
  574. X     SYS V Curses    int mvwscanw(WINDOW* win, int y, int x, char *fmt, ...);
  575. X
  576. X**man-end**********************************************************************/
  577. X
  578. Xint    mvwscanw(WINDOW * win, int y, int x, char *fmt,...)
  579. X{
  580. X    va_list args;
  581. X    int    retval = ERR;
  582. X
  583. X#if    !defined (HC)
  584. X    if (win == (WINDOW *)NULL)
  585. X        return( retval );
  586. X
  587. X    if (wmove(win, y, x) == ERR)
  588. X        return( retval );
  589. X
  590. X    wrefresh(win);        /* set cursor position */
  591. X
  592. X    /*
  593. X     * get string
  594. X     */
  595. X    c_printscanbuf[0] = '\0';  /* reset to empty string */
  596. X    if (wgetstr(win, c_printscanbuf) == ERR)
  597. X        return( retval );
  598. X    va_start(args, fmt);
  599. X#ifdef NO_VSSCANF
  600. X    retval = PDC_vsscanf(c_printscanbuf, fmt, args);
  601. X#else
  602. X    retval = vsscanf(c_printscanbuf, fmt, args);
  603. X#endif
  604. X    va_end(args);
  605. X#endif
  606. X    return( retval );
  607. X}
  608. END_OF_FILE
  609.   if test 2341 -ne `wc -c <'portable/mvwscanw.c'`; then
  610.     echo shar: \"'portable/mvwscanw.c'\" unpacked with wrong size!
  611.   fi
  612.   # end of 'portable/mvwscanw.c'
  613. fi
  614. if test -f 'portable/newpad.c' -a "${1}" != "-c" ; then 
  615.   echo shar: Will not clobber existing file \"'portable/newpad.c'\"
  616. else
  617.   echo shar: Extracting \"'portable/newpad.c'\" \(2641 characters\)
  618.   sed "s/^X//" >'portable/newpad.c' <<'END_OF_FILE'
  619. X#define    CURSES_LIBRARY    1
  620. X#include <curses.h>
  621. X#undef    newpad
  622. X
  623. X#ifndef    NDEBUG
  624. Xchar *rcsid_newpad = "$Header: c:/curses/portable/RCS/newpad.c%v 2.0 1992/11/15 03:29:27 MH Rel $";
  625. X#endif
  626. X
  627. X
  628. X
  629. X
  630. X/*man-start*********************************************************************
  631. X
  632. X  newpad()    - Create new pad
  633. X
  634. X  X/Open Description:
  635. X     Creates a new pad data structure.  A pad is a special case of a
  636. X     window, which is not restricted by the screen size, and is not
  637. X     necessarily associated with a particular part of the screen.  A
  638. X     pad can be used when a large window is needed, and only a part
  639. X     of the window will be on the screen at one tme.  Automatic
  640. X     refreshes of pads (e.g., from scrolling or echoing of input) do
  641. X     not occur.  It is not legal to call refresh() with a pad as an
  642. X     argument; the routines prefresh() or pnoutrefresh() should be
  643. X     called instead.  Note that these routines require additional
  644. X     parameters to specify the part of the pad to be displayed and
  645. X     the location on the screen to be used for display.
  646. X
  647. X  PDCurses Description:
  648. X     PDCurses (as a library) provides the developer with the ability to
  649. X     hook in their own malloc debugging  package.  See the details in
  650. X     INITSCR.C for details on how to accomplish this.
  651. X
  652. X  X/Open Return Value:
  653. X     The newpad() function returns a pointer to the new WINDOW structure
  654. X     created on success and returns a null pointer on error.
  655. X
  656. X  X/Open Errors:
  657. X     No errors are defined for this function.
  658. X
  659. X  Portability:
  660. X     PDCurses    WINDOW* newpad( int nlines, int ncols );
  661. X     X/Open Dec '88    WINDOW* newpad( int nlines, int ncols );
  662. X     BSD Curses    WINDOW* newpad( int nlines, int ncols );
  663. X     SYS V Curses    WINDOW* newpad( int nlines, int ncols );
  664. X
  665. X**man-end**********************************************************************/
  666. X
  667. XWINDOW* newpad( int nlines, int ncols )
  668. X{
  669. Xextern    void*    (*mallc)( size_t );
  670. Xextern    void*    (*callc)( size_t, size_t );
  671. Xextern    void    (*fre)( void* );
  672. X
  673. X    WINDOW* win;
  674. X    chtype* ptr;
  675. X    int    i;
  676. X    int    j;
  677. X
  678. X    if ((win = PDC_makenew( nlines, ncols, -1, -1 )) == (WINDOW *)NULL)
  679. X        return( (WINDOW *)NULL );
  680. X
  681. X    for (i = 0; i < nlines; i++)
  682. X    {
  683. X        /*
  684. X         * make and clear the lines
  685. X         */
  686. X        if ((win->_y[i] = (*callc)(ncols, sizeof(chtype))) == NULL)
  687. X        {
  688. X            for (j = 0; j < i; j++)
  689. X            {
  690. X                /*
  691. X                 * if error, free all the data
  692. X                 */
  693. X                (*fre)(win->_y[j]);
  694. X            }
  695. X            (*fre)(win->_firstch);
  696. X            (*fre)(win->_lastch);
  697. X            (*fre)(win->_y);
  698. X            (*fre)(win);
  699. X            return( (WINDOW *)NULL );
  700. X        }
  701. X        else
  702. X        {
  703. X            for (ptr = win->_y[i];
  704. X                 ptr < win->_y[i] + ncols;)
  705. X            {
  706. X                /*
  707. X                * Retain the original screen attributes...
  708. X                */
  709. X
  710. X                *ptr++ = _cursvar.blank;    
  711. X            }
  712. X        }
  713. X    }
  714. X    win->_flags = _PAD;
  715. X    return( win );
  716. X}
  717. END_OF_FILE
  718.   if test 2641 -ne `wc -c <'portable/newpad.c'`; then
  719.     echo shar: \"'portable/newpad.c'\" unpacked with wrong size!
  720.   fi
  721.   # end of 'portable/newpad.c'
  722. fi
  723. if test -f 'portable/newwin.c' -a "${1}" != "-c" ; then 
  724.   echo shar: Will not clobber existing file \"'portable/newwin.c'\"
  725. else
  726.   echo shar: Extracting \"'portable/newwin.c'\" \(2602 characters\)
  727.   sed "s/^X//" >'portable/newwin.c' <<'END_OF_FILE'
  728. X#include <stdlib.h>
  729. X#define    CURSES_LIBRARY    1
  730. X#include <curses.h>
  731. X#undef    newwin
  732. X
  733. X#ifndef    NDEBUG
  734. Xchar *rcsid_newwin = "$Header: c:/curses/portable/RCS/newwin.c%v 2.0 1992/11/15 03:29:28 MH Rel $";
  735. X#endif
  736. X
  737. X
  738. X
  739. X
  740. X/*man-start*********************************************************************
  741. X
  742. X  newwin()    - create new window
  743. X
  744. X  X/Open Description:
  745. X     Create a new window with the given number of lines, nlines and
  746. X     columns, ncols. The upper left corner of the window is at line
  747. X     begy, column begx. If either nlines or ncols is zero,
  748. X     they will be defaulted to LINES - begy and COLS - begx. A
  749. X     new full-screen window is created by calling newwin(0, 0, 0, 0).
  750. X
  751. X  PDCurses Description:
  752. X     PDCurses allows developers to provide a hook into the malloc
  753. X     package used.  See initscr(3c) for more details.
  754. X
  755. X     Also, when a window is created, it uses the default screen
  756. X     colors and attributes in effect when initscr() was called.
  757. X
  758. X  X/Open Return Value:
  759. X     On success the newwin() function returns a pointer to the new
  760. X     WINDOW structure created. On failure the function returns a
  761. X     null pointer.
  762. X
  763. X  PDCurses Errors:
  764. X     The following conditions are errors:
  765. X         o  number of lines   == 0,
  766. X         o  number of columns == 0,
  767. X         o  failure to allocate memory for the window structure
  768. X
  769. X  Portability:
  770. X     PDCurses    WINDOW* newwin(int nlines,int ncols,int begy,int begx);
  771. X     X/Open Dec '88    WINDOW* newwin(int nlines,int ncols,int begy,int begx);
  772. X     BSD Curses    WINDOW* newwin(int nlines,int ncols,int begy,int begx);
  773. X     SYS V Curses    WINDOW* newwin(int nlines,int ncols,int begy,int begx);
  774. X
  775. X**man-end**********************************************************************/
  776. X
  777. XWINDOW*    newwin(int nlines, int ncols, int begy, int begx)
  778. X{
  779. Xextern    void*    (*mallc)( size_t );
  780. Xextern    void*    (*callc)( size_t, size_t );
  781. Xextern    void    (*fre)( void* );
  782. X
  783. X    WINDOW*    win;
  784. X    chtype*    ptr;
  785. X    int    i;
  786. X    int    j;
  787. X
  788. X    if (nlines == 0)    nlines = LINES - begy;
  789. X    if (ncols  == 0)    ncols  = COLS  - begx;
  790. X
  791. X    if ((win = PDC_makenew(nlines, ncols, begy, begx)) == (WINDOW *) NULL)
  792. X        return( (WINDOW *)NULL );
  793. X
  794. X    for (i = 0; i < nlines; i++)
  795. X    {
  796. X        /*
  797. X         * make and clear the lines
  798. X         */
  799. X        if ((win->_y[i] = (*callc)(ncols, sizeof(chtype))) == NULL)
  800. X        {
  801. X            for (j = 0; j < i; j++)
  802. X            {
  803. X                /*
  804. X                 * if error, free all the data
  805. X                 */
  806. X                (*fre)(win->_y[j]);
  807. X            }
  808. X            (*fre)(win->_firstch);
  809. X            (*fre)(win->_lastch);
  810. X            (*fre)(win->_y);
  811. X            (*fre)(win);
  812. X            return( (WINDOW *)NULL );
  813. X        }
  814. X        else
  815. X        {
  816. X            for (ptr = win->_y[i];
  817. X                 ptr < win->_y[i] + ncols;)
  818. X            {
  819. X                /*
  820. X                 * Retain the original screen attributes...
  821. X                 */
  822. X                *ptr++ = _cursvar.blank;
  823. X            }
  824. X        }
  825. X    }
  826. X    return( win );
  827. X}
  828. END_OF_FILE
  829.   if test 2602 -ne `wc -c <'portable/newwin.c'`; then
  830.     echo shar: \"'portable/newwin.c'\" unpacked with wrong size!
  831.   fi
  832.   # end of 'portable/newwin.c'
  833. fi
  834. if test -f 'portable/overlay.c' -a "${1}" != "-c" ; then 
  835.   echo shar: Will not clobber existing file \"'portable/overlay.c'\"
  836. else
  837.   echo shar: Extracting \"'portable/overlay.c'\" \(2366 characters\)
  838.   sed "s/^X//" >'portable/overlay.c' <<'END_OF_FILE'
  839. X#define    CURSES_LIBRARY    1
  840. X#include <curses.h>
  841. X#undef    overlay
  842. X
  843. X#ifndef    NDEBUG
  844. Xchar *rcsid_overlay = "$Header: c:/curses/portable/RCS/overlay.c%v 2.0 1992/11/15 03:29:35 MH Rel $";
  845. X#endif
  846. X
  847. X
  848. X
  849. X
  850. X/*man-start*********************************************************************
  851. X
  852. X  overlay()    - Overlay windows
  853. X
  854. X  X/Open Description:    overlay() and overwrite()
  855. X     These functions overlay src_w on top of dst_w; that is,
  856. X     all text in src_w is copied into dst_w. The windows
  857. X     src_w and dst_w are not required to be the same size. The
  858. X     copy starts at (0, 0) on each window. The difference between
  859. X     the two functions is that overlay() is non-destructive
  860. X     (blanks are not copied) while overwrite() is destructive
  861. X     (blanks are copied).
  862. X
  863. X  PDCurses Description:
  864. X     No additional PDCurses functionality.
  865. X
  866. X  X/Open Return Value:
  867. X     The overlay() function returns OK on success and ERR on error.
  868. X
  869. X  PDCurses Errors:
  870. X     It is an error to pass a NULL window pointer.
  871. X
  872. X  Portability:
  873. X     PDCurses    int    overlay( WINDOW* src_w, WINDOW* dst_w );
  874. X     X/Open Dec '88    int    overlay( WINDOW* src_w, WINDOW* dst_w );
  875. X     BSD Curses    int    overlay( WINDOW* src_w, WINDOW* dst_w );
  876. X     SYS V Curses    int    overlay( WINDOW* src_w, WINDOW* dst_w );
  877. X
  878. X**man-end**********************************************************************/
  879. X
  880. Xint    overlay(WINDOW *src_w, WINDOW *dst_w)
  881. X{
  882. X    int*    minchng;
  883. X    int*    maxchng;
  884. X    chtype*    w1ptr;
  885. X    chtype*    w2ptr;
  886. X    chtype    attrs;
  887. X    int    col;
  888. X    int    line;
  889. X    int    last_line;
  890. X    int    last_col;
  891. X
  892. X    if (src_w == (WINDOW *)NULL)    return( ERR );
  893. X    if (dst_w == (WINDOW *)NULL)    return( ERR );
  894. X
  895. X    minchng      = dst_w->_firstch;
  896. X    maxchng   = dst_w->_lastch;
  897. X    last_col  = min(src_w->_maxx, dst_w->_maxx) - 1;
  898. X    last_line = min(src_w->_maxy, dst_w->_maxy) - 1;
  899. X    attrs      = dst_w->_attrs;
  900. X
  901. X    for (line = 0; line <= last_line; line++)
  902. X    {
  903. X        register int fc;
  904. X        register int lc;
  905. X
  906. X        w1ptr = src_w->_y[line];
  907. X        w2ptr = dst_w->_y[line];
  908. X        fc    = _NO_CHANGE;
  909. X
  910. X        for (col = 0; col <= last_col; col++)
  911. X        {
  912. X            if ((*w1ptr & A_CHARTEXT) != src_w->_blank)
  913. X            {
  914. X                *w2ptr = (*w1ptr & A_CHARTEXT) | attrs;
  915. X                if (fc == _NO_CHANGE)
  916. X                {
  917. X                    fc = col;
  918. X                }
  919. X                lc = col;
  920. X            }
  921. X            w1ptr++;
  922. X            w2ptr++;
  923. X        }
  924. X
  925. X        if (*minchng == _NO_CHANGE)
  926. X        {
  927. X            *minchng = fc;
  928. X            *maxchng = lc;
  929. X        }
  930. X        else    if (fc != _NO_CHANGE)
  931. X        {
  932. X            if (fc < *minchng)    *minchng = fc;
  933. X            if (lc > *maxchng)    *maxchng = lc;
  934. X        }
  935. X        minchng++;
  936. X        maxchng++;
  937. X    }
  938. X    return( OK );
  939. X}
  940. END_OF_FILE
  941.   if test 2366 -ne `wc -c <'portable/overlay.c'`; then
  942.     echo shar: \"'portable/overlay.c'\" unpacked with wrong size!
  943.   fi
  944.   # end of 'portable/overlay.c'
  945. fi
  946. if test -f 'portable/overwrit.c' -a "${1}" != "-c" ; then 
  947.   echo shar: Will not clobber existing file \"'portable/overwrit.c'\"
  948. else
  949.   echo shar: Extracting \"'portable/overwrit.c'\" \(2396 characters\)
  950.   sed "s/^X//" >'portable/overwrit.c' <<'END_OF_FILE'
  951. X#define    CURSES_LIBRARY    1
  952. X#include <curses.h>
  953. X#undef    overwrite
  954. X
  955. X#ifndef    NDEBUG
  956. Xchar *rcsid_overwrit = "$Header: c:/curses/portable/RCS/overwrit.c%v 2.0 1992/11/15 03:29:36 MH Rel $";
  957. X#endif
  958. X
  959. X
  960. X
  961. X
  962. X/*man-start*********************************************************************
  963. X
  964. X  overwrite()    - Overwrite windows
  965. X
  966. X  X/Open Description:    overlay() and overwrite()
  967. X     These functions overlay src_w on top of dst_w; that is,
  968. X     all text in src_w is copied into dst_w. The windows
  969. X     src_w and dst_w are not required to be the same size. The
  970. X     copy starts at (0, 0) on each window. The difference between
  971. X     the two functions is that overlay() is non-destructive
  972. X     (blanks are not copied) while overwrite() is destructive
  973. X     (blanks are copied).
  974. X
  975. X  PDCurses Description:
  976. X     No additional PDCurses functionality.
  977. X
  978. X  X/Open Return Value:
  979. X     The overwrite() function returns OK on success and ERR on error.
  980. X
  981. X  PDCurses Errors:
  982. X     It is an error to pass a NULL window pointer.
  983. X
  984. X  Portability:
  985. X     PDCurses    int    overwrite( WINDOW* src_w, WINDOW* dst_w );
  986. X     X/Open Dec '88    int    overwrite( WINDOW* src_w, WINDOW* dst_w );
  987. X     BSD Curses    int    overwrite( WINDOW* src_w, WINDOW* dst_w );
  988. X     SYS V Curses    int    overwrite( WINDOW* src_w, WINDOW* dst_w );
  989. X
  990. X**man-end**********************************************************************/
  991. X
  992. Xint    overwrite(WINDOW *src_w, WINDOW *dst_w)
  993. X{
  994. X    int*    minchng;
  995. X    int*    maxchng;
  996. X    chtype*    w1ptr;
  997. X    chtype*    w2ptr;
  998. X    chtype    attrs;
  999. X    int    col;
  1000. X    int    line;
  1001. X    int    last_line;
  1002. X    int    last_col;
  1003. X
  1004. X    if (src_w == (WINDOW *)NULL)    return( ERR );
  1005. X    if (dst_w == (WINDOW *)NULL)    return( ERR );
  1006. X
  1007. X    minchng      = dst_w->_firstch;
  1008. X    maxchng      = dst_w->_lastch;
  1009. X    last_col  = min(src_w->_maxx, dst_w->_maxx) - 1;
  1010. X    last_line = min(src_w->_maxy, dst_w->_maxy) - 1;
  1011. X    attrs      = dst_w->_attrs;
  1012. X
  1013. X     for (line = 0; line <= last_line; line++)
  1014. X    {
  1015. X        register int fc;
  1016. X        register int lc;
  1017. X
  1018. X        w1ptr = src_w->_y[line];
  1019. X        w2ptr = dst_w->_y[line];
  1020. X        fc    = _NO_CHANGE;
  1021. X
  1022. X        for (col = 0; col <= last_col; col++)
  1023. X        {
  1024. X            if ((*w1ptr & A_CHARTEXT) != (*w2ptr & A_CHARTEXT))
  1025. X            {
  1026. X                *w2ptr = (*w1ptr & A_CHARTEXT) | attrs;
  1027. X                if (fc == _NO_CHANGE)
  1028. X                {
  1029. X                    fc = col;
  1030. X                }
  1031. X                lc = col;
  1032. X            }
  1033. X            w1ptr++;
  1034. X            w2ptr++;
  1035. X        }
  1036. X
  1037. X        if (*minchng == _NO_CHANGE)
  1038. X        {
  1039. X            *minchng = fc;
  1040. X            *maxchng = lc;
  1041. X        }
  1042. X        else    if (fc != _NO_CHANGE)
  1043. X        {
  1044. X            if (fc < *minchng)    *minchng = fc;
  1045. X            if (lc > *maxchng)    *maxchng = lc;
  1046. X        }
  1047. X        minchng++;
  1048. X        maxchng++;
  1049. X    }
  1050. X    return( OK );
  1051. X}
  1052. X
  1053. END_OF_FILE
  1054.   if test 2396 -ne `wc -c <'portable/overwrit.c'`; then
  1055.     echo shar: \"'portable/overwrit.c'\" unpacked with wrong size!
  1056.   fi
  1057.   # end of 'portable/overwrit.c'
  1058. fi
  1059. if test -f 'portable/prefresh.c' -a "${1}" != "-c" ; then 
  1060.   echo shar: Will not clobber existing file \"'portable/prefresh.c'\"
  1061. else
  1062.   echo shar: Extracting \"'portable/prefresh.c'\" \(2499 characters\)
  1063.   sed "s/^X//" >'portable/prefresh.c' <<'END_OF_FILE'
  1064. X#define    CURSES_LIBRARY    1
  1065. X#include <curses.h>
  1066. X#undef    prefresh
  1067. X
  1068. X#ifndef    NDEBUG
  1069. Xchar *rcsid_prefresh = "$Header: c:/curses/portable/RCS/prefresh.c%v 2.0 1992/11/15 03:29:08 MH Rel $";
  1070. X#endif
  1071. X
  1072. X
  1073. X
  1074. X
  1075. X/*man-start*********************************************************************
  1076. X
  1077. X  prefresh()    - refresh pad
  1078. X
  1079. X  X/Open Description:
  1080. X     The prefresh routine copies the specified pad to the physical
  1081. X     terminal screen.  It takes account of what is already
  1082. X     displayed on the screen to optimize cursor movement.
  1083. X
  1084. X     The pnoutrefresh routine copies the named pad to the virtual
  1085. X     screen. It then compares the virtual screen with the physical
  1086. X     screen and performs the actual update.
  1087. X
  1088. X     These routines are analogous to the routines wrefresh and
  1089. X     wnoutrefresh except that pads, instead of windows, are
  1090. X     involved.  Additional parameters are also needed to indicate
  1091. X     what part of the pad and screen are involved. The upper left
  1092. X     corner of the part of the pad to be displayed is specified by
  1093. X     py and px.  The coordinates sy1, sx1, sy2, and sx2 specify the
  1094. X     edges of the screen rectangle that will contain the selected
  1095. X     part of the pad.
  1096. X
  1097. X     The lower right corner of the pad rectangle to be displayed is
  1098. X     calculated from the screen co-ordinates.  This ensures that
  1099. X     the screen rectangle and the pad rectangle are the same size.
  1100. X
  1101. X     Both rectangles must be entirely contained within their
  1102. X     respective structures.
  1103. X
  1104. X  PDCurses Description:
  1105. X     Contrary to the statements above, the pnoutrefresh() routine
  1106. X     will not perform an update to the physical screen.  This task
  1107. X     is performed by doupdate().
  1108. X
  1109. X  X/Open Return Value:
  1110. X     The prefresh() function returns OK on success and ERR on error.
  1111. X
  1112. X  PDCurses Errors:
  1113. X     It is an error to pass a null WINDOW* pointer.
  1114. X
  1115. X  Portability:
  1116. X     PDCurses    int prefresh( WINDOW* win, int py, int px,
  1117. X                         int sy1, int sx1,
  1118. X                         int sy2, int sx2 );
  1119. X     X/Open Dec '88    int prefresh( WINDOW* win, int py, int px,
  1120. X                         int sy1, int sx1,
  1121. X                         int sy2, int sx2 );
  1122. X     BSD Curses    int prefresh( WINDOW* win, int pminrow, int pmincol,
  1123. X                         int sminrow, int smincol,
  1124. X                         int smaxrow, int smaxcol );
  1125. X     SYS V Curses    int prefresh( WINDOW* win, int py, int px,
  1126. X                         int sy1, int sx1,
  1127. X                         int sy2, int sx2 );
  1128. X
  1129. X**man-end**********************************************************************/
  1130. X
  1131. Xint    prefresh(WINDOW* win,int py,int px,int sy1,int sx1,int sy2,int sx2)
  1132. X{
  1133. X    if (win == (WINDOW *)NULL)
  1134. X        return( ERR );
  1135. X
  1136. X    pnoutrefresh(win, py, px, sy1, sx1, sy2, sx2);
  1137. X    doupdate();
  1138. X    return( OK );
  1139. X}
  1140. END_OF_FILE
  1141.   if test 2499 -ne `wc -c <'portable/prefresh.c'`; then
  1142.     echo shar: \"'portable/prefresh.c'\" unpacked with wrong size!
  1143.   fi
  1144.   # end of 'portable/prefresh.c'
  1145. fi
  1146. if test -f 'portable/subwin.c' -a "${1}" != "-c" ; then 
  1147.   echo shar: Will not clobber existing file \"'portable/subwin.c'\"
  1148. else
  1149.   echo shar: Extracting \"'portable/subwin.c'\" \(2915 characters\)
  1150.   sed "s/^X//" >'portable/subwin.c' <<'END_OF_FILE'
  1151. X#include <stdlib.h>
  1152. X#include <string.h>
  1153. X#define    CURSES_LIBRARY    1
  1154. X#include <curses.h>
  1155. X#undef subwin
  1156. X
  1157. X#ifndef    NDEBUG
  1158. Xchar *rcsid_subwin = "$Header: c:/curses/portable/RCS/subwin.c%v 2.0 1992/11/15 03:29:24 MH Rel $";
  1159. X#endif
  1160. X
  1161. X
  1162. X
  1163. X
  1164. X/*man-start*********************************************************************
  1165. X
  1166. X  subwin()    - create subwindow
  1167. X
  1168. X  X/Open Description:
  1169. X     This routine creates a new sub-window within a window.  The
  1170. X     dimensions of the sub-window are nlines lines and ncols
  1171. X     columns.  The sub-window is at position (begin_y, begin_x) on
  1172. X     the screen.  This position is relative to the screen, and not
  1173. X     to the window orig.
  1174. X
  1175. X     The sub-window is made in the middle of the window orig, so
  1176. X     that changes made to either window will affect both.  When
  1177. X     using this routine, it will often be necessary to call
  1178. X     touchwin before calling wrefresh.
  1179. X
  1180. X  PDCurses Description:
  1181. X     No additional PDCurses functionality.
  1182. X
  1183. X  X/Open Return Value:
  1184. X     On success the subwin function returns a pointer to the new
  1185. X     WINDOW structure created.  On failure the function returns a
  1186. X     null pointer.
  1187. X
  1188. X  PDCurses Errors:
  1189. X     It is an error to pass sub-window coordinates that are out of
  1190. X     range or a NULL WINDOW pointer.  subwin() may also return an
  1191. X     error if it fails to allocate enough memory for the window
  1192. X     structure.
  1193. X
  1194. X  Portability:
  1195. X     PDCurses    WINDOW*    subwin( WINDOW* orig, int nlines,
  1196. X                 int ncols, int begin_y, int begin_x );
  1197. X     X/Open Dec '88    WINDOW*    subwin( WINDOW* orig, int nlines,
  1198. X                 int ncols, int begin_y, int begin_x );
  1199. X     BSD Curses    WINDOW*    subwin( WINDOW* orig, int nlines,
  1200. X                 int ncols, int begin_y, int begin_x );
  1201. X     SYS V Curses    WINDOW*    subwin( WINDOW* orig, int nlines,
  1202. X                 int ncols, int begin_y, int begin_x );
  1203. X
  1204. X**man-end**********************************************************************/
  1205. X
  1206. XWINDOW*    subwin(WINDOW* orig,int nlines,int ncols,int begin_y,int begin_x)
  1207. X{
  1208. Xextern    void*    (*mallc)( size_t );
  1209. Xextern    void*    (*callc)( size_t, size_t );
  1210. Xextern    void    (*fre)( void* );
  1211. X
  1212. X    WINDOW*    win;
  1213. X    int    i;
  1214. X    int    j = begin_y - orig->_begy;
  1215. X    int    k = begin_x - orig->_begx;
  1216. X
  1217. X    if (!orig)
  1218. X        return( (WINDOW *)NULL );
  1219. X
  1220. X    /*
  1221. X     * make sure window fits inside the original one
  1222. X     */
  1223. X    if ((begin_y < orig->_begy) ||
  1224. X        (begin_x < orig->_begx) ||
  1225. X        (begin_y + nlines) > (orig->_begy + orig->_maxy) ||
  1226. X        (begin_x + ncols)  > (orig->_begx + orig->_maxx))
  1227. X    {
  1228. X        return( (WINDOW *)NULL );
  1229. X    }
  1230. X    if (!nlines)    nlines = orig->_maxy - 1 - j;
  1231. X    if (!ncols)    ncols  = orig->_maxx - 1 - k;
  1232. X    if ((win = PDC_makenew(nlines, ncols, begin_y, begin_x)) == (WINDOW *) NULL)
  1233. X    {
  1234. X        return( (WINDOW *)NULL );
  1235. X    }
  1236. X
  1237. X    /*
  1238. X     * initialize window variables
  1239. X     */
  1240. X    win->_attrs    = orig->_attrs;
  1241. X    win->_leave    = orig->_leave;
  1242. X    win->_scroll    = orig->_scroll;
  1243. X    win->_nodelay    = orig->_nodelay;
  1244. X    win->_use_keypad    = orig->_use_keypad;
  1245. X    win->_parent    = orig;
  1246. X
  1247. X    for (i = 0; i < nlines; i++)
  1248. X    {
  1249. X        win->_y[i] = (orig->_y[j++]) + k;
  1250. X    }
  1251. X
  1252. X    win->_flags |= _SUBWIN;
  1253. X    return (win);
  1254. X}
  1255. END_OF_FILE
  1256.   if test 2915 -ne `wc -c <'portable/subwin.c'`; then
  1257.     echo shar: \"'portable/subwin.c'\" unpacked with wrong size!
  1258.   fi
  1259.   # end of 'portable/subwin.c'
  1260. fi
  1261. if test -f 'private/_chins.c' -a "${1}" != "-c" ; then 
  1262.   echo shar: Will not clobber existing file \"'private/_chins.c'\"
  1263. else
  1264.   echo shar: Extracting \"'private/_chins.c'\" \(2338 characters\)
  1265.   sed "s/^X//" >'private/_chins.c' <<'END_OF_FILE'
  1266. X#include <string.h>
  1267. X#define    CURSES_LIBRARY    1
  1268. X#include <curses.h>
  1269. X
  1270. X#ifndef    NDEBUG
  1271. Xchar *rcsid__chins = "$Header: c:/curses/private/RCS/_chins.c%v 2.0 1992/11/15 03:24:24 MH Rel $";
  1272. X#endif
  1273. X
  1274. X
  1275. X
  1276. X
  1277. X/*man-start*********************************************************************
  1278. X
  1279. X  PDC_chins()    - Low-level insert character in window
  1280. X
  1281. X  PDCurses Description:
  1282. X     This is a private PDCurses routine.
  1283. X
  1284. X     This routine provides the basic functionality for the X/Open
  1285. X     [mv][w]insch() routines.  The xlat flag indicates that normal
  1286. X     character translation is performed or not.  If not, then the
  1287. X     character is output as is.
  1288. X
  1289. X     The 'xlat' flag is TRUE for the normal curses routines.
  1290. X
  1291. X  PDCurses Return Value:
  1292. X     This function returns OK on success and ERR on error.
  1293. X
  1294. X  PDCurses Errors:
  1295. X     It is an error to call this function with a NULL window pointer.
  1296. X
  1297. X  Portability:
  1298. X     PDCurses    int PDC_chins( WINDOW* win, chtype c, bool xlat );
  1299. X
  1300. X**man-end**********************************************************************/
  1301. X
  1302. Xint    PDC_chins(WINDOW *win, chtype c, bool xlat)
  1303. X{
  1304. X    int    retval = ERR;
  1305. X    int    x;
  1306. X    int    y;
  1307. X    int    maxx;
  1308. X    int    offset;
  1309. X    chtype* temp1;
  1310. X    register chtype*    dstp;
  1311. X    register chtype*    srcp;
  1312. X    char    ch    = (c & A_CHARTEXT);
  1313. X
  1314. X    if (win == (WINDOW *)NULL)
  1315. X        return( retval );
  1316. X
  1317. X    x    = win->_curx;
  1318. X    y    = win->_cury;
  1319. X    maxx    = win->_maxx;
  1320. X    offset    = 1;
  1321. X    temp1    = &win->_y[y][x];
  1322. X
  1323. X/*
  1324. X    if ((ch < ' ') &&
  1325. X        ((ch == '\n') ||
  1326. X         (ch == '\r') ||
  1327. X         (ch == '\t') ||
  1328. X         (ch == '\b')))
  1329. X    {
  1330. X        retval = PDC_chadd(win, c, xlat,FALSE);
  1331. X        return( retval );
  1332. X    }
  1333. X*/
  1334. X    if ((ch < ' ') && xlat)
  1335. X    {
  1336. X        offset++;
  1337. X    }
  1338. X
  1339. X#ifdef    DOS
  1340. X#  if    SMALL || MEDIUM
  1341. X    srcp = temp1;
  1342. X    dstp = temp1+offset;
  1343. X    movedata(FP_SEG(srcp), FP_OFF(srcp),
  1344. X         FP_SEG(dstp), FP_OFF(dstp),
  1345. X         (maxx - x -offset) * sizeof(chtype));
  1346. X#  else
  1347. X    /* Changed from memcpy to memmove. Should work with
  1348. X     * TC and MSC.
  1349. X     *    -- MH    920605
  1350. X     */
  1351. X/*    memmove( temp1 + sizeof(chtype), temp1, (maxx - x -1) * sizeof(chtype) );*/
  1352. X    memmove( temp1+offset, temp1, (maxx - x -offset) * sizeof(chtype) );
  1353. X#  endif
  1354. X#endif
  1355. X#ifdef OS2
  1356. X    memmove( temp1+offset, temp1, (maxx - x -offset) * sizeof(chtype) );
  1357. X#endif
  1358. X
  1359. X    win->_lastch[y] = maxx-1;
  1360. X
  1361. X    if ((win->_firstch[y] == _NO_CHANGE) ||
  1362. X        (win->_firstch[y] > x))
  1363. X    {
  1364. X        win->_firstch[y] = x;
  1365. X    }
  1366. X    /*
  1367. X     * PDC_chadd() fixes CTRL-chars too
  1368. X     */
  1369. X    retval = (PDC_chadd(win, c, xlat,FALSE));
  1370. X    return( retval );
  1371. X}
  1372. END_OF_FILE
  1373.   if test 2338 -ne `wc -c <'private/_chins.c'`; then
  1374.     echo shar: \"'private/_chins.c'\" unpacked with wrong size!
  1375.   fi
  1376.   # end of 'private/_chins.c'
  1377. fi
  1378. if test -f 'private/_gbiosky.c' -a "${1}" != "-c" ; then 
  1379.   echo shar: Will not clobber existing file \"'private/_gbiosky.c'\"
  1380. else
  1381.   echo shar: Extracting \"'private/_gbiosky.c'\" \(2473 characters\)
  1382.   sed "s/^X//" >'private/_gbiosky.c' <<'END_OF_FILE'
  1383. X#define    CURSES_LIBRARY    1
  1384. X#include <curses.h>
  1385. X
  1386. X#ifndef    NDEBUG
  1387. Xchar *rcsid__gbiosky = "$Header: c:/curses/private/RCS/_gbiosky.c%v 2.0 1992/11/15 03:24:21 MH Rel $";
  1388. X#endif
  1389. X
  1390. X
  1391. X
  1392. X
  1393. X/*man-start*********************************************************************
  1394. X
  1395. X  PDC_get_bios_key()    - Returns the next key available from the BIOS.
  1396. X
  1397. X  PDCurses Description:
  1398. X     This is a private PDCurses routine.
  1399. X
  1400. X     Returns the next key code struck at the keyboard. If the low 8
  1401. X     bits are 0, the upper bits contain the extended character
  1402. X     code. If bit 0-7 are non-zero, the upper bits = 0.
  1403. X
  1404. X  PDCurses Return Value:
  1405. X     This function returns OK on success and ERR on error.
  1406. X
  1407. X  PDCurses Errors:
  1408. X     No errors are defined for this function.
  1409. X
  1410. X  Portability:
  1411. X     PDCurses    int PDC_get_bios_key( void );
  1412. X
  1413. X**man-end**********************************************************************/
  1414. X
  1415. Xint    PDC_get_bios_key(void)
  1416. X{
  1417. X#ifdef    FLEXOS
  1418. Xunsigned ch    = 0;
  1419. X
  1420. X    retcode = s_read(0x00, 0L, (char *) &ch, 2L, 0L);
  1421. X    return( (retcode < 0L) ? ERR : ch );
  1422. X#endif
  1423. X#if    defined (DOS) || defined (OS2)
  1424. X    int ascii,scan;
  1425. X#ifdef    DOS
  1426. X    static unsigned char keyboard_function=0xFF;
  1427. X    unsigned char far *enhanced_keyboard;
  1428. X    
  1429. X    if (keyboard_function == 0xFF)
  1430. X        {
  1431. X        enhanced_keyboard = (unsigned char far *) 0x0496L;
  1432. X        regs.h.ah = 0x02;             /* get shift status for all keyboards */
  1433. X        int86(0x16, ®s, ®s);
  1434. X        scan = regs.h.al;
  1435. X        regs.h.ah = 0x12;             /* get shift status for enhanced keyboards */
  1436. X        int86(0x16, ®s, ®s);
  1437. X        if (scan == regs.h.al
  1438. X        &&  *enhanced_keyboard == 0x10)
  1439. X            keyboard_function = 0x10;
  1440. X        else
  1441. X            keyboard_function = 0x0;
  1442. X        }
  1443. X     regs.h.ah = keyboard_function;
  1444. X    int86(0x16, ®s, ®s);
  1445. X    ascii = regs.h.al;
  1446. X    scan = regs.h.ah;
  1447. X#endif
  1448. X#ifdef    OS2
  1449. X    KBDKEYINFO keyInfo;
  1450. X    
  1451. X    KbdCharIn(&keyInfo, IO_WAIT, 0);    /* get a character    */
  1452. X    ascii = keyInfo.chChar;
  1453. X    scan = keyInfo.chScan;
  1454. X#endif
  1455. X    if (scan == 0x1c && ascii == 0x0a)  /* ^Enter */
  1456. X        return ((int) (0xfc00));
  1457. X    if ((scan == 0x03 && ascii == 0x00)  /* ^@ - Null */
  1458. X    ||  (scan == 0xe0 && ascii == 0x0d)  /* PadEnter */
  1459. X    ||  (scan == 0xe0 && ascii == 0x0a)) /* ^PadEnter */
  1460. X        return ((int) (ascii << 8));
  1461. X    if ((scan == 0x37 && ascii == 0x2a)  /* Star */
  1462. X    ||  (scan == 0x4a && ascii == 0x2d)  /* Minus */
  1463. X    ||  (scan == 0x4e && ascii == 0x2b)  /* Plus */
  1464. X    ||  (scan == 0xe0 && ascii == 0x2f)) /* Slash */
  1465. X        return ((int) ((ascii & 0x0f) | 0xf0) << 8);
  1466. X    if (ascii == 0x00 || ascii == 0xe0)
  1467. X        return ((int) (scan << 8));
  1468. X        return ((int) (ascii));
  1469. X#endif
  1470. X}
  1471. END_OF_FILE
  1472.   if test 2473 -ne `wc -c <'private/_gbiosky.c'`; then
  1473.     echo shar: \"'private/_gbiosky.c'\" unpacked with wrong size!
  1474.   fi
  1475.   # end of 'private/_gbiosky.c'
  1476. fi
  1477. if test -f 'private/_getrows.c' -a "${1}" != "-c" ; then 
  1478.   echo shar: Will not clobber existing file \"'private/_getrows.c'\"
  1479. else
  1480.   echo shar: Extracting \"'private/_getrows.c'\" \(2370 characters\)
  1481.   sed "s/^X//" >'private/_getrows.c' <<'END_OF_FILE'
  1482. X#define    CURSES_LIBRARY    1
  1483. X#include <curses.h>
  1484. X
  1485. X#ifndef    NDEBUG
  1486. Xchar *rcsid__getrows = "$Header: c:/curses/private/RCS/_getrows.c%v 2.0 1992/11/15 03:24:26 MH Rel $";
  1487. X#endif
  1488. X
  1489. X
  1490. X
  1491. X
  1492. X/*man-start*********************************************************************
  1493. X
  1494. X  PDC_get_rows()    - Return number of screen rows.
  1495. X
  1496. X  PDCurses Description:
  1497. X     This is a private PDCurses routine.
  1498. X
  1499. X     Returns the maximum number of rows supported by the display.
  1500. X     e.g.  25, 28, 43, 50, 60, 66...
  1501. X
  1502. X  PDCurses Return Value:
  1503. X     This function returns OK on success and ERR on error.
  1504. X
  1505. X  PDCurses Errors:
  1506. X     No errors are defined for this function.
  1507. X
  1508. X  Portability:
  1509. X     PDCurses    int PDC_get_rows( void );
  1510. X
  1511. X**man-end**********************************************************************/
  1512. X
  1513. Xint    PDC_get_rows(void)
  1514. X{
  1515. X#ifdef    FLEXOS
  1516. X        return (vir.vc_size.rs_nrows);
  1517. X#endif
  1518. X#ifdef    DOS
  1519. X    char far*    ROWS;
  1520. X    int        rows;
  1521. X    char *env_rows;
  1522. X/* use the value from LINES environment variable, if set. MH 10-Jun-92 */
  1523. X/* and use the minimum of LINES and *ROWS.                MH 18-Jun-92 */
  1524. X    ROWS = (char far *) 0x0484L;
  1525. X    rows = *ROWS + 1;
  1526. X    env_rows = (char *)getenv("LINES");
  1527. X    if (env_rows != (char *)NULL)
  1528. X        rows = min(atoi(env_rows),rows);
  1529. X
  1530. X    if ((rows == 1) && (_cursvar.adapter == _MDS_GENIUS))
  1531. X        rows = 66;
  1532. X    if ((rows == 1) && (_cursvar.adapter == _MDA))
  1533. X        rows = 25;  /* new test MH 10-Jun-92 */
  1534. X    if (rows == 1)
  1535. X    {
  1536. X        rows = _default_lines;    /* Allow pre-setting LINES     */
  1537. X        _cursvar.direct_video = FALSE;
  1538. X    }
  1539. X    switch (_cursvar.adapter)
  1540. X    {
  1541. X    case _EGACOLOR:
  1542. X    case _EGAMONO:
  1543. X        switch (rows)
  1544. X        {
  1545. X        case 25:
  1546. X        case 43:
  1547. X            break;
  1548. X        default:
  1549. X            rows = 25;
  1550. X        }
  1551. X        break;
  1552. X
  1553. X    case _VGACOLOR:
  1554. X    case _VGAMONO:
  1555. X/* lets be reasonably flexible with VGAs - they could be Super VGAs */
  1556. X/* capable of displaying any number of lines. MH 10-Jun-92          */
  1557. X/*
  1558. X        switch (rows)
  1559. X        {
  1560. X        case 25:
  1561. X        case 28:
  1562. X        case 50:
  1563. X            break;
  1564. X        default:
  1565. X            rows = 25;
  1566. X        }
  1567. X*/
  1568. X        break;
  1569. X
  1570. X    default:
  1571. X        rows = 25;
  1572. X        break;
  1573. X    }
  1574. X    return (rows);
  1575. X#endif
  1576. X#ifdef    OS2
  1577. X    VIOMODEINFO modeInfo;
  1578. X    int        rows;
  1579. X    char *env_rows;
  1580. X/* use the value from LINES environment variable, if set. MH 10-Jun-92 */
  1581. X/* and use the minimum of LINES and *ROWS.                MH 18-Jun-92 */
  1582. X
  1583. X    modeInfo.cb = sizeof(modeInfo);
  1584. X    VioGetMode(&modeInfo, 0);
  1585. X    rows = modeInfo.row;
  1586. X    env_rows = (char *)getenv("LINES");
  1587. X    if (env_rows != (char *)NULL)
  1588. X        rows = min(atoi(env_rows),rows);
  1589. X    return(rows);
  1590. X#endif
  1591. X}
  1592. END_OF_FILE
  1593.   if test 2370 -ne `wc -c <'private/_getrows.c'`; then
  1594.     echo shar: \"'private/_getrows.c'\" unpacked with wrong size!
  1595.   fi
  1596.   # end of 'private/_getrows.c'
  1597. fi
  1598. if test -f 'private/_scroll.c' -a "${1}" != "-c" ; then 
  1599.   echo shar: Will not clobber existing file \"'private/_scroll.c'\"
  1600. else
  1601.   echo shar: Extracting \"'private/_scroll.c'\" \(2928 characters\)
  1602.   sed "s/^X//" >'private/_scroll.c' <<'END_OF_FILE'
  1603. X#define    CURSES_LIBRARY    1
  1604. X#include <curses.h>
  1605. X
  1606. X#ifndef    NDEBUG
  1607. Xchar *rcsid__scroll = "$Header: c:/curses/private/RCS/_scroll.c%v 2.0 1992/11/15 03:24:34 MH Rel $";
  1608. X#endif
  1609. X
  1610. X
  1611. X
  1612. X
  1613. X/*man-start*********************************************************************
  1614. X
  1615. X  PDC_scroll()    - low level screen scroll
  1616. X
  1617. X  PDCurses Description:
  1618. X     Scrolls a window in the current page up or down. Urow, lcol,
  1619. X     lrow, rcol are the window coordinates.    Lines is the number of
  1620. X     lines to scroll. If 0, clears the window, if < 0 scrolls down,
  1621. X     if > 0 scrolls up.  Blanks areas that are left, and sets
  1622. X     character attributes to attr. If in a colour graphics mode,
  1623. X     fills them with the colour 'attr' instead.
  1624. X
  1625. X  PDCurses Return Value:
  1626. X     The PDC_scroll() function returns OK on success otherwise ERR is returned.
  1627. X
  1628. X  PDCurses Errors:
  1629. X     An error will only be returned on the Flexos platform if s_copy()
  1630. X     fails.
  1631. X
  1632. X  Portability:
  1633. X     PDCurses    int PDC_scroll( int urow, int lcol, int rcol,
  1634. X                      int lines, chtype attr );
  1635. X
  1636. X**man-end**********************************************************************/
  1637. X
  1638. Xint    PDC_scroll(int urow, int lcol, int lrow, int rcol, int lines, chtype attr)
  1639. X{
  1640. X#ifdef    FLEXOS
  1641. X    int    srow;
  1642. X    int    scol;
  1643. X    int    drow;
  1644. X    int    dcol;
  1645. X    int    nrows
  1646. X    int    ncols;
  1647. X    char    blank = (char) _cursvar.blank;
  1648. X
  1649. X    if (lines == 0)
  1650. X    {
  1651. X        sframe.fr_pl[0] = (UBYTE *) & blank;
  1652. X        sframe.fr_pl[1] = (UBYTE *) & attr;
  1653. X        sframe.fr_pl[2] = (UBYTE *) " ";
  1654. X        sframe.fr_nrow = 1;
  1655. X        sframe.fr_ncol = 1;
  1656. X        sframe.fr_use = 0x00;
  1657. X        nrows = lrow;
  1658. X        ncols = rcol;
  1659. X        srow = drow = 0;
  1660. X        scol = dcol = 0;
  1661. X    }
  1662. X    else
  1663. X    if (lines < 0)
  1664. X    {
  1665. X        srow = urow;
  1666. X        scol = lcol;
  1667. X        drow = lrow;
  1668. X        dcol = rcol;
  1669. X    }
  1670. X    else
  1671. X    if (lines > 0)
  1672. X    {
  1673. X        srow = urow;
  1674. X        scol = lcol;
  1675. X        drow = lrow;
  1676. X        dcol = lcol;
  1677. X    }
  1678. X
  1679. X    drect.r_row = drow;
  1680. X    drect.r_col = dcol;
  1681. X    drect.r_nrow = nrows;
  1682. X    drect.r_ncol = ncols;
  1683. X
  1684. X    srect.r_col = scol;
  1685. X    srect.r_row = srow;
  1686. X    srect.r_nrow = nrows;
  1687. X    srect.r_ncol = ncols;
  1688. X
  1689. X    if (lines != 0)
  1690. X        retcode = s_copy(0x03, 0x01L, 0L, (far unsigned short *) &drect, 0L, (far unsigned short *) &srect);
  1691. X    else
  1692. X        retcode = s_copy(0x03, 0x01L, 0L, (far unsigned short *) &drect, (far unsigned short *) &sframe, (far unsigned short *) &srect);
  1693. X    return( (retcode < 0L) ? ERR : OK );
  1694. X#endif
  1695. X#ifdef    DOS
  1696. X    if (lines >= 0)
  1697. X    {
  1698. X        regs.h.ah = 0x06;
  1699. X        regs.h.al = (unsigned char) lines;
  1700. X    }
  1701. X    else
  1702. X    {
  1703. X        regs.h.ah = 0x07;
  1704. X        regs.h.al = (unsigned char) (-lines);
  1705. X    }
  1706. X    regs.h.bh = (unsigned char)((attr & A_ATTRIBUTES) >> 8);
  1707. X    regs.h.ch = (unsigned char) urow;
  1708. X    regs.h.cl = (unsigned char) lcol;
  1709. X    regs.h.dh = (unsigned char) lrow;
  1710. X    regs.h.dl = (unsigned char) rcol;
  1711. X    int86(0x10, ®s, ®s);
  1712. X    return( OK );
  1713. X#endif
  1714. X#ifdef    OS2
  1715. X    USHORT ch=((attr << 8) & _cursvar.blank);
  1716. X    if (lines > 0)
  1717. X        VioScrollUp(urow, lcol, lrow, rcol, lines, (PBYTE)&ch, 0);
  1718. X    else
  1719. X        if (lines < 0)
  1720. X            VioScrollDn(urow, lcol, lrow, rcol, lines, (PBYTE)&ch, 0);
  1721. X        else
  1722. X/* this clears the whole screen */
  1723. X            VioScrollUp(0, 0, -1, -1, -1, (PBYTE)&ch, 0);
  1724. X#endif
  1725. X}
  1726. END_OF_FILE
  1727.   if test 2928 -ne `wc -c <'private/_scroll.c'`; then
  1728.     echo shar: \"'private/_scroll.c'\" unpacked with wrong size!
  1729.   fi
  1730.   # end of 'private/_scroll.c'
  1731. fi
  1732. if test -f 'private/_scropen.c' -a "${1}" != "-c" ; then 
  1733.   echo shar: Will not clobber existing file \"'private/_scropen.c'\"
  1734. else
  1735.   echo shar: Extracting \"'private/_scropen.c'\" \(2851 characters\)
  1736.   sed "s/^X//" >'private/_scropen.c' <<'END_OF_FILE'
  1737. X#define    CURSES_LIBRARY    1
  1738. X#include <curses.h>
  1739. X
  1740. X#ifndef    NDEBUG
  1741. Xchar *rcsid__scropen = "$Header: c:/curses/private/RCS/_scropen.c%v 2.0 1992/11/15 03:24:35 MH Rel $";
  1742. X#endif
  1743. X
  1744. X
  1745. X
  1746. X
  1747. X/*man-start*********************************************************************
  1748. X
  1749. X  PDC_scr_open()    - Internal low-level binding to open the physical screen
  1750. X
  1751. X  PDCurses Description:
  1752. X     This function provides a low-level binding for the Flexos
  1753. X     platform which must open the screen before writing to it.
  1754. X
  1755. X     This function is provided in order to access the FlexOS 16 bit
  1756. X     character set for input rather than the limited input
  1757. X     character set associated with the VT52.
  1758. X
  1759. X  PDCurses Return Value:
  1760. X     This function returns OK on success, otherwise an ERR is returned.
  1761. X
  1762. X  PDCurses Errors:
  1763. X     The DOS platform will never fail.  The Flexos platform may fail
  1764. X     depending on the ability to open the current virtual console in
  1765. X     8 (as opposed to 16) bit mode.
  1766. X
  1767. X  Portability:
  1768. X     PDCurses    int    PDC_scr_open( SCREEN* internal, bool echo );
  1769. X
  1770. X**man-end**********************************************************************/
  1771. X
  1772. Xint    PDC_scr_open(SCREEN *internal, bool echo)
  1773. X{
  1774. X#ifdef    FLEXOS
  1775. X    retcode = s_get(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  1776. X    if (retcode < 0L)
  1777. X        return( ERR );
  1778. X
  1779. X    kbmode = vir.vc_kbmode;
  1780. X    cmode = vir.vc_mode;
  1781. X    vir.vc_mode = 0;
  1782. X
  1783. X    if (!echo)    vir.vc_kbmode |= VCKM_NECHO;
  1784. X    else        vir.vc_kbmode &= ~VCKM_NECHO;
  1785. X
  1786. X    smode = vir.vc_smode;
  1787. X    retcode = s_set(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  1788. X    if  (retcode < 0L)
  1789. X        return( ERR );
  1790. X
  1791. X    if (vir.vc_type & 0x03)    internal->mono = TRUE;
  1792. X    else            internal->mono = FALSE;
  1793. X
  1794. X    internal->orig_attr = vir.vc_flcolor | vir.vc_blcolor;
  1795. X    _flexos_16bitmode();
  1796. X#endif
  1797. X
  1798. X#ifdef    DOS
  1799. X    char far *INFO = (char far *) 0x0487L;
  1800. X
  1801. X    internal->orig_attr     = 0;
  1802. X    internal->orig_emulation = *INFO;
  1803. X#endif
  1804. X#ifdef    OS2
  1805. X    internal->orig_attr     = 0;
  1806. X    internal->orig_emulation = 0;
  1807. X#endif
  1808. X
  1809. X    PDC_get_cursor_pos(&internal->cursrow, &internal->curscol);
  1810. X    internal->autocr    = TRUE;        /* lf -> crlf by default      */
  1811. X    internal->raw_out    = FALSE;    /* tty I/O modes          */
  1812. X    internal->raw_inp    = FALSE;    /* tty I/O modes          */
  1813. X    internal->cbreak    = FALSE;
  1814. X    internal->echo        = echo;
  1815. X    internal->refrbrk    = FALSE;    /* no premature end of refresh*/
  1816. X#if !defined OS2
  1817. X    internal->video_seg    = 0xb000;    /* Base screen segment addr   */
  1818. X    internal->video_ofs    = 0x0;        /* Base screen segment ofs    */
  1819. X#endif
  1820. X    internal->video_page    = 0;        /* Current Video Page          */
  1821. X    internal->direct_video    = TRUE;        /* Assume that we can          */
  1822. X    internal->visible_cursor= TRUE;        /* Assume that it is visible  */
  1823. X    internal->cursor    = PDC_get_cursor_mode();
  1824. X    internal->adapter    = PDC_query_adapter_type();
  1825. X    internal->font        = PDC_get_font();
  1826. X    internal->scrnmode    = PDC_get_scrn_mode();
  1827. X    internal->lines        = PDC_get_rows();
  1828. X    internal->cols        = PDC_get_columns();
  1829. X    internal->audible    = TRUE;
  1830. X    return( OK );
  1831. X}
  1832. END_OF_FILE
  1833.   if test 2851 -ne `wc -c <'private/_scropen.c'`; then
  1834.     echo shar: \"'private/_scropen.c'\" unpacked with wrong size!
  1835.   fi
  1836.   # end of 'private/_scropen.c'
  1837. fi
  1838. if test -f 'private/_setfont.c' -a "${1}" != "-c" ; then 
  1839.   echo shar: Will not clobber existing file \"'private/_setfont.c'\"
  1840. else
  1841.   echo shar: Extracting \"'private/_setfont.c'\" \(2836 characters\)
  1842.   sed "s/^X//" >'private/_setfont.c' <<'END_OF_FILE'
  1843. X#define    CURSES_LIBRARY    1
  1844. X#include <curses.h>
  1845. X
  1846. X#ifndef NDEBUG
  1847. Xchar *rcsid__setfont = "$Header: c:/curses/private/RCS/_setfont.c%v 2.0 1992/11/15 03:24:36 MH Rel $";
  1848. X#endif
  1849. X
  1850. X
  1851. X
  1852. X
  1853. X/*man-start*********************************************************************
  1854. X
  1855. X  PDC_set_font()    - sets the current font size
  1856. X
  1857. X  PDCurses Description:
  1858. X     This is a private PDCurses function.
  1859. X
  1860. X     This routine sets the current font size, if the adapter allows
  1861. X     such a change.
  1862. X
  1863. X  PDCurses Return Value:
  1864. X     This function returns OK upon success otherwise ERR is returned.
  1865. X
  1866. X  PDCurses Errors:
  1867. X     It is an error to attempt to change the font size on a "bogus"
  1868. X     adapter.  The reason for this is that we have a known video
  1869. X     adapter identity problem.  e.g. Two adapters report the same
  1870. X     identifying characteristics.
  1871. X
  1872. X     It is also an error to attempt to change the size of the Flexos
  1873. X     console (as there is currently no support for that).
  1874. X
  1875. X  Portability:
  1876. X     PDCurses    int    PDC_set_font( int size );
  1877. X
  1878. X**man-end**********************************************************************/
  1879. X
  1880. Xint    PDC_set_font(int size)
  1881. X{
  1882. X#ifdef    FLEXOS
  1883. X    return( ERR );
  1884. X#endif
  1885. X#ifdef    DOS
  1886. X    if (_cursvar.bogus_adapter)
  1887. X        return( ERR );
  1888. X
  1889. X    switch (_cursvar.adapter)
  1890. X    {
  1891. X    case _CGA:
  1892. X    case _MDA:
  1893. X    case _MCGACOLOR:
  1894. X    case _MCGAMONO:
  1895. X    case _MDS_GENIUS:
  1896. X        break;
  1897. X
  1898. X    case _EGACOLOR:
  1899. X    case _EGAMONO:
  1900. X        if (_cursvar.sizeable && (_cursvar.font != size))
  1901. X        {
  1902. X            switch (size)
  1903. X            {
  1904. X            case _FONT8:
  1905. X                regs.h.ah = 0x11;
  1906. X                regs.h.al = 0x12;
  1907. X                regs.h.bl = 0x00;
  1908. X                int86(0x10, ®s, ®s);
  1909. X                break;
  1910. X            case _FONT14:
  1911. X                regs.h.ah = 0x11;
  1912. X                regs.h.al = 0x11;
  1913. X                regs.h.bl = 0x00;
  1914. X                int86(0x10, ®s, ®s);
  1915. X                break;
  1916. X            default:
  1917. X                break;
  1918. X            }
  1919. X        }
  1920. X        break;
  1921. X
  1922. X    case _VGACOLOR:
  1923. X    case _VGAMONO:
  1924. X        if (_cursvar.sizeable && (_cursvar.font != size))
  1925. X        {
  1926. X            switch (size)
  1927. X            {
  1928. X            case _FONT8:
  1929. X                regs.h.ah = 0x11;
  1930. X                regs.h.al = 0x12;
  1931. X                regs.h.bl = 0x00;
  1932. X                int86(0x10, ®s, ®s);
  1933. X                break;
  1934. X            case _FONT14:
  1935. X                regs.h.ah = 0x11;
  1936. X                regs.h.al = 0x11;
  1937. X                regs.h.bl = 0x00;
  1938. X                int86(0x10, ®s, ®s);
  1939. X                break;
  1940. X            case _FONT16:
  1941. X                regs.h.ah = 0x11;
  1942. X                regs.h.al = 0x14;
  1943. X                regs.h.bl = 0x00;
  1944. X                int86(0x10, ®s, ®s);
  1945. X                break;
  1946. X            default:
  1947. X                break;
  1948. X            }
  1949. X        }
  1950. X        break;
  1951. X    default:
  1952. X        break;
  1953. X    }
  1954. X    if (_cursvar.visible_cursor)
  1955. X        curson();
  1956. X    else
  1957. X        cursoff();
  1958. X    _cursvar.font = PDC_get_font();
  1959. X    return( OK );
  1960. X#endif
  1961. X#ifdef    OS2
  1962. X    VIOMODEINFO modeInfo;
  1963. X    if (_cursvar.sizeable && (_cursvar.font != size))
  1964. X    {
  1965. X           modeInfo.cb = sizeof(modeInfo);
  1966. X           /* set most parameters of modeInfo */
  1967. X           VioGetMode(&modeInfo, 0);
  1968. X           modeInfo.cb = 8;     /* ignore horiz an vert resolution */
  1969. X               modeInfo.row = modeInfo.vres / size;
  1970. X           VioSetMode(&modeInfo, 0);
  1971. X    }
  1972. X    if (_cursvar.visible_cursor)
  1973. X        curson();
  1974. X    else
  1975. X        cursoff();
  1976. X    _cursvar.font = PDC_get_font();
  1977. X    return( OK );
  1978. X#endif
  1979. X}
  1980. END_OF_FILE
  1981.   if test 2836 -ne `wc -c <'private/_setfont.c'`; then
  1982.     echo shar: \"'private/_setfont.c'\" unpacked with wrong size!
  1983.   fi
  1984.   # end of 'private/_setfont.c'
  1985. fi
  1986. echo shar: End of archive 6 \(of 11\).
  1987. cp /dev/null ark6isdone
  1988. MISSING=""
  1989. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1990.     if test ! -f ark${I}isdone ; then
  1991.     MISSING="${MISSING} ${I}"
  1992.     fi
  1993. done
  1994. if test "${MISSING}" = "" ; then
  1995.     echo You have unpacked all 11 archives.
  1996.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1997. else
  1998.     echo You still must unpack the following archives:
  1999.     echo "        " ${MISSING}
  2000. fi
  2001. exit 0
  2002. exit 0 # Just in case...
  2003.