ncurses.h 98 KB

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