curses.h 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  1. #ifndef PDC_DLL_BUILD
  2. # define PDC_DLL_BUILD
  3. #endif
  4. #ifndef PDC_WIDE
  5. # define PDC_WIDE
  6. #endif
  7. /* Public Domain Curses */
  8. /* $Id: curses.h,v 1.295 2008/07/15 17:13:25 wmcbrine Exp $ */
  9. /*----------------------------------------------------------------------*
  10. * PDCurses *
  11. *----------------------------------------------------------------------*/
  12. #ifndef __PDCURSES__
  13. #define __PDCURSES__ 1
  14. /*man-start**************************************************************
  15. PDCurses definitions list: (Only define those needed)
  16. XCURSES True if compiling for X11.
  17. PDC_RGB True if you want to use RGB color definitions
  18. (Red = 1, Green = 2, Blue = 4) instead of BGR.
  19. PDC_WIDE True if building wide-character support.
  20. PDC_DLL_BUILD True if building a Win32 DLL.
  21. NCURSES_MOUSE_VERSION Use the ncurses mouse API instead
  22. of PDCurses' traditional mouse API.
  23. PDCurses portable platform definitions list:
  24. PDC_BUILD Defines API build version.
  25. PDCURSES Enables access to PDCurses-only routines.
  26. XOPEN Always true.
  27. SYSVcurses True if you are compiling for SYSV portability.
  28. BSDcurses True if you are compiling for BSD portability.
  29. **man-end****************************************************************/
  30. #define PDC_BUILD 3401
  31. #define PDCURSES 1 /* PDCurses-only routines */
  32. #define XOPEN 1 /* X/Open Curses routines */
  33. #define SYSVcurses 1 /* System V Curses routines */
  34. #define BSDcurses 1 /* BSD Curses routines */
  35. #define CHTYPE_LONG 1 /* size of chtype; long */
  36. /*----------------------------------------------------------------------*/
  37. #include <stdarg.h>
  38. #include <stddef.h>
  39. #include <stdio.h> /* Required by X/Open usage below */
  40. #ifdef PDC_WIDE
  41. # include <wchar.h>
  42. #endif
  43. #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
  44. extern "C"
  45. {
  46. # define bool _bool
  47. #endif
  48. /*----------------------------------------------------------------------
  49. *
  50. * PDCurses Manifest Constants
  51. *
  52. */
  53. #ifndef FALSE
  54. # define FALSE 0
  55. #endif
  56. #ifndef TRUE
  57. # define TRUE 1
  58. #endif
  59. #ifndef NULL
  60. # define NULL (void *)0
  61. #endif
  62. #ifndef ERR
  63. # define ERR (-1)
  64. #endif
  65. #ifndef OK
  66. # define OK 0
  67. #endif
  68. /*----------------------------------------------------------------------
  69. *
  70. * PDCurses Type Declarations
  71. *
  72. */
  73. typedef unsigned char bool; /* PDCurses Boolean type */
  74. #ifdef CHTYPE_LONG
  75. # if _LP64
  76. typedef unsigned int chtype;
  77. # else
  78. typedef unsigned long chtype; /* 16-bit attr + 16-bit char */
  79. # endif
  80. #else
  81. typedef unsigned short chtype; /* 8-bit attr + 8-bit char */
  82. #endif
  83. #ifdef PDC_WIDE
  84. typedef chtype cchar_t;
  85. #endif
  86. typedef chtype attr_t;
  87. /*----------------------------------------------------------------------
  88. *
  89. * PDCurses Mouse Interface -- SYSVR4, with extensions
  90. *
  91. */
  92. typedef struct
  93. {
  94. int x; /* absolute column, 0 based, measured in characters */
  95. int y; /* absolute row, 0 based, measured in characters */
  96. short button[3]; /* state of each button */
  97. int changes; /* flags indicating what has changed with the mouse */
  98. } MOUSE_STATUS;
  99. #define BUTTON_RELEASED 0x0000
  100. #define BUTTON_PRESSED 0x0001
  101. #define BUTTON_CLICKED 0x0002
  102. #define BUTTON_DOUBLE_CLICKED 0x0003
  103. #define BUTTON_TRIPLE_CLICKED 0x0004
  104. #define BUTTON_MOVED 0x0005 /* PDCurses */
  105. #define WHEEL_SCROLLED 0x0006 /* PDCurses */
  106. #define BUTTON_ACTION_MASK 0x0007 /* PDCurses */
  107. #define PDC_BUTTON_SHIFT 0x0008 /* PDCurses */
  108. #define PDC_BUTTON_CONTROL 0x0010 /* PDCurses */
  109. #define PDC_BUTTON_ALT 0x0020 /* PDCurses */
  110. #define BUTTON_MODIFIER_MASK 0x0038 /* PDCurses */
  111. #define MOUSE_X_POS (Mouse_status.x)
  112. #define MOUSE_Y_POS (Mouse_status.y)
  113. /*
  114. * Bits associated with the .changes field:
  115. * 3 2 1 0
  116. * 210987654321098765432109876543210
  117. * 1 <- button 1 has changed
  118. * 10 <- button 2 has changed
  119. * 100 <- button 3 has changed
  120. * 1000 <- mouse has moved
  121. * 10000 <- mouse position report
  122. * 100000 <- mouse wheel up
  123. * 1000000 <- mouse wheel down
  124. */
  125. #define PDC_MOUSE_MOVED 0x0008
  126. #define PDC_MOUSE_POSITION 0x0010
  127. #define PDC_MOUSE_WHEEL_UP 0x0020
  128. #define PDC_MOUSE_WHEEL_DOWN 0x0040
  129. #define A_BUTTON_CHANGED (Mouse_status.changes & 7)
  130. #define MOUSE_MOVED (Mouse_status.changes & PDC_MOUSE_MOVED)
  131. #define MOUSE_POS_REPORT (Mouse_status.changes & PDC_MOUSE_POSITION)
  132. #define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - 1)))
  133. #define BUTTON_STATUS(x) (Mouse_status.button[(x) - 1])
  134. #define MOUSE_WHEEL_UP (Mouse_status.changes & PDC_MOUSE_WHEEL_UP)
  135. #define MOUSE_WHEEL_DOWN (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN)
  136. /* mouse bit-masks */
  137. #define BUTTON1_RELEASED 0x00000001L
  138. #define BUTTON1_PRESSED 0x00000002L
  139. #define BUTTON1_CLICKED 0x00000004L
  140. #define BUTTON1_DOUBLE_CLICKED 0x00000008L
  141. #define BUTTON1_TRIPLE_CLICKED 0x00000010L
  142. #define BUTTON1_MOVED 0x00000010L /* PDCurses */
  143. #define BUTTON2_RELEASED 0x00000020L
  144. #define BUTTON2_PRESSED 0x00000040L
  145. #define BUTTON2_CLICKED 0x00000080L
  146. #define BUTTON2_DOUBLE_CLICKED 0x00000100L
  147. #define BUTTON2_TRIPLE_CLICKED 0x00000200L
  148. #define BUTTON2_MOVED 0x00000200L /* PDCurses */
  149. #define BUTTON3_RELEASED 0x00000400L
  150. #define BUTTON3_PRESSED 0x00000800L
  151. #define BUTTON3_CLICKED 0x00001000L
  152. #define BUTTON3_DOUBLE_CLICKED 0x00002000L
  153. #define BUTTON3_TRIPLE_CLICKED 0x00004000L
  154. #define BUTTON3_MOVED 0x00004000L /* PDCurses */
  155. /* For the ncurses-compatible functions only, BUTTON4_PRESSED and
  156. BUTTON5_PRESSED are returned for mouse scroll wheel up and down;
  157. otherwise PDCurses doesn't support buttons 4 and 5 */
  158. #define BUTTON4_RELEASED 0x00008000L
  159. #define BUTTON4_PRESSED 0x00010000L
  160. #define BUTTON4_CLICKED 0x00020000L
  161. #define BUTTON4_DOUBLE_CLICKED 0x00040000L
  162. #define BUTTON4_TRIPLE_CLICKED 0x00080000L
  163. #define BUTTON5_RELEASED 0x00100000L
  164. #define BUTTON5_PRESSED 0x00200000L
  165. #define BUTTON5_CLICKED 0x00400000L
  166. #define BUTTON5_DOUBLE_CLICKED 0x00800000L
  167. #define BUTTON5_TRIPLE_CLICKED 0x01000000L
  168. #define MOUSE_WHEEL_SCROLL 0x02000000L /* PDCurses */
  169. #define BUTTON_MODIFIER_SHIFT 0x04000000L /* PDCurses */
  170. #define BUTTON_MODIFIER_CONTROL 0x08000000L /* PDCurses */
  171. #define BUTTON_MODIFIER_ALT 0x10000000L /* PDCurses */
  172. #define ALL_MOUSE_EVENTS 0x1fffffffL
  173. #define REPORT_MOUSE_POSITION 0x20000000L
  174. /* ncurses mouse interface */
  175. typedef unsigned long mmask_t;
  176. typedef struct
  177. {
  178. short id; /* unused, always 0 */
  179. int x, y, z; /* x, y same as MOUSE_STATUS; z unused */
  180. mmask_t bstate; /* equivalent to changes + button[], but
  181. in the same format as used for mousemask() */
  182. } MEVENT;
  183. #ifdef NCURSES_MOUSE_VERSION
  184. # define BUTTON_SHIFT BUTTON_MODIFIER_SHIFT
  185. # define BUTTON_CONTROL BUTTON_MODIFIER_CONTROL
  186. # define BUTTON_CTRL BUTTON_MODIFIER_CONTROL
  187. # define BUTTON_ALT BUTTON_MODIFIER_ALT
  188. #else
  189. # define BUTTON_SHIFT PDC_BUTTON_SHIFT
  190. # define BUTTON_CONTROL PDC_BUTTON_CONTROL
  191. # define BUTTON_ALT PDC_BUTTON_ALT
  192. #endif
  193. /*----------------------------------------------------------------------
  194. *
  195. * PDCurses Structure Definitions
  196. *
  197. */
  198. typedef struct _win /* definition of a window */
  199. {
  200. int _cury; /* current pseudo-cursor */
  201. int _curx;
  202. int _maxy; /* max window coordinates */
  203. int _maxx;
  204. int _begy; /* origin on screen */
  205. int _begx;
  206. int _flags; /* window properties */
  207. chtype _attrs; /* standard attributes and colors */
  208. chtype _bkgd; /* background, normally blank */
  209. bool _clear; /* causes clear at next refresh */
  210. bool _leaveit; /* leaves cursor where it is */
  211. bool _scroll; /* allows window scrolling */
  212. bool _nodelay; /* input character wait flag */
  213. bool _immed; /* immediate update flag */
  214. bool _sync; /* synchronise window ancestors */
  215. bool _use_keypad; /* flags keypad key mode active */
  216. chtype **_y; /* pointer to line pointer array */
  217. int *_firstch; /* first changed character in line */
  218. int *_lastch; /* last changed character in line */
  219. int _tmarg; /* top of scrolling region */
  220. int _bmarg; /* bottom of scrolling region */
  221. int _delayms; /* milliseconds of delay for getch() */
  222. int _parx, _pary; /* coords relative to parent (0,0) */
  223. struct _win *_parent; /* subwin's pointer to parent win */
  224. } WINDOW;
  225. /* Avoid using the SCREEN struct directly -- use the corresponding
  226. functions if possible. This struct may eventually be made private. */
  227. typedef struct
  228. {
  229. bool alive; /* if initscr() called, and not endwin() */
  230. bool autocr; /* if cr -> lf */
  231. bool cbreak; /* if terminal unbuffered */
  232. bool echo; /* if terminal echo */
  233. bool raw_inp; /* raw input mode (v. cooked input) */
  234. bool raw_out; /* raw output mode (7 v. 8 bits) */
  235. bool audible; /* FALSE if the bell is visual */
  236. bool mono; /* TRUE if current screen is mono */
  237. bool resized; /* TRUE if TERM has been resized */
  238. bool orig_attr; /* TRUE if we have the original colors */
  239. short orig_fore; /* original screen foreground color */
  240. short orig_back; /* original screen foreground color */
  241. int cursrow; /* position of physical cursor */
  242. int curscol; /* position of physical cursor */
  243. int visibility; /* visibility of cursor */
  244. int orig_cursor; /* original cursor size */
  245. int lines; /* new value for LINES */
  246. int cols; /* new value for COLS */
  247. unsigned long _trap_mbe; /* trap these mouse button events */
  248. unsigned long _map_mbe_to_key; /* map mouse buttons to slk */
  249. int mouse_wait; /* time to wait (in ms) for a
  250. button release after a press, in
  251. order to count it as a click */
  252. int slklines; /* lines in use by slk_init() */
  253. WINDOW *slk_winptr; /* window for slk */
  254. int linesrippedoff; /* lines ripped off via ripoffline() */
  255. int linesrippedoffontop; /* lines ripped off on
  256. top via ripoffline() */
  257. int delaytenths; /* 1/10ths second to wait block
  258. getch() for */
  259. bool _preserve; /* TRUE if screen background
  260. to be preserved */
  261. int _restore; /* specifies if screen background
  262. to be restored, and how */
  263. bool save_key_modifiers; /* TRUE if each key modifiers saved
  264. with each key press */
  265. bool return_key_modifiers; /* TRUE if modifier keys are
  266. returned as "real" keys */
  267. bool key_code; /* TRUE if last key is a special key;
  268. used internally by get_wch() */
  269. #ifdef XCURSES
  270. int XcurscrSize; /* size of Xcurscr shared memory block */
  271. bool sb_on;
  272. int sb_viewport_y;
  273. int sb_viewport_x;
  274. int sb_total_y;
  275. int sb_total_x;
  276. int sb_cur_y;
  277. int sb_cur_x;
  278. #endif
  279. short line_color; /* color of line attributes - default -1 */
  280. } SCREEN;
  281. /*----------------------------------------------------------------------
  282. *
  283. * PDCurses External Variables
  284. *
  285. */
  286. #ifdef PDC_DLL_BUILD
  287. # ifdef CURSES_LIBRARY
  288. # define PDCEX __declspec(dllexport) extern
  289. # else
  290. # define PDCEX __declspec(dllimport)
  291. # endif
  292. #else
  293. # define PDCEX extern
  294. #endif
  295. PDCEX int LINES; /* terminal height */
  296. PDCEX int COLS; /* terminal width */
  297. PDCEX WINDOW *stdscr; /* the default screen window */
  298. PDCEX WINDOW *curscr; /* the current screen image */
  299. PDCEX SCREEN *SP; /* curses variables */
  300. PDCEX MOUSE_STATUS Mouse_status;
  301. PDCEX int COLORS;
  302. PDCEX int COLOR_PAIRS;
  303. PDCEX int TABSIZE;
  304. PDCEX chtype acs_map[]; /* alternate character set map */
  305. PDCEX char ttytype[]; /* terminal name/description */
  306. /*man-start**************************************************************
  307. PDCurses Text Attributes
  308. ========================
  309. Originally, PDCurses used a short (16 bits) for its chtype. To include
  310. color, a number of things had to be sacrificed from the strict Unix and
  311. System V support. The main problem was fitting all character attributes
  312. and color into an unsigned char (all 8 bits!).
  313. Today, PDCurses by default uses a long (32 bits) for its chtype, as in
  314. System V. The short chtype is still available, by undefining CHTYPE_LONG
  315. and rebuilding the library.
  316. The following is the structure of a win->_attrs chtype:
  317. short form:
  318. -------------------------------------------------
  319. |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
  320. -------------------------------------------------
  321. color number | attrs | character eg 'a'
  322. The available non-color attributes are bold, reverse and blink. Others
  323. have no effect. The high order char is an index into an array of
  324. physical colors (defined in color.c) -- 32 foreground/background color
  325. pairs (5 bits) plus 3 bits for other attributes.
  326. long form:
  327. ----------------------------------------------------------------------------
  328. |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|..| 3| 2| 1| 0|
  329. ----------------------------------------------------------------------------
  330. color number | modifiers | character eg 'a'
  331. The available non-color attributes are bold, underline, invisible,
  332. right-line, left-line, protect, reverse and blink. 256 color pairs (8
  333. bits), 8 bits for other attributes, and 16 bits for character data.
  334. **man-end****************************************************************/
  335. /*** Video attribute macros ***/
  336. #define A_NORMAL (chtype)0
  337. #ifdef CHTYPE_LONG
  338. # define A_ALTCHARSET (chtype)0x00010000
  339. # define A_RIGHTLINE (chtype)0x00020000
  340. # define A_LEFTLINE (chtype)0x00040000
  341. # define A_INVIS (chtype)0x00080000
  342. # define A_UNDERLINE (chtype)0x00100000
  343. # define A_REVERSE (chtype)0x00200000
  344. # define A_BLINK (chtype)0x00400000
  345. # define A_BOLD (chtype)0x00800000
  346. # define A_ATTRIBUTES (chtype)0xffff0000
  347. # define A_CHARTEXT (chtype)0x0000ffff
  348. # define A_COLOR (chtype)0xff000000
  349. # define A_ITALIC A_INVIS
  350. # define A_PROTECT (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE)
  351. # define PDC_ATTR_SHIFT 19
  352. # define PDC_COLOR_SHIFT 24
  353. #else
  354. # define A_BOLD (chtype)0x0100 /* X/Open */
  355. # define A_REVERSE (chtype)0x0200 /* X/Open */
  356. # define A_BLINK (chtype)0x0400 /* X/Open */
  357. # define A_ATTRIBUTES (chtype)0xff00 /* X/Open */
  358. # define A_CHARTEXT (chtype)0x00ff /* X/Open */
  359. # define A_COLOR (chtype)0xf800 /* System V */
  360. # define A_ALTCHARSET A_NORMAL /* X/Open */
  361. # define A_PROTECT A_NORMAL /* X/Open */
  362. # define A_UNDERLINE A_NORMAL /* X/Open */
  363. # define A_LEFTLINE A_NORMAL
  364. # define A_RIGHTLINE A_NORMAL
  365. # define A_ITALIC A_NORMAL
  366. # define A_INVIS A_NORMAL
  367. # define PDC_ATTR_SHIFT 8
  368. # define PDC_COLOR_SHIFT 11
  369. #endif
  370. #define A_STANDOUT (A_REVERSE | A_BOLD) /* X/Open */
  371. #define A_DIM A_NORMAL
  372. #define CHR_MSK A_CHARTEXT /* Obsolete */
  373. #define ATR_MSK A_ATTRIBUTES /* Obsolete */
  374. #define ATR_NRM A_NORMAL /* Obsolete */
  375. /* For use with attr_t -- X/Open says, "these shall be distinct", so
  376. this is a non-conforming implementation. */
  377. #define WA_ALTCHARSET A_ALTCHARSET
  378. #define WA_BLINK A_BLINK
  379. #define WA_BOLD A_BOLD
  380. #define WA_DIM A_DIM
  381. #define WA_INVIS A_INVIS
  382. #define WA_LEFT A_LEFTLINE
  383. #define WA_PROTECT A_PROTECT
  384. #define WA_REVERSE A_REVERSE
  385. #define WA_RIGHT A_RIGHTLINE
  386. #define WA_STANDOUT A_STANDOUT
  387. #define WA_UNDERLINE A_UNDERLINE
  388. #define WA_HORIZONTAL A_NORMAL
  389. #define WA_LOW A_NORMAL
  390. #define WA_TOP A_NORMAL
  391. #define WA_VERTICAL A_NORMAL
  392. /*** Alternate character set macros ***/
  393. /* 'w' = 32-bit chtype; acs_map[] index | A_ALTCHARSET
  394. 'n' = 16-bit chtype; it gets the fallback set because no bit is
  395. available for A_ALTCHARSET */
  396. #ifdef CHTYPE_LONG
  397. # define ACS_PICK(w, n) ((chtype)w | A_ALTCHARSET)
  398. #else
  399. # define ACS_PICK(w, n) ((chtype)n)
  400. #endif
  401. /* VT100-compatible symbols -- box chars */
  402. #define ACS_ULCORNER ACS_PICK('l', '+')
  403. #define ACS_LLCORNER ACS_PICK('m', '+')
  404. #define ACS_URCORNER ACS_PICK('k', '+')
  405. #define ACS_LRCORNER ACS_PICK('j', '+')
  406. #define ACS_RTEE ACS_PICK('u', '+')
  407. #define ACS_LTEE ACS_PICK('t', '+')
  408. #define ACS_BTEE ACS_PICK('v', '+')
  409. #define ACS_TTEE ACS_PICK('w', '+')
  410. #define ACS_HLINE ACS_PICK('q', '-')
  411. #define ACS_VLINE ACS_PICK('x', '|')
  412. #define ACS_PLUS ACS_PICK('n', '+')
  413. /* VT100-compatible symbols -- other */
  414. #define ACS_S1 ACS_PICK('o', '-')
  415. #define ACS_S9 ACS_PICK('s', '_')
  416. #define ACS_DIAMOND ACS_PICK('`', '+')
  417. #define ACS_CKBOARD ACS_PICK('a', ':')
  418. #define ACS_DEGREE ACS_PICK('f', '\'')
  419. #define ACS_PLMINUS ACS_PICK('g', '#')
  420. #define ACS_BULLET ACS_PICK('~', 'o')
  421. /* Teletype 5410v1 symbols -- these are defined in SysV curses, but
  422. are not well-supported by most terminals. Stick to VT100 characters
  423. for optimum portability. */
  424. #define ACS_LARROW ACS_PICK(',', '<')
  425. #define ACS_RARROW ACS_PICK('+', '>')
  426. #define ACS_DARROW ACS_PICK('.', 'v')
  427. #define ACS_UARROW ACS_PICK('-', '^')
  428. #define ACS_BOARD ACS_PICK('h', '#')
  429. #define ACS_LANTERN ACS_PICK('i', '*')
  430. #define ACS_BLOCK ACS_PICK('0', '#')
  431. /* That goes double for these -- undocumented SysV symbols. Don't use
  432. them. */
  433. #define ACS_S3 ACS_PICK('p', '-')
  434. #define ACS_S7 ACS_PICK('r', '-')
  435. #define ACS_LEQUAL ACS_PICK('y', '<')
  436. #define ACS_GEQUAL ACS_PICK('z', '>')
  437. #define ACS_PI ACS_PICK('{', 'n')
  438. #define ACS_NEQUAL ACS_PICK('|', '+')
  439. #define ACS_STERLING ACS_PICK('}', 'L')
  440. /* Box char aliases */
  441. #define ACS_BSSB ACS_ULCORNER
  442. #define ACS_SSBB ACS_LLCORNER
  443. #define ACS_BBSS ACS_URCORNER
  444. #define ACS_SBBS ACS_LRCORNER
  445. #define ACS_SBSS ACS_RTEE
  446. #define ACS_SSSB ACS_LTEE
  447. #define ACS_SSBS ACS_BTEE
  448. #define ACS_BSSS ACS_TTEE
  449. #define ACS_BSBS ACS_HLINE
  450. #define ACS_SBSB ACS_VLINE
  451. #define ACS_SSSS ACS_PLUS
  452. /* cchar_t aliases */
  453. #ifdef PDC_WIDE
  454. # define WACS_ULCORNER (&(acs_map['l']))
  455. # define WACS_LLCORNER (&(acs_map['m']))
  456. # define WACS_URCORNER (&(acs_map['k']))
  457. # define WACS_LRCORNER (&(acs_map['j']))
  458. # define WACS_RTEE (&(acs_map['u']))
  459. # define WACS_LTEE (&(acs_map['t']))
  460. # define WACS_BTEE (&(acs_map['v']))
  461. # define WACS_TTEE (&(acs_map['w']))
  462. # define WACS_HLINE (&(acs_map['q']))
  463. # define WACS_VLINE (&(acs_map['x']))
  464. # define WACS_PLUS (&(acs_map['n']))
  465. # define WACS_S1 (&(acs_map['o']))
  466. # define WACS_S9 (&(acs_map['s']))
  467. # define WACS_DIAMOND (&(acs_map['`']))
  468. # define WACS_CKBOARD (&(acs_map['a']))
  469. # define WACS_DEGREE (&(acs_map['f']))
  470. # define WACS_PLMINUS (&(acs_map['g']))
  471. # define WACS_BULLET (&(acs_map['~']))
  472. # define WACS_LARROW (&(acs_map[',']))
  473. # define WACS_RARROW (&(acs_map['+']))
  474. # define WACS_DARROW (&(acs_map['.']))
  475. # define WACS_UARROW (&(acs_map['-']))
  476. # define WACS_BOARD (&(acs_map['h']))
  477. # define WACS_LANTERN (&(acs_map['i']))
  478. # define WACS_BLOCK (&(acs_map['0']))
  479. # define WACS_S3 (&(acs_map['p']))
  480. # define WACS_S7 (&(acs_map['r']))
  481. # define WACS_LEQUAL (&(acs_map['y']))
  482. # define WACS_GEQUAL (&(acs_map['z']))
  483. # define WACS_PI (&(acs_map['{']))
  484. # define WACS_NEQUAL (&(acs_map['|']))
  485. # define WACS_STERLING (&(acs_map['}']))
  486. # define WACS_BSSB WACS_ULCORNER
  487. # define WACS_SSBB WACS_LLCORNER
  488. # define WACS_BBSS WACS_URCORNER
  489. # define WACS_SBBS WACS_LRCORNER
  490. # define WACS_SBSS WACS_RTEE
  491. # define WACS_SSSB WACS_LTEE
  492. # define WACS_SSBS WACS_BTEE
  493. # define WACS_BSSS WACS_TTEE
  494. # define WACS_BSBS WACS_HLINE
  495. # define WACS_SBSB WACS_VLINE
  496. # define WACS_SSSS WACS_PLUS
  497. #endif
  498. /*** Color macros ***/
  499. #define COLOR_BLACK 0
  500. #ifdef PDC_RGB /* RGB */
  501. # define COLOR_RED 1
  502. # define COLOR_GREEN 2
  503. # define COLOR_BLUE 4
  504. #else /* BGR */
  505. # define COLOR_BLUE 1
  506. # define COLOR_GREEN 2
  507. # define COLOR_RED 4
  508. #endif
  509. #define COLOR_CYAN (COLOR_BLUE | COLOR_GREEN)
  510. #define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE)
  511. #define COLOR_YELLOW (COLOR_RED | COLOR_GREEN)
  512. #define COLOR_WHITE 7
  513. /*----------------------------------------------------------------------
  514. *
  515. * Function and Keypad Key Definitions.
  516. * Many are just for compatibility.
  517. *
  518. */
  519. #define KEY_CODE_YES 0x100 /* If get_wch() gives a key code */
  520. #define KEY_BREAK 0x101 /* Not on PC KBD */
  521. #define KEY_DOWN 0x102 /* Down arrow key */
  522. #define KEY_UP 0x103 /* Up arrow key */
  523. #define KEY_LEFT 0x104 /* Left arrow key */
  524. #define KEY_RIGHT 0x105 /* Right arrow key */
  525. #define KEY_HOME 0x106 /* home key */
  526. #define KEY_BACKSPACE 0x107 /* not on pc */
  527. #define KEY_F0 0x108 /* function keys; 64 reserved */
  528. #define KEY_DL 0x148 /* delete line */
  529. #define KEY_IL 0x149 /* insert line */
  530. #define KEY_DC 0x14a /* delete character */
  531. #define KEY_IC 0x14b /* insert char or enter ins mode */
  532. #define KEY_EIC 0x14c /* exit insert char mode */
  533. #define KEY_CLEAR 0x14d /* clear screen */
  534. #define KEY_EOS 0x14e /* clear to end of screen */
  535. #define KEY_EOL 0x14f /* clear to end of line */
  536. #define KEY_SF 0x150 /* scroll 1 line forward */
  537. #define KEY_SR 0x151 /* scroll 1 line back (reverse) */
  538. #define KEY_NPAGE 0x152 /* next page */
  539. #define KEY_PPAGE 0x153 /* previous page */
  540. #define KEY_STAB 0x154 /* set tab */
  541. #define KEY_CTAB 0x155 /* clear tab */
  542. #define KEY_CATAB 0x156 /* clear all tabs */
  543. #define KEY_ENTER 0x157 /* enter or send (unreliable) */
  544. #define KEY_SRESET 0x158 /* soft/reset (partial/unreliable) */
  545. #define KEY_RESET 0x159 /* reset/hard reset (unreliable) */
  546. #define KEY_PRINT 0x15a /* print/copy */
  547. #define KEY_LL 0x15b /* home down/bottom (lower left) */
  548. #define KEY_ABORT 0x15c /* abort/terminate key (any) */
  549. #define KEY_SHELP 0x15d /* short help */
  550. #define KEY_LHELP 0x15e /* long help */
  551. #define KEY_BTAB 0x15f /* Back tab key */
  552. #define KEY_BEG 0x160 /* beg(inning) key */
  553. #define KEY_CANCEL 0x161 /* cancel key */
  554. #define KEY_CLOSE 0x162 /* close key */
  555. #define KEY_COMMAND 0x163 /* cmd (command) key */
  556. #define KEY_COPY 0x164 /* copy key */
  557. #define KEY_CREATE 0x165 /* create key */
  558. #define KEY_END 0x166 /* end key */
  559. #define KEY_EXIT 0x167 /* exit key */
  560. #define KEY_FIND 0x168 /* find key */
  561. #define KEY_HELP 0x169 /* help key */
  562. #define KEY_MARK 0x16a /* mark key */
  563. #define KEY_MESSAGE 0x16b /* message key */
  564. #define KEY_MOVE 0x16c /* move key */
  565. #define KEY_NEXT 0x16d /* next object key */
  566. #define KEY_OPEN 0x16e /* open key */
  567. #define KEY_OPTIONS 0x16f /* options key */
  568. #define KEY_PREVIOUS 0x170 /* previous object key */
  569. #define KEY_REDO 0x171 /* redo key */
  570. #define KEY_REFERENCE 0x172 /* ref(erence) key */
  571. #define KEY_REFRESH 0x173 /* refresh key */
  572. #define KEY_REPLACE 0x174 /* replace key */
  573. #define KEY_RESTART 0x175 /* restart key */
  574. #define KEY_RESUME 0x176 /* resume key */
  575. #define KEY_SAVE 0x177 /* save key */
  576. #define KEY_SBEG 0x178 /* shifted beginning key */
  577. #define KEY_SCANCEL 0x179 /* shifted cancel key */
  578. #define KEY_SCOMMAND 0x17a /* shifted command key */
  579. #define KEY_SCOPY 0x17b /* shifted copy key */
  580. #define KEY_SCREATE 0x17c /* shifted create key */
  581. #define KEY_SDC 0x17d /* shifted delete char key */
  582. #define KEY_SDL 0x17e /* shifted delete line key */
  583. #define KEY_SELECT 0x17f /* select key */
  584. #define KEY_SEND 0x180 /* shifted end key */
  585. #define KEY_SEOL 0x181 /* shifted clear line key */
  586. #define KEY_SEXIT 0x182 /* shifted exit key */
  587. #define KEY_SFIND 0x183 /* shifted find key */
  588. #define KEY_SHOME 0x184 /* shifted home key */
  589. #define KEY_SIC 0x185 /* shifted input key */
  590. #define KEY_SLEFT 0x187 /* shifted left arrow key */
  591. #define KEY_SMESSAGE 0x188 /* shifted message key */
  592. #define KEY_SMOVE 0x189 /* shifted move key */
  593. #define KEY_SNEXT 0x18a /* shifted next key */
  594. #define KEY_SOPTIONS 0x18b /* shifted options key */
  595. #define KEY_SPREVIOUS 0x18c /* shifted prev key */
  596. #define KEY_SPRINT 0x18d /* shifted print key */
  597. #define KEY_SREDO 0x18e /* shifted redo key */
  598. #define KEY_SREPLACE 0x18f /* shifted replace key */
  599. #define KEY_SRIGHT 0x190 /* shifted right arrow */
  600. #define KEY_SRSUME 0x191 /* shifted resume key */
  601. #define KEY_SSAVE 0x192 /* shifted save key */
  602. #define KEY_SSUSPEND 0x193 /* shifted suspend key */
  603. #define KEY_SUNDO 0x194 /* shifted undo key */
  604. #define KEY_SUSPEND 0x195 /* suspend key */
  605. #define KEY_UNDO 0x196 /* undo key */
  606. /* PDCurses-specific key definitions -- PC only */
  607. #define ALT_0 0x197
  608. #define ALT_1 0x198
  609. #define ALT_2 0x199
  610. #define ALT_3 0x19a
  611. #define ALT_4 0x19b
  612. #define ALT_5 0x19c
  613. #define ALT_6 0x19d
  614. #define ALT_7 0x19e
  615. #define ALT_8 0x19f
  616. #define ALT_9 0x1a0
  617. #define ALT_A 0x1a1
  618. #define ALT_B 0x1a2
  619. #define ALT_C 0x1a3
  620. #define ALT_D 0x1a4
  621. #define ALT_E 0x1a5
  622. #define ALT_F 0x1a6
  623. #define ALT_G 0x1a7
  624. #define ALT_H 0x1a8
  625. #define ALT_I 0x1a9
  626. #define ALT_J 0x1aa
  627. #define ALT_K 0x1ab
  628. #define ALT_L 0x1ac
  629. #define ALT_M 0x1ad
  630. #define ALT_N 0x1ae
  631. #define ALT_O 0x1af
  632. #define ALT_P 0x1b0
  633. #define ALT_Q 0x1b1
  634. #define ALT_R 0x1b2
  635. #define ALT_S 0x1b3
  636. #define ALT_T 0x1b4
  637. #define ALT_U 0x1b5
  638. #define ALT_V 0x1b6
  639. #define ALT_W 0x1b7
  640. #define ALT_X 0x1b8
  641. #define ALT_Y 0x1b9
  642. #define ALT_Z 0x1ba
  643. #define CTL_LEFT 0x1bb /* Control-Left-Arrow */
  644. #define CTL_RIGHT 0x1bc
  645. #define CTL_PGUP 0x1bd
  646. #define CTL_PGDN 0x1be
  647. #define CTL_HOME 0x1bf
  648. #define CTL_END 0x1c0
  649. #define KEY_A1 0x1c1 /* upper left on Virtual keypad */
  650. #define KEY_A2 0x1c2 /* upper middle on Virt. keypad */
  651. #define KEY_A3 0x1c3 /* upper right on Vir. keypad */
  652. #define KEY_B1 0x1c4 /* middle left on Virt. keypad */
  653. #define KEY_B2 0x1c5 /* center on Virt. keypad */
  654. #define KEY_B3 0x1c6 /* middle right on Vir. keypad */
  655. #define KEY_C1 0x1c7 /* lower left on Virt. keypad */
  656. #define KEY_C2 0x1c8 /* lower middle on Virt. keypad */
  657. #define KEY_C3 0x1c9 /* lower right on Vir. keypad */
  658. #define PADSLASH 0x1ca /* slash on keypad */
  659. #define PADENTER 0x1cb /* enter on keypad */
  660. #define CTL_PADENTER 0x1cc /* ctl-enter on keypad */
  661. #define ALT_PADENTER 0x1cd /* alt-enter on keypad */
  662. #define PADSTOP 0x1ce /* stop on keypad */
  663. #define PADSTAR 0x1cf /* star on keypad */
  664. #define PADMINUS 0x1d0 /* minus on keypad */
  665. #define PADPLUS 0x1d1 /* plus on keypad */
  666. #define CTL_PADSTOP 0x1d2 /* ctl-stop on keypad */
  667. #define CTL_PADCENTER 0x1d3 /* ctl-enter on keypad */
  668. #define CTL_PADPLUS 0x1d4 /* ctl-plus on keypad */
  669. #define CTL_PADMINUS 0x1d5 /* ctl-minus on keypad */
  670. #define CTL_PADSLASH 0x1d6 /* ctl-slash on keypad */
  671. #define CTL_PADSTAR 0x1d7 /* ctl-star on keypad */
  672. #define ALT_PADPLUS 0x1d8 /* alt-plus on keypad */
  673. #define ALT_PADMINUS 0x1d9 /* alt-minus on keypad */
  674. #define ALT_PADSLASH 0x1da /* alt-slash on keypad */
  675. #define ALT_PADSTAR 0x1db /* alt-star on keypad */
  676. #define ALT_PADSTOP 0x1dc /* alt-stop on keypad */
  677. #define CTL_INS 0x1dd /* ctl-insert */
  678. #define ALT_DEL 0x1de /* alt-delete */
  679. #define ALT_INS 0x1df /* alt-insert */
  680. #define CTL_UP 0x1e0 /* ctl-up arrow */
  681. #define CTL_DOWN 0x1e1 /* ctl-down arrow */
  682. #define CTL_TAB 0x1e2 /* ctl-tab */
  683. #define ALT_TAB 0x1e3
  684. #define ALT_MINUS 0x1e4
  685. #define ALT_EQUAL 0x1e5
  686. #define ALT_HOME 0x1e6
  687. #define ALT_PGUP 0x1e7
  688. #define ALT_PGDN 0x1e8
  689. #define ALT_END 0x1e9
  690. #define ALT_UP 0x1ea /* alt-up arrow */
  691. #define ALT_DOWN 0x1eb /* alt-down arrow */
  692. #define ALT_RIGHT 0x1ec /* alt-right arrow */
  693. #define ALT_LEFT 0x1ed /* alt-left arrow */
  694. #define ALT_ENTER 0x1ee /* alt-enter */
  695. #define ALT_ESC 0x1ef /* alt-escape */
  696. #define ALT_BQUOTE 0x1f0 /* alt-back quote */
  697. #define ALT_LBRACKET 0x1f1 /* alt-left bracket */
  698. #define ALT_RBRACKET 0x1f2 /* alt-right bracket */
  699. #define ALT_SEMICOLON 0x1f3 /* alt-semi-colon */
  700. #define ALT_FQUOTE 0x1f4 /* alt-forward quote */
  701. #define ALT_COMMA 0x1f5 /* alt-comma */
  702. #define ALT_STOP 0x1f6 /* alt-stop */
  703. #define ALT_FSLASH 0x1f7 /* alt-forward slash */
  704. #define ALT_BKSP 0x1f8 /* alt-backspace */
  705. #define CTL_BKSP 0x1f9 /* ctl-backspace */
  706. #define PAD0 0x1fa /* keypad 0 */
  707. #define CTL_PAD0 0x1fb /* ctl-keypad 0 */
  708. #define CTL_PAD1 0x1fc
  709. #define CTL_PAD2 0x1fd
  710. #define CTL_PAD3 0x1fe
  711. #define CTL_PAD4 0x1ff
  712. #define CTL_PAD5 0x200
  713. #define CTL_PAD6 0x201
  714. #define CTL_PAD7 0x202
  715. #define CTL_PAD8 0x203
  716. #define CTL_PAD9 0x204
  717. #define ALT_PAD0 0x205 /* alt-keypad 0 */
  718. #define ALT_PAD1 0x206
  719. #define ALT_PAD2 0x207
  720. #define ALT_PAD3 0x208
  721. #define ALT_PAD4 0x209
  722. #define ALT_PAD5 0x20a
  723. #define ALT_PAD6 0x20b
  724. #define ALT_PAD7 0x20c
  725. #define ALT_PAD8 0x20d
  726. #define ALT_PAD9 0x20e
  727. #define CTL_DEL 0x20f /* clt-delete */
  728. #define ALT_BSLASH 0x210 /* alt-back slash */
  729. #define CTL_ENTER 0x211 /* ctl-enter */
  730. #define SHF_PADENTER 0x212 /* shift-enter on keypad */
  731. #define SHF_PADSLASH 0x213 /* shift-slash on keypad */
  732. #define SHF_PADSTAR 0x214 /* shift-star on keypad */
  733. #define SHF_PADPLUS 0x215 /* shift-plus on keypad */
  734. #define SHF_PADMINUS 0x216 /* shift-minus on keypad */
  735. #define SHF_UP 0x217 /* shift-up on keypad */
  736. #define SHF_DOWN 0x218 /* shift-down on keypad */
  737. #define SHF_IC 0x219 /* shift-insert on keypad */
  738. #define SHF_DC 0x21a /* shift-delete on keypad */
  739. #define KEY_MOUSE 0x21b /* "mouse" key */
  740. #define KEY_SHIFT_L 0x21c /* Left-shift */
  741. #define KEY_SHIFT_R 0x21d /* Right-shift */
  742. #define KEY_CONTROL_L 0x21e /* Left-control */
  743. #define KEY_CONTROL_R 0x21f /* Right-control */
  744. #define KEY_ALT_L 0x220 /* Left-alt */
  745. #define KEY_ALT_R 0x221 /* Right-alt */
  746. #define KEY_RESIZE 0x222 /* Window resize */
  747. #define KEY_SUP 0x223 /* Shifted up arrow */
  748. #define KEY_SDOWN 0x224 /* Shifted down arrow */
  749. #define KEY_MIN KEY_BREAK /* Minimum curses key value */
  750. #define KEY_MAX KEY_SDOWN /* Maximum curses key */
  751. #define KEY_F(n) (KEY_F0 + (n))
  752. /*----------------------------------------------------------------------
  753. *
  754. * PDCurses Function Declarations
  755. *
  756. */
  757. /* Standard */
  758. int addch(const chtype);
  759. int addchnstr(const chtype *, int);
  760. int addchstr(const chtype *);
  761. int addnstr(const char *, int);
  762. int addstr(const char *);
  763. int attroff(chtype);
  764. int attron(chtype);
  765. int attrset(chtype);
  766. int attr_get(attr_t *, short *, void *);
  767. int attr_off(attr_t, void *);
  768. int attr_on(attr_t, void *);
  769. int attr_set(attr_t, short, void *);
  770. int baudrate(void);
  771. int beep(void);
  772. int bkgd(chtype);
  773. void bkgdset(chtype);
  774. int border(chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype);
  775. int box(WINDOW *, chtype, chtype);
  776. bool can_change_color(void);
  777. int cbreak(void);
  778. int chgat(int, attr_t, short, const void *);
  779. int clearok(WINDOW *, bool);
  780. int clear(void);
  781. int clrtobot(void);
  782. int clrtoeol(void);
  783. int color_content(short, short *, short *, short *);
  784. int color_set(short, void *);
  785. int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int);
  786. int curs_set(int);
  787. int def_prog_mode(void);
  788. int def_shell_mode(void);
  789. int delay_output(int);
  790. int delch(void);
  791. int deleteln(void);
  792. void delscreen(SCREEN *);
  793. int delwin(WINDOW *);
  794. WINDOW *derwin(WINDOW *, int, int, int, int);
  795. int doupdate(void);
  796. WINDOW *dupwin(WINDOW *);
  797. int echochar(const chtype);
  798. int echo(void);
  799. int endwin(void);
  800. char erasechar(void);
  801. int erase(void);
  802. void filter(void);
  803. int flash(void);
  804. int flushinp(void);
  805. chtype getbkgd(WINDOW *);
  806. int getnstr(char *, int);
  807. int getstr(char *);
  808. WINDOW *getwin(FILE *);
  809. int halfdelay(int);
  810. bool has_colors(void);
  811. bool has_ic(void);
  812. bool has_il(void);
  813. int hline(chtype, int);
  814. void idcok(WINDOW *, bool);
  815. int idlok(WINDOW *, bool);
  816. void immedok(WINDOW *, bool);
  817. int inchnstr(chtype *, int);
  818. int inchstr(chtype *);
  819. chtype inch(void);
  820. int init_color(short, short, short, short);
  821. int init_pair(short, short, short);
  822. WINDOW *initscr(void);
  823. int innstr(char *, int);
  824. int insch(chtype);
  825. int insdelln(int);
  826. int insertln(void);
  827. int insnstr(const char *, int);
  828. int insstr(const char *);
  829. int instr(char *);
  830. int intrflush(WINDOW *, bool);
  831. bool isendwin(void);
  832. bool is_linetouched(WINDOW *, int);
  833. bool is_wintouched(WINDOW *);
  834. char *keyname(int);
  835. int keypad(WINDOW *, bool);
  836. char killchar(void);
  837. int leaveok(WINDOW *, bool);
  838. char *longname(void);
  839. int meta(WINDOW *, bool);
  840. int move(int, int);
  841. int mvaddch(int, int, const chtype);
  842. int mvaddchnstr(int, int, const chtype *, int);
  843. int mvaddchstr(int, int, const chtype *);
  844. int mvaddnstr(int, int, const char *, int);
  845. int mvaddstr(int, int, const char *);
  846. int mvchgat(int, int, int, attr_t, short, const void *);
  847. int mvcur(int, int, int, int);
  848. int mvdelch(int, int);
  849. int mvderwin(WINDOW *, int, int);
  850. int mvgetch(int, int);
  851. int mvgetnstr(int, int, char *, int);
  852. int mvgetstr(int, int, char *);
  853. int mvhline(int, int, chtype, int);
  854. chtype mvinch(int, int);
  855. int mvinchnstr(int, int, chtype *, int);
  856. int mvinchstr(int, int, chtype *);
  857. int mvinnstr(int, int, char *, int);
  858. int mvinsch(int, int, chtype);
  859. int mvinsnstr(int, int, const char *, int);
  860. int mvinsstr(int, int, const char *);
  861. int mvinstr(int, int, char *);
  862. int mvprintw(int, int, const char *, ...);
  863. int mvscanw(int, int, const char *, ...);
  864. int mvvline(int, int, chtype, int);
  865. int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
  866. int mvwaddchstr(WINDOW *, int, int, const chtype *);
  867. int mvwaddch(WINDOW *, int, int, const chtype);
  868. int mvwaddnstr(WINDOW *, int, int, const char *, int);
  869. int mvwaddstr(WINDOW *, int, int, const char *);
  870. int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
  871. int mvwdelch(WINDOW *, int, int);
  872. int mvwgetch(WINDOW *, int, int);
  873. int mvwgetnstr(WINDOW *, int, int, char *, int);
  874. int mvwgetstr(WINDOW *, int, int, char *);
  875. int mvwhline(WINDOW *, int, int, chtype, int);
  876. int mvwinchnstr(WINDOW *, int, int, chtype *, int);
  877. int mvwinchstr(WINDOW *, int, int, chtype *);
  878. chtype mvwinch(WINDOW *, int, int);
  879. int mvwinnstr(WINDOW *, int, int, char *, int);
  880. int mvwinsch(WINDOW *, int, int, chtype);
  881. int mvwinsnstr(WINDOW *, int, int, const char *, int);
  882. int mvwinsstr(WINDOW *, int, int, const char *);
  883. int mvwinstr(WINDOW *, int, int, char *);
  884. int mvwin(WINDOW *, int, int);
  885. int mvwprintw(WINDOW *, int, int, const char *, ...);
  886. int mvwscanw(WINDOW *, int, int, const char *, ...);
  887. int mvwvline(WINDOW *, int, int, chtype, int);
  888. int napms(int);
  889. WINDOW *newpad(int, int);
  890. SCREEN *newterm(const char *, FILE *, FILE *);
  891. WINDOW *newwin(int, int, int, int);
  892. int nl(void);
  893. int nocbreak(void);
  894. int nodelay(WINDOW *, bool);
  895. int noecho(void);
  896. int nonl(void);
  897. void noqiflush(void);
  898. int noraw(void);
  899. int notimeout(WINDOW *, bool);
  900. int overlay(const WINDOW *, WINDOW *);
  901. int overwrite(const WINDOW *, WINDOW *);
  902. int pair_content(short, short *, short *);
  903. int pechochar(WINDOW *, chtype);
  904. int pnoutrefresh(WINDOW *, int, int, int, int, int, int);
  905. int prefresh(WINDOW *, int, int, int, int, int, int);
  906. int printw(const char *, ...);
  907. int putwin(WINDOW *, FILE *);
  908. void qiflush(void);
  909. int raw(void);
  910. int redrawwin(WINDOW *);
  911. int refresh(void);
  912. int reset_prog_mode(void);
  913. int reset_shell_mode(void);
  914. int resetty(void);
  915. int ripoffline(int, int (*)(WINDOW *, int));
  916. int savetty(void);
  917. int scanw(const char *, ...);
  918. int scr_dump(const char *);
  919. int scr_init(const char *);
  920. int scr_restore(const char *);
  921. int scr_set(const char *);
  922. int scrl(int);
  923. int scroll(WINDOW *);
  924. int scrollok(WINDOW *, bool);
  925. SCREEN *set_term(SCREEN *);
  926. int setscrreg(int, int);
  927. int slk_attroff(const chtype);
  928. int slk_attr_off(const attr_t, void *);
  929. int slk_attron(const chtype);
  930. int slk_attr_on(const attr_t, void *);
  931. int slk_attrset(const chtype);
  932. int slk_attr_set(const attr_t, short, void *);
  933. int slk_clear(void);
  934. int slk_color(short);
  935. int slk_init(int);
  936. char *slk_label(int);
  937. int slk_noutrefresh(void);
  938. int slk_refresh(void);
  939. int slk_restore(void);
  940. int slk_set(int, const char *, int);
  941. int slk_touch(void);
  942. int standend(void);
  943. int standout(void);
  944. int start_color(void);
  945. WINDOW *subpad(WINDOW *, int, int, int, int);
  946. WINDOW *subwin(WINDOW *, int, int, int, int);
  947. int syncok(WINDOW *, bool);
  948. chtype termattrs(void);
  949. attr_t term_attrs(void);
  950. char *termname(void);
  951. void timeout(int);
  952. int touchline(WINDOW *, int, int);
  953. int touchwin(WINDOW *);
  954. int typeahead(int);
  955. int untouchwin(WINDOW *);
  956. void use_env(bool);
  957. int vidattr(chtype);
  958. int vid_attr(attr_t, short, void *);
  959. int vidputs(chtype, int (*)(int));
  960. int vid_puts(attr_t, short, void *, int (*)(int));
  961. int vline(chtype, int);
  962. int vw_printw(WINDOW *, const char *, va_list);
  963. int vwprintw(WINDOW *, const char *, va_list);
  964. int vw_scanw(WINDOW *, const char *, va_list);
  965. int vwscanw(WINDOW *, const char *, va_list);
  966. int waddchnstr(WINDOW *, const chtype *, int);
  967. int waddchstr(WINDOW *, const chtype *);
  968. int waddch(WINDOW *, const chtype);
  969. int waddnstr(WINDOW *, const char *, int);
  970. int waddstr(WINDOW *, const char *);
  971. int wattroff(WINDOW *, chtype);
  972. int wattron(WINDOW *, chtype);
  973. int wattrset(WINDOW *, chtype);
  974. int wattr_get(WINDOW *, attr_t *, short *, void *);
  975. int wattr_off(WINDOW *, attr_t, void *);
  976. int wattr_on(WINDOW *, attr_t, void *);
  977. int wattr_set(WINDOW *, attr_t, short, void *);
  978. void wbkgdset(WINDOW *, chtype);
  979. int wbkgd(WINDOW *, chtype);
  980. int wborder(WINDOW *, chtype, chtype, chtype, chtype,
  981. chtype, chtype, chtype, chtype);
  982. int wchgat(WINDOW *, int, attr_t, short, const void *);
  983. int wclear(WINDOW *);
  984. int wclrtobot(WINDOW *);
  985. int wclrtoeol(WINDOW *);
  986. int wcolor_set(WINDOW *, short, void *);
  987. void wcursyncup(WINDOW *);
  988. int wdelch(WINDOW *);
  989. int wdeleteln(WINDOW *);
  990. int wechochar(WINDOW *, const chtype);
  991. int werase(WINDOW *);
  992. int wgetch(WINDOW *);
  993. int wgetnstr(WINDOW *, char *, int);
  994. int wgetstr(WINDOW *, char *);
  995. int whline(WINDOW *, chtype, int);
  996. int winchnstr(WINDOW *, chtype *, int);
  997. int winchstr(WINDOW *, chtype *);
  998. chtype winch(WINDOW *);
  999. int winnstr(WINDOW *, char *, int);
  1000. int winsch(WINDOW *, chtype);
  1001. int winsdelln(WINDOW *, int);
  1002. int winsertln(WINDOW *);
  1003. int winsnstr(WINDOW *, const char *, int);
  1004. int winsstr(WINDOW *, const char *);
  1005. int winstr(WINDOW *, char *);
  1006. int wmove(WINDOW *, int, int);
  1007. int wnoutrefresh(WINDOW *);
  1008. int wprintw(WINDOW *, const char *, ...);
  1009. int wredrawln(WINDOW *, int, int);
  1010. int wrefresh(WINDOW *);
  1011. int wscanw(WINDOW *, const char *, ...);
  1012. int wscrl(WINDOW *, int);
  1013. int wsetscrreg(WINDOW *, int, int);
  1014. int wstandend(WINDOW *);
  1015. int wstandout(WINDOW *);
  1016. void wsyncdown(WINDOW *);
  1017. void wsyncup(WINDOW *);
  1018. void wtimeout(WINDOW *, int);
  1019. int wtouchln(WINDOW *, int, int, int);
  1020. int wvline(WINDOW *, chtype, int);
  1021. /* Wide-character functions */
  1022. #ifdef PDC_WIDE
  1023. int addnwstr(const wchar_t *, int);
  1024. int addwstr(const wchar_t *);
  1025. int add_wch(const cchar_t *);
  1026. int add_wchnstr(const cchar_t *, int);
  1027. int add_wchstr(const cchar_t *);
  1028. int border_set(const cchar_t *, const cchar_t *, const cchar_t *,
  1029. const cchar_t *, const cchar_t *, const cchar_t *,
  1030. const cchar_t *, const cchar_t *);
  1031. int box_set(WINDOW *, const cchar_t *, const cchar_t *);
  1032. int echo_wchar(const cchar_t *);
  1033. int erasewchar(wchar_t *);
  1034. int getbkgrnd(cchar_t *);
  1035. int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *);
  1036. int getn_wstr(wint_t *, int);
  1037. int get_wch(wint_t *);
  1038. int get_wstr(wint_t *);
  1039. int hline_set(const cchar_t *, int);
  1040. int innwstr(wchar_t *, int);
  1041. int ins_nwstr(const wchar_t *, int);
  1042. int ins_wch(const cchar_t *);
  1043. int ins_wstr(const wchar_t *);
  1044. int inwstr(wchar_t *);
  1045. int in_wch(cchar_t *);
  1046. int in_wchnstr(cchar_t *, int);
  1047. int in_wchstr(cchar_t *);
  1048. char *key_name(wchar_t);
  1049. int killwchar(wchar_t *);
  1050. int mvaddnwstr(int, int, const wchar_t *, int);
  1051. int mvaddwstr(int, int, const wchar_t *);
  1052. int mvadd_wch(int, int, const cchar_t *);
  1053. int mvadd_wchnstr(int, int, const cchar_t *, int);
  1054. int mvadd_wchstr(int, int, const cchar_t *);
  1055. int mvgetn_wstr(int, int, wint_t *, int);
  1056. int mvget_wch(int, int, wint_t *);
  1057. int mvget_wstr(int, int, wint_t *);
  1058. int mvhline_set(int, int, const cchar_t *, int);
  1059. int mvinnwstr(int, int, wchar_t *, int);
  1060. int mvins_nwstr(int, int, const wchar_t *, int);
  1061. int mvins_wch(int, int, const cchar_t *);
  1062. int mvins_wstr(int, int, const wchar_t *);
  1063. int mvinwstr(int, int, wchar_t *);
  1064. int mvin_wch(int, int, cchar_t *);
  1065. int mvin_wchnstr(int, int, cchar_t *, int);
  1066. int mvin_wchstr(int, int, cchar_t *);
  1067. int mvvline_set(int, int, const cchar_t *, int);
  1068. int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
  1069. int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
  1070. int mvwadd_wch(WINDOW *, int, int, const cchar_t *);
  1071. int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int);
  1072. int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);
  1073. int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);
  1074. int mvwget_wch(WINDOW *, int, int, wint_t *);
  1075. int mvwget_wstr(WINDOW *, int, int, wint_t *);
  1076. int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);
  1077. int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
  1078. int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
  1079. int mvwins_wch(WINDOW *, int, int, const cchar_t *);
  1080. int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
  1081. int mvwin_wch(WINDOW *, int, int, cchar_t *);
  1082. int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int);
  1083. int mvwin_wchstr(WINDOW *, int, int, cchar_t *);
  1084. int mvwinwstr(WINDOW *, int, int, wchar_t *);
  1085. int mvwvline_set(WINDOW *, int, int, const cchar_t *, int);
  1086. int pecho_wchar(WINDOW *, const cchar_t*);
  1087. int setcchar(cchar_t*, const wchar_t*, const attr_t, short, const void*);
  1088. int slk_wset(int, const wchar_t *, int);
  1089. int unget_wch(const wchar_t);
  1090. int vline_set(const cchar_t *, int);
  1091. int waddnwstr(WINDOW *, const wchar_t *, int);
  1092. int waddwstr(WINDOW *, const wchar_t *);
  1093. int wadd_wch(WINDOW *, const cchar_t *);
  1094. int wadd_wchnstr(WINDOW *, const cchar_t *, int);
  1095. int wadd_wchstr(WINDOW *, const cchar_t *);
  1096. int wbkgrnd(WINDOW *, const cchar_t *);
  1097. void wbkgrndset(WINDOW *, const cchar_t *);
  1098. int wborder_set(WINDOW *, const cchar_t *, const cchar_t *,
  1099. const cchar_t *, const cchar_t *, const cchar_t *,
  1100. const cchar_t *, const cchar_t *, const cchar_t *);
  1101. int wecho_wchar(WINDOW *, const cchar_t *);
  1102. int wgetbkgrnd(WINDOW *, cchar_t *);
  1103. int wgetn_wstr(WINDOW *, wint_t *, int);
  1104. int wget_wch(WINDOW *, wint_t *);
  1105. int wget_wstr(WINDOW *, wint_t *);
  1106. int whline_set(WINDOW *, const cchar_t *, int);
  1107. int winnwstr(WINDOW *, wchar_t *, int);
  1108. int wins_nwstr(WINDOW *, const wchar_t *, int);
  1109. int wins_wch(WINDOW *, const cchar_t *);
  1110. int wins_wstr(WINDOW *, const wchar_t *);
  1111. int winwstr(WINDOW *, wchar_t *);
  1112. int win_wch(WINDOW *, cchar_t *);
  1113. int win_wchnstr(WINDOW *, cchar_t *, int);
  1114. int win_wchstr(WINDOW *, cchar_t *);
  1115. wchar_t *wunctrl(cchar_t *);
  1116. int wvline_set(WINDOW *, const cchar_t *, int);
  1117. #endif
  1118. /* Quasi-standard */
  1119. chtype getattrs(WINDOW *);
  1120. int getbegx(WINDOW *);
  1121. int getbegy(WINDOW *);
  1122. int getmaxx(WINDOW *);
  1123. int getmaxy(WINDOW *);
  1124. int getparx(WINDOW *);
  1125. int getpary(WINDOW *);
  1126. int getcurx(WINDOW *);
  1127. int getcury(WINDOW *);
  1128. void traceoff(void);
  1129. void traceon(void);
  1130. char *unctrl(chtype);
  1131. int crmode(void);
  1132. int nocrmode(void);
  1133. int draino(int);
  1134. int resetterm(void);
  1135. int fixterm(void);
  1136. int saveterm(void);
  1137. int setsyx(int, int);
  1138. int mouse_set(unsigned long);
  1139. int mouse_on(unsigned long);
  1140. int mouse_off(unsigned long);
  1141. int request_mouse_pos(void);
  1142. int map_button(unsigned long);
  1143. void wmouse_position(WINDOW *, int *, int *);
  1144. unsigned long getmouse(void);
  1145. unsigned long getbmap(void);
  1146. /* ncurses */
  1147. int assume_default_colors(int, int);
  1148. const char *curses_version(void);
  1149. bool has_key(int);
  1150. int use_default_colors(void);
  1151. int wresize(WINDOW *, int, int);
  1152. int mouseinterval(int);
  1153. mmask_t mousemask(mmask_t, mmask_t *);
  1154. bool mouse_trafo(int *, int *, bool);
  1155. int nc_getmouse(MEVENT *);
  1156. int ungetmouse(MEVENT *);
  1157. bool wenclose(const WINDOW *, int, int);
  1158. bool wmouse_trafo(const WINDOW *, int *, int *, bool);
  1159. /* PDCurses */
  1160. int addrawch(chtype);
  1161. int insrawch(chtype);
  1162. bool is_termresized(void);
  1163. int mvaddrawch(int, int, chtype);
  1164. int mvdeleteln(int, int);
  1165. int mvinsertln(int, int);
  1166. int mvinsrawch(int, int, chtype);
  1167. int mvwaddrawch(WINDOW *, int, int, chtype);
  1168. int mvwdeleteln(WINDOW *, int, int);
  1169. int mvwinsertln(WINDOW *, int, int);
  1170. int mvwinsrawch(WINDOW *, int, int, chtype);
  1171. int raw_output(bool);
  1172. int resize_term(int, int);
  1173. WINDOW *resize_window(WINDOW *, int, int);
  1174. int waddrawch(WINDOW *, chtype);
  1175. int winsrawch(WINDOW *, chtype);
  1176. char wordchar(void);
  1177. #ifdef PDC_WIDE
  1178. wchar_t *slk_wlabel(int);
  1179. #endif
  1180. void PDC_debug(const char *, ...);
  1181. int PDC_ungetch(int);
  1182. int PDC_set_blink(bool);
  1183. int PDC_set_line_color(short);
  1184. void PDC_set_title(const char *);
  1185. int PDC_clearclipboard(void);
  1186. int PDC_freeclipboard(char *);
  1187. int PDC_getclipboard(char **, long *);
  1188. int PDC_setclipboard(const char *, long);
  1189. unsigned long PDC_get_input_fd(void);
  1190. unsigned long PDC_get_key_modifiers(void);
  1191. int PDC_return_key_modifiers(bool);
  1192. int PDC_save_key_modifiers(bool);
  1193. #ifdef XCURSES
  1194. WINDOW *Xinitscr(int, char **);
  1195. void XCursesExit(void);
  1196. int sb_init(void);
  1197. int sb_set_horz(int, int, int);
  1198. int sb_set_vert(int, int, int);
  1199. int sb_get_horz(int *, int *, int *);
  1200. int sb_get_vert(int *, int *, int *);
  1201. int sb_refresh(void);
  1202. #endif
  1203. /*** Functions defined as macros ***/
  1204. /* getch() and ungetch() conflict with some DOS libraries */
  1205. #define getch() wgetch(stdscr)
  1206. #define ungetch(ch) PDC_ungetch(ch)
  1207. #define COLOR_PAIR(n) (((chtype)(n) << PDC_COLOR_SHIFT) & A_COLOR)
  1208. #define PAIR_NUMBER(n) (((n) & A_COLOR) >> PDC_COLOR_SHIFT)
  1209. /* These will _only_ work as macros */
  1210. #define getbegyx(w, y, x) (y = getbegy(w), x = getbegx(w))
  1211. #define getmaxyx(w, y, x) (y = getmaxy(w), x = getmaxx(w))
  1212. #define getparyx(w, y, x) (y = getpary(w), x = getparx(w))
  1213. #define getyx(w, y, x) (y = getcury(w), x = getcurx(w))
  1214. #define getsyx(y, x) { if (curscr->_leaveit) (y)=(x)=-1; \
  1215. else getyx(curscr,(y),(x)); }
  1216. #ifdef NCURSES_MOUSE_VERSION
  1217. # define getmouse(x) nc_getmouse(x)
  1218. #endif
  1219. /* return codes from PDC_getclipboard() and PDC_setclipboard() calls */
  1220. #define PDC_CLIP_SUCCESS 0
  1221. #define PDC_CLIP_ACCESS_ERROR 1
  1222. #define PDC_CLIP_EMPTY 2
  1223. #define PDC_CLIP_MEMORY_ERROR 3
  1224. /* PDCurses key modifier masks */
  1225. #define PDC_KEY_MODIFIER_SHIFT 1
  1226. #define PDC_KEY_MODIFIER_CONTROL 2
  1227. #define PDC_KEY_MODIFIER_ALT 4
  1228. #define PDC_KEY_MODIFIER_NUMLOCK 8
  1229. #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
  1230. # undef bool
  1231. }
  1232. #endif
  1233. #endif /* __PDCURSES__ */