curses.h 94 KB

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