ncurses.h 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755
  1. /****************************************************************************
  2. * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
  3. * *
  4. * Permission is hereby granted, free of charge, to any person obtaining a *
  5. * copy of this software and associated documentation files (the *
  6. * "Software"), to deal in the Software without restriction, including *
  7. * without limitation the rights to use, copy, modify, merge, publish, *
  8. * distribute, distribute with modifications, sublicense, and/or sell *
  9. * copies of the Software, and to permit persons to whom the Software is *
  10. * furnished to do so, subject to the following conditions: *
  11. * *
  12. * The above copyright notice and this permission notice shall be included *
  13. * in all copies or substantial portions of the Software. *
  14. * *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  16. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  18. * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  19. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  20. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  21. * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  22. * *
  23. * Except as contained in this notice, the name(s) of the above copyright *
  24. * holders shall not be used in advertising or otherwise to promote the *
  25. * sale, use or other dealings in this Software without prior written *
  26. * authorization. *
  27. ****************************************************************************/
  28. /****************************************************************************
  29. * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
  30. * and: Eric S. Raymond <esr@snark.thyrsus.com> *
  31. * and: Thomas E. Dickey 1996-on *
  32. ****************************************************************************/
  33. /* $Id: curses.h.in,v 1.190 2008/12/20 22:28:52 tom Exp $ */
  34. #ifndef __NCURSES_H
  35. #define __NCURSES_H
  36. #define CURSES 1
  37. #define CURSES_H 1
  38. /* These are defined only in curses.h, and are used for conditional compiles */
  39. #define NCURSES_VERSION_MAJOR 5
  40. #define NCURSES_VERSION_MINOR 7
  41. #define NCURSES_VERSION_PATCH 20090207
  42. /* This is defined in more than one ncurses header, for identification */
  43. #undef NCURSES_VERSION
  44. #define NCURSES_VERSION "5.7"
  45. /*
  46. * Identify the mouse encoding version.
  47. */
  48. #define NCURSES_MOUSE_VERSION 1
  49. /*
  50. * Definitions to facilitate DLL's.
  51. */
  52. #include <ncurses_dll.h>
  53. /*
  54. * User-definable tweak to disable the include of <stdbool.h>.
  55. */
  56. #ifndef NCURSES_ENABLE_STDBOOL_H
  57. #define NCURSES_ENABLE_STDBOOL_H 1
  58. #endif
  59. /*
  60. * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
  61. * configured using --disable-macros.
  62. */
  63. #ifdef NCURSES_NOMACROS
  64. #ifndef NCURSES_ATTR_T
  65. #define NCURSES_ATTR_T attr_t
  66. #endif
  67. #endif /* NCURSES_NOMACROS */
  68. #ifndef NCURSES_ATTR_T
  69. #define NCURSES_ATTR_T int
  70. #endif
  71. /*
  72. * Expands to 'const' if ncurses is configured using --enable-const. Note that
  73. * doing so makes it incompatible with other implementations of X/Open Curses.
  74. */
  75. #undef NCURSES_CONST
  76. #define NCURSES_CONST /*nothing*/
  77. #undef NCURSES_INLINE
  78. #define NCURSES_INLINE inline
  79. /*
  80. * The internal type used for color values
  81. */
  82. #undef NCURSES_COLOR_T
  83. #define NCURSES_COLOR_T short
  84. /*
  85. * Definition used to make WINDOW and similar structs opaque.
  86. */
  87. #ifndef NCURSES_OPAQUE
  88. #define NCURSES_OPAQUE 0
  89. #endif
  90. /*
  91. * The internal type used for window dimensions.
  92. */
  93. #undef NCURSES_SIZE_T
  94. #define NCURSES_SIZE_T short
  95. /*
  96. * Control whether tparm() supports varargs or fixed-parameter list.
  97. */
  98. #undef NCURSES_TPARM_VARARGS
  99. #define NCURSES_TPARM_VARARGS 1
  100. /*
  101. * NCURSES_CH_T is used in building the library, but not used otherwise in
  102. * this header file, since that would make the normal/wide-character versions
  103. * of the header incompatible.
  104. */
  105. #undef NCURSES_CH_T
  106. #define NCURSES_CH_T cchar_t
  107. #if 0 && defined(_LP64)
  108. typedef unsigned chtype;
  109. typedef unsigned mmask_t;
  110. #else
  111. typedef unsigned long chtype;
  112. typedef unsigned long mmask_t;
  113. #endif
  114. #include <stdio.h>
  115. #include <unctrl.h>
  116. #include <stdarg.h> /* we need va_list */
  117. #ifdef _XOPEN_SOURCE_EXTENDED
  118. #include <stddef.h> /* we want wchar_t */
  119. #endif /* _XOPEN_SOURCE_EXTENDED */
  120. /* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also
  121. * implement it. If so, we must use the C++ compiler's type to avoid conflict
  122. * with other interfaces.
  123. *
  124. * A further complication is that <stdbool.h> may declare 'bool' to be a
  125. * different type, such as an enum which is not necessarily compatible with
  126. * C++. If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.
  127. * Otherwise, let it remain a typedef to avoid conflicts with other #define's.
  128. * In either case, make a typedef for NCURSES_BOOL which can be used if needed
  129. * from either C or C++.
  130. */
  131. #undef TRUE
  132. #define TRUE 1
  133. #undef FALSE
  134. #define FALSE 0
  135. typedef unsigned char NCURSES_BOOL;
  136. #if defined(__cplusplus) /* __cplusplus, etc. */
  137. /* use the C++ compiler's bool type */
  138. #define NCURSES_BOOL bool
  139. #else /* c89, c99, etc. */
  140. #if NCURSES_ENABLE_STDBOOL_H
  141. #include <stdbool.h>
  142. /* use whatever the C compiler decides bool really is */
  143. #define NCURSES_BOOL bool
  144. #else
  145. /* there is no predefined bool - use our own */
  146. #undef bool
  147. #define bool NCURSES_BOOL
  148. #endif
  149. #endif /* !__cplusplus, etc. */
  150. #ifdef __cplusplus
  151. extern "C" {
  152. #define NCURSES_CAST(type,value) static_cast<type>(value)
  153. #else
  154. #define NCURSES_CAST(type,value) (type)(value)
  155. #endif
  156. /*
  157. * X/Open attributes. In the ncurses implementation, they are identical to the
  158. * A_ attributes.
  159. */
  160. #define WA_ATTRIBUTES A_ATTRIBUTES
  161. #define WA_NORMAL A_NORMAL
  162. #define WA_STANDOUT A_STANDOUT
  163. #define WA_UNDERLINE A_UNDERLINE
  164. #define WA_REVERSE A_REVERSE
  165. #define WA_BLINK A_BLINK
  166. #define WA_DIM A_DIM
  167. #define WA_BOLD A_BOLD
  168. #define WA_ALTCHARSET A_ALTCHARSET
  169. #define WA_INVIS A_INVIS
  170. #define WA_PROTECT A_PROTECT
  171. #define WA_HORIZONTAL A_HORIZONTAL
  172. #define WA_LEFT A_LEFT
  173. #define WA_LOW A_LOW
  174. #define WA_RIGHT A_RIGHT
  175. #define WA_TOP A_TOP
  176. #define WA_VERTICAL A_VERTICAL
  177. /* colors */
  178. #define COLOR_BLACK 0
  179. #define COLOR_RED 1
  180. #define COLOR_GREEN 2
  181. #define COLOR_YELLOW 3
  182. #define COLOR_BLUE 4
  183. #define COLOR_MAGENTA 5
  184. #define COLOR_CYAN 6
  185. #define COLOR_WHITE 7
  186. /* line graphics */
  187. #if 0 || 0
  188. NCURSES_WRAPPED_VAR(chtype*, acs_map);
  189. #define acs_map (_nc_acs_map())
  190. #else
  191. extern NCURSES_EXPORT_VAR(chtype) acs_map[];
  192. #endif
  193. #define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,c)])
  194. /* VT100 symbols begin here */
  195. #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */
  196. #define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */
  197. #define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */
  198. #define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */
  199. #define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */
  200. #define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */
  201. #define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */
  202. #define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */
  203. #define ACS_HLINE NCURSES_ACS('q') /* horizontal line */
  204. #define ACS_VLINE NCURSES_ACS('x') /* vertical line */
  205. #define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */
  206. #define ACS_S1 NCURSES_ACS('o') /* scan line 1 */
  207. #define ACS_S9 NCURSES_ACS('s') /* scan line 9 */
  208. #define ACS_DIAMOND NCURSES_ACS('`') /* diamond */
  209. #define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */
  210. #define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */
  211. #define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */
  212. #define ACS_BULLET NCURSES_ACS('~') /* bullet */
  213. /* Teletype 5410v1 symbols begin here */
  214. #define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */
  215. #define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */
  216. #define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */
  217. #define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */
  218. #define ACS_BOARD NCURSES_ACS('h') /* board of squares */
  219. #define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */
  220. #define ACS_BLOCK NCURSES_ACS('0') /* solid square block */
  221. /*
  222. * These aren't documented, but a lot of System Vs have them anyway
  223. * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
  224. * The ACS_names may not match AT&T's, our source didn't know them.
  225. */
  226. #define ACS_S3 NCURSES_ACS('p') /* scan line 3 */
  227. #define ACS_S7 NCURSES_ACS('r') /* scan line 7 */
  228. #define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */
  229. #define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */
  230. #define ACS_PI NCURSES_ACS('{') /* Pi */
  231. #define ACS_NEQUAL NCURSES_ACS('|') /* not equal */
  232. #define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */
  233. /*
  234. * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
  235. * is the right, b is the bottom, and l is the left. t, r, b, and l might
  236. * be B (blank), S (single), D (double), or T (thick). The subset defined
  237. * here only uses B and S.
  238. */
  239. #define ACS_BSSB ACS_ULCORNER
  240. #define ACS_SSBB ACS_LLCORNER
  241. #define ACS_BBSS ACS_URCORNER
  242. #define ACS_SBBS ACS_LRCORNER
  243. #define ACS_SBSS ACS_RTEE
  244. #define ACS_SSSB ACS_LTEE
  245. #define ACS_SSBS ACS_BTEE
  246. #define ACS_BSSS ACS_TTEE
  247. #define ACS_BSBS ACS_HLINE
  248. #define ACS_SBSB ACS_VLINE
  249. #define ACS_SSSS ACS_PLUS
  250. #undef ERR
  251. #define ERR (-1)
  252. #undef OK
  253. #define OK (0)
  254. /* values for the _flags member */
  255. #define _SUBWIN 0x01 /* is this a sub-window? */
  256. #define _ENDLINE 0x02 /* is the window flush right? */
  257. #define _FULLWIN 0x04 /* is the window full-screen? */
  258. #define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */
  259. #define _ISPAD 0x10 /* is this window a pad? */
  260. #define _HASMOVED 0x20 /* has cursor moved since last refresh? */
  261. #define _WRAPPED 0x40 /* cursor was just wrappped */
  262. /*
  263. * this value is used in the firstchar and lastchar fields to mark
  264. * unchanged lines
  265. */
  266. #define _NOCHANGE -1
  267. /*
  268. * this value is used in the oldindex field to mark lines created by insertions
  269. * and scrolls.
  270. */
  271. #define _NEWINDEX -1
  272. typedef struct screen SCREEN;
  273. typedef struct _win_st WINDOW;
  274. typedef chtype attr_t; /* ...must be at least as wide as chtype */
  275. #ifdef _XOPEN_SOURCE_EXTENDED
  276. #if 0
  277. #ifdef mblen /* libutf8.h defines it w/o undefining first */
  278. #undef mblen
  279. #endif
  280. #include <libutf8.h>
  281. #endif
  282. #if 1
  283. #include <wchar.h> /* ...to get mbstate_t, etc. */
  284. #endif
  285. #if 0
  286. typedef unsigned short wchar_t1;
  287. #endif
  288. #if 0
  289. typedef unsigned int wint_t1;
  290. #endif
  291. #define CCHARW_MAX 5
  292. typedef struct
  293. {
  294. attr_t attr;
  295. wchar_t chars[CCHARW_MAX];
  296. #if 0
  297. #undef NCURSES_EXT_COLORS
  298. #define NCURSES_EXT_COLORS 20090207
  299. int ext_color; /* color pair, must be more than 16-bits */
  300. #endif
  301. }
  302. cchar_t;
  303. #endif /* _XOPEN_SOURCE_EXTENDED */
  304. #if !NCURSES_OPAQUE
  305. struct ldat;
  306. struct _win_st
  307. {
  308. NCURSES_SIZE_T _cury, _curx; /* current cursor position */
  309. /* window location and size */
  310. NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
  311. NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
  312. short _flags; /* window state flags */
  313. /* attribute tracking */
  314. attr_t _attrs; /* current attribute for non-space character */
  315. chtype _bkgd; /* current background char/attribute pair */
  316. /* option values set by user */
  317. bool _notimeout; /* no time out on function-key entry? */
  318. bool _clear; /* consider all data in the window invalid? */
  319. bool _leaveok; /* OK to not reset cursor on exit? */
  320. bool _scroll; /* OK to scroll this window? */
  321. bool _idlok; /* OK to use insert/delete line? */
  322. bool _idcok; /* OK to use insert/delete char? */
  323. bool _immed; /* window in immed mode? (not yet used) */
  324. bool _sync; /* window in sync mode? */
  325. bool _use_keypad; /* process function keys into KEY_ symbols? */
  326. int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */
  327. struct ldat *_line; /* the actual line data */
  328. /* global screen state */
  329. NCURSES_SIZE_T _regtop; /* top line of scrolling region */
  330. NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
  331. /* these are used only if this is a sub-window */
  332. int _parx; /* x coordinate of this window in parent */
  333. int _pary; /* y coordinate of this window in parent */
  334. WINDOW *_parent; /* pointer to parent if a sub-window */
  335. /* these are used only if this is a pad */
  336. struct pdat
  337. {
  338. NCURSES_SIZE_T _pad_y, _pad_x;
  339. NCURSES_SIZE_T _pad_top, _pad_left;
  340. NCURSES_SIZE_T _pad_bottom, _pad_right;
  341. } _pad;
  342. NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
  343. #ifdef _XOPEN_SOURCE_EXTENDED
  344. cchar_t _bkgrnd; /* current background char/attribute pair */
  345. #if 0
  346. int _color; /* current color-pair for non-space character */
  347. #endif
  348. #endif
  349. };
  350. #endif /* NCURSES_OPAQUE */
  351. /*
  352. * This is an extension to support events...
  353. */
  354. #if 1
  355. #ifdef NCURSES_WGETCH_EVENTS
  356. #if !defined(__BEOS__) || defined(__HAIKU__)
  357. /* Fix _nc_timed_wait() on BEOS... */
  358. # define NCURSES_EVENT_VERSION 1
  359. #endif /* !defined(__BEOS__) */
  360. /*
  361. * Bits to set in _nc_event.data.flags
  362. */
  363. # define _NC_EVENT_TIMEOUT_MSEC 1
  364. # define _NC_EVENT_FILE 2
  365. # define _NC_EVENT_FILE_READABLE 2
  366. # if 0 /* Not supported yet... */
  367. # define _NC_EVENT_FILE_WRITABLE 4
  368. # define _NC_EVENT_FILE_EXCEPTION 8
  369. # endif
  370. typedef struct
  371. {
  372. int type;
  373. union
  374. {
  375. long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */
  376. struct
  377. {
  378. unsigned int flags;
  379. int fd;
  380. unsigned int result;
  381. } fev; /* _NC_EVENT_FILE */
  382. } data;
  383. } _nc_event;
  384. typedef struct
  385. {
  386. int count;
  387. int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */
  388. _nc_event *events[1];
  389. } _nc_eventlist;
  390. extern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *); /* experimental */
  391. extern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */
  392. #endif /* NCURSES_WGETCH_EVENTS */
  393. #endif /* NCURSES_EXT_FUNCS */
  394. /*
  395. * GCC (and some other compilers) define '__attribute__'; we're using this
  396. * macro to alert the compiler to flag inconsistencies in printf/scanf-like
  397. * function calls. Just in case '__attribute__' isn't defined, make a dummy.
  398. * Old versions of G++ do not accept it anyway, at least not consistently with
  399. * GCC.
  400. */
  401. #if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))
  402. #define __attribute__(p) /* nothing */
  403. #endif
  404. /*
  405. * We cannot define these in ncurses_cfg.h, since they require parameters to be
  406. * passed (that is non-portable). If you happen to be using gcc with warnings
  407. * enabled, define
  408. * GCC_PRINTF
  409. * GCC_SCANF
  410. * to improve checking of calls to printw(), etc.
  411. */
  412. #ifndef GCC_PRINTFLIKE
  413. #if defined(GCC_PRINTF) && !defined(printf)
  414. #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
  415. #else
  416. #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
  417. #endif
  418. #endif
  419. #ifndef GCC_SCANFLIKE
  420. #if defined(GCC_SCANF) && !defined(scanf)
  421. #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
  422. #else
  423. #define GCC_SCANFLIKE(fmt,var) /*nothing*/
  424. #endif
  425. #endif
  426. #ifndef GCC_NORETURN
  427. #define GCC_NORETURN /* nothing */
  428. #endif
  429. #ifndef GCC_UNUSED
  430. #define GCC_UNUSED /* nothing */
  431. #endif
  432. /*
  433. * Function prototypes. This is the complete X/Open Curses list of required
  434. * functions. Those marked `generated' will have sources generated from the
  435. * macro definitions later in this file, in order to satisfy XPG4.2
  436. * requirements.
  437. */
  438. extern NCURSES_EXPORT(int) addch (const chtype); /* generated */
  439. extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */
  440. extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */
  441. extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */
  442. extern NCURSES_EXPORT(int) addstr (const char *); /* generated */
  443. extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */
  444. extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */
  445. extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */
  446. extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */
  447. extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */
  448. extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */
  449. extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */
  450. extern NCURSES_EXPORT(int) baudrate (void); /* implemented */
  451. extern NCURSES_EXPORT(int) beep (void); /* implemented */
  452. extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */
  453. extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */
  454. extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */
  455. extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */
  456. extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */
  457. extern NCURSES_EXPORT(int) cbreak (void); /* implemented */
  458. extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */
  459. extern NCURSES_EXPORT(int) clear (void); /* generated */
  460. extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */
  461. extern NCURSES_EXPORT(int) clrtobot (void); /* generated */
  462. extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */
  463. extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */
  464. extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */
  465. extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */
  466. extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */
  467. extern NCURSES_EXPORT(int) curs_set (int); /* implemented */
  468. extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */
  469. extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */
  470. extern NCURSES_EXPORT(int) delay_output (int); /* implemented */
  471. extern NCURSES_EXPORT(int) delch (void); /* generated */
  472. extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */
  473. extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */
  474. extern NCURSES_EXPORT(int) deleteln (void); /* generated */
  475. extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */
  476. extern NCURSES_EXPORT(int) doupdate (void); /* implemented */
  477. extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */
  478. extern NCURSES_EXPORT(int) echo (void); /* implemented */
  479. extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */
  480. extern NCURSES_EXPORT(int) erase (void); /* generated */
  481. extern NCURSES_EXPORT(int) endwin (void); /* implemented */
  482. extern NCURSES_EXPORT(char) erasechar (void); /* implemented */
  483. extern NCURSES_EXPORT(void) filter (void); /* implemented */
  484. extern NCURSES_EXPORT(int) flash (void); /* implemented */
  485. extern NCURSES_EXPORT(int) flushinp (void); /* implemented */
  486. extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */
  487. extern NCURSES_EXPORT(int) getch (void); /* generated */
  488. extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */
  489. extern NCURSES_EXPORT(int) getstr (char *); /* generated */
  490. extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */
  491. extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */
  492. extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */
  493. extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */
  494. extern NCURSES_EXPORT(bool) has_il (void); /* implemented */
  495. extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */
  496. extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */
  497. extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */
  498. extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */
  499. extern NCURSES_EXPORT(chtype) inch (void); /* generated */
  500. extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */
  501. extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */
  502. extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */
  503. extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */
  504. extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */
  505. extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */
  506. extern NCURSES_EXPORT(int) insch (chtype); /* generated */
  507. extern NCURSES_EXPORT(int) insdelln (int); /* generated */
  508. extern NCURSES_EXPORT(int) insertln (void); /* generated */
  509. extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */
  510. extern NCURSES_EXPORT(int) insstr (const char *); /* generated */
  511. extern NCURSES_EXPORT(int) instr (char *); /* generated */
  512. extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */
  513. extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */
  514. extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */
  515. extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */
  516. extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */
  517. extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */
  518. extern NCURSES_EXPORT(char) killchar (void); /* implemented */
  519. extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */
  520. extern NCURSES_EXPORT(char *) longname (void); /* implemented */
  521. extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */
  522. extern NCURSES_EXPORT(int) move (int, int); /* generated */
  523. extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */
  524. extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */
  525. extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */
  526. extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */
  527. extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */
  528. extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */
  529. extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */
  530. extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */
  531. extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */
  532. extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */
  533. extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */
  534. extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */
  535. extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */
  536. extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */
  537. extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */
  538. extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */
  539. extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */
  540. extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */
  541. extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */
  542. extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */
  543. extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */
  544. extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */
  545. GCC_PRINTFLIKE(3,4);
  546. extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */
  547. GCC_SCANFLIKE(3,4);
  548. extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */
  549. extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */
  550. extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */
  551. extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */
  552. extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */
  553. extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */
  554. extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
  555. extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */
  556. extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */
  557. extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */
  558. extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */
  559. extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */
  560. extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */
  561. extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */
  562. extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */
  563. extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */
  564. extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */
  565. extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */
  566. extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */
  567. extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */
  568. extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */
  569. extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */
  570. GCC_PRINTFLIKE(4,5);
  571. extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */
  572. GCC_SCANFLIKE(4,5);
  573. extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */
  574. extern NCURSES_EXPORT(int) napms (int); /* implemented */
  575. extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */
  576. extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */
  577. extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */
  578. extern NCURSES_EXPORT(int) nl (void); /* implemented */
  579. extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */
  580. extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */
  581. extern NCURSES_EXPORT(int) noecho (void); /* implemented */
  582. extern NCURSES_EXPORT(int) nonl (void); /* implemented */
  583. extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */
  584. extern NCURSES_EXPORT(int) noraw (void); /* implemented */
  585. extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */
  586. extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */
  587. extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */
  588. extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */
  589. extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */
  590. extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */
  591. extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
  592. extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */
  593. extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */
  594. GCC_PRINTFLIKE(1,2);
  595. extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */
  596. extern NCURSES_EXPORT(void) qiflush (void); /* implemented */
  597. extern NCURSES_EXPORT(int) raw (void); /* implemented */
  598. extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */
  599. extern NCURSES_EXPORT(int) refresh (void); /* generated */
  600. extern NCURSES_EXPORT(int) resetty (void); /* implemented */
  601. extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */
  602. extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */
  603. extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */
  604. extern NCURSES_EXPORT(int) savetty (void); /* implemented */
  605. extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */
  606. GCC_SCANFLIKE(1,2);
  607. extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */
  608. extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */
  609. extern NCURSES_EXPORT(int) scrl (int); /* generated */
  610. extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */
  611. extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */
  612. extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */
  613. extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */
  614. extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */
  615. extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */
  616. extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */
  617. extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */
  618. extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */
  619. extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */
  620. extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */
  621. extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */
  622. extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */
  623. extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */
  624. extern NCURSES_EXPORT(int) slk_color (short); /* implemented */
  625. extern NCURSES_EXPORT(int) slk_init (int); /* implemented */
  626. extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */
  627. extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */
  628. extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */
  629. extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */
  630. extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */
  631. extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */
  632. extern NCURSES_EXPORT(int) standout (void); /* generated */
  633. extern NCURSES_EXPORT(int) standend (void); /* generated */
  634. extern NCURSES_EXPORT(int) start_color (void); /* implemented */
  635. extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */
  636. extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */
  637. extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */
  638. extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */
  639. extern NCURSES_EXPORT(char *) termname (void); /* implemented */
  640. extern NCURSES_EXPORT(void) timeout (int); /* generated */
  641. extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */
  642. extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */
  643. extern NCURSES_EXPORT(int) typeahead (int); /* implemented */
  644. extern NCURSES_EXPORT(int) ungetch (int); /* implemented */
  645. extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */
  646. extern NCURSES_EXPORT(void) use_env (bool); /* implemented */
  647. extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */
  648. extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int)); /* implemented */
  649. extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */
  650. extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list); /* implemented */
  651. extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list); /* generated */
  652. extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */
  653. extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */
  654. extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */
  655. extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */
  656. extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */
  657. extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */
  658. extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */
  659. extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */
  660. extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */
  661. extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */
  662. extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */
  663. extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */
  664. extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */
  665. extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */
  666. extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */
  667. extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */
  668. extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */
  669. extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */
  670. extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */
  671. extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */
  672. extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */
  673. extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */
  674. extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */
  675. extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */
  676. extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */
  677. extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */
  678. extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */
  679. extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */
  680. extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */
  681. extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */
  682. extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */
  683. extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */
  684. extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */
  685. extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */
  686. extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */
  687. extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */
  688. extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */
  689. extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */
  690. extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */
  691. extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */
  692. extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */
  693. extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */
  694. extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */
  695. extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */
  696. GCC_PRINTFLIKE(2,3);
  697. extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */
  698. extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */
  699. extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */
  700. GCC_SCANFLIKE(2,3);
  701. extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */
  702. extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */
  703. extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */
  704. extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */
  705. extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */
  706. extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */
  707. extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */
  708. extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */
  709. extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */
  710. /*
  711. * These are also declared in <term.h>:
  712. */
  713. extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */
  714. extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */
  715. extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */
  716. extern NCURSES_EXPORT(int) putp (const char *); /* implemented */
  717. #if NCURSES_TPARM_VARARGS
  718. extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */
  719. #else
  720. extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */
  721. extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */
  722. #endif
  723. /*
  724. * These functions are not in X/Open, but we use them in macro definitions:
  725. */
  726. extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */
  727. extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */
  728. extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */
  729. extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */
  730. extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */
  731. extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */
  732. extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */
  733. extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */
  734. extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */
  735. /*
  736. * vid_attr() was implemented originally based on a draft of X/Open curses.
  737. */
  738. #ifndef _XOPEN_SOURCE_EXTENDED
  739. #define vid_attr(a,pair,opts) vidattr(a)
  740. #endif
  741. /*
  742. * These functions are extensions - not in X/Open Curses.
  743. */
  744. #if 1
  745. #undef NCURSES_EXT_FUNCS
  746. #define NCURSES_EXT_FUNCS 20090207
  747. typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
  748. typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
  749. extern NCURSES_EXPORT(bool) is_term_resized (int, int);
  750. extern NCURSES_EXPORT(char *) keybound (int, int);
  751. extern NCURSES_EXPORT(const char *) curses_version (void);
  752. extern NCURSES_EXPORT(int) assume_default_colors (int, int);
  753. extern NCURSES_EXPORT(int) define_key (const char *, int);
  754. extern NCURSES_EXPORT(int) key_defined (const char *);
  755. extern NCURSES_EXPORT(int) keyok (int, bool);
  756. extern NCURSES_EXPORT(int) resize_term (int, int);
  757. extern NCURSES_EXPORT(int) resizeterm (int, int);
  758. extern NCURSES_EXPORT(int) set_escdelay (int);
  759. extern NCURSES_EXPORT(int) set_tabsize (int);
  760. extern NCURSES_EXPORT(int) use_default_colors (void);
  761. extern NCURSES_EXPORT(int) use_extended_names (bool);
  762. extern NCURSES_EXPORT(int) use_legacy_coding (int);
  763. extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
  764. extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
  765. extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
  766. extern NCURSES_EXPORT(void) nofilter(void);
  767. /*
  768. * These extensions provide access to information stored in the WINDOW even
  769. * when NCURSES_OPAQUE is set:
  770. */
  771. extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */
  772. extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */
  773. extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */
  774. extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */
  775. extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */
  776. extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */
  777. extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */
  778. extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */
  779. extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */
  780. extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */
  781. extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */
  782. extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */
  783. #else
  784. #define curses_version() NCURSES_VERSION
  785. #endif
  786. /* attributes */
  787. #define NCURSES_ATTR_SHIFT 8
  788. #define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))
  789. #define A_NORMAL (1UL - 1UL)
  790. #define A_ATTRIBUTES NCURSES_BITS(~(1UL - 1UL),0)
  791. #define A_CHARTEXT (NCURSES_BITS(1UL,0) - 1UL)
  792. #define A_COLOR NCURSES_BITS(((1UL) << 8) - 1UL,0)
  793. #define A_STANDOUT NCURSES_BITS(1UL,8)
  794. #define A_UNDERLINE NCURSES_BITS(1UL,9)
  795. #define A_REVERSE NCURSES_BITS(1UL,10)
  796. #define A_BLINK NCURSES_BITS(1UL,11)
  797. #define A_DIM NCURSES_BITS(1UL,12)
  798. #define A_BOLD NCURSES_BITS(1UL,13)
  799. #define A_ALTCHARSET NCURSES_BITS(1UL,14)
  800. #define A_INVIS NCURSES_BITS(1UL,15)
  801. #define A_PROTECT NCURSES_BITS(1UL,16)
  802. #define A_HORIZONTAL NCURSES_BITS(1UL,17)
  803. #define A_LEFT NCURSES_BITS(1UL,18)
  804. #define A_LOW NCURSES_BITS(1UL,19)
  805. #define A_RIGHT NCURSES_BITS(1UL,20)
  806. #define A_TOP NCURSES_BITS(1UL,21)
  807. #define A_VERTICAL NCURSES_BITS(1UL,22)
  808. /*
  809. * Most of the pseudo functions are macros that either provide compatibility
  810. * with older versions of curses, or provide inline functionality to improve
  811. * performance.
  812. */
  813. /*
  814. * These pseudo functions are always implemented as macros:
  815. */
  816. #define getyx(win,y,x) (y = getcury(win), x = getcurx(win))
  817. #define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win))
  818. #define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))
  819. #define getparyx(win,y,x) (y = getpary(win), x = getparx(win))
  820. #define getsyx(y,x) do { if (newscr) { \
  821. if (is_leaveok(newscr)) \
  822. (y) = (x) = -1; \
  823. else \
  824. getyx(newscr,(y), (x)); \
  825. } \
  826. } while(0)
  827. #define setsyx(y,x) do { if (newscr) { \
  828. if ((y) == -1 && (x) == -1) \
  829. leaveok(newscr, TRUE); \
  830. else { \
  831. leaveok(newscr, FALSE); \
  832. wmove(newscr, (y), (x)); \
  833. } \
  834. } \
  835. } while(0)
  836. #ifndef NCURSES_NOMACROS
  837. /*
  838. * These miscellaneous pseudo functions are provided for compatibility:
  839. */
  840. #define wgetstr(w, s) wgetnstr(w, s, -1)
  841. #define getnstr(s, n) wgetnstr(stdscr, s, n)
  842. #define setterm(term) setupterm(term, 1, (int *)0)
  843. #define fixterm() reset_prog_mode()
  844. #define resetterm() reset_shell_mode()
  845. #define saveterm() def_prog_mode()
  846. #define crmode() cbreak()
  847. #define nocrmode() nocbreak()
  848. #define gettmode()
  849. /* It seems older SYSV curses versions define these */
  850. #if !NCURSES_OPAQUE
  851. #define getattrs(win) ((win) ? (win)->_attrs : A_NORMAL)
  852. #define getcurx(win) ((win) ? (win)->_curx : ERR)
  853. #define getcury(win) ((win) ? (win)->_cury : ERR)
  854. #define getbegx(win) ((win) ? (win)->_begx : ERR)
  855. #define getbegy(win) ((win) ? (win)->_begy : ERR)
  856. #define getmaxx(win) ((win) ? ((win)->_maxx + 1) : ERR)
  857. #define getmaxy(win) ((win) ? ((win)->_maxy + 1) : ERR)
  858. #define getparx(win) ((win) ? (win)->_parx : ERR)
  859. #define getpary(win) ((win) ? (win)->_pary : ERR)
  860. #endif /* NCURSES_OPAQUE */
  861. #define wstandout(win) (wattrset(win,A_STANDOUT))
  862. #define wstandend(win) (wattrset(win,A_NORMAL))
  863. #define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL)
  864. #define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
  865. #if !NCURSES_OPAQUE
  866. #if defined(_XOPEN_SOURCE_EXTENDED) && 0
  867. #define wattrset(win,at) ((win)->_color = PAIR_NUMBER(at), \
  868. (win)->_attrs = (at))
  869. #else
  870. #define wattrset(win,at) ((win)->_attrs = (at))
  871. #endif
  872. #endif /* NCURSES_OPAQUE */
  873. #define scroll(win) wscrl(win,1)
  874. #define touchwin(win) wtouchln((win), 0, getmaxy(win), 1)
  875. #define touchline(win, s, c) wtouchln((win), s, c, 1)
  876. #define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0)
  877. #define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0)
  878. #define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
  879. #define hline(ch, n) whline(stdscr, ch, n)
  880. #define vline(ch, n) wvline(stdscr, ch, n)
  881. #define winstr(w, s) winnstr(w, s, -1)
  882. #define winchstr(w, s) winchnstr(w, s, -1)
  883. #define winsstr(w, s) winsnstr(w, s, -1)
  884. #if !NCURSES_OPAQUE
  885. #define redrawwin(win) wredrawln(win, 0, (win)->_maxy+1)
  886. #endif /* NCURSES_OPAQUE */
  887. #define waddstr(win,str) waddnstr(win,str,-1)
  888. #define waddchstr(win,str) waddchnstr(win,str,-1)
  889. /*
  890. * These apply to the first 256 color pairs.
  891. */
  892. #define COLOR_PAIR(n) NCURSES_BITS(n, 0)
  893. #define PAIR_NUMBER(a) (NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
  894. /*
  895. * pseudo functions for standard screen
  896. */
  897. #define addch(ch) waddch(stdscr,ch)
  898. #define addchnstr(str,n) waddchnstr(stdscr,str,n)
  899. #define addchstr(str) waddchstr(stdscr,str)
  900. #define addnstr(str,n) waddnstr(stdscr,str,n)
  901. #define addstr(str) waddnstr(stdscr,str,-1)
  902. #define attroff(at) wattroff(stdscr,at)
  903. #define attron(at) wattron(stdscr,at)
  904. #define attrset(at) wattrset(stdscr,at)
  905. #define attr_get(ap,cp,o) wattr_get(stdscr,ap,cp,o)
  906. #define attr_off(a,o) wattr_off(stdscr,a,o)
  907. #define attr_on(a,o) wattr_on(stdscr,a,o)
  908. #define attr_set(a,c,o) wattr_set(stdscr,a,c,o)
  909. #define bkgd(ch) wbkgd(stdscr,ch)
  910. #define bkgdset(ch) wbkgdset(stdscr,ch)
  911. #define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o)
  912. #define clear() wclear(stdscr)
  913. #define clrtobot() wclrtobot(stdscr)
  914. #define clrtoeol() wclrtoeol(stdscr)
  915. #define color_set(c,o) wcolor_set(stdscr,c,o)
  916. #define delch() wdelch(stdscr)
  917. #define deleteln() winsdelln(stdscr,-1)
  918. #define echochar(c) wechochar(stdscr,c)
  919. #define erase() werase(stdscr)
  920. #define getch() wgetch(stdscr)
  921. #define getstr(str) wgetstr(stdscr,str)
  922. #define inch() winch(stdscr)
  923. #define inchnstr(s,n) winchnstr(stdscr,s,n)
  924. #define inchstr(s) winchstr(stdscr,s)
  925. #define innstr(s,n) winnstr(stdscr,s,n)
  926. #define insch(c) winsch(stdscr,c)
  927. #define insdelln(n) winsdelln(stdscr,n)
  928. #define insertln() winsdelln(stdscr,1)
  929. #define insnstr(s,n) winsnstr(stdscr,s,n)
  930. #define insstr(s) winsstr(stdscr,s)
  931. #define instr(s) winstr(stdscr,s)
  932. #define move(y,x) wmove(stdscr,y,x)
  933. #define refresh() wrefresh(stdscr)
  934. #define scrl(n) wscrl(stdscr,n)
  935. #define setscrreg(t,b) wsetscrreg(stdscr,t,b)
  936. #define standend() wstandend(stdscr)
  937. #define standout() wstandout(stdscr)
  938. #define timeout(delay) wtimeout(stdscr,delay)
  939. #define wdeleteln(win) winsdelln(win,-1)
  940. #define winsertln(win) winsdelln(win,1)
  941. /*
  942. * mv functions
  943. */
  944. #define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
  945. #define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
  946. #define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
  947. #define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
  948. #define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
  949. #define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win))
  950. #define mvwchgat(win,y,x,n,a,c,o) (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
  951. #define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win))
  952. #define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
  953. #define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
  954. #define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
  955. #define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
  956. #define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
  957. #define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
  958. #define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
  959. #define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c))
  960. #define mvwinsnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
  961. #define mvwinsstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
  962. #define mvwinstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winstr(win,s))
  963. #define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
  964. #define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
  965. #define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,y,x,str,n)
  966. #define mvaddchstr(y,x,str) mvwaddchstr(stdscr,y,x,str)
  967. #define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n)
  968. #define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
  969. #define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,y,x,n,a,c,o)
  970. #define mvdelch(y,x) mvwdelch(stdscr,y,x)
  971. #define mvgetch(y,x) mvwgetch(stdscr,y,x)
  972. #define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,y,x,str,n)
  973. #define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
  974. #define mvhline(y,x,c,n) mvwhline(stdscr,y,x,c,n)
  975. #define mvinch(y,x) mvwinch(stdscr,y,x)
  976. #define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,y,x,s,n)
  977. #define mvinchstr(y,x,s) mvwinchstr(stdscr,y,x,s)
  978. #define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n)
  979. #define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
  980. #define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n)
  981. #define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s)
  982. #define mvinstr(y,x,s) mvwinstr(stdscr,y,x,s)
  983. #define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n)
  984. /*
  985. * Some wide-character functions can be implemented without the extensions.
  986. */
  987. #if !NCURSES_OPAQUE
  988. #define getbkgd(win) ((win)->_bkgd)
  989. #endif /* NCURSES_OPAQUE */
  990. #define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a))
  991. #define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a))
  992. #if !NCURSES_OPAQUE
  993. #if defined(_XOPEN_SOURCE_EXTENDED) && 0
  994. #define wattr_set(win,a,p,opts) ((win)->_attrs = ((a) & ~A_COLOR), \
  995. (win)->_color = (p), \
  996. OK)
  997. #define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
  998. (void)((p) != (void *)0 && (*(p) = (win)->_color)), \
  999. OK)
  1000. #else
  1001. #define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
  1002. #define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
  1003. (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
  1004. OK)
  1005. #endif
  1006. #endif /* NCURSES_OPAQUE */
  1007. /*
  1008. * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
  1009. * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to
  1010. * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already
  1011. * use stdarg.h, so...
  1012. */
  1013. #define vw_printw vwprintw
  1014. #define vw_scanw vwscanw
  1015. /*
  1016. * Export fallback function for use in C++ binding.
  1017. */
  1018. #if !1
  1019. #define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
  1020. NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
  1021. #endif
  1022. /*
  1023. * These macros are extensions - not in X/Open Curses.
  1024. */
  1025. #if 1
  1026. #if !NCURSES_OPAQUE
  1027. #define is_cleared(win) ((win)->_clear)
  1028. #define is_idcok(win) ((win)->_idcok)
  1029. #define is_idlok(win) ((win)->_idlok)
  1030. #define is_immedok(win) ((win)->_immed)
  1031. #define is_keypad(win) ((win)->_use_keypad)
  1032. #define is_leaveok(win) ((win)->_leaveok)
  1033. #define is_nodelay(win) ((win)->_delay == 0)
  1034. #define is_notimeout(win) ((win)->_notimeout)
  1035. #define is_scrollok(win) ((win)->_scroll)
  1036. #define is_syncok(win) ((win)->_sync)
  1037. #define wgetparent(win) ((win) ? (win)->_parent : 0)
  1038. #define wgetscrreg(win,t,b) ((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
  1039. #endif
  1040. #endif
  1041. #endif /* NCURSES_NOMACROS */
  1042. /*
  1043. * Public variables.
  1044. *
  1045. * Notes:
  1046. * a. ESCDELAY was an undocumented feature under AIX curses.
  1047. * It gives the ESC expire time in milliseconds.
  1048. * b. ttytype is needed for backward compatibility
  1049. */
  1050. #if 0
  1051. NCURSES_WRAPPED_VAR(WINDOW *, curscr);
  1052. NCURSES_WRAPPED_VAR(WINDOW *, newscr);
  1053. NCURSES_WRAPPED_VAR(WINDOW *, stdscr);
  1054. NCURSES_WRAPPED_VAR(char *, ttytype);
  1055. NCURSES_WRAPPED_VAR(int, COLORS);
  1056. NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
  1057. NCURSES_WRAPPED_VAR(int, COLS);
  1058. NCURSES_WRAPPED_VAR(int, ESCDELAY);
  1059. NCURSES_WRAPPED_VAR(int, LINES);
  1060. NCURSES_WRAPPED_VAR(int, TABSIZE);
  1061. #define curscr NCURSES_PUBLIC_VAR(curscr())
  1062. #define newscr NCURSES_PUBLIC_VAR(newscr())
  1063. #define stdscr NCURSES_PUBLIC_VAR(stdscr())
  1064. #define ttytype NCURSES_PUBLIC_VAR(ttytype())
  1065. #define COLORS NCURSES_PUBLIC_VAR(COLORS())
  1066. #define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
  1067. #define COLS NCURSES_PUBLIC_VAR(COLS())
  1068. #define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY())
  1069. #define LINES NCURSES_PUBLIC_VAR(LINES())
  1070. #define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE())
  1071. #else
  1072. extern NCURSES_EXPORT_VAR(WINDOW *) curscr;
  1073. extern NCURSES_EXPORT_VAR(WINDOW *) newscr;
  1074. extern NCURSES_EXPORT_VAR(WINDOW *) stdscr;
  1075. extern NCURSES_EXPORT_VAR(char) ttytype[];
  1076. extern NCURSES_EXPORT_VAR(int) COLORS;
  1077. extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;
  1078. extern NCURSES_EXPORT_VAR(int) COLS;
  1079. extern NCURSES_EXPORT_VAR(int) ESCDELAY;
  1080. extern NCURSES_EXPORT_VAR(int) LINES;
  1081. extern NCURSES_EXPORT_VAR(int) TABSIZE;
  1082. #endif
  1083. /*
  1084. * Pseudo-character tokens outside ASCII range. The curses wgetch() function
  1085. * will return any given one of these only if the corresponding k- capability
  1086. * is defined in your terminal's terminfo entry.
  1087. *
  1088. * Some keys (KEY_A1, etc) are arranged like this:
  1089. * a1 up a3
  1090. * left b2 right
  1091. * c1 down c3
  1092. *
  1093. * A few key codes do not depend upon the terminfo entry.
  1094. */
  1095. #define KEY_CODE_YES 0400 /* A wchar_t contains a key code */
  1096. #define KEY_MIN 0401 /* Minimum curses key */
  1097. #define KEY_BREAK 0401 /* Break key (unreliable) */
  1098. #define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */
  1099. #define KEY_RESET 0531 /* Reset or hard reset (unreliable) */
  1100. /*
  1101. * These definitions were generated by ../../include/MKkey_defs.sh ../../include/Caps
  1102. */
  1103. #define KEY_DOWN 0402 /* down-arrow key */
  1104. #define KEY_UP 0403 /* up-arrow key */
  1105. #define KEY_LEFT 0404 /* left-arrow key */
  1106. #define KEY_RIGHT 0405 /* right-arrow key */
  1107. #define KEY_HOME 0406 /* home key */
  1108. #define KEY_BACKSPACE 0407 /* backspace key */
  1109. #define KEY_F0 0410 /* Function keys. Space for 64 */
  1110. #define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */
  1111. #define KEY_DL 0510 /* delete-line key */
  1112. #define KEY_IL 0511 /* insert-line key */
  1113. #define KEY_DC 0512 /* delete-character key */
  1114. #define KEY_IC 0513 /* insert-character key */
  1115. #define KEY_EIC 0514 /* sent by rmir or smir in insert mode */
  1116. #define KEY_CLEAR 0515 /* clear-screen or erase key */
  1117. #define KEY_EOS 0516 /* clear-to-end-of-screen key */
  1118. #define KEY_EOL 0517 /* clear-to-end-of-line key */
  1119. #define KEY_SF 0520 /* scroll-forward key */
  1120. #define KEY_SR 0521 /* scroll-backward key */
  1121. #define KEY_NPAGE 0522 /* next-page key */
  1122. #define KEY_PPAGE 0523 /* previous-page key */
  1123. #define KEY_STAB 0524 /* set-tab key */
  1124. #define KEY_CTAB 0525 /* clear-tab key */
  1125. #define KEY_CATAB 0526 /* clear-all-tabs key */
  1126. #define KEY_ENTER 0527 /* enter/send key */
  1127. #define KEY_PRINT 0532 /* print key */
  1128. #define KEY_LL 0533 /* lower-left key (home down) */
  1129. #define KEY_A1 0534 /* upper left of keypad */
  1130. #define KEY_A3 0535 /* upper right of keypad */
  1131. #define KEY_B2 0536 /* center of keypad */
  1132. #define KEY_C1 0537 /* lower left of keypad */
  1133. #define KEY_C3 0540 /* lower right of keypad */
  1134. #define KEY_BTAB 0541 /* back-tab key */
  1135. #define KEY_BEG 0542 /* begin key */
  1136. #define KEY_CANCEL 0543 /* cancel key */
  1137. #define KEY_CLOSE 0544 /* close key */
  1138. #define KEY_COMMAND 0545 /* command key */
  1139. #define KEY_COPY 0546 /* copy key */
  1140. #define KEY_CREATE 0547 /* create key */
  1141. #define KEY_END 0550 /* end key */
  1142. #define KEY_EXIT 0551 /* exit key */
  1143. #define KEY_FIND 0552 /* find key */
  1144. #define KEY_HELP 0553 /* help key */
  1145. #define KEY_MARK 0554 /* mark key */
  1146. #define KEY_MESSAGE 0555 /* message key */
  1147. #define KEY_MOVE 0556 /* move key */
  1148. #define KEY_NEXT 0557 /* next key */
  1149. #define KEY_OPEN 0560 /* open key */
  1150. #define KEY_OPTIONS 0561 /* options key */
  1151. #define KEY_PREVIOUS 0562 /* previous key */
  1152. #define KEY_REDO 0563 /* redo key */
  1153. #define KEY_REFERENCE 0564 /* reference key */
  1154. #define KEY_REFRESH 0565 /* refresh key */
  1155. #define KEY_REPLACE 0566 /* replace key */
  1156. #define KEY_RESTART 0567 /* restart key */
  1157. #define KEY_RESUME 0570 /* resume key */
  1158. #define KEY_SAVE 0571 /* save key */
  1159. #define KEY_SBEG 0572 /* shifted begin key */
  1160. #define KEY_SCANCEL 0573 /* shifted cancel key */
  1161. #define KEY_SCOMMAND 0574 /* shifted command key */
  1162. #define KEY_SCOPY 0575 /* shifted copy key */
  1163. #define KEY_SCREATE 0576 /* shifted create key */
  1164. #define KEY_SDC 0577 /* shifted delete-character key */
  1165. #define KEY_SDL 0600 /* shifted delete-line key */
  1166. #define KEY_SELECT 0601 /* select key */
  1167. #define KEY_SEND 0602 /* shifted end key */
  1168. #define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */
  1169. #define KEY_SEXIT 0604 /* shifted exit key */
  1170. #define KEY_SFIND 0605 /* shifted find key */
  1171. #define KEY_SHELP 0606 /* shifted help key */
  1172. #define KEY_SHOME 0607 /* shifted home key */
  1173. #define KEY_SIC 0610 /* shifted insert-character key */
  1174. #define KEY_SLEFT 0611 /* shifted left-arrow key */
  1175. #define KEY_SMESSAGE 0612 /* shifted message key */
  1176. #define KEY_SMOVE 0613 /* shifted move key */
  1177. #define KEY_SNEXT 0614 /* shifted next key */
  1178. #define KEY_SOPTIONS 0615 /* shifted options key */
  1179. #define KEY_SPREVIOUS 0616 /* shifted previous key */
  1180. #define KEY_SPRINT 0617 /* shifted print key */
  1181. #define KEY_SREDO 0620 /* shifted redo key */
  1182. #define KEY_SREPLACE 0621 /* shifted replace key */
  1183. #define KEY_SRIGHT 0622 /* shifted right-arrow key */
  1184. #define KEY_SRSUME 0623 /* shifted resume key */
  1185. #define KEY_SSAVE 0624 /* shifted save key */
  1186. #define KEY_SSUSPEND 0625 /* shifted suspend key */
  1187. #define KEY_SUNDO 0626 /* shifted undo key */
  1188. #define KEY_SUSPEND 0627 /* suspend key */
  1189. #define KEY_UNDO 0630 /* undo key */
  1190. #define KEY_MOUSE 0631 /* Mouse event has occurred */
  1191. #define KEY_RESIZE 0632 /* Terminal resize event */
  1192. #define KEY_EVENT 0633 /* We were interrupted by an event */
  1193. #define KEY_MAX 0777 /* Maximum key value is 0633 */
  1194. /* $Id: curses.wide,v 1.36 2008/11/29 18:44:08 tom Exp $ */
  1195. /*
  1196. * vile:cmode:
  1197. * This file is part of ncurses, designed to be appended after curses.h.in
  1198. * (see that file for the relevant copyright).
  1199. */
  1200. #define _XOPEN_CURSES 1
  1201. #ifdef _XOPEN_SOURCE_EXTENDED
  1202. extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs;
  1203. #define NCURSES_WACS(c) (&_nc_wacs[(unsigned char)c])
  1204. #define WACS_BSSB NCURSES_WACS('l')
  1205. #define WACS_SSBB NCURSES_WACS('m')
  1206. #define WACS_BBSS NCURSES_WACS('k')
  1207. #define WACS_SBBS NCURSES_WACS('j')
  1208. #define WACS_SBSS NCURSES_WACS('u')
  1209. #define WACS_SSSB NCURSES_WACS('t')
  1210. #define WACS_SSBS NCURSES_WACS('v')
  1211. #define WACS_BSSS NCURSES_WACS('w')
  1212. #define WACS_BSBS NCURSES_WACS('q')
  1213. #define WACS_SBSB NCURSES_WACS('x')
  1214. #define WACS_SSSS NCURSES_WACS('n')
  1215. #define WACS_ULCORNER WACS_BSSB
  1216. #define WACS_LLCORNER WACS_SSBB
  1217. #define WACS_URCORNER WACS_BBSS
  1218. #define WACS_LRCORNER WACS_SBBS
  1219. #define WACS_RTEE WACS_SBSS
  1220. #define WACS_LTEE WACS_SSSB
  1221. #define WACS_BTEE WACS_SSBS
  1222. #define WACS_TTEE WACS_BSSS
  1223. #define WACS_HLINE WACS_BSBS
  1224. #define WACS_VLINE WACS_SBSB
  1225. #define WACS_PLUS WACS_SSSS
  1226. #define WACS_S1 NCURSES_WACS('o') /* scan line 1 */
  1227. #define WACS_S9 NCURSES_WACS('s') /* scan line 9 */
  1228. #define WACS_DIAMOND NCURSES_WACS('`') /* diamond */
  1229. #define WACS_CKBOARD NCURSES_WACS('a') /* checker board */
  1230. #define WACS_DEGREE NCURSES_WACS('f') /* degree symbol */
  1231. #define WACS_PLMINUS NCURSES_WACS('g') /* plus/minus */
  1232. #define WACS_BULLET NCURSES_WACS('~') /* bullet */
  1233. /* Teletype 5410v1 symbols */
  1234. #define WACS_LARROW NCURSES_WACS(',') /* arrow left */
  1235. #define WACS_RARROW NCURSES_WACS('+') /* arrow right */
  1236. #define WACS_DARROW NCURSES_WACS('.') /* arrow down */
  1237. #define WACS_UARROW NCURSES_WACS('-') /* arrow up */
  1238. #define WACS_BOARD NCURSES_WACS('h') /* board of squares */
  1239. #define WACS_LANTERN NCURSES_WACS('i') /* lantern symbol */
  1240. #define WACS_BLOCK NCURSES_WACS('0') /* solid square block */
  1241. /* ncurses extensions */
  1242. #define WACS_S3 NCURSES_WACS('p') /* scan line 3 */
  1243. #define WACS_S7 NCURSES_WACS('r') /* scan line 7 */
  1244. #define WACS_LEQUAL NCURSES_WACS('y') /* less/equal */
  1245. #define WACS_GEQUAL NCURSES_WACS('z') /* greater/equal */
  1246. #define WACS_PI NCURSES_WACS('{') /* Pi */
  1247. #define WACS_NEQUAL NCURSES_WACS('|') /* not equal */
  1248. #define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */
  1249. /*
  1250. * Function prototypes for wide-character operations.
  1251. *
  1252. * "generated" comments should include ":WIDEC" to make the corresponding
  1253. * functions ifdef'd in lib_gen.c
  1254. *
  1255. * "implemented" comments do not need this marker.
  1256. */
  1257. extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* generated:WIDEC */
  1258. extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* generated:WIDEC */
  1259. extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* generated:WIDEC */
  1260. extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* generated:WIDEC */
  1261. extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* generated:WIDEC */
  1262. extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* generated:WIDEC */
  1263. extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* generated:WIDEC */
  1264. extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* generated:WIDEC */
  1265. extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* generated:WIDEC */
  1266. extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* generated:WIDEC */
  1267. extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* implemented */
  1268. extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */
  1269. extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */
  1270. extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */
  1271. extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* implemented */
  1272. extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */
  1273. extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */
  1274. extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */
  1275. extern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int); /* generated:WIDEC */
  1276. extern NCURSES_EXPORT(int) in_wchstr (cchar_t *); /* generated:WIDEC */
  1277. extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* generated:WIDEC */
  1278. extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* generated:WIDEC */
  1279. extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* generated:WIDEC */
  1280. extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* generated:WIDEC */
  1281. extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* generated:WIDEC */
  1282. extern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t); /* implemented */
  1283. extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* implemented */
  1284. extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* generated:WIDEC */
  1285. extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */
  1286. extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* generated:WIDEC */
  1287. extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* generated:WIDEC */
  1288. extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* generated:WIDEC */
  1289. extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* generated:WIDEC */
  1290. extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* generated:WIDEC */
  1291. extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* generated:WIDEC */
  1292. extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* generated:WIDEC */
  1293. extern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *); /* generated:WIDEC */
  1294. extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int); /* generated:WIDEC */
  1295. extern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *); /* generated:WIDEC */
  1296. extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* generated:WIDEC */
  1297. extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* generated:WIDEC */
  1298. extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* generated:WIDEC */
  1299. extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* generated:WIDEC */
  1300. extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* generated:WIDEC */
  1301. extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* generated:WIDEC */
  1302. extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
  1303. extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */
  1304. extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
  1305. extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */
  1306. extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */
  1307. extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* generated:WIDEC */
  1308. extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* generated:WIDEC */
  1309. extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */
  1310. extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */
  1311. extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */
  1312. extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int); /* generated:WIDEC */
  1313. extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *); /* generated:WIDEC */
  1314. extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* generated:WIDEC */
  1315. extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */
  1316. extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* generated:WIDEC */
  1317. extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* generated:WIDEC */
  1318. extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */
  1319. extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */
  1320. extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */
  1321. extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* implemented */
  1322. extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */
  1323. extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */
  1324. extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */
  1325. extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* implemented */
  1326. extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, int (*)(int)); /* implemented */
  1327. extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */
  1328. extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */
  1329. extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */
  1330. extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* generated:WIDEC */
  1331. extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* implemented */
  1332. extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* generated:WIDEC */
  1333. extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* implemented */
  1334. extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* implemented */
  1335. extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* implemented */
  1336. extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* implemented */
  1337. extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* implemented */
  1338. extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* generated:WIDEC */
  1339. extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* generated:WIDEC */
  1340. extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *,wint_t *, int); /* implemented */
  1341. extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* implemented */
  1342. extern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *); /* implemented */
  1343. extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int); /* implemented */
  1344. extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *); /* generated:WIDEC */
  1345. extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented */
  1346. extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */
  1347. extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */
  1348. extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */
  1349. extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */
  1350. extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */
  1351. extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */
  1352. #ifndef NCURSES_NOMACROS
  1353. /*
  1354. * XSI curses macros for XPG4 conformance.
  1355. */
  1356. #define add_wch(c) wadd_wch(stdscr,c)
  1357. #define add_wchnstr(str,n) wadd_wchnstr(stdscr,str,n)
  1358. #define add_wchstr(str) wadd_wchstr(stdscr,str)
  1359. #define addnwstr(wstr,n) waddnwstr(stdscr,wstr,n)
  1360. #define addwstr(wstr) waddwstr(stdscr,wstr)
  1361. #define bkgrnd(c) wbkgrnd(stdscr,c)
  1362. #define bkgrndset(c) wbkgrndset(stdscr,c)
  1363. #define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,l,r,t,b,tl,tr,bl,br)
  1364. #define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,0)
  1365. #define echo_wchar(c) wecho_wchar(stdscr,c)
  1366. #define get_wch(c) wget_wch(stdscr,c)
  1367. #define get_wstr(t) wget_wstr(stdscr,t)
  1368. #define getbkgrnd(wch) wgetbkgrnd(stdscr,wch)
  1369. #define getn_wstr(t,n) wgetn_wstr(stdscr,t,n)
  1370. #define hline_set(c,n) whline_set(stdscr,c,n)
  1371. #define in_wch(c) win_wch(stdscr,c)
  1372. #define in_wchnstr(c,n) win_wchnstr(stdscr,c,n)
  1373. #define in_wchstr(c) win_wchstr(stdscr,c)
  1374. #define innwstr(c,n) winnwstr(stdscr,c,n)
  1375. #define ins_nwstr(t,n) wins_nwstr(stdscr,t,n)
  1376. #define ins_wch(c) wins_wch(stdscr,c)
  1377. #define ins_wstr(t) wins_wstr(stdscr,t)
  1378. #define inwstr(c) winwstr(stdscr,c)
  1379. #define vline_set(c,n) wvline_set(stdscr,c,n)
  1380. #define wadd_wchstr(win,str) wadd_wchnstr(win,str,-1)
  1381. #define waddwstr(win,wstr) waddnwstr(win,wstr,-1)
  1382. #define wget_wstr(w,t) wgetn_wstr(w,t,-1)
  1383. #define win_wchstr(w,c) win_wchnstr(w,c,-1)
  1384. #define wins_wstr(w,t) wins_nwstr(w,t,-1)
  1385. #if !NCURSES_OPAQUE
  1386. #define wgetbkgrnd(win,wch) (*wch = win->_bkgrnd, OK)
  1387. #endif
  1388. #define mvadd_wch(y,x,c) mvwadd_wch(stdscr,y,x,c)
  1389. #define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,y,x,s,n)
  1390. #define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,y,x,s)
  1391. #define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,y,x,wstr,n)
  1392. #define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,y,x,wstr)
  1393. #define mvget_wch(y,x,c) mvwget_wch(stdscr,y,x,c)
  1394. #define mvget_wstr(y,x,t) mvwget_wstr(stdscr,y,x,t)
  1395. #define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,y,x,t,n)
  1396. #define mvhline_set(y,x,c,n) mvwhline_set(stdscr,y,x,c,n)
  1397. #define mvin_wch(y,x,c) mvwin_wch(stdscr,y,x,c)
  1398. #define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,y,x,c,n)
  1399. #define mvin_wchstr(y,x,c) mvwin_wchstr(stdscr,y,x,c)
  1400. #define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,y,x,c,n)
  1401. #define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,y,x,t,n)
  1402. #define mvins_wch(y,x,c) mvwins_wch(stdscr,y,x,c)
  1403. #define mvins_wstr(y,x,t) mvwins_wstr(stdscr,y,x,t)
  1404. #define mvinwstr(y,x,c) mvwinwstr(stdscr,y,x,c)
  1405. #define mvvline_set(y,x,c,n) mvwvline_set(stdscr,y,x,c,n)
  1406. #define mvwadd_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wadd_wch(win,c))
  1407. #define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : wadd_wchnstr(win,s,n))
  1408. #define mvwadd_wchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : wadd_wchstr(win,s))
  1409. #define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,y,x) == ERR ? ERR : waddnwstr(win,wstr,n))
  1410. #define mvwaddwstr(win,y,x,wstr) (wmove(win,y,x) == ERR ? ERR : waddwstr(win,wstr))
  1411. #define mvwget_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wget_wch(win,c))
  1412. #define mvwget_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wget_wstr(win,t))
  1413. #define mvwgetn_wstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n))
  1414. #define mvwhline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n))
  1415. #define mvwin_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wch(win,c))
  1416. #define mvwin_wchnstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : win_wchnstr(win,c,n))
  1417. #define mvwin_wchstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wchstr(win,c))
  1418. #define mvwinnwstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : winnwstr(win,c,n))
  1419. #define mvwins_nwstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wins_nwstr(win,t,n))
  1420. #define mvwins_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wins_wch(win,c))
  1421. #define mvwins_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wins_wstr(win,t))
  1422. #define mvwinwstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winwstr(win,c))
  1423. #define mvwvline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
  1424. #endif /* NCURSES_NOMACROS */
  1425. #if defined(TRACE) || defined(NCURSES_TEST)
  1426. extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *);
  1427. extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *);
  1428. #endif
  1429. #endif /* _XOPEN_SOURCE_EXTENDED */
  1430. /* $Id: curses.tail,v 1.17 2008/11/23 00:12:12 tom Exp $ */
  1431. /*
  1432. * vile:cmode:
  1433. * This file is part of ncurses, designed to be appended after curses.h.in
  1434. * (see that file for the relevant copyright).
  1435. */
  1436. /* mouse interface */
  1437. #if NCURSES_MOUSE_VERSION > 1
  1438. #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
  1439. #else
  1440. #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
  1441. #endif
  1442. #define NCURSES_BUTTON_RELEASED 001L
  1443. #define NCURSES_BUTTON_PRESSED 002L
  1444. #define NCURSES_BUTTON_CLICKED 004L
  1445. #define NCURSES_DOUBLE_CLICKED 010L
  1446. #define NCURSES_TRIPLE_CLICKED 020L
  1447. #define NCURSES_RESERVED_EVENT 040L
  1448. /* event masks */
  1449. #define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
  1450. #define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
  1451. #define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
  1452. #define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
  1453. #define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
  1454. #define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
  1455. #define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
  1456. #define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
  1457. #define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
  1458. #define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
  1459. #define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
  1460. #define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
  1461. #define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
  1462. #define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
  1463. #define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
  1464. #define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
  1465. #define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
  1466. #define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
  1467. #define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
  1468. #define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
  1469. /*
  1470. * In 32 bits the version-1 scheme does not provide enough space for a 5th
  1471. * button, unless we choose to change the ABI by omitting the reserved-events.
  1472. */
  1473. #if NCURSES_MOUSE_VERSION > 1
  1474. #define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
  1475. #define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
  1476. #define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
  1477. #define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
  1478. #define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
  1479. #define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L)
  1480. #define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L)
  1481. #define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L)
  1482. #define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L)
  1483. #else
  1484. #define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
  1485. #define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
  1486. #define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
  1487. #define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
  1488. #define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L)
  1489. #define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L)
  1490. #define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L)
  1491. #define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L)
  1492. #endif
  1493. #define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1)
  1494. /* macros to extract single event-bits from masks */
  1495. #define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001))
  1496. #define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002))
  1497. #define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004))
  1498. #define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010))
  1499. #define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020))
  1500. #define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040))
  1501. typedef struct
  1502. {
  1503. short id; /* ID to distinguish multiple devices */
  1504. int x, y, z; /* event coordinates (character-cell) */
  1505. mmask_t bstate; /* button state bits */
  1506. }
  1507. MEVENT;
  1508. extern NCURSES_EXPORT(bool) has_mouse (void);
  1509. extern NCURSES_EXPORT(int) getmouse (MEVENT *);
  1510. extern NCURSES_EXPORT(int) ungetmouse (MEVENT *);
  1511. extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
  1512. extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);
  1513. extern NCURSES_EXPORT(int) mouseinterval (int);
  1514. extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
  1515. extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
  1516. #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
  1517. /* other non-XSI functions */
  1518. extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */
  1519. extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */
  1520. /* Debugging : use with libncurses_g.a */
  1521. extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);
  1522. extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *);
  1523. extern NCURSES_EXPORT(char *) _traceattr (attr_t);
  1524. extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);
  1525. extern NCURSES_EXPORT(char *) _nc_tracebits (void);
  1526. extern NCURSES_EXPORT(char *) _tracechar (int);
  1527. extern NCURSES_EXPORT(char *) _tracechtype (chtype);
  1528. extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
  1529. #ifdef _XOPEN_SOURCE_EXTENDED
  1530. #define _tracech_t _tracecchar_t
  1531. extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
  1532. #define _tracech_t2 _tracecchar_t2
  1533. extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);
  1534. #else
  1535. #define _tracech_t _tracechtype
  1536. #define _tracech_t2 _tracechtype2
  1537. #endif
  1538. extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *);
  1539. extern NCURSES_EXPORT(void) trace (const unsigned int);
  1540. /* trace masks */
  1541. #define TRACE_DISABLE 0x0000 /* turn off tracing */
  1542. #define TRACE_TIMES 0x0001 /* trace user and system times of updates */
  1543. #define TRACE_TPUTS 0x0002 /* trace tputs calls */
  1544. #define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */
  1545. #define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */
  1546. #define TRACE_CHARPUT 0x0010 /* trace all character outputs */
  1547. #define TRACE_ORDINARY 0x001F /* trace all update actions */
  1548. #define TRACE_CALLS 0x0020 /* trace all curses calls */
  1549. #define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */
  1550. #define TRACE_IEVENT 0x0080 /* trace low-level input processing */
  1551. #define TRACE_BITS 0x0100 /* trace state of TTY control bits */
  1552. #define TRACE_ICALLS 0x0200 /* trace internal/nested calls */
  1553. #define TRACE_CCALLS 0x0400 /* trace per-character calls */
  1554. #define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */
  1555. #define TRACE_ATTRS 0x1000 /* trace attribute updates */
  1556. #define TRACE_SHIFT 13 /* number of bits in the trace masks */
  1557. #define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */
  1558. #if defined(TRACE) || defined(NCURSES_TEST)
  1559. extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */
  1560. extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
  1561. #define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */
  1562. #define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */
  1563. #define OPTIMIZE_SCROLL 0x04 /* scroll optimization */
  1564. #define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */
  1565. #endif
  1566. #ifdef __cplusplus
  1567. #ifndef NCURSES_NOMACROS
  1568. /* these names conflict with STL */
  1569. #undef box
  1570. #undef clear
  1571. #undef erase
  1572. #undef move
  1573. #undef refresh
  1574. #endif /* NCURSES_NOMACROS */
  1575. }
  1576. #endif
  1577. #endif /* __NCURSES_H */