curses.h 54 KB

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