terminal_interface-curses.ads.m4 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560
  1. -- -*- ada -*-
  2. define(`HTMLNAME',`terminal_interface-curses__ads.htm')dnl
  3. include(M4MACRO)------------------------------------------------------------------------------
  4. -- --
  5. -- GNAT ncurses Binding --
  6. -- --
  7. -- Terminal_Interface.Curses --
  8. -- --
  9. -- S P E C --
  10. -- --
  11. ------------------------------------------------------------------------------
  12. -- Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. --
  13. -- --
  14. -- Permission is hereby granted, free of charge, to any person obtaining a --
  15. -- copy of this software and associated documentation files (the --
  16. -- "Software"), to deal in the Software without restriction, including --
  17. -- without limitation the rights to use, copy, modify, merge, publish, --
  18. -- distribute, distribute with modifications, sublicense, and/or sell --
  19. -- copies of the Software, and to permit persons to whom the Software is --
  20. -- furnished to do so, subject to the following conditions: --
  21. -- --
  22. -- The above copyright notice and this permission notice shall be included --
  23. -- in all copies or substantial portions of the Software. --
  24. -- --
  25. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
  26. -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
  27. -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
  28. -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
  29. -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
  30. -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
  31. -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
  32. -- --
  33. -- Except as contained in this notice, the name(s) of the above copyright --
  34. -- holders shall not be used in advertising or otherwise to promote the --
  35. -- sale, use or other dealings in this Software without prior written --
  36. -- authorization. --
  37. ------------------------------------------------------------------------------
  38. -- Author: Juergen Pfeifer, 1996
  39. -- Version Control:
  40. -- $Revision: 1.41 $
  41. -- $Date: 2007/05/05 20:33:52 $
  42. -- Binding Version 01.00
  43. ------------------------------------------------------------------------------
  44. include(`Base_Defs')
  45. with System.Storage_Elements;
  46. with Interfaces.C; -- We need this for some assertions.
  47. package Terminal_Interface.Curses is
  48. pragma Preelaborate (Terminal_Interface.Curses);
  49. include(`Linker_Options')
  50. include(`Version_Info')
  51. type Window is private;
  52. Null_Window : constant Window;
  53. type Line_Position is new Natural; -- line coordinate
  54. type Column_Position is new Natural; -- column coordinate
  55. subtype Line_Count is Line_Position range 1 .. Line_Position'Last;
  56. -- Type to count lines. We do not allow null windows, so must be positive
  57. subtype Column_Count is Column_Position range 1 .. Column_Position'Last;
  58. -- Type to count columns. We do not allow null windows, so must be positive
  59. type Key_Code is new Integer;
  60. -- That is anything including real characters, special keys and logical
  61. -- request codes.
  62. -- FIXME: The "-1" should be Curses_Err
  63. subtype Real_Key_Code is Key_Code range -1 .. M4_KEY_MAX;
  64. -- This are the codes that potentially represent a real keystroke.
  65. -- Not all codes may be possible on a specific terminal. To check the
  66. -- availability of a special key, the Has_Key function is provided.
  67. subtype Special_Key_Code is Real_Key_Code
  68. range M4_SPECIAL_FIRST .. Real_Key_Code'Last;
  69. -- Type for a function- or special key number
  70. subtype Normal_Key_Code is Real_Key_Code range
  71. Character'Pos (Character'First) .. Character'Pos (Character'Last);
  72. -- This are the codes for regular (incl. non-graphical) characters.
  73. -- Constants for function- and special keys
  74. --
  75. Key_None : constant Special_Key_Code := M4_SPECIAL_FIRST;
  76. include(`Key_Definitions')
  77. Key_Max : constant Special_Key_Code
  78. := Special_Key_Code'Last;
  79. subtype User_Key_Code is Key_Code
  80. range (Key_Max + 129) .. Key_Code'Last;
  81. -- This is reserved for user defined key codes. The range between Key_Max
  82. -- and the first user code is reserved for subsystems like menu and forms.
  83. -- For those who like to use the original key names we produce them were
  84. -- they differ from the original. Please note that they may differ in
  85. -- lower/upper case.
  86. include(`Old_Keys')dnl
  87. ------------------------------------------------------------------------------
  88. type Color_Number is range -1 .. Integer (Interfaces.C.short'Last);
  89. for Color_Number'Size use Interfaces.C.short'Size;
  90. -- (n)curses uses a short for the color index
  91. -- The model is, that a Color_Number is an index into an array of
  92. -- (potentially) definable colors. Some of those indices are
  93. -- predefined (see below), although they may not really exist.
  94. include(`Color_Defs')
  95. type RGB_Value is range 0 .. Integer (Interfaces.C.short'Last);
  96. for RGB_Value'Size use Interfaces.C.short'Size;
  97. -- Some system may allow to redefine a color by setting RGB values.
  98. type Color_Pair is range 0 .. 255;
  99. for Color_Pair'Size use 8;
  100. subtype Redefinable_Color_Pair is Color_Pair range 1 .. 255;
  101. -- (n)curses reserves 1 Byte for the color-pair number. Color Pair 0
  102. -- is fixed (Black & White). A color pair is simply a combination of
  103. -- two colors described by Color_Numbers, one for the foreground and
  104. -- the other for the background
  105. include(`Character_Attribute_Set_Rep')
  106. -- (n)curses uses all but the lowest 16 Bits for Attributes.
  107. Normal_Video : constant Character_Attribute_Set := (others => False);
  108. type Attributed_Character is
  109. record
  110. Attr : Character_Attribute_Set;
  111. Color : Color_Pair;
  112. Ch : Character;
  113. end record;
  114. pragma Convention (C, Attributed_Character);
  115. -- This is the counterpart for the chtype in C.
  116. include(`AC_Rep')
  117. Default_Character : constant Attributed_Character
  118. := (Ch => Character'First,
  119. Color => Color_Pair'First,
  120. Attr => (others => False)); -- preelaboratable Normal_Video
  121. type Attributed_String is array (Positive range <>) of Attributed_Character;
  122. pragma Pack (Attributed_String);
  123. -- In this binding we allow strings of attributed characters.
  124. ------------------
  125. -- Exceptions --
  126. ------------------
  127. Curses_Exception : exception;
  128. Wrong_Curses_Version : exception;
  129. -- Those exceptions are raised by the ETI (Extended Terminal Interface)
  130. -- subpackets for Menu and Forms handling.
  131. --
  132. Eti_System_Error : exception;
  133. Eti_Bad_Argument : exception;
  134. Eti_Posted : exception;
  135. Eti_Connected : exception;
  136. Eti_Bad_State : exception;
  137. Eti_No_Room : exception;
  138. Eti_Not_Posted : exception;
  139. Eti_Unknown_Command : exception;
  140. Eti_No_Match : exception;
  141. Eti_Not_Selectable : exception;
  142. Eti_Not_Connected : exception;
  143. Eti_Request_Denied : exception;
  144. Eti_Invalid_Field : exception;
  145. Eti_Current : exception;
  146. --------------------------------------------------------------------------
  147. -- External C variables
  148. -- Conceptually even in C this are kind of constants, but they are
  149. -- initialized and sometimes changed by the library routines at runtime
  150. -- depending on the type of terminal. I believe the best way to model
  151. -- this is to use functions.
  152. --------------------------------------------------------------------------
  153. function Lines return Line_Count;
  154. pragma Inline (Lines);
  155. function Columns return Column_Count;
  156. pragma Inline (Columns);
  157. function Tab_Size return Natural;
  158. pragma Inline (Tab_Size);
  159. function Number_Of_Colors return Natural;
  160. pragma Inline (Number_Of_Colors);
  161. function Number_Of_Color_Pairs return Natural;
  162. pragma Inline (Number_Of_Color_Pairs);
  163. include(`ACS_Map')dnl
  164. -- MANPAGE(`curs_initscr.3x')
  165. -- | Not implemented: newterm, set_term, delscreen
  166. -- ANCHOR(`stdscr',`Standard_Window')
  167. function Standard_Window return Window;
  168. -- AKA
  169. pragma Inline (Standard_Window);
  170. -- ANCHOR(`curscr',`Current_Window')
  171. function Current_Window return Window;
  172. -- AKA
  173. pragma Inline (Current_Window);
  174. -- ANCHOR(`initscr()',`Init_Screen')
  175. procedure Init_Screen;
  176. -- ANCHOR(`initscr()',`Init_Windows')
  177. procedure Init_Windows renames Init_Screen;
  178. -- AKA
  179. pragma Inline (Init_Screen);
  180. -- pragma Inline (Init_Windows);
  181. -- ANCHOR(`endwin()',`End_Windows')
  182. procedure End_Windows;
  183. -- AKA
  184. procedure End_Screen renames End_Windows;
  185. pragma Inline (End_Windows);
  186. -- pragma Inline (End_Screen);
  187. -- ANCHOR(`isendwin()',`Is_End_Window')
  188. function Is_End_Window return Boolean;
  189. -- AKA
  190. pragma Inline (Is_End_Window);
  191. -- MANPAGE(`curs_move.3x')
  192. -- ANCHOR(`wmove()',`Move_Cursor')
  193. procedure Move_Cursor (Win : in Window := Standard_Window;
  194. Line : in Line_Position;
  195. Column : in Column_Position);
  196. -- AKA
  197. -- ALIAS(`move()')
  198. pragma Inline (Move_Cursor);
  199. -- MANPAGE(`curs_addch.3x')
  200. -- ANCHOR(`waddch()',`Add')
  201. procedure Add (Win : in Window := Standard_Window;
  202. Ch : in Attributed_Character);
  203. -- AKA
  204. -- ALIAS(`addch()')
  205. procedure Add (Win : in Window := Standard_Window;
  206. Ch : in Character);
  207. -- Add a single character at the current logical cursor position to
  208. -- the window. Use the current windows attributes.
  209. -- ANCHOR(`mvwaddch()',`Add')
  210. procedure Add
  211. (Win : in Window := Standard_Window;
  212. Line : in Line_Position;
  213. Column : in Column_Position;
  214. Ch : in Attributed_Character);
  215. -- AKA
  216. -- ALIAS(`mvaddch()')
  217. procedure Add
  218. (Win : in Window := Standard_Window;
  219. Line : in Line_Position;
  220. Column : in Column_Position;
  221. Ch : in Character);
  222. -- Move to the position and add a single character into the window
  223. -- There are more Add routines, so the Inline pragma follows later
  224. -- ANCHOR(`wechochar()',`Add_With_Immediate_Echo')
  225. procedure Add_With_Immediate_Echo
  226. (Win : in Window := Standard_Window;
  227. Ch : in Attributed_Character);
  228. -- AKA
  229. -- ALIAS(`echochar()')
  230. procedure Add_With_Immediate_Echo
  231. (Win : in Window := Standard_Window;
  232. Ch : in Character);
  233. -- Add a character and do an immediate refresh of the screen.
  234. pragma Inline (Add_With_Immediate_Echo);
  235. -- MANPAGE(`curs_window.3x')
  236. -- Not Implemented: wcursyncup
  237. -- ANCHOR(`newwin()',`Create')
  238. function Create
  239. (Number_Of_Lines : Line_Count;
  240. Number_Of_Columns : Column_Count;
  241. First_Line_Position : Line_Position;
  242. First_Column_Position : Column_Position) return Window;
  243. -- Not Implemented: Default Number_Of_Lines, Number_Of_Columns
  244. -- the C version lets them be 0, see the man page.
  245. -- AKA
  246. pragma Inline (Create);
  247. function New_Window
  248. (Number_Of_Lines : Line_Count;
  249. Number_Of_Columns : Column_Count;
  250. First_Line_Position : Line_Position;
  251. First_Column_Position : Column_Position) return Window
  252. renames Create;
  253. -- pragma Inline (New_Window);
  254. -- ANCHOR(`delwin()',`Delete')
  255. procedure Delete (Win : in out Window);
  256. -- AKA
  257. -- Reset Win to Null_Window
  258. pragma Inline (Delete);
  259. -- ANCHOR(`subwin()',`Sub_Window')
  260. function Sub_Window
  261. (Win : Window := Standard_Window;
  262. Number_Of_Lines : Line_Count;
  263. Number_Of_Columns : Column_Count;
  264. First_Line_Position : Line_Position;
  265. First_Column_Position : Column_Position) return Window;
  266. -- AKA
  267. pragma Inline (Sub_Window);
  268. -- ANCHOR(`derwin()',`Derived_Window')
  269. function Derived_Window
  270. (Win : Window := Standard_Window;
  271. Number_Of_Lines : Line_Count;
  272. Number_Of_Columns : Column_Count;
  273. First_Line_Position : Line_Position;
  274. First_Column_Position : Column_Position) return Window;
  275. -- AKA
  276. pragma Inline (Derived_Window);
  277. -- ANCHOR(`dupwin()',`Duplicate')
  278. function Duplicate (Win : Window) return Window;
  279. -- AKA
  280. pragma Inline (Duplicate);
  281. -- ANCHOR(`mvwin()',`Move_Window')
  282. procedure Move_Window (Win : in Window;
  283. Line : in Line_Position;
  284. Column : in Column_Position);
  285. -- AKA
  286. pragma Inline (Move_Window);
  287. -- ANCHOR(`mvderwin()',`Move_Derived_Window')
  288. procedure Move_Derived_Window (Win : in Window;
  289. Line : in Line_Position;
  290. Column : in Column_Position);
  291. -- AKA
  292. pragma Inline (Move_Derived_Window);
  293. -- ANCHOR(`wsyncup()',`Synchronize_Upwards')
  294. procedure Synchronize_Upwards (Win : in Window);
  295. -- AKA
  296. pragma Import (C, Synchronize_Upwards, "wsyncup");
  297. -- ANCHOR(`wsyncdown()',`Synchronize_Downwards')
  298. procedure Synchronize_Downwards (Win : in Window);
  299. -- AKA
  300. pragma Import (C, Synchronize_Downwards, "wsyncdown");
  301. -- ANCHOR(`syncok()',`Set_Synch_Mode')
  302. procedure Set_Synch_Mode (Win : in Window := Standard_Window;
  303. Mode : in Boolean := False);
  304. -- AKA
  305. pragma Inline (Set_Synch_Mode);
  306. -- MANPAGE(`curs_addstr.3x')
  307. -- ANCHOR(`waddnstr()',`Add')
  308. procedure Add (Win : in Window := Standard_Window;
  309. Str : in String;
  310. Len : in Integer := -1);
  311. -- AKA
  312. -- ALIAS(`waddstr()')
  313. -- ALIAS(`addnstr()')
  314. -- ALIAS(`addstr()')
  315. -- ANCHOR(`mvwaddnstr()',`Add')
  316. procedure Add (Win : in Window := Standard_Window;
  317. Line : in Line_Position;
  318. Column : in Column_Position;
  319. Str : in String;
  320. Len : in Integer := -1);
  321. -- AKA
  322. -- ALIAS(`mvwaddstr()')
  323. -- ALIAS(`mvaddnstr()')
  324. -- ALIAS(`mvaddstr()')
  325. -- MANPAGE(`curs_addchstr.3x')
  326. -- ANCHOR(`waddchnstr()',`Add')
  327. procedure Add (Win : in Window := Standard_Window;
  328. Str : in Attributed_String;
  329. Len : in Integer := -1);
  330. -- AKA
  331. -- ALIAS(`waddchstr()')
  332. -- ALIAS(`addchnstr()')
  333. -- ALIAS(`addchstr()')
  334. -- ANCHOR(`mvwaddchnstr()',`Add')
  335. procedure Add (Win : in Window := Standard_Window;
  336. Line : in Line_Position;
  337. Column : in Column_Position;
  338. Str : in Attributed_String;
  339. Len : in Integer := -1);
  340. -- AKA
  341. -- ALIAS(`mvwaddchstr()')
  342. -- ALIAS(`mvaddchnstr()')
  343. -- ALIAS(`mvaddchstr()')
  344. pragma Inline (Add);
  345. -- MANPAGE(`curs_border.3x')
  346. -- | Not implemented: mvhline, mvwhline, mvvline, mvwvline
  347. -- | use Move_Cursor then Horizontal_Line or Vertical_Line
  348. -- ANCHOR(`wborder()',`Border')
  349. procedure Border
  350. (Win : in Window := Standard_Window;
  351. Left_Side_Symbol : in Attributed_Character := Default_Character;
  352. Right_Side_Symbol : in Attributed_Character := Default_Character;
  353. Top_Side_Symbol : in Attributed_Character := Default_Character;
  354. Bottom_Side_Symbol : in Attributed_Character := Default_Character;
  355. Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character;
  356. Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character;
  357. Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character;
  358. Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character
  359. );
  360. -- AKA
  361. -- ALIAS(`border()')
  362. pragma Inline (Border);
  363. -- ANCHOR(`box()',`Box')
  364. procedure Box
  365. (Win : in Window := Standard_Window;
  366. Vertical_Symbol : in Attributed_Character := Default_Character;
  367. Horizontal_Symbol : in Attributed_Character := Default_Character);
  368. -- AKA
  369. pragma Inline (Box);
  370. -- ANCHOR(`whline()',`Horizontal_Line')
  371. procedure Horizontal_Line
  372. (Win : in Window := Standard_Window;
  373. Line_Size : in Natural;
  374. Line_Symbol : in Attributed_Character := Default_Character);
  375. -- AKA
  376. -- ALIAS(`hline()')
  377. pragma Inline (Horizontal_Line);
  378. -- ANCHOR(`wvline()',`Vertical_Line')
  379. procedure Vertical_Line
  380. (Win : in Window := Standard_Window;
  381. Line_Size : in Natural;
  382. Line_Symbol : in Attributed_Character := Default_Character);
  383. -- AKA
  384. -- ALIAS(`vline()')
  385. pragma Inline (Vertical_Line);
  386. -- MANPAGE(`curs_getch.3x')
  387. -- Not implemented: mvgetch, mvwgetch
  388. -- ANCHOR(`wgetch()',`Get_Keystroke')
  389. function Get_Keystroke (Win : Window := Standard_Window)
  390. return Real_Key_Code;
  391. -- AKA
  392. -- ALIAS(`getch()')
  393. -- Get a character from the keyboard and echo it - if enabled - to the
  394. -- window.
  395. -- If for any reason (i.e. a timeout) we couldn't get a character the
  396. -- returned keycode is Key_None.
  397. pragma Inline (Get_Keystroke);
  398. -- ANCHOR(`ungetch()',`Undo_Keystroke')
  399. procedure Undo_Keystroke (Key : in Real_Key_Code);
  400. -- AKA
  401. pragma Inline (Undo_Keystroke);
  402. -- ANCHOR(`has_key()',`Has_Key')
  403. function Has_Key (Key : Special_Key_Code) return Boolean;
  404. -- AKA
  405. pragma Inline (Has_Key);
  406. -- |
  407. -- | Some helper functions
  408. -- |
  409. function Is_Function_Key (Key : Special_Key_Code) return Boolean;
  410. -- Return True if the Key is a function key (i.e. one of F0 .. F63)
  411. pragma Inline (Is_Function_Key);
  412. subtype Function_Key_Number is Integer range 0 .. 63;
  413. -- (n)curses allows for 64 function keys.
  414. function Function_Key (Key : Real_Key_Code) return Function_Key_Number;
  415. -- Return the number of the function key. If the code is not a
  416. -- function key, a CONSTRAINT_ERROR will be raised.
  417. pragma Inline (Function_Key);
  418. function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code;
  419. -- Return the key code for a given function-key number.
  420. pragma Inline (Function_Key_Code);
  421. -- MANPAGE(`curs_attr.3x')
  422. -- | Not implemented attr_off, wattr_off,
  423. -- | attr_on, wattr_on, attr_set, wattr_set
  424. -- PAIR_NUMBER
  425. -- PAIR_NUMBER(c) is the same as c.Color
  426. -- ANCHOR(`standout()',`Standout')
  427. procedure Standout (Win : Window := Standard_Window;
  428. On : Boolean := True);
  429. -- ALIAS(`wstandout()')
  430. -- ALIAS(`wstandend()')
  431. -- ANCHOR(`wattron()',`Switch_Character_Attribute')
  432. procedure Switch_Character_Attribute
  433. (Win : in Window := Standard_Window;
  434. Attr : in Character_Attribute_Set := Normal_Video;
  435. On : in Boolean := True); -- if False we switch Off.
  436. -- Switches those Attributes set to true in the list.
  437. -- AKA
  438. -- ALIAS(`wattroff()')
  439. -- ALIAS(`attron()')
  440. -- ALIAS(`attroff()')
  441. -- ANCHOR(`wattrset()',`Set_Character_Attributes')
  442. procedure Set_Character_Attributes
  443. (Win : in Window := Standard_Window;
  444. Attr : in Character_Attribute_Set := Normal_Video;
  445. Color : in Color_Pair := Color_Pair'First);
  446. -- AKA
  447. -- ALIAS(`attrset()')
  448. pragma Inline (Set_Character_Attributes);
  449. -- ANCHOR(`wattr_get()',`Get_Character_Attributes')
  450. function Get_Character_Attribute
  451. (Win : in Window := Standard_Window) return Character_Attribute_Set;
  452. -- AKA
  453. -- ALIAS(`attr_get()')
  454. -- ANCHOR(`wattr_get()',`Get_Character_Attribute')
  455. function Get_Character_Attribute
  456. (Win : in Window := Standard_Window) return Color_Pair;
  457. -- AKA
  458. pragma Inline (Get_Character_Attribute);
  459. -- ANCHOR(`wcolor_set()',`Set_Color')
  460. procedure Set_Color (Win : in Window := Standard_Window;
  461. Pair : in Color_Pair);
  462. -- AKA
  463. -- ALIAS(`color_set()')
  464. pragma Inline (Set_Color);
  465. -- ANCHOR(`wchgat()',`Change_Attributes')
  466. procedure Change_Attributes
  467. (Win : in Window := Standard_Window;
  468. Count : in Integer := -1;
  469. Attr : in Character_Attribute_Set := Normal_Video;
  470. Color : in Color_Pair := Color_Pair'First);
  471. -- AKA
  472. -- ALIAS(`chgat()')
  473. -- ANCHOR(`mvwchgat()',`Change_Attributes')
  474. procedure Change_Attributes
  475. (Win : in Window := Standard_Window;
  476. Line : in Line_Position := Line_Position'First;
  477. Column : in Column_Position := Column_Position'First;
  478. Count : in Integer := -1;
  479. Attr : in Character_Attribute_Set := Normal_Video;
  480. Color : in Color_Pair := Color_Pair'First);
  481. -- AKA
  482. -- ALIAS(`mvchgat()')
  483. pragma Inline (Change_Attributes);
  484. -- MANPAGE(`curs_beep.3x')
  485. -- ANCHOR(`beep()',`Beep')
  486. procedure Beep;
  487. -- AKA
  488. pragma Inline (Beep);
  489. -- ANCHOR(`flash()',`Flash_Screen')
  490. procedure Flash_Screen;
  491. -- AKA
  492. pragma Inline (Flash_Screen);
  493. -- MANPAGE(`curs_inopts.3x')
  494. -- | Not implemented : typeahead
  495. --
  496. -- ANCHOR(`cbreak()',`Set_Cbreak_Mode')
  497. procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True);
  498. -- AKA
  499. -- ALIAS(`nocbreak()')
  500. pragma Inline (Set_Cbreak_Mode);
  501. -- ANCHOR(`raw()',`Set_Raw_Mode')
  502. procedure Set_Raw_Mode (SwitchOn : in Boolean := True);
  503. -- AKA
  504. -- ALIAS(`noraw()')
  505. pragma Inline (Set_Raw_Mode);
  506. -- ANCHOR(`echo()',`Set_Echo_Mode')
  507. procedure Set_Echo_Mode (SwitchOn : in Boolean := True);
  508. -- AKA
  509. -- ALIAS(`noecho()')
  510. pragma Inline (Set_Echo_Mode);
  511. -- ANCHOR(`meta()',`Set_Meta_Mode')
  512. procedure Set_Meta_Mode (Win : in Window := Standard_Window;
  513. SwitchOn : in Boolean := True);
  514. -- AKA
  515. pragma Inline (Set_Meta_Mode);
  516. -- ANCHOR(`keypad()',`Set_KeyPad_Mode')
  517. procedure Set_KeyPad_Mode (Win : in Window := Standard_Window;
  518. SwitchOn : in Boolean := True);
  519. -- AKA
  520. pragma Inline (Set_KeyPad_Mode);
  521. function Get_KeyPad_Mode (Win : in Window := Standard_Window)
  522. return Boolean;
  523. -- This has no pendant in C. There you've to look into the WINDOWS
  524. -- structure to get the value. Bad practice, not repeated in Ada.
  525. type Half_Delay_Amount is range 1 .. 255;
  526. -- ANCHOR(`halfdelay()',`Half_Delay')
  527. procedure Half_Delay (Amount : in Half_Delay_Amount);
  528. -- AKA
  529. pragma Inline (Half_Delay);
  530. -- ANCHOR(`intrflush()',`Set_Flush_On_Interrupt_Mode')
  531. procedure Set_Flush_On_Interrupt_Mode
  532. (Win : in Window := Standard_Window;
  533. Mode : in Boolean := True);
  534. -- AKA
  535. pragma Inline (Set_Flush_On_Interrupt_Mode);
  536. -- ANCHOR(`qiflush()',`Set_Queue_Interrupt_Mode')
  537. procedure Set_Queue_Interrupt_Mode
  538. (Win : in Window := Standard_Window;
  539. Flush : in Boolean := True);
  540. -- AKA
  541. -- ALIAS(`noqiflush()')
  542. pragma Inline (Set_Queue_Interrupt_Mode);
  543. -- ANCHOR(`nodelay()',`Set_NoDelay_Mode')
  544. procedure Set_NoDelay_Mode
  545. (Win : in Window := Standard_Window;
  546. Mode : in Boolean := False);
  547. -- AKA
  548. pragma Inline (Set_NoDelay_Mode);
  549. type Timeout_Mode is (Blocking, Non_Blocking, Delayed);
  550. -- ANCHOR(`wtimeout()',`Set_Timeout_Mode')
  551. procedure Set_Timeout_Mode (Win : in Window := Standard_Window;
  552. Mode : in Timeout_Mode;
  553. Amount : in Natural); -- in Milliseconds
  554. -- AKA
  555. -- ALIAS(`timeout()')
  556. -- Instead of overloading the semantic of the sign of amount, we
  557. -- introduce the Timeout_Mode parameter. This should improve
  558. -- readability. For Blocking and Non_Blocking, the Amount is not
  559. -- evaluated.
  560. -- We don't inline this procedure.
  561. -- ANCHOR(`notimeout()',`Set_Escape_Time_Mode')
  562. procedure Set_Escape_Timer_Mode
  563. (Win : in Window := Standard_Window;
  564. Timer_Off : in Boolean := False);
  565. -- AKA
  566. pragma Inline (Set_Escape_Timer_Mode);
  567. -- MANPAGE(`curs_outopts.3x')
  568. -- ANCHOR(`nl()',`Set_NL_Mode')
  569. procedure Set_NL_Mode (SwitchOn : in Boolean := True);
  570. -- AKA
  571. -- ALIAS(`nonl()')
  572. pragma Inline (Set_NL_Mode);
  573. -- ANCHOR(`clearok()',`Clear_On_Next_Update')
  574. procedure Clear_On_Next_Update
  575. (Win : in Window := Standard_Window;
  576. Do_Clear : in Boolean := True);
  577. -- AKA
  578. pragma Inline (Clear_On_Next_Update);
  579. -- ANCHOR(`idlok()',`Use_Insert_Delete_Line')
  580. procedure Use_Insert_Delete_Line
  581. (Win : in Window := Standard_Window;
  582. Do_Idl : in Boolean := True);
  583. -- AKA
  584. pragma Inline (Use_Insert_Delete_Line);
  585. -- ANCHOR(`idcok()',`Use_Insert_Delete_Character')
  586. procedure Use_Insert_Delete_Character
  587. (Win : in Window := Standard_Window;
  588. Do_Idc : in Boolean := True);
  589. -- AKA
  590. pragma Inline (Use_Insert_Delete_Character);
  591. -- ANCHOR(`leaveok()',`Leave_Cursor_After_Update')
  592. procedure Leave_Cursor_After_Update
  593. (Win : in Window := Standard_Window;
  594. Do_Leave : in Boolean := True);
  595. -- AKA
  596. pragma Inline (Leave_Cursor_After_Update);
  597. -- ANCHOR(`immedok()',`Immediate_Update_Mode')
  598. procedure Immediate_Update_Mode
  599. (Win : in Window := Standard_Window;
  600. Mode : in Boolean := False);
  601. -- AKA
  602. pragma Inline (Immediate_Update_Mode);
  603. -- ANCHOR(`scrollok()',`Allow_Scrolling')
  604. procedure Allow_Scrolling
  605. (Win : in Window := Standard_Window;
  606. Mode : in Boolean := False);
  607. -- AKA
  608. pragma Inline (Allow_Scrolling);
  609. function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean;
  610. -- There is no such function in the C interface.
  611. pragma Inline (Scrolling_Allowed);
  612. -- ANCHOR(`wsetscrreg()',`Set_Scroll_Region')
  613. procedure Set_Scroll_Region
  614. (Win : in Window := Standard_Window;
  615. Top_Line : in Line_Position;
  616. Bottom_Line : in Line_Position);
  617. -- AKA
  618. -- ALIAS(`setscrreg()')
  619. pragma Inline (Set_Scroll_Region);
  620. -- MANPAGE(`curs_refresh.3x')
  621. -- ANCHOR(`doupdate()',`Update_Screen')
  622. procedure Update_Screen;
  623. -- AKA
  624. pragma Inline (Update_Screen);
  625. -- ANCHOR(`wrefresh()',`Refresh')
  626. procedure Refresh (Win : in Window := Standard_Window);
  627. -- AKA
  628. -- There is an overloaded Refresh for Pads.
  629. -- The Inline pragma appears there
  630. -- ALIAS(`refresh()')
  631. -- ANCHOR(`wnoutrefresh()',`Refresh_Without_Update')
  632. procedure Refresh_Without_Update
  633. (Win : in Window := Standard_Window);
  634. -- AKA
  635. -- There is an overloaded Refresh_Without_Update for Pads.
  636. -- The Inline pragma appears there
  637. -- ANCHOR(`redrawwin()',`Redraw')
  638. procedure Redraw (Win : in Window := Standard_Window);
  639. -- AKA
  640. -- ANCHOR(`wredrawln()',`Redraw')
  641. procedure Redraw (Win : in Window := Standard_Window;
  642. Begin_Line : in Line_Position;
  643. Line_Count : in Positive);
  644. -- AKA
  645. pragma Inline (Redraw);
  646. -- MANPAGE(`curs_clear.3x')
  647. -- ANCHOR(`werase()',`Erase')
  648. procedure Erase (Win : in Window := Standard_Window);
  649. -- AKA
  650. -- ALIAS(`erase()')
  651. pragma Inline (Erase);
  652. -- ANCHOR(`wclear()',`Clear')
  653. procedure Clear
  654. (Win : in Window := Standard_Window);
  655. -- AKA
  656. -- ALIAS(`clear()')
  657. pragma Inline (Clear);
  658. -- ANCHOR(`wclrtobot()',`Clear_To_End_Of_Screen')
  659. procedure Clear_To_End_Of_Screen
  660. (Win : in Window := Standard_Window);
  661. -- AKA
  662. -- ALIAS(`clrtobot()')
  663. pragma Inline (Clear_To_End_Of_Screen);
  664. -- ANCHOR(`wclrtoeol()',`Clear_To_End_Of_Line')
  665. procedure Clear_To_End_Of_Line
  666. (Win : in Window := Standard_Window);
  667. -- AKA
  668. -- ALIAS(`clrtoeol()')
  669. pragma Inline (Clear_To_End_Of_Line);
  670. -- MANPAGE(`curs_bkgd.3x')
  671. -- ANCHOR(`wbkgdset()',`Set_Background')
  672. -- TODO: we could have Set_Background(Window; Character_Attribute_Set)
  673. -- because in C it is common to see bkgdset(A_BOLD) or
  674. -- bkgdset(COLOR_PAIR(n))
  675. procedure Set_Background
  676. (Win : in Window := Standard_Window;
  677. Ch : in Attributed_Character);
  678. -- AKA
  679. -- ALIAS(`bkgdset()')
  680. pragma Inline (Set_Background);
  681. -- ANCHOR(`wbkgd()',`Change_Background')
  682. procedure Change_Background
  683. (Win : in Window := Standard_Window;
  684. Ch : in Attributed_Character);
  685. -- AKA
  686. -- ALIAS(`bkgd()')
  687. pragma Inline (Change_Background);
  688. -- ANCHOR(`wbkgdget()',`Get_Background')
  689. -- ? wbkgdget is not listed in curs_bkgd, getbkgd is thpough.
  690. function Get_Background (Win : Window := Standard_Window)
  691. return Attributed_Character;
  692. -- AKA
  693. -- ALIAS(`bkgdget()')
  694. pragma Inline (Get_Background);
  695. -- MANPAGE(`curs_touch.3x')
  696. -- ANCHOR(`untouchwin()',`Untouch')
  697. procedure Untouch (Win : in Window := Standard_Window);
  698. -- AKA
  699. pragma Inline (Untouch);
  700. -- ANCHOR(`touchwin()',`Touch')
  701. procedure Touch (Win : in Window := Standard_Window);
  702. -- AKA
  703. -- ANCHOR(`touchline()',`Touch')
  704. procedure Touch (Win : in Window := Standard_Window;
  705. Start : in Line_Position;
  706. Count : in Positive);
  707. -- AKA
  708. pragma Inline (Touch);
  709. -- ANCHOR(`wtouchln()',`Change_Line_Status')
  710. procedure Change_Lines_Status (Win : in Window := Standard_Window;
  711. Start : in Line_Position;
  712. Count : in Positive;
  713. State : in Boolean);
  714. -- AKA
  715. pragma Inline (Change_Lines_Status);
  716. -- ANCHOR(`is_linetouched()',`Is_Touched')
  717. function Is_Touched (Win : Window := Standard_Window;
  718. Line : Line_Position) return Boolean;
  719. -- AKA
  720. -- ANCHOR(`is_wintouched()',`Is_Touched')
  721. function Is_Touched (Win : Window := Standard_Window) return Boolean;
  722. -- AKA
  723. pragma Inline (Is_Touched);
  724. -- MANPAGE(`curs_overlay.3x')
  725. -- ANCHOR(`copywin()',`Copy')
  726. procedure Copy
  727. (Source_Window : in Window;
  728. Destination_Window : in Window;
  729. Source_Top_Row : in Line_Position;
  730. Source_Left_Column : in Column_Position;
  731. Destination_Top_Row : in Line_Position;
  732. Destination_Left_Column : in Column_Position;
  733. Destination_Bottom_Row : in Line_Position;
  734. Destination_Right_Column : in Column_Position;
  735. Non_Destructive_Mode : in Boolean := True);
  736. -- AKA
  737. pragma Inline (Copy);
  738. -- ANCHOR(`overwrite()',`Overwrite')
  739. procedure Overwrite (Source_Window : in Window;
  740. Destination_Window : in Window);
  741. -- AKA
  742. pragma Inline (Overwrite);
  743. -- ANCHOR(`overlay()',`Overlay')
  744. procedure Overlay (Source_Window : in Window;
  745. Destination_Window : in Window);
  746. -- AKA
  747. pragma Inline (Overlay);
  748. -- MANPAGE(`curs_deleteln.3x')
  749. -- ANCHOR(`winsdelln()',`Insert_Delete_Lines')
  750. procedure Insert_Delete_Lines
  751. (Win : in Window := Standard_Window;
  752. Lines : in Integer := 1); -- default is to insert one line above
  753. -- AKA
  754. -- ALIAS(`insdelln()')
  755. pragma Inline (Insert_Delete_Lines);
  756. -- ANCHOR(`wdeleteln()',`Delete_Line')
  757. procedure Delete_Line (Win : in Window := Standard_Window);
  758. -- AKA
  759. -- ALIAS(`deleteln()')
  760. pragma Inline (Delete_Line);
  761. -- ANCHOR(`winsertln()',`Insert_Line')
  762. procedure Insert_Line (Win : in Window := Standard_Window);
  763. -- AKA
  764. -- ALIAS(`insertln()')
  765. pragma Inline (Insert_Line);
  766. -- MANPAGE(`curs_getyx.3x')
  767. -- ANCHOR(`getmaxyx()',`Get_Size')
  768. procedure Get_Size
  769. (Win : in Window := Standard_Window;
  770. Number_Of_Lines : out Line_Count;
  771. Number_Of_Columns : out Column_Count);
  772. -- AKA
  773. pragma Inline (Get_Size);
  774. -- ANCHOR(`getbegyx()',`Get_Window_Position')
  775. procedure Get_Window_Position
  776. (Win : in Window := Standard_Window;
  777. Top_Left_Line : out Line_Position;
  778. Top_Left_Column : out Column_Position);
  779. -- AKA
  780. pragma Inline (Get_Window_Position);
  781. -- ANCHOR(`getyx()',`Get_Cursor_Position')
  782. procedure Get_Cursor_Position
  783. (Win : in Window := Standard_Window;
  784. Line : out Line_Position;
  785. Column : out Column_Position);
  786. -- AKA
  787. pragma Inline (Get_Cursor_Position);
  788. -- ANCHOR(`getparyx()',`Get_Origin_Relative_To_Parent')
  789. procedure Get_Origin_Relative_To_Parent
  790. (Win : in Window;
  791. Top_Left_Line : out Line_Position;
  792. Top_Left_Column : out Column_Position;
  793. Is_Not_A_Subwindow : out Boolean);
  794. -- AKA
  795. -- Instead of placing -1 in the coordinates as return, we use a boolean
  796. -- to return the info that the window has no parent.
  797. pragma Inline (Get_Origin_Relative_To_Parent);
  798. -- MANPAGE(`curs_pad.3x')
  799. -- ANCHOR(`newpad()',`New_Pad')
  800. function New_Pad (Lines : Line_Count;
  801. Columns : Column_Count) return Window;
  802. -- AKA
  803. pragma Inline (New_Pad);
  804. -- ANCHOR(`subpad()',`Sub_Pad')
  805. function Sub_Pad
  806. (Pad : Window;
  807. Number_Of_Lines : Line_Count;
  808. Number_Of_Columns : Column_Count;
  809. First_Line_Position : Line_Position;
  810. First_Column_Position : Column_Position) return Window;
  811. -- AKA
  812. pragma Inline (Sub_Pad);
  813. -- ANCHOR(`prefresh()',`Refresh')
  814. procedure Refresh
  815. (Pad : in Window;
  816. Source_Top_Row : in Line_Position;
  817. Source_Left_Column : in Column_Position;
  818. Destination_Top_Row : in Line_Position;
  819. Destination_Left_Column : in Column_Position;
  820. Destination_Bottom_Row : in Line_Position;
  821. Destination_Right_Column : in Column_Position);
  822. -- AKA
  823. pragma Inline (Refresh);
  824. -- ANCHOR(`pnoutrefresh()',`Refresh_Without_Update')
  825. procedure Refresh_Without_Update
  826. (Pad : in Window;
  827. Source_Top_Row : in Line_Position;
  828. Source_Left_Column : in Column_Position;
  829. Destination_Top_Row : in Line_Position;
  830. Destination_Left_Column : in Column_Position;
  831. Destination_Bottom_Row : in Line_Position;
  832. Destination_Right_Column : in Column_Position);
  833. -- AKA
  834. pragma Inline (Refresh_Without_Update);
  835. -- ANCHOR(`pechochar()',`Add_Character_To_Pad_And_Echo_It')
  836. procedure Add_Character_To_Pad_And_Echo_It
  837. (Pad : in Window;
  838. Ch : in Attributed_Character);
  839. -- AKA
  840. procedure Add_Character_To_Pad_And_Echo_It
  841. (Pad : in Window;
  842. Ch : in Character);
  843. pragma Inline (Add_Character_To_Pad_And_Echo_It);
  844. -- MANPAGE(`curs_scroll.3x')
  845. -- ANCHOR(`wscrl()',`Scroll')
  846. procedure Scroll (Win : in Window := Standard_Window;
  847. Amount : in Integer := 1);
  848. -- AKA
  849. -- ALIAS(`scroll()')
  850. -- ALIAS(`scrl()')
  851. pragma Inline (Scroll);
  852. -- MANPAGE(`curs_delch.3x')
  853. -- ANCHOR(`wdelch()',`Delete_Character')
  854. procedure Delete_Character (Win : in Window := Standard_Window);
  855. -- AKA
  856. -- ALIAS(`delch()')
  857. -- ANCHOR(`mvwdelch()',`Delete_Character')
  858. procedure Delete_Character
  859. (Win : in Window := Standard_Window;
  860. Line : in Line_Position;
  861. Column : in Column_Position);
  862. -- AKA
  863. -- ALIAS(`mvdelch()')
  864. pragma Inline (Delete_Character);
  865. -- MANPAGE(`curs_inch.3x')
  866. -- ANCHOR(`winch()',`Peek')
  867. function Peek (Win : Window := Standard_Window)
  868. return Attributed_Character;
  869. -- ALIAS(`inch()')
  870. -- AKA
  871. -- ANCHOR(`mvwinch()',`Peek')
  872. function Peek
  873. (Win : Window := Standard_Window;
  874. Line : Line_Position;
  875. Column : Column_Position) return Attributed_Character;
  876. -- AKA
  877. -- ALIAS(`mvinch()')
  878. -- More Peek's follow, pragma Inline appears later.
  879. -- MANPAGE(`curs_insch.3x')
  880. -- ANCHOR(`winsch()',`Insert')
  881. procedure Insert (Win : in Window := Standard_Window;
  882. Ch : in Attributed_Character);
  883. -- AKA
  884. -- ALIAS(`insch()')
  885. -- ANCHOR(`mvwinsch()',`Insert')
  886. procedure Insert (Win : in Window := Standard_Window;
  887. Line : in Line_Position;
  888. Column : in Column_Position;
  889. Ch : in Attributed_Character);
  890. -- AKA
  891. -- ALIAS(`mvinsch()')
  892. -- MANPAGE(`curs_insstr.3x')
  893. -- ANCHOR(`winsnstr()',`Insert')
  894. procedure Insert (Win : in Window := Standard_Window;
  895. Str : in String;
  896. Len : in Integer := -1);
  897. -- AKA
  898. -- ALIAS(`winsstr()')
  899. -- ALIAS(`insnstr()')
  900. -- ALIAS(`insstr()')
  901. -- ANCHOR(`mvwinsnstr()',`Insert')
  902. procedure Insert (Win : in Window := Standard_Window;
  903. Line : in Line_Position;
  904. Column : in Column_Position;
  905. Str : in String;
  906. Len : in Integer := -1);
  907. -- AKA
  908. -- ALIAS(`mvwinsstr()')
  909. -- ALIAS(`mvinsnstr()')
  910. -- ALIAS(`mvinsstr()')
  911. pragma Inline (Insert);
  912. -- MANPAGE(`curs_instr.3x')
  913. -- ANCHOR(`winnstr()',`Peek')
  914. procedure Peek (Win : in Window := Standard_Window;
  915. Str : out String;
  916. Len : in Integer := -1);
  917. -- AKA
  918. -- ALIAS(`winstr()')
  919. -- ALIAS(`innstr()')
  920. -- ALIAS(`instr()')
  921. -- ANCHOR(`mvwinnstr()',`Peek')
  922. procedure Peek (Win : in Window := Standard_Window;
  923. Line : in Line_Position;
  924. Column : in Column_Position;
  925. Str : out String;
  926. Len : in Integer := -1);
  927. -- AKA
  928. -- ALIAS(`mvwinstr()')
  929. -- ALIAS(`mvinnstr()')
  930. -- ALIAS(`mvinstr()')
  931. -- MANPAGE(`curs_inchstr.3x')
  932. -- ANCHOR(`winchnstr()',`Peek')
  933. procedure Peek (Win : in Window := Standard_Window;
  934. Str : out Attributed_String;
  935. Len : in Integer := -1);
  936. -- AKA
  937. -- ALIAS(`winchstr()')
  938. -- ALIAS(`inchnstr()')
  939. -- ALIAS(`inchstr()')
  940. -- ANCHOR(`mvwinchnstr()',`Peek')
  941. procedure Peek (Win : in Window := Standard_Window;
  942. Line : in Line_Position;
  943. Column : in Column_Position;
  944. Str : out Attributed_String;
  945. Len : in Integer := -1);
  946. -- AKA
  947. -- ALIAS(`mvwinchstr()')
  948. -- ALIAS(`mvinchnstr()')
  949. -- ALIAS(`mvinchstr()')
  950. -- We don't inline the Peek procedures
  951. -- MANPAGE(`curs_getstr.3x')
  952. -- ANCHOR(`wgetnstr()',`Get')
  953. procedure Get (Win : in Window := Standard_Window;
  954. Str : out String;
  955. Len : in Integer := -1);
  956. -- AKA
  957. -- ALIAS(`wgetstr()')
  958. -- ALIAS(`getnstr()')
  959. -- ALIAS(`getstr()')
  960. -- actually getstr is not supported because that results in buffer
  961. -- overflows.
  962. -- ANCHOR(`mvwgetnstr()',`Get')
  963. procedure Get (Win : in Window := Standard_Window;
  964. Line : in Line_Position;
  965. Column : in Column_Position;
  966. Str : out String;
  967. Len : in Integer := -1);
  968. -- AKA
  969. -- ALIAS(`mvwgetstr()')
  970. -- ALIAS(`mvgetnstr()')
  971. -- ALIAS(`mvgetstr()')
  972. -- Get is not inlined
  973. -- MANPAGE(`curs_slk.3x')
  974. -- Not Implemented: slk_attr_on, slk_attr_off, slk_attr_set
  975. type Soft_Label_Key_Format is (Three_Two_Three,
  976. Four_Four,
  977. PC_Style, -- ncurses specific
  978. PC_Style_With_Index); -- "
  979. type Label_Number is new Positive range 1 .. 12;
  980. type Label_Justification is (Left, Centered, Right);
  981. -- ANCHOR(`slk_init()',`Init_Soft_Label_Keys')
  982. procedure Init_Soft_Label_Keys
  983. (Format : in Soft_Label_Key_Format := Three_Two_Three);
  984. -- AKA
  985. pragma Inline (Init_Soft_Label_Keys);
  986. -- ANCHOR(`slk_set()',`Set_Soft_Label_Key')
  987. procedure Set_Soft_Label_Key (Label : in Label_Number;
  988. Text : in String;
  989. Fmt : in Label_Justification := Left);
  990. -- AKA
  991. -- We don't inline this procedure
  992. -- ANCHOR(`slk_refresh()',`Refresh_Soft_Label_Key')
  993. procedure Refresh_Soft_Label_Keys;
  994. -- AKA
  995. pragma Inline (Refresh_Soft_Label_Keys);
  996. -- ANCHOR(`slk_noutrefresh()',`Refresh_Soft_Label_Keys_Without_Update')
  997. procedure Refresh_Soft_Label_Keys_Without_Update;
  998. -- AKA
  999. pragma Inline (Refresh_Soft_Label_Keys_Without_Update);
  1000. -- ANCHOR(`slk_label()',`Get_Soft_Label_Key')
  1001. procedure Get_Soft_Label_Key (Label : in Label_Number;
  1002. Text : out String);
  1003. -- AKA
  1004. -- ANCHOR(`slk_label()',`Get_Soft_Label_Key')
  1005. function Get_Soft_Label_Key (Label : in Label_Number) return String;
  1006. -- AKA
  1007. -- Same as function
  1008. pragma Inline (Get_Soft_Label_Key);
  1009. -- ANCHOR(`slk_clear()',`Clear_Soft_Label_Keys')
  1010. procedure Clear_Soft_Label_Keys;
  1011. -- AKA
  1012. pragma Inline (Clear_Soft_Label_Keys);
  1013. -- ANCHOR(`slk_restore()',`Restore_Soft_Label_Keys')
  1014. procedure Restore_Soft_Label_Keys;
  1015. -- AKA
  1016. pragma Inline (Restore_Soft_Label_Keys);
  1017. -- ANCHOR(`slk_touch()',`Touch_Soft_Label_Keys')
  1018. procedure Touch_Soft_Label_Keys;
  1019. -- AKA
  1020. pragma Inline (Touch_Soft_Label_Keys);
  1021. -- ANCHOR(`slk_attron()',`Switch_Soft_Label_Key_Attributes')
  1022. procedure Switch_Soft_Label_Key_Attributes
  1023. (Attr : in Character_Attribute_Set;
  1024. On : in Boolean := True);
  1025. -- AKA
  1026. -- ALIAS(`slk_attroff()')
  1027. pragma Inline (Switch_Soft_Label_Key_Attributes);
  1028. -- ANCHOR(`slk_attrset()',`Set_Soft_Label_Key_Attributes')
  1029. procedure Set_Soft_Label_Key_Attributes
  1030. (Attr : in Character_Attribute_Set := Normal_Video;
  1031. Color : in Color_Pair := Color_Pair'First);
  1032. -- AKA
  1033. pragma Inline (Set_Soft_Label_Key_Attributes);
  1034. -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
  1035. function Get_Soft_Label_Key_Attributes return Character_Attribute_Set;
  1036. -- AKA
  1037. -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
  1038. function Get_Soft_Label_Key_Attributes return Color_Pair;
  1039. -- AKA
  1040. pragma Inline (Get_Soft_Label_Key_Attributes);
  1041. -- ANCHOR(`slk_color()',`Set_Soft_Label_Key_Color')
  1042. procedure Set_Soft_Label_Key_Color (Pair : in Color_Pair);
  1043. -- AKA
  1044. pragma Inline (Set_Soft_Label_Key_Color);
  1045. -- MANPAGE(`keybound.3x')
  1046. -- Not Implemented: keybound
  1047. -- MANPAGE(`keyok.3x')
  1048. -- ANCHOR(`keyok()',`Enable_Key')
  1049. procedure Enable_Key (Key : in Special_Key_Code;
  1050. Enable : in Boolean := True);
  1051. -- AKA
  1052. pragma Inline (Enable_Key);
  1053. -- MANPAGE(`define_key.3x')
  1054. -- ANCHOR(`define_key()',`Define_Key')
  1055. procedure Define_Key (Definition : in String;
  1056. Key : in Special_Key_Code);
  1057. -- AKA
  1058. pragma Inline (Define_Key);
  1059. -- MANPAGE(`curs_util.3x')
  1060. -- | Not implemented : filter, use_env
  1061. -- | putwin, getwin are in the child package PutWin
  1062. --
  1063. -- ANCHOR(`keyname()',`Key_Name')
  1064. procedure Key_Name (Key : in Real_Key_Code;
  1065. Name : out String);
  1066. -- AKA
  1067. -- The external name for a real keystroke.
  1068. -- ANCHOR(`keyname()',`Key_Name')
  1069. function Key_Name (Key : in Real_Key_Code) return String;
  1070. -- AKA
  1071. -- Same as function
  1072. -- We don't inline this routine
  1073. -- ANCHOR(`unctrl()',`Un_Control')
  1074. procedure Un_Control (Ch : in Attributed_Character;
  1075. Str : out String);
  1076. -- AKA
  1077. -- ANCHOR(`unctrl()',`Un_Control')
  1078. function Un_Control (Ch : in Attributed_Character) return String;
  1079. -- AKA
  1080. -- Same as function
  1081. pragma Inline (Un_Control);
  1082. -- ANCHOR(`delay_output()',`Delay_Output')
  1083. procedure Delay_Output (Msecs : in Natural);
  1084. -- AKA
  1085. pragma Inline (Delay_Output);
  1086. -- ANCHOR(`flushinp()',`Flush_Input')
  1087. procedure Flush_Input;
  1088. -- AKA
  1089. pragma Inline (Flush_Input);
  1090. -- MANPAGE(`curs_termattrs.3x')
  1091. -- ANCHOR(`baudrate()',`Baudrate')
  1092. function Baudrate return Natural;
  1093. -- AKA
  1094. pragma Inline (Baudrate);
  1095. -- ANCHOR(`erasechar()',`Erase_Character')
  1096. function Erase_Character return Character;
  1097. -- AKA
  1098. pragma Inline (Erase_Character);
  1099. -- ANCHOR(`killchar()',`Kill_Character')
  1100. function Kill_Character return Character;
  1101. -- AKA
  1102. pragma Inline (Kill_Character);
  1103. -- ANCHOR(`has_ic()',`Has_Insert_Character')
  1104. function Has_Insert_Character return Boolean;
  1105. -- AKA
  1106. pragma Inline (Has_Insert_Character);
  1107. -- ANCHOR(`has_il()',`Has_Insert_Line')
  1108. function Has_Insert_Line return Boolean;
  1109. -- AKA
  1110. pragma Inline (Has_Insert_Line);
  1111. -- ANCHOR(`termattrs()',`Supported_Attributes')
  1112. function Supported_Attributes return Character_Attribute_Set;
  1113. -- AKA
  1114. pragma Inline (Supported_Attributes);
  1115. -- ANCHOR(`longname()',`Long_Name')
  1116. procedure Long_Name (Name : out String);
  1117. -- AKA
  1118. -- ANCHOR(`longname()',`Long_Name')
  1119. function Long_Name return String;
  1120. -- AKA
  1121. -- Same as function
  1122. pragma Inline (Long_Name);
  1123. -- ANCHOR(`termname()',`Terminal_Name')
  1124. procedure Terminal_Name (Name : out String);
  1125. -- AKA
  1126. -- ANCHOR(`termname()',`Terminal_Name')
  1127. function Terminal_Name return String;
  1128. -- AKA
  1129. -- Same as function
  1130. pragma Inline (Terminal_Name);
  1131. -- MANPAGE(`curs_color.3x')
  1132. -- COLOR_PAIR
  1133. -- COLOR_PAIR(n) in C is the same as
  1134. -- Attributed_Character(Ch => Nul, Color => n, Attr => Normal_Video)
  1135. -- In C you often see something like c = c | COLOR_PAIR(n);
  1136. -- This is equivalent to c.Color := n;
  1137. -- ANCHOR(`start_color()',`Start_Color')
  1138. procedure Start_Color;
  1139. -- AKA
  1140. pragma Import (C, Start_Color, "start_color");
  1141. -- ANCHOR(`init_pair()',`Init_Pair')
  1142. procedure Init_Pair (Pair : in Redefinable_Color_Pair;
  1143. Fore : in Color_Number;
  1144. Back : in Color_Number);
  1145. -- AKA
  1146. pragma Inline (Init_Pair);
  1147. -- ANCHOR(`pair_content()',`Pair_Content')
  1148. procedure Pair_Content (Pair : in Color_Pair;
  1149. Fore : out Color_Number;
  1150. Back : out Color_Number);
  1151. -- AKA
  1152. pragma Inline (Pair_Content);
  1153. -- ANCHOR(`has_colors()',`Has_Colors')
  1154. function Has_Colors return Boolean;
  1155. -- AKA
  1156. pragma Inline (Has_Colors);
  1157. -- ANCHOR(`init_color()',`Init_Color')
  1158. procedure Init_Color (Color : in Color_Number;
  1159. Red : in RGB_Value;
  1160. Green : in RGB_Value;
  1161. Blue : in RGB_Value);
  1162. -- AKA
  1163. pragma Inline (Init_Color);
  1164. -- ANCHOR(`can_change_color()',`Can_Change_Color')
  1165. function Can_Change_Color return Boolean;
  1166. -- AKA
  1167. pragma Inline (Can_Change_Color);
  1168. -- ANCHOR(`color_content()',`Color_Content')
  1169. procedure Color_Content (Color : in Color_Number;
  1170. Red : out RGB_Value;
  1171. Green : out RGB_Value;
  1172. Blue : out RGB_Value);
  1173. -- AKA
  1174. pragma Inline (Color_Content);
  1175. -- MANPAGE(`curs_kernel.3x')
  1176. -- | Not implemented: getsyx, setsyx
  1177. --
  1178. type Curses_Mode is (Curses, Shell);
  1179. -- ANCHOR(`def_prog_mode()',`Save_Curses_Mode')
  1180. procedure Save_Curses_Mode (Mode : in Curses_Mode);
  1181. -- AKA
  1182. -- ALIAS(`def_shell_mode()')
  1183. pragma Inline (Save_Curses_Mode);
  1184. -- ANCHOR(`reset_prog_mode()',`Reset_Curses_Mode')
  1185. procedure Reset_Curses_Mode (Mode : in Curses_Mode);
  1186. -- AKA
  1187. -- ALIAS(`reset_shell_mode()')
  1188. pragma Inline (Reset_Curses_Mode);
  1189. -- ANCHOR(`savetty()',`Save_Terminal_State')
  1190. procedure Save_Terminal_State;
  1191. -- AKA
  1192. pragma Inline (Save_Terminal_State);
  1193. -- ANCHOR(`resetty();',`Reset_Terminal_State')
  1194. procedure Reset_Terminal_State;
  1195. -- AKA
  1196. pragma Inline (Reset_Terminal_State);
  1197. type Stdscr_Init_Proc is access
  1198. function (Win : Window;
  1199. Columns : Column_Count) return Integer;
  1200. pragma Convention (C, Stdscr_Init_Proc);
  1201. -- N.B.: the return value is actually ignored, but it seems to be
  1202. -- a good practice to return 0 if you think all went fine
  1203. -- and -1 otherwise.
  1204. -- ANCHOR(`ripoffline()',`Rip_Off_Lines')
  1205. procedure Rip_Off_Lines (Lines : in Integer;
  1206. Proc : in Stdscr_Init_Proc);
  1207. -- AKA
  1208. -- N.B.: to be more precise, this uses a ncurses specific enhancement of
  1209. -- ripoffline(), in which the Lines argument absolute value is the
  1210. -- number of lines to be ripped of. The official ripoffline() only
  1211. -- uses the sign of Lines to rip of a single line from bottom or top.
  1212. pragma Inline (Rip_Off_Lines);
  1213. type Cursor_Visibility is (Invisible, Normal, Very_Visible);
  1214. -- ANCHOR(`curs_set()',`Set_Cursor_Visibility')
  1215. procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility);
  1216. -- AKA
  1217. pragma Inline (Set_Cursor_Visibility);
  1218. -- ANCHOR(`napms()',`Nap_Milli_Seconds')
  1219. procedure Nap_Milli_Seconds (Ms : in Natural);
  1220. -- AKA
  1221. pragma Inline (Nap_Milli_Seconds);
  1222. -- |=====================================================================
  1223. -- | Some useful helpers.
  1224. -- |=====================================================================
  1225. type Transform_Direction is (From_Screen, To_Screen);
  1226. procedure Transform_Coordinates
  1227. (W : in Window := Standard_Window;
  1228. Line : in out Line_Position;
  1229. Column : in out Column_Position;
  1230. Dir : in Transform_Direction := From_Screen);
  1231. -- This procedure transforms screen coordinates into coordinates relative
  1232. -- to the window and vice versa, depending on the Dir parameter.
  1233. -- Screen coordinates are the position informations on the physical device.
  1234. -- An Curses_Exception will be raised if Line and Column are not in the
  1235. -- Window or if you pass the Null_Window as argument.
  1236. -- We don't inline this procedure
  1237. -- MANPAGE(`default_colors.3x')
  1238. -- ANCHOR(`use_default_colors()',`Use_Default_Colors')
  1239. procedure Use_Default_Colors;
  1240. -- AKA
  1241. pragma Inline (Use_Default_Colors);
  1242. -- ANCHOR(`assume_default_colors()',`Assume_Default_Colors')
  1243. procedure Assume_Default_Colors (Fore : Color_Number := Default_Color;
  1244. Back : Color_Number := Default_Color);
  1245. -- AKA
  1246. pragma Inline (Assume_Default_Colors);
  1247. -- MANPAGE(`curs_extend.3x')
  1248. -- ANCHOR(`curses_version()',`Curses_Version')
  1249. function Curses_Version return String;
  1250. -- AKA
  1251. -- ANCHOR(`use_extended_names()',`Use_Extended_Names')
  1252. -- The returnvalue is the previous setting of the flag
  1253. function Use_Extended_Names (Enable : Boolean) return Boolean;
  1254. -- AKA
  1255. -- MANPAGE(`curs_trace.3x')
  1256. -- ANCHOR(`_nc_freeall()',`Curses_Free_All')
  1257. procedure Curses_Free_All;
  1258. -- AKA
  1259. -- MANPAGE(`curs_scr_dump.3x')
  1260. -- ANCHOR(`scr_dump()',`Screen_Dump_To_File')
  1261. procedure Screen_Dump_To_File (Filename : in String);
  1262. -- AKA
  1263. -- ANCHOR(`scr_restore()',`Screen_Restore_From_File')
  1264. procedure Screen_Restore_From_File (Filename : in String);
  1265. -- AKA
  1266. -- ANCHOR(`scr_init()',`Screen_Init_From_File')
  1267. procedure Screen_Init_From_File (Filename : in String);
  1268. -- AKA
  1269. -- ANCHOR(`scr_set()',`Screen_Set_File')
  1270. procedure Screen_Set_File (Filename : in String);
  1271. -- AKA
  1272. -- MANPAGE(`curs_print.3x')
  1273. -- Not implemented: mcprint
  1274. -- MANPAGE(`curs_printw.3x')
  1275. -- Not implemented: printw, wprintw, mvprintw, mvwprintw, vwprintw,
  1276. -- vw_printw
  1277. -- Please use the Ada style Text_IO child packages for formatted
  1278. -- printing. It doesn't make a lot of sense to map the printf style
  1279. -- C functions to Ada.
  1280. -- MANPAGE(`curs_scanw.3x')
  1281. -- Not implemented: scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw
  1282. -- MANPAGE(`resizeterm.3x')
  1283. -- Not Implemented: resizeterm
  1284. -- MANPAGE(`wresize.3x')
  1285. -- ANCHOR(`wresize()',`Resize')
  1286. procedure Resize (Win : Window := Standard_Window;
  1287. Number_Of_Lines : Line_Count;
  1288. Number_Of_Columns : Column_Count);
  1289. -- AKA
  1290. private
  1291. type Window is new System.Storage_Elements.Integer_Address;
  1292. Null_Window : constant Window := 0;
  1293. -- The next constants are generated and may be different on your
  1294. -- architecture.
  1295. --
  1296. include(`Window_Offsets')dnl
  1297. Curses_Bool_False : constant Curses_Bool := 0;
  1298. end Terminal_Interface.Curses;