curses.h 98 KB

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