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

  1. Newsgroups: comp.sources.misc
  2. From: M.Hessling@gu.edu.au (Mark Hessling)
  3. Subject:  v33i084:  pdcurses - Public Domain curses library for DOS and OS/2 v2.0, Part04/11
  4. Message-ID: <1992Nov19.040136.6902@sparky.imd.sterling.com>
  5. X-Md4-Signature: ebe688e70f43af466ce636695e9cddcf
  6. Date: Thu, 19 Nov 1992 04:01:36 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 84
  11. Archive-name: pdcurses/part04
  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:  cursos2.h demos/newdemo.c doc/intro.man
  19. #   portable/flushinp.c portable/initscr.c portable/keyname.c
  20. #   portable/wgetch.c portable/wnoutref.c private/_queryad.c
  21. #   private/_xfrmlin.c
  22. # Wrapped by kent@sparky on Wed Nov 18 21:44:07 1992
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 4 (of 11)."'
  26. if test -f 'cursos2.h' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'cursos2.h'\"
  28. else
  29.   echo shar: Extracting \"'cursos2.h'\" \(6500 characters\)
  30.   sed "s/^X//" >'cursos2.h' <<'END_OF_FILE'
  31. X/* $Header: c:/curses/RCS/cursos2.h%v 2.0 1992/11/16 22:40:44 MH Rel $ */
  32. X#ifndef CURSOS2_INCL
  33. X#define CURSOS2_INCL 1
  34. X
  35. X#ifdef CURSES__32BIT__
  36. X
  37. X#define KbdSetStatus Kbd32SetStatus
  38. X#define KbdGetStatus Kbd32GetStatus
  39. X#define KbdCharIn Kbd32CharIn
  40. X#define KbdPeek   Kbd32Peek
  41. X#define KbdFlushBuffer Kbd32FlushBuffer
  42. X
  43. X#define VioGetMode Vio32GetMode
  44. X#define VioSetMode Vio32SetMode
  45. X#define VioGetCurPos Vio32GetCurPos
  46. X#define VioSetCurPos Vio32SetCurPos
  47. X#define VioGetCurType Vio32GetCurType
  48. X#define VioSetCurType Vio32SetCurType
  49. X#define VioScrollDn Vio32ScrollDn
  50. X#define VioScrollUp Vio32ScrollUp
  51. X#define VioGetConfig Vio32GetConfig
  52. X#define VioWrtTTY Vio32WrtTTY
  53. X#define VioReadCellStr Vio32ReadCellStr
  54. X#define VioWrtCellStr Vio32WrtCellStr
  55. X#define VioWrtNAttr Vio32WrtNAttr
  56. X
  57. X#define FARKeyword
  58. X
  59. X#define CURS_INCL_VIO_KBD
  60. X
  61. X
  62. X#ifdef __EMX__
  63. X#  ifndef USE_OS2_H
  64. X#     define USE_OS2_H
  65. X#  endif
  66. X#  define APIENTRY
  67. X#else
  68. X#  define APIRET ULONG
  69. X#endif
  70. X
  71. X#else
  72. X
  73. X
  74. X#   define FARKeyword far
  75. X#   define APIRET USHORT
  76. X
  77. X#ifdef USE_OS2_H
  78. X#   define INCL_VIO
  79. X#   define INCL_KBD
  80. X#else
  81. X#   define CURS_INCL_VIO_KBD
  82. X#endif
  83. X
  84. X
  85. X#endif   /* __32BIT__ */
  86. X
  87. X
  88. X/* if USE_OS2_H is defined then use the os2.h that comes with your compiler ...*/
  89. X
  90. X#ifdef USE_OS2_H
  91. X#  include <os2.h>
  92. X#else
  93. X
  94. X/* ... otherwise use these definitions */
  95. X
  96. X#  include <os2def.h>
  97. X
  98. X#endif
  99. X
  100. X#ifdef CURS_INCL_VIO_KBD
  101. X
  102. Xtypedef SHANDLE         HKBD;
  103. Xtypedef HKBD    FARKeyword *   PHKBD;
  104. X
  105. X
  106. Xtypedef SHANDLE         HVIO;
  107. Xtypedef HVIO    FARKeyword *   PHVIO;
  108. X
  109. X
  110. X
  111. Xtypedef struct _KBDINFO {
  112. X        USHORT cb;
  113. X        USHORT fsMask;
  114. X        USHORT chTurnAround;
  115. X        USHORT fsInterim;
  116. X        USHORT fsState;
  117. X        }KBDINFO;
  118. Xtypedef KBDINFO FARKeyword *PKBDINFO;
  119. X
  120. X
  121. XUSHORT APIENTRY KbdSetStatus(
  122. X        PKBDINFO    pkbdinfo,
  123. X        HKBD        hkbd );
  124. X
  125. X
  126. XUSHORT APIENTRY KbdGetStatus(
  127. X        PKBDINFO    pkbdinfo,
  128. X        HKBD        hdbd  );
  129. X
  130. X
  131. Xtypedef struct _KBDKEYINFO {
  132. X        UCHAR    chChar;    /* ASCII character code                     */
  133. X        UCHAR    chScan;    /* Scan Code                                */
  134. X        UCHAR    fbStatus;
  135. X        UCHAR    bNlsShift;
  136. X        USHORT   fsState;
  137. X        ULONG    time;
  138. X        }KBDKEYINFO;
  139. Xtypedef KBDKEYINFO FARKeyword *PKBDKEYINFO;
  140. X
  141. X#define IO_WAIT     0
  142. X#define IO_NOWAIT   1
  143. X
  144. XUSHORT APIENTRY KbdCharIn(
  145. X        PKBDKEYINFO pkbci,
  146. X        USHORT      fWait,      /* IO_WAIT, IO_NOWAIT     */
  147. X        HKBD        hkbd);
  148. X
  149. XUSHORT APIENTRY KbdFlushBuffer(
  150. X        HKBD hkbd);
  151. X
  152. X
  153. Xtypedef struct _VIOMODEINFO {
  154. X        USHORT cb;
  155. X        UCHAR  fbType;
  156. X        UCHAR  color;
  157. X        USHORT col;     /* number of text columns                       */
  158. X        USHORT row;     /* number of text rows                          */
  159. X        USHORT hres;    /* horizontal resolution                        */
  160. X        USHORT vres;    /* vertical resolution                          */
  161. X        UCHAR  fmt_ID;
  162. X        UCHAR  attrib;  /* number of attributes                         */
  163. X        ULONG  buf_addr;
  164. X        ULONG  buf_length;
  165. X        ULONG  full_length;
  166. X        ULONG  partial_length;
  167. X        PCH    ext_data_addr;
  168. X        } VIOMODEINFO;
  169. Xtypedef VIOMODEINFO FARKeyword *PVIOMODEINFO;
  170. X
  171. X
  172. XUSHORT APIENTRY VioGetMode(
  173. X        PVIOMODEINFO  pvioModeInfo,
  174. X        HVIO          hvio);
  175. X
  176. X
  177. XUSHORT APIENTRY VioSetMode(
  178. X        PVIOMODEINFO  pvioModeInfo,
  179. X        HVIO          hvio);
  180. X
  181. X
  182. XUSHORT APIENTRY VioGetCurPos(
  183. X        PUSHORT    pusRow,
  184. X        PUSHORT    pusColumn,
  185. X        HVIO       hvio );
  186. X
  187. X
  188. XUSHORT APIENTRY VioSetCurPos(
  189. X        USHORT  usRow,
  190. X        USHORT  usColumn,
  191. X        HVIO    hvio);
  192. X
  193. Xtypedef struct _VIOCURSORINFO {
  194. X        USHORT   yStart;
  195. X        USHORT   cEnd;
  196. X        USHORT   cx;
  197. X        USHORT   attr;   /* -1=hidden cursor, any other=normal cursor   */
  198. X        } VIOCURSORINFO;
  199. Xtypedef VIOCURSORINFO FARKeyword *PVIOCURSORINFO;
  200. X
  201. X
  202. XUSHORT APIENTRY VioGetCurType(
  203. X       PVIOCURSORINFO pvioCursorInfo,
  204. X       HVIO           hvio );
  205. X
  206. X
  207. XUSHORT APIENTRY VioSetCurType(
  208. X        PVIOCURSORINFO pvioCursorInfo,
  209. X        HVIO           hvio );
  210. X
  211. XUSHORT APIENTRY VioScrollDn(
  212. X        USHORT  usTopRow,
  213. X        USHORT  usLeftCol,
  214. X        USHORT  usBotRow,
  215. X        USHORT  usRightCol,
  216. X        USHORT  cbLines,
  217. X        PBYTE   pCell,
  218. X        HVIO    hvio );
  219. X
  220. X
  221. X
  222. XUSHORT APIENTRY VioScrollUp(
  223. X        USHORT  usTopRow,
  224. X        USHORT  usLeftCol,
  225. X        USHORT  usBotRow,
  226. X        USHORT  usRightCol,
  227. X        USHORT  cbLines,
  228. X        PBYTE   pCell,
  229. X        HVIO    hvio );
  230. X
  231. X
  232. X   /* VIOCONFIGINFO.adapter constants */
  233. X
  234. X   #define DISPLAY_MONOCHROME      0x0000
  235. X   #define DISPLAY_CGA             0x0001
  236. X   #define DISPLAY_EGA             0x0002
  237. X   #define DISPLAY_VGA             0x0003
  238. X   #define DISPLAY_8514A           0x0007
  239. X
  240. X   /* VIOCONFIGINFO.display constants */
  241. X
  242. X   #define MONITOR_MONOCHROME      0x0000
  243. X   #define MONITOR_COLOR           0x0001
  244. X   #define MONITOR_ENHANCED        0x0002
  245. X   #define MONITOR_8503            0x0003
  246. X   #define MONITOR_851X_COLOR      0x0004
  247. X   #define MONITOR_8514            0x0009
  248. X
  249. Xtypedef struct _VIOCONFIGINFO {
  250. X        USHORT  cb;
  251. X        USHORT  adapter;
  252. X        USHORT  display;
  253. X        ULONG   cbMemory;
  254. X        USHORT  Configuration;
  255. X        USHORT  VDHVersion;
  256. X        USHORT  Flags;
  257. X        ULONG   HWBufferSize;
  258. X        ULONG   FullSaveSize;
  259. X        ULONG   PartSaveSize;
  260. X        USHORT  EMAdaptersOFF;
  261. X        USHORT  EMDisplaysOFF;
  262. X        } VIOCONFIGINFO;
  263. Xtypedef VIOCONFIGINFO FARKeyword *PVIOCONFIGINFO;
  264. X
  265. X
  266. XUSHORT APIENTRY VioGetConfig(
  267. X        USHORT         usConfigId,  /* Reserved (must be 0)             */
  268. X        PVIOCONFIGINFO pvioin,
  269. X        HVIO           hvio );
  270. X
  271. XUSHORT APIENTRY VioWrtTTY(
  272. X        PCH     pch,
  273. X        USHORT  cb,
  274. X        HVIO    hvio );
  275. X
  276. XUSHORT APIENTRY VioReadCellStr(
  277. X        PCH       pchCellStr,
  278. X        PUSHORT   pcb,
  279. X        USHORT    usRow,
  280. X        USHORT    usColumn,
  281. X        HVIO      hvio );
  282. X
  283. XUSHORT APIENTRY VioWrtCellStr(
  284. X        PCH      pchCellStr,
  285. X        USHORT   cb,
  286. X        USHORT   usRow,
  287. X        USHORT   usColumn,
  288. X        HVIO     hvio );
  289. X
  290. XUSHORT APIENTRY VioWrtNAttr(
  291. X        PBYTE     pAttr,
  292. X        USHORT    cb,
  293. X        USHORT    usRow,
  294. X        USHORT    usColumn,
  295. X        HVIO      hvio );
  296. X
  297. X
  298. XUSHORT APIENTRY VioWrtNCell(
  299. X        PBYTE   pCell,
  300. X        USHORT  cb,
  301. X        USHORT  usRow,
  302. X        USHORT  usColumn,
  303. X        HVIO    hvio );
  304. X
  305. X#endif
  306. X
  307. X#endif
  308. X
  309. X
  310. X#ifndef KEYBOARD_ASCII_MODE
  311. X#define KEYBOARD_ASCII_MODE 0x0008
  312. X#endif
  313. X
  314. X#ifndef KEYBOARD_BINARY_MODE
  315. X#define KEYBOARD_BINARY_MODE 0x0004
  316. X#endif
  317. END_OF_FILE
  318.   if test 6500 -ne `wc -c <'cursos2.h'`; then
  319.     echo shar: \"'cursos2.h'\" unpacked with wrong size!
  320.   fi
  321.   # end of 'cursos2.h'
  322. fi
  323. if test -f 'demos/newdemo.c' -a "${1}" != "-c" ; then 
  324.   echo shar: Will not clobber existing file \"'demos/newdemo.c'\"
  325. else
  326.   echo shar: Extracting \"'demos/newdemo.c'\" \(8479 characters\)
  327.   sed "s/^X//" >'demos/newdemo.c' <<'END_OF_FILE'
  328. X/* $Header: c:/curses/demos/RCS/newdemo.c%v 2.0 1992/11/15 03:32:03 MH Rel $
  329. X *
  330. X *  DEMO.CPP    -    A demo program using PDCurses. The program illustrate
  331. X *               the use of colours for text output.
  332. X */
  333. X
  334. X#include <stdio.h>
  335. X#include <signal.h>
  336. X#include <time.h>
  337. X#include <curses.h>
  338. X
  339. X/*
  340. X *  The Australian map
  341. X */
  342. Xchar    *AusMap[16] =
  343. X{
  344. X    "           A           A ",
  345. X    "    N.T. AAAAA       AAAA ",
  346. X    "     AAAAAAAAAAA  AAAAAAAA ",
  347. X    "   AAAAAAAAAAAAAAAAAAAAAAAAA Qld.",
  348. X    "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA ",
  349. X    "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ",
  350. X    " AAAAAAAAAAAAAAAAAAAAAAAAAAAA ",
  351. X    "   AAAAAAAAAAAAAAAAAAAAAAAAA N.S.W.",
  352. X    "W.A. AAAAAAAAA      AAAAAA Vic.",
  353. X    "       AAA   S.A.     AA",
  354. X    "                       A  Tas.",
  355. X    ""
  356. X};
  357. X
  358. X/*
  359. X *  Funny messages
  360. X */
  361. X#define NMESSAGES   6
  362. X
  363. Xchar    *messages[] =
  364. X{
  365. X    "Hello from the Land Down Under",
  366. X    "The Land of crocs. and a big Red Rock",
  367. X    "Where the sunflower runs along the highways",
  368. X    "the dusty red roads lead one to loneliness",
  369. X    "Blue sky in the morning and",
  370. X    "freezing nights and twinkling stars",
  371. X    ""
  372. X};
  373. X
  374. X/*
  375. X *  Main driver
  376. X */
  377. Xmain()
  378. X{
  379. XWINDOW  *win;
  380. Xint     w, x, y, i, j, c, len;
  381. Xtime_t  t;
  382. Xchar    buffer[80], *message;
  383. Xint     width, height;
  384. Xchtype  save[80];
  385. Xvoid    trap();
  386. X
  387. X    initscr();
  388. X    start_color();
  389. X    signal(SIGINT, trap);
  390. X    width  = 48;
  391. X    height = 13;                /* Create a drawing window */
  392. X    win = newwin(height, width, (LINES-height)/2, (COLS-width)/2);
  393. X    if(win == NULL)
  394. X    {   endwin();
  395. X        return 1;
  396. X    }
  397. X
  398. X    while(1)
  399. X    {   init_pair(1,COLOR_WHITE,COLOR_BLUE);
  400. X        wattrset(win, COLOR_PAIR(1));
  401. X        werase(win);
  402. X
  403. X        init_pair(2,COLOR_RED,COLOR_RED);
  404. X        wattrset(win, COLOR_PAIR(2));
  405. X        box(win, 0xba, 0xcd);
  406. X        wrefresh(win);
  407. X                                /* Do ramdom output of a character */
  408. X        wattrset(win, COLOR_PAIR(1));
  409. X        c = 'a';
  410. X        for(i=0; i < 5000; ++i)
  411. X        {   x = rand() % (width-2)  + 1;
  412. X            y = rand() % (height-2) + 1;
  413. X            mvwaddch(win, y, x, c);
  414. X            wrefresh(win);
  415. X            if(typeahead(stdin))
  416. X                break;
  417. X            if(i == 2000)
  418. X            {   c = 'b';
  419. X                init_pair(3,COLOR_CYAN,COLOR_YELLOW);
  420. X                wattron(win, COLOR_PAIR(3));
  421. X            }
  422. X        }
  423. X
  424. X        SubWinTest(win);
  425. X                                /* Erase and draw green window */
  426. X        init_pair(4,COLOR_YELLOW,COLOR_GREEN);
  427. X        wattrset(win, COLOR_PAIR(4) | A_BOLD);
  428. X        werase(win);
  429. X        wrefresh(win);
  430. X                                /* Draw RED bounding box */
  431. X        wattrset(win, COLOR_PAIR(2));
  432. X        box(win, ' ', ' ');
  433. X        wrefresh(win);
  434. X                                /* Display Australia map */
  435. X    wattrset(win, COLOR_PAIR(4) | A_BOLD);
  436. X        i = 0;
  437. X        while(*AusMap[i])
  438. X    {   mvwaddstr(win, i+1, 8, AusMap[i]);
  439. X            wrefresh(win);
  440. X            delay_output(100);
  441. X            ++i;
  442. X        }
  443. X
  444. X        init_pair(5,COLOR_BLUE,COLOR_WHITE);
  445. X        wattrset(win, COLOR_PAIR(5) | A_BLINK);
  446. X    mvwaddstr(win, height-2, 1, " PDCurses 2.0 for DOS and OS/2");
  447. X    wrefresh(win);
  448. X
  449. X                /* Draw running messages */
  450. X    init_pair(6,COLOR_YELLOW,COLOR_WHITE);
  451. X    wattrset(win, COLOR_PAIR(6));
  452. X    message = messages[0];
  453. X    len = strlen(message);
  454. X    j = 0;
  455. X    i = 2;
  456. X    w = width-2;
  457. X        while(j < NMESSAGES)
  458. X        {   strncpy(buffer, message, w - i);
  459. X            buffer[w-i] = 0;
  460. X        mvwaddstr(win, height/2, i, buffer);
  461. X            if(w - i < len)
  462. X            {   memset(buffer, ' ', i);
  463. X                strcpy(buffer, message + (w - i));
  464. X                buffer[strlen(buffer)]   = ' ';
  465. X                buffer[i-2] = '\0';
  466. X                mvwaddstr(win, height/2, 2, buffer);
  467. X        }
  468. X            wrefresh(win);
  469. X            if(typeahead(stdin))
  470. X            {   flushinp();
  471. X        break;
  472. X            }
  473. X            mvwaddch(win, height/2, i, ' ');
  474. X            i = ++i % w;
  475. X            if(i < 2)
  476. X            {   message = messages[++j%NMESSAGES];
  477. X                memset(buffer, ' ', w-2);
  478. X        buffer[w-2] = 0;
  479. X                mvwaddstr(win, height/2, 2, buffer);
  480. X                i = 2;
  481. X            }
  482. X        delay_output(300);
  483. X        }
  484. X
  485. X        j = 0;
  486. X                                /*  Draw running As across in RED */
  487. X        init_pair(7,COLOR_RED,COLOR_GREEN);
  488. X        wattron(win, COLOR_PAIR(7));
  489. X    for(i=2; i < width - 4; ++i)
  490. X        {   c = mvwinch(win, 4, i);
  491. X            save[j++] = c;
  492. X            c = c & 0x7f;
  493. X        mvwaddch(win, 4, i, c);
  494. X        }
  495. X        wrefresh(win);
  496. X
  497. X                                /* Put a message up wait for a key */
  498. X        i = height-2;
  499. X        wattrset(win, COLOR_PAIR(5));
  500. X    mvwaddstr(win, i, 1, " Type a key to continue or ESC to quit ");
  501. X        wrefresh(win);
  502. X
  503. X        if(WaitForUser() == 0x1b)
  504. X        break;
  505. X
  506. X        j = 0;                  /* Restore the old line */
  507. X        for(i=2; i < width - 4; ++i)
  508. X            mvwaddch(win, 4, i, save[j++]);
  509. X        wrefresh(win);
  510. X
  511. X    BouncingBalls(win);
  512. X                                /* Put a message up wait for a key */
  513. X        i = height-2;
  514. X        wattrset(win, COLOR_PAIR(5));
  515. X    mvwaddstr(win, i, 1, " Type a key to continue or ESC to quit ");
  516. X        wrefresh(win);
  517. X        if(WaitForUser() == 0x1b)
  518. X            break;
  519. X    }
  520. Xexit:
  521. X    endwin();
  522. X    return 0;
  523. X}
  524. X
  525. X/*
  526. X * Test sub windows
  527. X */
  528. XSubWinTest(WINDOW *win)
  529. X{
  530. Xint     w, h, sw, sh, bx, by;
  531. XWINDOW  *swin1, *swin2, *swin3;
  532. X
  533. X    w  = win->_maxx;
  534. X    h  = win->_maxy;
  535. X    bx = win->_begx;
  536. X    by = win->_begy;
  537. X    sw = w / 3;
  538. X    sh = h / 3;
  539. X    if((swin1 = subwin(win, sh, sw, by+3, bx+5)) == NULL)
  540. X        return  1;
  541. X    if((swin2 = subwin(win, sh, sw, by+4, bx+8)) == NULL)
  542. X        return  1;
  543. X    if((swin3 = subwin(win, sh, sw, by+5, bx+11)) == NULL)
  544. X    return  1;
  545. X
  546. X    init_pair(8,COLOR_RED,COLOR_BLUE);
  547. X    wattrset(swin1, COLOR_PAIR(8));
  548. X    werase(swin1);
  549. X    mvwaddstr(swin1, 0, 3, "Sub-window 1");
  550. X    wrefresh(swin1);
  551. X
  552. X    init_pair(8,COLOR_CYAN,COLOR_MAGENTA);
  553. X    wattrset(swin2, COLOR_PAIR(8));
  554. X    werase(swin2);
  555. X    mvwaddstr(swin2, 0, 3, "Sub-window 2");
  556. X    wrefresh(swin2);
  557. X
  558. X    init_pair(8,COLOR_YELLOW,COLOR_GREEN);
  559. X    wattrset(swin3, COLOR_PAIR(8));
  560. X    werase(swin3);
  561. X    mvwaddstr(swin3, 0, 3, "Sub-window 3");
  562. X    wrefresh(swin3);
  563. X
  564. X    delwin(swin1);
  565. X    delwin(swin2);
  566. X    delwin(swin3);
  567. X    WaitForUser();
  568. X    return  0;
  569. X}
  570. X
  571. X/*
  572. X *  Bouncing balls
  573. X */
  574. XBouncingBalls(WINDOW *win)
  575. X{
  576. Xchtype     c1, c2, c3;
  577. Xint    w, h;
  578. Xint     x1, y1, xd1, yd1;
  579. Xint     x2, y2, xd2, yd2;
  580. Xint     x3, y3, xd3, yd3;
  581. X
  582. X    w    = win->_maxx;
  583. X    h    = win->_maxy;
  584. X    x1   = 2 + rand() % (w - 4);
  585. X    y1   = 2 + rand() % (h - 4);
  586. X    x2   = 2 + rand() % (w - 4);
  587. X    y2   = 2 + rand() % (h - 4);
  588. X    x3   = 2 + rand() % (w - 4);
  589. X    y3   = 2 + rand() % (h - 4);
  590. X    xd1  = 1; yd1 = 1;
  591. X    xd2  = 1; yd2 = 0;
  592. X    xd3  = 0; yd3 = 1;
  593. X    while(!typeahead(stdin))
  594. X    {   x1 = xd1 > 0 ? ++x1 : --x1;
  595. X        if(x1 <= 1 || x1 >= w - 2)
  596. X            xd1 = xd1 ? 0 : 1;
  597. X        y1 = yd1 > 0 ? ++y1 : --y1;
  598. X        if(y1 <= 1 || y1 >= h - 2)
  599. X        yd1 = yd1 ? 0 : 1;
  600. X
  601. X        x2 = xd2 > 0 ? ++x2 : --x2;
  602. X        if(x2 <= 1 || x2 >= w - 2)
  603. X            xd2 = xd2 ? 0 : 1;
  604. X        y2 = yd2 > 0 ? ++y2 : --y2;
  605. X        if(y2 <= 1 || y2 >= h - 2)
  606. X            yd2 = yd2 ? 0 : 1;
  607. X
  608. X        x3 = xd3 > 0 ? ++x3 : --x3;
  609. X        if(x3 <= 1 || x3 >= w - 2)
  610. X        xd3 = xd3 ? 0 : 1;
  611. X        y3 = yd3 > 0 ? ++y3 : --y3;
  612. X        if(y3 <= 1 || y3 >= h - 2)
  613. X            yd3 = yd3 ? 0 : 1;
  614. X
  615. X        c1 = mvwinch(win, y1, x1);
  616. X        c2 = mvwinch(win, y2, x2);
  617. X        c3 = mvwinch(win, y3, x3);
  618. X
  619. X        init_pair(8,COLOR_RED,COLOR_BLUE);
  620. X        wattrset(win, COLOR_PAIR(8));
  621. X    mvwaddch(win, y1, x1, 'O');
  622. X        init_pair(8,COLOR_BLUE,COLOR_RED);
  623. X        wattrset(win, COLOR_PAIR(8));
  624. X        mvwaddch(win, y2, x2, '*');
  625. X        init_pair(8,COLOR_YELLOW,COLOR_WHITE);
  626. X        wattrset(win, COLOR_PAIR(8));
  627. X        mvwaddch(win, y3, x3, '@');
  628. X        wmove(win, 0, 0);
  629. X        wrefresh(win);
  630. X    mvwaddch(win, y1, x1, c1);
  631. X    mvwaddch(win, y2, x2, c2);
  632. X    mvwaddch(win, y3, x3, c3);
  633. X    delay_output(150);
  634. X    }
  635. X    return 0;
  636. X}
  637. X
  638. X/*
  639. X *  Wait for user
  640. X */
  641. XWaitForUser()
  642. X{
  643. Xtime_t  t;
  644. X
  645. X    t = time((time_t *)0);
  646. X    while(1)
  647. X    {   if(typeahead(stdin))
  648. X        {   if(PDC_get_bios_key()  == 0x1b)
  649. X                return  0x1b;
  650. X            else
  651. X                return  0;
  652. X        }
  653. X        if(time((time_t *)0) - t > 5)
  654. X            return  0;
  655. X    }
  656. X}
  657. X
  658. X/*
  659. X *  Trap interrupt
  660. X */
  661. Xvoid trap()
  662. X{
  663. X    endwin();
  664. X    exit(0);
  665. X}
  666. X
  667. X/*  End of DEMO.C */
  668. END_OF_FILE
  669.   if test 8479 -ne `wc -c <'demos/newdemo.c'`; then
  670.     echo shar: \"'demos/newdemo.c'\" unpacked with wrong size!
  671.   fi
  672.   # end of 'demos/newdemo.c'
  673. fi
  674. if test -f 'doc/intro.man' -a "${1}" != "-c" ; then 
  675.   echo shar: Will not clobber existing file \"'doc/intro.man'\"
  676. else
  677.   echo shar: Extracting \"'doc/intro.man'\" \(6418 characters\)
  678.   sed "s/^X//" >'doc/intro.man' <<'END_OF_FILE'
  679. X/*man-start*********************************************************************
  680. X
  681. X        Introduction to XSI Curses Interface
  682. X
  683. XThe X/Open Group has identified a strong need for a generic terminal
  684. Xinterface for applications that wish to be independent of terminal
  685. Xhardware and connection method.
  686. X
  687. XThis interface should allow the attachment of character and
  688. Xblock-oriented terminals.  Furthermore, it should not put any
  689. Xconstraints on how the terminals are attached (e.g., Local Area
  690. XNetworks, PADs on X.25, etc.). 
  691. X
  692. XThe curses library interfaces provides the user with a method of
  693. Xupdating screens with reasonable optimisation. 
  694. X
  695. XThe X/Open group has found it impossible to define a totally portable
  696. Xset of curses interface routines that cover asynchronous, networked,
  697. Xand synchronous terminals.  The functions are oriented towards locally
  698. Xconnected asynchronous terminals.  For such terminals, applications
  699. Xconforming to this interface are portable.  The interface routines
  700. Xcurses may, however, also be used with synchronous and networked
  701. Xterminals, provided the restrictions below are considered. 
  702. X
  703. XThese functions have been included been included in the X/Open
  704. Xdefinition in the "optional" category.  This means that although they
  705. Xare likely to appear on many X/Open compliant systems, they are not
  706. Xguaranteed to be on all systems.  Where they are supported, they will
  707. Xconform to the given definition. 
  708. X
  709. X
  710. X----------------------------------------------------------------------
  711. X
  712. X        Synchronous and Networked Asynchronous Terminals
  713. X
  714. XThese notes indicate to the application writer some considerations to
  715. Xbe borne in mind when driving synchronous, networked asynchronous
  716. X(NWA) or non-standard directly connected asynchronous terminals.
  717. X
  718. XSuch terminals are often used in a mainframe environment and
  719. Xcommunicatie to the host in block mode.  That is, the user types
  720. Xcharacters at the terminal then presses a special key to initiate
  721. Xtransmission of the characters to the host. 
  722. X
  723. XFrequently, although it may be possible to send arbitrary sized blocks
  724. Xto the host, it may not be possible or desireable to cause a character
  725. Xto be transmitted with only a single keystroke. 
  726. X
  727. XThis can cause severe problems to an application wishing to make use
  728. Xof single character input. 
  729. X
  730. X
  731. X
  732. XOUTPUT
  733. X
  734. XThe curses package can be used in the normal way for all operations
  735. Xpertaining to output to the terminal, with the possible exception that
  736. Xon some terminals the refresh() routine may have to redraw the entire
  737. Xscreen contents in order to perform any update.
  738. X
  739. XIf it is additionally necessary to clear the screen before each such
  740. Xoperation, the result could be unacceptable. 
  741. X
  742. X
  743. XINPUT
  744. X
  745. XBecause of the nature of operation of synchronous (block-mode) and NWA
  746. Xterminals, it may not be possible to support all or any of the curses
  747. Xinput functions.  In particular, the following points should be noted:
  748. X
  749. X* Single-character input may not be possible.  It may be necessary to
  750. X  press a special key to cause all characters typed at the terminal to
  751. X  be transmitted to the host. 
  752. X
  753. X* It may not be possibel to disable echo.  Character echo may be performed
  754. X  directly by the terminal.  On terminals that behave this way, any curses
  755. X  application that performs input should be aware that any characters
  756. X  type will appear on the screen wherever the cursor is positioned.
  757. X  This may not necessarily correspond to the position of the cursor in
  758. X  the window.
  759. X
  760. X
  761. X----------------------------------------------------------------------
  762. X
  763. X        Data Types and the <curses.h> Header
  764. X
  765. XThe data types supported by curses are described in this section.
  766. X
  767. XAs the library supports a procedural interface to the data types,
  768. Xactual structure contents are not described.  All curses data are
  769. Xmanipulated using the routines provided. 
  770. X
  771. X
  772. XTHE <curses.h> HEADER
  773. X
  774. XThe <curses.h> header defines various constants and declares the data types
  775. Xthat are available to the application.
  776. X
  777. X
  778. XDATA TYPES
  779. X
  780. XThe following data types are declared:
  781. X
  782. X    WINDOW*        pointer to screen representation
  783. X    SCREEN*        pointer to terminal descriptor
  784. X    bool        boolean data type
  785. X    chtype        representation of a character in a window
  786. X
  787. XThe actual WINDOW and SCREEN objects used to store information are
  788. Xcreated by the corresponding routiens and a pointer to them is
  789. Xprovided.  All manipulation is through that pointer. 
  790. X
  791. X
  792. XCONSTANTS
  793. X
  794. XThe following constants are defined. 
  795. X
  796. X
  797. XGENERAL
  798. X
  799. X    COLS        number of columns on terminal screen
  800. X    ERR        value returned on error condition
  801. X    FALSE        boolean false value
  802. X    LINES        number of lines on terminal screen
  803. X    OK        value returned on successful completion
  804. X    NULL        zero pointer value
  805. X    TRUE        boolean true value
  806. X
  807. XVIDEO ATTRIBUTES
  808. X
  809. X    A_BLINK        blinking
  810. X    A_BOLD        extra bright or bold
  811. X    A_DIM        half bright
  812. X    A_REVERSE    reverse video
  813. X    A_STANDOUT    terminal's best highlighting mode
  814. X    A_UNDERLINE    underlining
  815. X    A_ATTRIBUTES    bit-mask to extract attributes
  816. X    A_CHARTEXT    bit-mask to extract a character
  817. X
  818. XNormally, attributres are a property of the character. 
  819. X
  820. X
  821. XINPUT VALUES
  822. X
  823. XThe following constants might be returned by getch() if keypad() has
  824. Xbeen enabled.  Note that not all of these may be supported on a
  825. Xparticular terminal if the terminal does not transmit a unique code
  826. Xwhen the key is pressed or the definition for the key is not present
  827. Xin the underlying table of terminal capabilities. 
  828. X
  829. X    KEY_BREAK    break key
  830. X    KEY_DOWN    the four arrow keys
  831. X    KEY_UP
  832. X    KEY_LEFT
  833. X    KEY_RIGHT
  834. X    KEY_HOME    home key (upward+left arrow)
  835. X    KEY_BACKSPACE    backspace
  836. X    KEY_F0        function keys; space for 64 keys is reserved
  837. X    KEY_F(n)    (KEY_F0+(n))
  838. X    KEY_DL        delete line
  839. X    KEY_IL        insert line
  840. X    KEY_DC        delete character
  841. X    KEY_IC        insert character
  842. X    KEY_EIC        exit insert character mode
  843. X    KEY_CLEAR    clear screen
  844. X    KEY_EOS        clear to end of screen
  845. X    KEY_EOL        clear to end of line
  846. X    KEY_SF        scroll 1 line forwards
  847. X    KEY_SR        scroll 1 line backwards (reverse)
  848. X    KEY_NPAGE    next page
  849. X    KEY_PPAGE    previous page
  850. X    KEY_STAB    set tab
  851. X    KEY_CTAB    clear tab
  852. X    KEY_CATAB    clear all tabs
  853. X    KEY_ENTER    enter or send
  854. X    KEY_SRESET    soft (partial) reset
  855. X    KEY_RESET    reset or hard reset
  856. X    KEY_PRINT    print or copy
  857. X    KEY_LL        home down or bottom (lower left)
  858. X    KEY_A1        upper left of virtual keypad
  859. X    KEY_A3        upper right of virtual keypad
  860. X    KEY_B2        centre of virtual keypad
  861. X    KEY_C1        lower left of virtual keypad
  862. X    KEY_C3        lower right of virtual keypad
  863. X
  864. XThe virtual keypad is arranged like this:
  865. X
  866. X    A1    up    A3
  867. X    left    B2    right
  868. X    C1    down    C3
  869. X
  870. X**man-end**********************************************************************/
  871. END_OF_FILE
  872.   if test 6418 -ne `wc -c <'doc/intro.man'`; then
  873.     echo shar: \"'doc/intro.man'\" unpacked with wrong size!
  874.   fi
  875.   # end of 'doc/intro.man'
  876. fi
  877. if test -f 'portable/flushinp.c' -a "${1}" != "-c" ; then 
  878.   echo shar: Will not clobber existing file \"'portable/flushinp.c'\"
  879. else
  880.   echo shar: Extracting \"'portable/flushinp.c'\" \(1744 characters\)
  881.   sed "s/^X//" >'portable/flushinp.c' <<'END_OF_FILE'
  882. X#define    CURSES_LIBRARY    1
  883. X#include <curses.h>
  884. X#undef    flushinp
  885. X
  886. X#ifndef    NDEBUG
  887. Xchar *rcsid_flushinp = "$Header: c:/curses/portable/RCS/flushinp.c%v 2.0 1992/11/15 03:28:52 MH Rel $";
  888. X#endif
  889. X
  890. X
  891. X
  892. X
  893. X/*man-start*********************************************************************
  894. X
  895. X  flushinp()    - discard type-ahead
  896. X
  897. X  X/Open Description:
  898. X     Throws away any type-ahead that has been typed by the user and
  899. X     has not yet been read by the program.
  900. X
  901. X  PDCurses Description:
  902. X     If the PDCurses library is compiled under DOS with the FAST_VIDEO
  903. X     define true, then we will poke the BIOS keyboard buffer head and
  904. X     tail pointers, resetting the typeahead.
  905. X
  906. X     If this is not true, then we will be unable to reliably flush
  907. X     the typeahead.
  908. X
  909. X  X/Open Return Value:
  910. X     The flushinp() function returns OK on success and ERR on error.
  911. X
  912. X  X/Open Errors:
  913. X     No errors are defined for this function.
  914. X
  915. X  Portability:
  916. X     PDCurses    int flushinp( void );
  917. X     X/Open Dec '88    int flushinp( void );
  918. X     BSD Curses    int flushinp( void );
  919. X     SYS V Curses    int flushinp( void );
  920. X
  921. X**man-end**********************************************************************/
  922. X
  923. Xint    flushinp(void)
  924. X{
  925. Xextern int    c_pindex;        /* putter index */
  926. Xextern int    c_gindex;        /* getter index */
  927. Xextern int    c_ungind;        /* wungetch() push index */
  928. X
  929. X
  930. X#if defined(DOS) && defined(FAST_VIDEO)
  931. X    short  *KB_HEAD = (short *) 0x041aL;    /* 40:1A  BIOS KB head    */
  932. X    short  *KB_TAIL = (short *) 0x041cL;    /* 40:1A  BIOS KB tail    */
  933. X
  934. X    *KB_HEAD = *KB_TAIL;        /* Force the BIOS kbd buf    */
  935. X                    /* head/tail pointers to be the */
  936. X                    /* same...  Real nasty trick... */
  937. X
  938. X#endif
  939. X#ifdef OS2
  940. X    KbdFlushBuffer(0);
  941. X#endif
  942. X    c_gindex = 1;            /* set indices to kill buffer     */
  943. X    c_pindex = 0;
  944. X    c_ungind = 0;            /* clear c_ungch array         */
  945. X    return( OK );
  946. X}
  947. END_OF_FILE
  948.   if test 1744 -ne `wc -c <'portable/flushinp.c'`; then
  949.     echo shar: \"'portable/flushinp.c'\" unpacked with wrong size!
  950.   fi
  951.   # end of 'portable/flushinp.c'
  952. fi
  953. if test -f 'portable/initscr.c' -a "${1}" != "-c" ; then 
  954.   echo shar: Will not clobber existing file \"'portable/initscr.c'\"
  955. else
  956.   echo shar: Extracting \"'portable/initscr.c'\" \(4451 characters\)
  957.   sed "s/^X//" >'portable/initscr.c' <<'END_OF_FILE'
  958. X#ifndef NO_MEMORY_H
  959. X#include <memory.h>
  960. X#endif
  961. X#define    CURSES_LIBRARY    1
  962. X#define    LOCAL_VAR
  963. X#include <curses.h>
  964. X#undef    initscr
  965. X
  966. X
  967. X
  968. X
  969. X#ifndef    NDEBUG
  970. Xchar *rcsid_initscr = "$Header: c:/curses/portable/RCS/initscr.c%v 2.0 1992/11/15 03:29:35 MH Rel $";
  971. X#else
  972. Xchar*    _curses_notice = "PDCurses 2.0 - Public Domain 1992";
  973. X#endif
  974. X
  975. X
  976. X
  977. XSCREEN _cursvar;        /* curses variables        */
  978. X
  979. XWINDOW*    curscr;            /* the current screen image    */
  980. XWINDOW*    stdscr;            /* the default screen window    */
  981. XWINDOW*    tmpwin;            /* the temporary screen image. formally in _cursvar */
  982. Xint    _default_lines = 25;    /* default terminal height    */
  983. Xint    LINES;            /* current terminal height    */
  984. Xint    COLS;            /* current terminal width    */
  985. X
  986. X#if defined    DOS
  987. XRegs regs;
  988. X#endif
  989. X
  990. X/*
  991. X * Global definitions for charget routines
  992. X */
  993. Xint    c_pindex = 0;        /* putter index */
  994. Xint    c_gindex = 1;        /* getter index */
  995. Xint    c_ungind = 0;        /* wungetch() push index */
  996. Xchtype    c_ungch[NUNGETCH];    /* array of ungotten chars */
  997. XWINDOW*    _getch_win_;
  998. X
  999. X/*
  1000. X * Global definitions for setmode routines
  1001. X */
  1002. Xstruct cttyset c_sh_tty = {0};    /* tty modes for def_shell_mode */
  1003. Xstruct cttyset c_pr_tty = {0};    /* tty modes for def_prog_mode  */
  1004. Xstruct cttyset c_save_tty = {0};
  1005. Xstruct cttyset c_save_trm = {0};
  1006. X
  1007. X/*
  1008. X * Global definitions for printscan routines
  1009. X */
  1010. Xchar c_printscanbuf[513];    /* buffer used during I/O */
  1011. X
  1012. X/*
  1013. X * Global definitions for strget routines
  1014. X */
  1015. Xchar *c_strbeg;
  1016. X
  1017. X#if    EMALLOC
  1018. Xvoid*    emalloc( size_t );
  1019. Xvoid*    ecalloc( size_t, size_t );
  1020. Xvoid    efree( void* );
  1021. X    
  1022. Xextern    void*    emalloc();    /* user's emalloc(size)        */
  1023. Xextern    void*    ecalloc();    /* user's ecalloc(num,size)    */
  1024. Xextern    void    efree();    /* user's efree(ptr)        */
  1025. X#endif
  1026. X
  1027. Xextern    void*    malloc();    /* runtime's malloc(size)    */
  1028. Xextern    void*    calloc();    /* runtime's calloc(num,size)    */
  1029. Xextern    void    free();        /* runtime's free(ptr)        */
  1030. X
  1031. Xvoid*    (*mallc)();        /* ptr to some malloc(size)    */
  1032. Xvoid*    (*callc)();        /* ptr to some ecalloc(num,size)*/
  1033. Xvoid    (*fre)();        /* ptr to some free(ptr)    */
  1034. X
  1035. X
  1036. X
  1037. X
  1038. X/*man-start*********************************************************************
  1039. X
  1040. X  initscr()    - Initialize terminal environment
  1041. X
  1042. X  X/Open Description:
  1043. X     The first routine called should be initscr().  This will
  1044. X     deterine the terminal type and initialize all curses data
  1045. X     structures.  The initscr() function also arranges that the
  1046. X     first call to refresh() will clear the screen.  If errors
  1047. X     occur, initscr() will write an appropriate error message to
  1048. X     standard error and exit.  If the program wants an indication
  1049. X     of error conditions, newterm() should be used instead of
  1050. X     initscr().
  1051. X
  1052. X  PDCurses Description:
  1053. X     Due to the fact that newterm() does not yet exist in PDCurses,
  1054. X     there is no way to recover from an error in initscr().
  1055. X
  1056. X  X/Open Return Value:
  1057. X     The initscr() function returns stdscr on success and calls
  1058. X     exit() on error.
  1059. X
  1060. X  X/Open Errors:
  1061. X     No errors are defined for this function.
  1062. X
  1063. X  Portability:
  1064. X     PDCurses    WINDOW* initscr( void );
  1065. X     X/Open Dec '88    WINDOW* initscr( void );
  1066. X     BSD Curses    WINDOW* initscr( void );
  1067. X     SYS V Curses    WINDOW* initscr( void );
  1068. X
  1069. X**man-end**********************************************************************/
  1070. X
  1071. XWINDOW*    initscr(void)
  1072. X{
  1073. X    if  (_cursvar.alive)
  1074. X        return( ERR );
  1075. X
  1076. X    if  (_cursvar.emalloc == EMALLOC_MAGIC)
  1077. X    {
  1078. X#if    EMALLOC
  1079. X        memset(&_cursvar, 0, sizeof(SCREEN));
  1080. X        _cursvar.emalloc = TRUE;
  1081. X        mallc = emalloc;
  1082. X        callc = ecalloc;
  1083. X        fre   = efree;
  1084. X#endif
  1085. X    }
  1086. X    else
  1087. X    {
  1088. X        memset(&_cursvar, 0, sizeof(SCREEN));
  1089. X        mallc = malloc;
  1090. X        callc = calloc;
  1091. X        fre   = free;
  1092. X    }
  1093. X    PDC_scr_open(&_cursvar, 0);
  1094. X    _cursvar.orig_cursor = _cursvar.cursor;
  1095. X/*    _cursvar.orig_font = PDC_get_font();*/
  1096. X    _cursvar.orig_font = _cursvar.font;
  1097. X    _cursvar.orgcbr = PDC_get_ctrl_break();
  1098. X    _cursvar.blank = ' ';
  1099. X#ifdef    FLEXOS
  1100. X    _flexos_16bitmode();
  1101. X#endif
  1102. X/*    savetty();*/
  1103. X/*    LINES = PDC_get_rows();*/
  1104. X/*    COLS = PDC_get_columns(); */
  1105. X    LINES = _cursvar.lines;
  1106. X    COLS = _cursvar.cols;
  1107. X
  1108. X    if ((tmpwin = newwin(LINES, COLS, 0, 0)) == (WINDOW *) ERR)
  1109. X    {
  1110. X        fprintf( stderr, "initscr(): Unable to create tmpwin.\n" );
  1111. X        exit( 3 );
  1112. X    }
  1113. X    if ((curscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *) ERR)
  1114. X    {
  1115. X        fprintf( stderr, "initscr(): Unable to create curscr.\n" );
  1116. X        exit( 2 );
  1117. X    }
  1118. X    if ((stdscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *) ERR)
  1119. X    {
  1120. X        fprintf( stderr, "initscr(): Unable to create stdscr.\n" );
  1121. X        exit( 1 );
  1122. X    }
  1123. X    curscr->_clear = FALSE;
  1124. X#ifdef    REGISTERWINDOWS
  1125. X    _cursvar.refreshall = FALSE;
  1126. X    _inswin(stdscr, (WINDOW *)NULL);
  1127. X#endif
  1128. X    _cursvar.alive = TRUE;
  1129. X    def_shell_mode();
  1130. X    return( stdscr );
  1131. X}
  1132. END_OF_FILE
  1133.   if test 4451 -ne `wc -c <'portable/initscr.c'`; then
  1134.     echo shar: \"'portable/initscr.c'\" unpacked with wrong size!
  1135.   fi
  1136.   # end of 'portable/initscr.c'
  1137. fi
  1138. if test -f 'portable/keyname.c' -a "${1}" != "-c" ; then 
  1139.   echo shar: Will not clobber existing file \"'portable/keyname.c'\"
  1140. else
  1141.   echo shar: Extracting \"'portable/keyname.c'\" \(4209 characters\)
  1142.   sed "s/^X//" >'portable/keyname.c' <<'END_OF_FILE'
  1143. X#define    CURSES_LIBRARY    1
  1144. X#include <curses.h>
  1145. X#undef keyname
  1146. X
  1147. X#ifndef    NDEBUG
  1148. Xchar *rcsid_keyname = "$Header: c:/curses/portable/RCS/keyname.c%v 2.0 1992/11/15 03:28:57 MH Rel $";
  1149. X#endif
  1150. X
  1151. X
  1152. X
  1153. X
  1154. X/*man-start*********************************************************************
  1155. X
  1156. X  keyname()    - returns pointer to name of key.
  1157. X
  1158. X  X/Open Description:
  1159. X     Returns a pointer to a character string containing a symbolic name
  1160. X     corresponding to that specified in the argument key. key may be any
  1161. X     key returned by wgetch().
  1162. X
  1163. X  X/Open Return Value:
  1164. X     The keyname() function a pointer to the symbolic name of a key or
  1165. X     a pointer to NULL if an invalid key is passed.
  1166. X
  1167. X  X/Open Errors:
  1168. X     It is an error to pass a key value less than KEY_MIN or greater
  1169. X     than KEY_MAX (these values defined in curses.h.
  1170. X
  1171. X  Portability:
  1172. X     PDCurses    char *keyname( int );
  1173. X     X/Open Dec '88    char * keyname( int );
  1174. X     BSD Curses    
  1175. X     SYS V Curses    char *keyname( int );
  1176. X
  1177. X**man-end**********************************************************************/
  1178. X
  1179. Xchar *    keyname(int key)
  1180. X{
  1181. X    static char *key_name[] =
  1182. X    {
  1183. X "KEY_BREAK","KEY_DOWN","KEY_UP","KEY_LEFT","KEY_RIGHT","KEY_HOME","KEY_BACKSPACE",
  1184. X "KEY_F0","KEY_F(1)","KEY_F(2)","KEY_F(3)","KEY_F(4)","KEY_F(5)",
  1185. X "KEY_F(6)","KEY_F(7)","KEY_F(8)","KEY_F(9)","KEY_F(10)",
  1186. X "KEY_F(11)","KEY_F(12)","KEY_F(13)","KEY_F(14)","KEY_F(15)",
  1187. X "KEY_F(16)","KEY_F(17)","KEY_F(18)","KEY_F(19)","KEY_F(20)",
  1188. X "KEY_F(21)","KEY_F(22)","KEY_F(23)","KEY_F(24)","KEY_F(25)",
  1189. X "KEY_F(26)","KEY_F(27)","KEY_F(28)","KEY_F(29)","KEY_F(30)",
  1190. X "KEY_F(31)","KEY_F(32)","KEY_F(33)","KEY_F(34)","KEY_F(35)",
  1191. X "KEY_F(36)","KEY_F(37)","KEY_F(38)","KEY_F(39)","KEY_F(40)",
  1192. X "KEY_F(41)","KEY_F(42)","KEY_F(43)","KEY_F(44)","KEY_F(45)",
  1193. X "KEY_F(46)","KEY_F(47)","KEY_F(48)","KEY_F(49)","KEY_F(50)",
  1194. X "KEY_F(51)","KEY_F(52)","KEY_F(53)","KEY_F(54)","KEY_F(55)",
  1195. X "KEY_F(56)","KEY_F(57)","KEY_F(58)","KEY_F(59)","KEY_F(60)",
  1196. X "KEY_F(61)","KEY_F(62)","KEY_F(63)",
  1197. X "KEY_DL","KEY_IL","KEY_DC","KEY_IC","KEY_EIC","KEY_CLEAR","KEY_EOS","KEY_EOL",
  1198. X "KEY_SF","KEY_SR","KEY_NPAGE","KEY_PPAGE","KEY_STAB","KEY_CTAB","KEY_CATAB",
  1199. X "KEY_ENTER","KEY_SRESET","KEY_RESET","KEY_PRINT","KEY_LL","KEY_ABORT","KEY_SHELP",
  1200. X "KEY_LHELP","KEY_BTAB","KEY_BEG","KEY_CANCEL","KEY_CLOSE","KEY_COMMAND","KEY_COPY",
  1201. X "KEY_CREATE","KEY_END","KEY_EXIT","KEY_FIND","KEY_HELP","KEY_MARK","KEY_MESSAGE",
  1202. X "KEY_MOVE","KEY_NEXT","KEY_OPEN","KEY_OPTIONS","KEY_PREVIOUS","KEY_REDO",
  1203. X "KEY_REFERENCE","KEY_REFRESH","KEY_REPLACE","KEY_RESTART","KEY_RESUME","KEY_SAVE",
  1204. X "KEY_SBEG","KEY_SCANCEL","KEY_SCOMMAND","KEY_SCOPY","KEY_SCREATE","KEY_SDC","KEY_SDL",
  1205. X "KEY_SELECT","KEY_SEND","KEY_SEOL","KEY_SEXIT","KEY_SFIND","KEY_SHOME","KEY_SIC",
  1206. X "NO KEY NAME",
  1207. X "KEY_SLEFT","KEY_SMESSAGE","KEY_SMOVE","KEY_SNEXT","KEY_SOPTIONS","KEY_SPREVIOUS",
  1208. X "KEY_SPRINT","KEY_SREDO","KEY_SREPLACE","KEY_SRIGHT","KEY_SRSUME","KEY_SSAVE",
  1209. X "KEY_SSUSPEND","KEY_SUNDO","KEY_SUSPEND","KEY_UNDO",
  1210. X "ALT_0","ALT_1","ALT_2","ALT_3","ALT_4","ALT_5","ALT_6","ALT_7","ALT_8","ALT_9",
  1211. X "ALT_A","ALT_B","ALT_C","ALT_D","ALT_E","ALT_F","ALT_G","ALT_H","ALT_I","ALT_J",
  1212. X "ALT_K","ALT_L","ALT_M","ALT_N","ALT_O","ALT_P","ALT_Q","ALT_R","ALT_S","ALT_T",
  1213. X "ALT_U","ALT_V","ALT_W","ALT_X","ALT_Y","ALT_Z","CTL_LEFT","CTL_RIGHT","CTL_PGUP",
  1214. X "CTL_PGDN","CTL_HOME","CTL_END","KEY_BACKTAB","KEY_A1","KEY_A2","KEY_A3","KEY_B1",
  1215. X "KEY_B2","KEY_B3","KEY_C1","KEY_C2","KEY_C3","PADSLASH","PADENTER","CTL_PADENTER",
  1216. X "ALT_PADENTER","SHF_PADSTOP","PADSTAR","PADMINUS","PADPLUS","CTL_PADSTOP",
  1217. X "CTL_PADCENTER","CTL_PADPLUS","CTL_PADMINUS","CTL_PADSLASH","CTL_PADSTAR","ALT_PADPLUS",
  1218. X "ALT_PADMINUS","ALT_PADSLASH","ALT_PADSTAR","CTL_INS","ALT_DEL","ALT_INS","CTL_UP",
  1219. X "CTL_DOWN","CTL_TAB","ALT_TAB","ALT_MINUS","ALT_EQUAL","ALT_HOME","ALT_PGUP","ALT_PGDN",
  1220. X "ALT_END","ALT_UP","ALT_DOWN","ALT_RIGHT","ALT_LEFT","ALT_ENTER","ALT_ESC","ALT_BQUOTE",
  1221. X "ALT_LBRACKET","ALT_RBRACKET","ALT_SEMICOLON","ALT_FQUOTE","ALT_COMMA","ALT_STOP",
  1222. X "ALT_FSLASH","ALT_BKSP","CTL_BKSP","CTL_PAD0","CTL_PAD1","CTL_PAD2","CTL_PAD3","CTL_PAD4",
  1223. X "CTL_PAD5","CTL_PAD6","CTL_PAD7","CTL_PAD8","CTL_PAD9","CTL_DEL","ALT_BSLASH","CTL_ENTER"
  1224. X    };
  1225. X    if (key < KEY_MIN
  1226. X    ||  key > KEY_MAX)
  1227. X        return((char *)"NO KEY NAME");
  1228. X    return( key_name[key-KEY_MIN] );
  1229. X}
  1230. END_OF_FILE
  1231.   if test 4209 -ne `wc -c <'portable/keyname.c'`; then
  1232.     echo shar: \"'portable/keyname.c'\" unpacked with wrong size!
  1233.   fi
  1234.   # end of 'portable/keyname.c'
  1235. fi
  1236. if test -f 'portable/wgetch.c' -a "${1}" != "-c" ; then 
  1237.   echo shar: Will not clobber existing file \"'portable/wgetch.c'\"
  1238. else
  1239.   echo shar: Extracting \"'portable/wgetch.c'\" \(4290 characters\)
  1240.   sed "s/^X//" >'portable/wgetch.c' <<'END_OF_FILE'
  1241. X#define    CURSES_LIBRARY    1
  1242. X#include <curses.h>
  1243. X#undef    wgetch
  1244. X
  1245. X#ifndef    NDEBUG
  1246. Xchar *rcsid_wgetch = "$Header: c:/curses/portable/RCS/wgetch.c%v 2.0 1992/11/15 03:29:25 MH Rel $";
  1247. X#endif
  1248. X
  1249. Xstatic WINDOW *w;            /* to reduce stack usage   */
  1250. X
  1251. X
  1252. X
  1253. X
  1254. X
  1255. X
  1256. X
  1257. X/*man-start*********************************************************************
  1258. X
  1259. X  wgetch()    - read character
  1260. X
  1261. X  X/Open Description:
  1262. X     A character is read from the terminal associated with the
  1263. X     window.  In nodelay mode, if there is no input waiting,
  1264. X     the value ERR is returned.  In delay mode, the program will
  1265. X     hang until the system passes text through to the program.
  1266. X     Depending on the setting of cbreak(), this will be after one
  1267. X     character or after the first newline.  Unless noecho() has
  1268. X     been set, the character will also be echoed into the designated
  1269. X     window.
  1270. X
  1271. X     If keypad() is TRUE, and a function key is pressed, the token for
  1272. X     that function key will be returned instead of the raw characters.
  1273. X     Possible function keys are defined in <curses.h> with integers
  1274. X     beginning with 0401, whose names begin with KEY_.  If a character
  1275. X     is received that could be the beginning of a function key (such as
  1276. X     escape), curses will set a timer.  If the remainder of the sequence
  1277. X     does not come in within the designated time, the character will be
  1278. X     passed through, otherwise the function key value will be returned.
  1279. X     For this reason, on many terminals, there will be a delay after a
  1280. X     user presses the escape key before the escape is returned to the
  1281. X     program.  (Use by a programmer of the escape key for a single
  1282. X     character function is discouraged.)
  1283. X
  1284. X     NOTE: getch(), mvgetch() and mvwgetch() are macros.
  1285. X
  1286. X  PDCurses Description:
  1287. X     Given the nature of the PC, there is no such timer set for an
  1288. X     incoming ESCAPE value, because function keys generate unique
  1289. X     scan codes that are not prefixed with the ESCAPE character.
  1290. X
  1291. X     Also, note that the getch() definition will conflict  with
  1292. X     many DOS compiler's runtime libraries.
  1293. X
  1294. X  X/Open Return Value:
  1295. X     These functions return OK on success and ERR on error.
  1296. X
  1297. X  PDCurses Errors:
  1298. X     It is an error to call this function with a NULL window pointer.
  1299. X
  1300. X  Portability:
  1301. X     PDCurses    int wgetch( WINDOW* win );
  1302. X     X/Open Dec '88    int wgetch( WINDOW* win );
  1303. X     BSD Curses    int wgetch( WINDOW* win );
  1304. X     SYS V Curses    int wgetch( WINDOW* win );
  1305. X
  1306. X**man-end**********************************************************************/
  1307. X
  1308. Xint    wgetch(WINDOW *win)
  1309. X{
  1310. Xextern    short    c_pindex;        /* putter index           */
  1311. Xextern    short    c_gindex;        /* getter index           */
  1312. Xextern    short    c_ungind;        /* wungetch() push index   */
  1313. Xextern    chtype    c_ungch[NUNGETCH];    /* array of ungotten chars */
  1314. Xextern  WINDOW*    _getch_win_;
  1315. X
  1316. X    signed    key;
  1317. X    bool    cbr;
  1318. Xstatic    chtype    buffer[_INBUFSIZ];    /* character buffer */
  1319. X
  1320. X    if (win == (WINDOW *)NULL)
  1321. X        return( ERR );
  1322. X
  1323. X    _getch_win_ = win;
  1324. X    if (c_ungind)                /* if ungotten char exists */
  1325. X        return( c_ungch[--c_ungind] );    /* remove and return it */
  1326. X    if ((!_cursvar.raw_inp) &&
  1327. X        (!_cursvar.cbreak))
  1328. X    {
  1329. X        /*
  1330. X         * if normal
  1331. X         */
  1332. X        if (c_gindex < c_pindex)
  1333. X        {
  1334. X            /*
  1335. X             * and data in buffer
  1336. X             */
  1337. X            return( buffer[c_gindex++] );
  1338. X        }
  1339. X    }
  1340. X
  1341. X    w = win;        /* static for speed & stack */
  1342. X    c_pindex = 0;        /* prepare to buffer data */
  1343. X    c_gindex = 0;
  1344. X    for(;;)            /* loop for any buffering */
  1345. X    {
  1346. X        if (_cursvar.raw_inp)
  1347. X        {
  1348. X            /*
  1349. X             * get a raw character
  1350. X             */
  1351. X            key = PDC_rawgetch();
  1352. X        }
  1353. X        else
  1354. X        {
  1355. X            /*
  1356. X             * get a system character
  1357. X             * if break return proper
  1358. X             */
  1359. X            cbr = PDC_get_ctrl_break();
  1360. X            PDC_set_ctrl_break(_cursvar.orgcbr);
  1361. X            key = PDC_sysgetch();
  1362. X            PDC_set_ctrl_break(cbr);    /* restore as it was */
  1363. X        }
  1364. X        if (w->_nodelay && (key == -1))
  1365. X        {
  1366. X            /*
  1367. X             * if nodelay and no char
  1368. X             */
  1369. X            return( ERR );
  1370. X        }
  1371. X        if ((key == '\r') &&
  1372. X            (_cursvar.autocr) &&
  1373. X            (!_cursvar.raw_inp))
  1374. X        {
  1375. X            /*
  1376. X             * translate CR
  1377. X             */
  1378. X            key = '\n';
  1379. X        }
  1380. X        if (_cursvar.echo && (key < 0x100))
  1381. X        {
  1382. X            /*
  1383. X             * if echo is enabled
  1384. X             */
  1385. X            waddch(w, key);
  1386. X            wrefresh(w);
  1387. X        }
  1388. X        if (_cursvar.raw_inp || _cursvar.cbreak)
  1389. X        {
  1390. X            /*
  1391. X             * if no buffering
  1392. X             */
  1393. X            return( key );
  1394. X        }
  1395. X
  1396. X        if (c_pindex < _INBUFSIZ - 2)
  1397. X        {
  1398. X            /*
  1399. X             * if no overflow, put data in buffer
  1400. X             */
  1401. X            buffer[c_pindex++] = key;
  1402. X        }
  1403. X        if ((key == '\n') || (key == '\r'))
  1404. X        {
  1405. X            /*
  1406. X             * if we got a line
  1407. X             */
  1408. X            return( buffer[c_gindex++] );
  1409. X        }
  1410. X    }
  1411. X}
  1412. END_OF_FILE
  1413.   if test 4290 -ne `wc -c <'portable/wgetch.c'`; then
  1414.     echo shar: \"'portable/wgetch.c'\" unpacked with wrong size!
  1415.   fi
  1416.   # end of 'portable/wgetch.c'
  1417. fi
  1418. if test -f 'portable/wnoutref.c' -a "${1}" != "-c" ; then 
  1419.   echo shar: Will not clobber existing file \"'portable/wnoutref.c'\"
  1420. else
  1421.   echo shar: Extracting \"'portable/wnoutref.c'\" \(4158 characters\)
  1422.   sed "s/^X//" >'portable/wnoutref.c' <<'END_OF_FILE'
  1423. X#define    CURSES_LIBRARY    1
  1424. X#include <curses.h>
  1425. X#undef    wnoutrefresh
  1426. X
  1427. X#ifndef    NDEBUG
  1428. Xchar *rcsid_wnoutref = "$Header: c:/curses/portable/RCS/wnoutref.c%v 2.0 1992/11/15 03:29:36 MH Rel $";
  1429. X#endif
  1430. X
  1431. X
  1432. X
  1433. X
  1434. X/*man-start*********************************************************************
  1435. X
  1436. X  wnoutrefresh()    - do effiecient refresh
  1437. X
  1438. X  X/Open Description: (part of the wnoutrefresh() description.)
  1439. X     These two routines allow multiple updates with more efficiency
  1440. X     than wrefresh() alone.  In addition to all of the window
  1441. X     structures representing the terminal screen: a physical screen,
  1442. X     describing what is actually on the screen and a virtual screen,
  1443. X     describing what the programmer wants to have on  the screen.
  1444. X
  1445. X     The wrefresh() function works by first calling wnoutrefresh(),
  1446. X     which copies the named window to the virtual screen.  It then
  1447. X     calls doupdate(), which compares the virtual screen to the
  1448. X     physical screen and does the actual update.  If the programmer
  1449. X     wishes to output several windows at once, a series of cals to
  1450. X     wrefresh() will result in alternating calls to wnoutrefresh()
  1451. X     and doupdate(), causing several bursts of output to the
  1452. X     screen.  By first calling wnoutrefresh() for each window, it
  1453. X     is then possible to call doupdate() once.  This results in
  1454. X     only one burst of output, with probably fewer total characters
  1455. X     transmitted and certainly less CPU time used.
  1456. X
  1457. X  PDCurses Description:
  1458. X     In addition to the above, if REGISTERWINDOWS is TRUE when the
  1459. X     library was compiled, any windows registered (true by default
  1460. X     with PDCurses and _cursvar.refreshall is TRUE, then all
  1461. X     registered windows will be called via wnoutrefresh() before
  1462. X     the actual screen update begins.
  1463. X
  1464. X  X/Open Return Value:
  1465. X     The doupdate() function returns OK on success and ERR on error.
  1466. X
  1467. X  X/Open Errors:
  1468. X     No errors are defined for this function.
  1469. X
  1470. X  Portability:
  1471. X     PDCurses    int wnoutrefresh( WINDOW* w );
  1472. X     X/Open Dec '88    int wnoutrefresh( WINDOW* w );
  1473. X     BSD Curses    int wnoutrefresh( WINDOW* w );
  1474. X     SYS V Curses    int wnoutrefresh( WINDOW* w );
  1475. X
  1476. X**man-end**********************************************************************/
  1477. X
  1478. Xint    wnoutrefresh(register WINDOW *win)
  1479. X{
  1480. Xregister chtype*    dstp;
  1481. Xregister chtype*    srcp;
  1482. Xregister int        first;    /* first changed char on line */
  1483. Xregister int        last;    /* last changed char on line  */
  1484. X    int        begy;    /* window's place on screen   */
  1485. X    int        begx;
  1486. X    WINDOW*        s;
  1487. X    int        i;
  1488. X    int        j;
  1489. X    int        y;
  1490. X    int        x;
  1491. X    int        len;
  1492. X    chtype        attrs;
  1493. X
  1494. X    if (win == (WINDOW *)NULL)
  1495. X        return( ERR );
  1496. X
  1497. X    y = win->_cury;
  1498. X    x = win->_curx;
  1499. X    attrs = win->_attrs;
  1500. X    if (win->_title != NULL)
  1501. X        len = strlen(win->_title);
  1502. X    /*
  1503. X     * There may be a better place to implement window titles, but this
  1504. X     * seems to be the best place. -- Frotz
  1505. X     */
  1506. X    if ((len > 0) && (win->_title != NULL) && !(win->_flags & _SUBWIN))
  1507. X    {
  1508. X        wattrset(win, win->_title_attr);
  1509. X        mvwprintw(win, 0, (win->_title_ofs), "%s", (long) win->_title);
  1510. X        wmove(win, y, x);    /* restore cursor postion */
  1511. X        wattrset(win, attrs);    /* restore attributes      */
  1512. X    }
  1513. X
  1514. X    if (win->_flags & _PAD)
  1515. X        return( ERR );
  1516. X
  1517. X    s = tmpwin;
  1518. X    begy = win->_begy;
  1519. X    begx = win->_begx;
  1520. X
  1521. X    for (i = 0, j = begy; i < win->_maxy; i++, j++)
  1522. X    {
  1523. X        if (win->_firstch[i] != _NO_CHANGE)
  1524. X        {
  1525. X            first = win->_firstch[i];
  1526. X            last = win->_lastch[i];
  1527. X
  1528. X#if     defined(DOS) || defined(OS2)
  1529. X#  if    SMALL || MEDIUM
  1530. X            srcp = &(win->_y[i][first]);
  1531. X            dstp = &(s->_y[j][begx + first]);
  1532. X            movedata( FP_SEG(srcp), FP_OFF(srcp),
  1533. X                  FP_SEG(dstp), FP_OFF(dstp),
  1534. X                  (last - first + 1) * sizeof(chtype));
  1535. X#  else
  1536. X            memcpy(&(s->_y[j][begx + first]),
  1537. X                   &(win->_y[i][first]),
  1538. X                   (last - first + 1) * sizeof(chtype));
  1539. X#  endif
  1540. X#endif
  1541. X            first += begx;    /* s's min/max change positions */
  1542. X            last += begx;
  1543. X
  1544. X            if (s->_firstch[j] != _NO_CHANGE)
  1545. X                s->_firstch[j] = min(s->_firstch[j], first);
  1546. X            else
  1547. X                s->_firstch[j] = first;
  1548. X
  1549. X            s->_lastch[j] = max(s->_lastch[j], last);
  1550. X
  1551. X            win->_firstch[i] = _NO_CHANGE;    /* updated now */
  1552. X        }
  1553. X        win->_lastch[i] = _NO_CHANGE;    /* updated now */
  1554. X    }
  1555. X
  1556. X    if (win->_clear)
  1557. X    {
  1558. X        win->_clear = FALSE;
  1559. X        s->_clear = TRUE;
  1560. X    }
  1561. X
  1562. X    if (!win->_leave)
  1563. X    {
  1564. X        s->_cury = win->_cury + begy;
  1565. X        s->_curx = win->_curx + begx;
  1566. X    }
  1567. X    return( OK );
  1568. X}
  1569. END_OF_FILE
  1570.   if test 4158 -ne `wc -c <'portable/wnoutref.c'`; then
  1571.     echo shar: \"'portable/wnoutref.c'\" unpacked with wrong size!
  1572.   fi
  1573.   # end of 'portable/wnoutref.c'
  1574. fi
  1575. if test -f 'private/_queryad.c' -a "${1}" != "-c" ; then 
  1576.   echo shar: Will not clobber existing file \"'private/_queryad.c'\"
  1577. else
  1578.   echo shar: Extracting \"'private/_queryad.c'\" \(4567 characters\)
  1579.   sed "s/^X//" >'private/_queryad.c' <<'END_OF_FILE'
  1580. X#define    CURSES_LIBRARY    1
  1581. X#include <curses.h>
  1582. X
  1583. X#ifndef    NDEBUG
  1584. Xchar *rcsid__queryad = "$Header: c:/curses/private/RCS/_queryad.c%v 2.0 1992/11/15 03:24:30 MH Rel $";
  1585. X#endif
  1586. X
  1587. X
  1588. X
  1589. X
  1590. X/*man-start*********************************************************************
  1591. X
  1592. X  PDC_query_adapter_type()    - Determine PC video adapter type
  1593. X
  1594. X  PDCurses Description:
  1595. X     This is a private PDCurses routine.
  1596. X
  1597. X     Thanks to Jeff Duntemann, K16RA for providing the impetus
  1598. X     (through the Dr. Dobbs Journal, March 1989 issue) for getting
  1599. X     the routines below merged into Bjorn Larsson's PDCurses 1.3...
  1600. X         -- frotz@dri.com    900730
  1601. X
  1602. X  PDCurses Return Value:
  1603. X     This function returns a macro identifier indicating the adapter
  1604. X     type.  See the list of adapter types in PRIVATE/CURSPRIV.H.
  1605. X
  1606. X  PDCurses Errors:
  1607. X     No errors are defined for this function.
  1608. X
  1609. X  Portability:
  1610. X     PDCurses    int PDC_query_adapter_type( void );
  1611. X
  1612. X**man-end**********************************************************************/
  1613. X
  1614. X#ifdef     OS2
  1615. XVIOCONFIGINFO    PDC_query_adapter_type(void)
  1616. X#else
  1617. Xint    PDC_query_adapter_type(void)
  1618. X#endif
  1619. X{
  1620. X#ifdef    FLEXOS
  1621. X    return (_FLEXOS);
  1622. X#endif
  1623. X#ifdef    DOS
  1624. X    int    retval = _NONE;
  1625. X    int    equip;
  1626. X    short far *VIDEO_BASE;
  1627. X
  1628. X    /*
  1629. X     * Attempt to call VGA Identify Adapter Function...
  1630. X     */
  1631. X    regs.h.ah = 0x1a;
  1632. X    regs.h.al = 0;
  1633. X    int86(0x10, ®s, ®s);
  1634. X    if ((regs.h.al == 0x1a) && (retval == _NONE))
  1635. X    {
  1636. X        /*
  1637. X         * We know that the PS/2 video BIOS is alive and well.
  1638. X         */
  1639. X        switch (regs.h.al)
  1640. X        {
  1641. X        case 0:
  1642. X            retval = _NONE;
  1643. X            break;
  1644. X        case 1:
  1645. X            retval = _MDA;
  1646. X            break;
  1647. X        case 2:
  1648. X            retval = _CGA;
  1649. X            break;
  1650. X        case 4:
  1651. X            retval = _EGACOLOR;
  1652. X            _cursvar.sizeable = TRUE;
  1653. X            break;
  1654. X        case 5:
  1655. X            retval = _EGAMONO;
  1656. X            break;
  1657. X        case 26:
  1658. X            retval = _VGACOLOR;    /* ...alt. VGA BIOS... */
  1659. X        case 7:
  1660. X            retval = _VGACOLOR;
  1661. X            _cursvar.sizeable = TRUE;
  1662. X            break;
  1663. X        case 8:
  1664. X            retval = _VGAMONO;
  1665. X            break;
  1666. X        case 10:
  1667. X        case 13:
  1668. X            retval = _MCGACOLOR;
  1669. X            break;
  1670. X        case 12:
  1671. X            retval = _MCGAMONO;
  1672. X            break;
  1673. X        default:
  1674. X            retval = _CGA;
  1675. X            break;
  1676. X        }
  1677. X    }
  1678. X    else
  1679. X    {
  1680. X        /*
  1681. X         * No VGA BIOS, check for an EGA BIOS by selecting an
  1682. X         * Alternate Function Service...
  1683. X         *
  1684. X         * bx == 0x0010     -->  return EGA information
  1685. X         */
  1686. X        regs.h.ah = 0x12;
  1687. X        regs.x.bx = 0x10;
  1688. X        int86(0x10, ®s, ®s);
  1689. X        if ((regs.h.bl != 0x10) && (retval == _NONE))
  1690. X        {
  1691. X            /*
  1692. X             * An EGA BIOS exists...
  1693. X             */
  1694. X            regs.h.ah = 0x12;
  1695. X            regs.h.bl = 0x10;
  1696. X            int86(0x10, ®s, ®s);
  1697. X            if (regs.h.bh == 0)
  1698. X                retval = _EGACOLOR;
  1699. X            else
  1700. X                retval = _EGAMONO;
  1701. X        }
  1702. X        else
  1703. X        if (retval == _NONE)
  1704. X        {
  1705. X            /*
  1706. X             * Now we know we only have CGA or MDA...
  1707. X             */
  1708. X            int86(0x11, ®s, ®s);
  1709. X            equip = (regs.h.al & 0x30) >> 4;
  1710. X            switch (equip)
  1711. X            {
  1712. X            case 1:
  1713. X            case 2:
  1714. X                retval = _CGA;
  1715. X                break;
  1716. X            case 3:
  1717. X                retval = _MDA;
  1718. X                break;
  1719. X            default:
  1720. X                retval = _NONE;
  1721. X                break;
  1722. X            }
  1723. X        }
  1724. X    }
  1725. X    VIDEO_BASE = (void far *) 0x0463L;
  1726. X    if (*VIDEO_BASE == 0x3d4)
  1727. X    {
  1728. X        _cursvar.video_seg = 0xb800;
  1729. X        switch (retval)
  1730. X        {
  1731. X        case _EGAMONO:
  1732. X            retval = _EGACOLOR;
  1733. X            break;
  1734. X        case _VGAMONO:
  1735. X            retval = _VGACOLOR;
  1736. X            break;
  1737. X        default:
  1738. X            break;
  1739. X        }
  1740. X    }
  1741. X    if (*VIDEO_BASE == 0x3b4)
  1742. X    {
  1743. X        _cursvar.video_seg = 0xb000;
  1744. X        switch (retval)
  1745. X        {
  1746. X        case _EGACOLOR:
  1747. X            retval = _EGAMONO;
  1748. X            break;
  1749. X        case _VGACOLOR:
  1750. X            retval = _VGAMONO;
  1751. X            break;
  1752. X        default:
  1753. X            break;
  1754. X        }
  1755. X    }
  1756. X    if ((retval == _NONE) ||
  1757. X        (retval == _CGA))
  1758. X    {
  1759. X        _cursvar.direct_video = FALSE;
  1760. X    }
  1761. X    if ((unsigned int) _cursvar.video_seg == 0xb000)
  1762. X        _cursvar.mono = TRUE;
  1763. X    else
  1764. X        _cursvar.mono = FALSE;
  1765. X    if  (!_cursvar.adapter)
  1766. X        _cursvar.adapter = retval;
  1767. X    return (PDC_sanity_check(retval));
  1768. X#endif
  1769. X#ifdef    OS2
  1770. X    int    retval = _NONE;
  1771. X    VIOCONFIGINFO configInfo;
  1772. X
  1773. X    VioGetConfig(0, &configInfo, 0);
  1774. X    _cursvar.sizeable = TRUE;
  1775. X        return configInfo;
  1776. X#  if     0
  1777. X    switch (configInfo.adapter)
  1778. X    {
  1779. X        case 0:
  1780. X            retval = _MDA;
  1781. X            _cursvar.mono =TRUE;
  1782. X            break;
  1783. X        case 1:
  1784. X            retval = _CGA;
  1785. X            _cursvar.mono = FALSE;
  1786. X            break;
  1787. X        case 2: switch (configInfo.display)
  1788. X            {
  1789. X                case 0:
  1790. X                case 3:
  1791. X                    retval = _EGAMONO;
  1792. X                    _cursvar.mono = TRUE;
  1793. X                    break;
  1794. X                case 1:
  1795. X                case 2:
  1796. X                case 4:
  1797. X                case 9:
  1798. X                    retval = _EGACOLOR;
  1799. X                    _cursvar.mono = FALSE;
  1800. X                    break;
  1801. X            }
  1802. X            break;
  1803. X        case 3: switch (configInfo.display)
  1804. X            {
  1805. X                case 0:
  1806. X                case 3:
  1807. X                    retval = _VGAMONO;
  1808. X                    _cursvar.sizeable = TRUE;
  1809. X                    _cursvar.mono = TRUE;
  1810. X                    break;
  1811. X                case 1:
  1812. X                case 2:
  1813. X                case 4:
  1814. X                case 9:
  1815. X                    retval = _VGACOLOR;
  1816. X                    _cursvar.sizeable = TRUE;
  1817. X                    _cursvar.mono = FALSE;
  1818. X                    break;
  1819. X            }
  1820. X            break;
  1821. X        default:
  1822. X            retval = _CGA;
  1823. X            _cursvar.mono = FALSE;
  1824. X            break;
  1825. X    }
  1826. X    return (PDC_sanity_check(retval));
  1827. X#  endif
  1828. X#endif
  1829. X}
  1830. END_OF_FILE
  1831.   if test 4567 -ne `wc -c <'private/_queryad.c'`; then
  1832.     echo shar: \"'private/_queryad.c'\" unpacked with wrong size!
  1833.   fi
  1834.   # end of 'private/_queryad.c'
  1835. fi
  1836. if test -f 'private/_xfrmlin.c' -a "${1}" != "-c" ; then 
  1837.   echo shar: Will not clobber existing file \"'private/_xfrmlin.c'\"
  1838. else
  1839.   echo shar: Extracting \"'private/_xfrmlin.c'\" \(4281 characters\)
  1840.   sed "s/^X//" >'private/_xfrmlin.c' <<'END_OF_FILE'
  1841. X#ifndef NO_MEMORY_H
  1842. X#include <memory.h>
  1843. X#endif
  1844. X#define    CURSES_LIBRARY    1
  1845. X#include <curses.h>
  1846. X
  1847. X#ifndef    NDEBUG
  1848. Xchar *rcsid__xfrmlin = "$Header: c:/curses/private/RCS/_xfrmlin.c%v 2.0 1992/11/15 03:24:38 MH Rel $";
  1849. X#endif
  1850. X
  1851. X
  1852. X
  1853. X
  1854. X/*man-start*********************************************************************
  1855. X
  1856. X  PDC_transform_line()    - transform
  1857. X
  1858. X  PDCurses Description:
  1859. X     This is a private PDCurses function.
  1860. X
  1861. X     Updates the given physical line to look like the corresponding
  1862. X     line in _cursvar.tmpwin.
  1863. X
  1864. X  PDCurses Return Value:
  1865. X     This routine returns TRUE if a premature refresh end
  1866. X     is allowed, and there is an input character pending.  Otherwise,
  1867. X     FALSE is returned.
  1868. X
  1869. X  PDCurses Errors:
  1870. X     No errors are defined for this routine.
  1871. X
  1872. X  Portability:
  1873. X     PDCurses    bool    PDC_transform_line( int lineno );
  1874. X
  1875. X**man-end**********************************************************************/
  1876. X
  1877. Xbool    PDC_transform_line(register int lineno)
  1878. X{
  1879. X#if defined (MSC) && defined (DOS)
  1880. Xchtype*    dstp;
  1881. Xchtype*    srcp;
  1882. X#else
  1883. Xregister chtype*    dstp;
  1884. Xregister chtype*    srcp;
  1885. X#endif
  1886. X    int rc;
  1887. X    int        x;
  1888. X    int        endx;
  1889. X    int        len;
  1890. X    chtype*    ch;
  1891. X    extern unsigned    char atrtab[MAX_ATRTAB];
  1892. X    chtype temp_line[256]; /* this should be enough for the maximum width of a screen. MH-920715 */
  1893. X    chtype chr;
  1894. X    register int j;
  1895. X#ifdef    FLEXOS
  1896. X    char    line[80];
  1897. X    char    attr[80];
  1898. X    FFRAME    sframe;
  1899. X    RECT    drect;
  1900. X    RECT    srect;
  1901. X#endif
  1902. X
  1903. X    if (twin == (WINDOW *)NULL)
  1904. X        return( FALSE );
  1905. X
  1906. X    x = twin->_firstch[lineno];
  1907. X    endx = twin->_lastch[lineno];
  1908. X    dstp = curscr->_y[lineno] + x;
  1909. X    srcp = twin->_y[lineno] + x;
  1910. X    len = endx-x+1;
  1911. X
  1912. X    ch = temp_line; /* now have ch pointing to area to contain real attributes. MH-920715 */
  1913. X#ifdef     DOS
  1914. X#  if    SMALL || MEDIUM
  1915. X        movedata(FP_SEG(srcp), FP_OFF(srcp),
  1916. X            FP_SEG(ch), FP_OFF(ch),len * sizeof(chtype));
  1917. X#  else
  1918. X        memcpy(ch, srcp, len * sizeof(chtype));
  1919. X#  endif
  1920. X#else
  1921. X        memcpy(ch, srcp, len * sizeof(chtype));
  1922. X#endif
  1923. X    for (j=0;j<len;j++)          /* for each chtype in the line... */
  1924. X       {
  1925. X        chr = temp_line[j] & A_CHARTEXT;
  1926. X        temp_line[j] = chtype_attr(temp_line[j]) | chr;
  1927. X       }
  1928. X
  1929. X    if (_cursvar.direct_video)
  1930. X    {
  1931. X#ifdef     DOS
  1932. X#  if    SMALL || MEDIUM
  1933. X        movedata(FP_SEG(srcp), FP_OFF(srcp),
  1934. X            FP_SEG(dstp), FP_OFF(dstp),len * sizeof(chtype));
  1935. X#  else
  1936. X        memcpy(dstp, srcp, len * sizeof(chtype));
  1937. X#  endif
  1938. X#endif
  1939. X#ifdef OS2
  1940. X        memcpy(dstp, srcp, len * sizeof(chtype));
  1941. X#endif
  1942. X#ifdef    FLEXOS
  1943. X        _split_plane(curscr, &line[0], &attr[0], lineno, x, lineno, endx);
  1944. X
  1945. X        drect.r_row = lineno;
  1946. X        drect.r_col = x;
  1947. X        drect.r_nrow = 1;
  1948. X        drect.r_ncol = len;
  1949. X
  1950. X        sframe.fr_pl[0] = (UBYTE *) line;
  1951. X        sframe.fr_pl[1] = (UBYTE *) attr;
  1952. X        sframe.fr_nrow = 1;
  1953. X        sframe.fr_ncol = len;
  1954. X        sframe.fr_use = 0x03;
  1955. X
  1956. X        srect.r_col = 0;
  1957. X        srect.r_row = 0;
  1958. X        srect.r_nrow = 1;
  1959. X        srect.r_ncol = len;
  1960. X
  1961. X        s_copy(0x03, 0x01L, 0L, (far unsigned short *) &drect,
  1962. X            (far unsigned short *) &sframe, (far unsigned
  1963. X            short *) &srect);
  1964. X
  1965. X#endif
  1966. X#ifdef    DOS
  1967. X#  if    SMALL || MEDIUM || MSC
  1968. X        movedata(FP_SEG(ch), FP_OFF(ch),
  1969. X            _cursvar.video_seg,
  1970. X            _cursvar.video_ofs+(((lineno*curscr->_maxx)+x)*sizeof(chtype)),
  1971. X                len * sizeof(chtype));
  1972. X#  else
  1973. X        memcpy(MK_FP(_cursvar.video_seg,
  1974. X                 _cursvar.video_ofs + (((lineno * curscr->_maxx) + x) * sizeof(chtype))),
  1975. X               ch, len * sizeof(chtype));
  1976. X#  endif
  1977. X#endif
  1978. X#ifdef    OS2
  1979. X                    VioWrtCellStr ((PCH)ch, (USHORT)(len*sizeof(chtype)), (USHORT)lineno, (USHORT)x, 0);
  1980. X#endif
  1981. X    }
  1982. X    else
  1983. X    {
  1984. X        for (; x <= endx; x++)
  1985. X        {
  1986. X            PDC_gotoxy(lineno, x);
  1987. X            PDC_putc( (*ch & A_CHARTEXT),(*ch & A_ATTRIBUTES) >> 8 );
  1988. X            ch++;
  1989. X        }
  1990. X    }
  1991. X    twin->_firstch[lineno] = _NO_CHANGE;
  1992. X    twin->_lastch[lineno] = _NO_CHANGE;
  1993. X
  1994. X/*****************************************************************/
  1995. X/*****************************************************************/
  1996. X/*****************************************************************/
  1997. X/*****************************************************************/
  1998. X/* temporarily turn off check for typeahead() */
  1999. X/*
  2000. X rc = typeahead(stdin);
  2001. X if (_cursvar.refrbrk && rc)
  2002. X    return(TRUE);
  2003. X else
  2004. X    return(FALSE);
  2005. X*/
  2006. X/*****************************************************************/
  2007. X/*****************************************************************/
  2008. X/*****************************************************************/
  2009. X/*****************************************************************/
  2010. X return(FALSE);
  2011. X}
  2012. END_OF_FILE
  2013.   if test 4281 -ne `wc -c <'private/_xfrmlin.c'`; then
  2014.     echo shar: \"'private/_xfrmlin.c'\" unpacked with wrong size!
  2015.   fi
  2016.   # end of 'private/_xfrmlin.c'
  2017. fi
  2018. echo shar: End of archive 4 \(of 11\).
  2019. cp /dev/null ark4isdone
  2020. MISSING=""
  2021. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  2022.     if test ! -f ark${I}isdone ; then
  2023.     MISSING="${MISSING} ${I}"
  2024.     fi
  2025. done
  2026. if test "${MISSING}" = "" ; then
  2027.     echo You have unpacked all 11 archives.
  2028.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2029. else
  2030.     echo You still must unpack the following archives:
  2031.     echo "        " ${MISSING}
  2032. fi
  2033. exit 0
  2034. exit 0 # Just in case...
  2035.