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

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