1--  -*- ada -*-
2define(`HTMLNAME',`terminal_interface-curses__ads.htm')dnl
3include(M4MACRO)------------------------------------------------------------------------------
4--                                                                          --
5--                           GNAT ncurses Binding                           --
6--                                                                          --
7--                         Terminal_Interface.Curses                        --
8--                                                                          --
9--                                 S P E C                                  --
10--                                                                          --
11------------------------------------------------------------------------------
12-- Copyright 2020 Thomas E. Dickey                                          --
13-- Copyright 1998-2011,2014 Free Software Foundation, Inc.                  --
14--                                                                          --
15-- Permission is hereby granted, free of charge, to any person obtaining a  --
16-- copy of this software and associated documentation files (the            --
17-- "Software"), to deal in the Software without restriction, including      --
18-- without limitation the rights to use, copy, modify, merge, publish,      --
19-- distribute, distribute with modifications, sublicense, and/or sell       --
20-- copies of the Software, and to permit persons to whom the Software is    --
21-- furnished to do so, subject to the following conditions:                 --
22--                                                                          --
23-- The above copyright notice and this permission notice shall be included  --
24-- in all copies or substantial portions of the Software.                   --
25--                                                                          --
26-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --
27-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --
28-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --
29-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --
30-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --
31-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --
32-- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --
33--                                                                          --
34-- Except as contained in this notice, the name(s) of the above copyright   --
35-- holders shall not be used in advertising or otherwise to promote the     --
36-- sale, use or other dealings in this Software without prior written       --
37-- authorization.                                                           --
38------------------------------------------------------------------------------
39--  Author:  Juergen Pfeifer, 1996
40--  Version Control:
41--  $Revision: 1.48 $
42--  $Date: 2020/02/02 23:34:34 $
43--  Binding Version 01.00
44------------------------------------------------------------------------------
45with System.Storage_Elements;
46with Interfaces.C;   --  We need this for some assertions.
47
48with Terminal_Interface.Curses_Constants;
49
50package Terminal_Interface.Curses is
51   pragma Preelaborate (Terminal_Interface.Curses);
52   pragma Linker_Options ("-lncurses" & Curses_Constants.DFT_ARG_SUFFIX);
53
54   Major_Version : constant := Curses_Constants.NCURSES_VERSION_MAJOR;
55   Minor_Version : constant := Curses_Constants.NCURSES_VERSION_MINOR;
56   NC_Version : String renames Curses_Constants.Version;
57
58   type Window is private;
59   Null_Window : constant Window;
60
61   type Line_Position   is new Integer; --  line coordinate
62   type Column_Position is new Integer; --  column coordinate
63
64   subtype Line_Count   is Line_Position   range 1 .. Line_Position'Last;
65   --  Type to count lines. We do not allow null windows, so must be positive
66   subtype Column_Count is Column_Position range 1 .. Column_Position'Last;
67   --  Type to count columns. We do not allow null windows, so must be positive
68
69   type Key_Code is new Integer;
70   --  That is anything including real characters, special keys and logical
71   --  request codes.
72
73   --  FIXME: The "-1" should be Curses_Err
74   subtype Real_Key_Code is Key_Code range -1 .. Curses_Constants.KEY_MAX;
75   --  This are the codes that potentially represent a real keystroke.
76   --  Not all codes may be possible on a specific terminal. To check the
77   --  availability of a special key, the Has_Key function is provided.
78
79   subtype Special_Key_Code is Real_Key_Code
80     range Curses_Constants. KEY_MIN - 1 .. Real_Key_Code'Last;
81   --  Type for a function- or special key number
82
83   subtype Normal_Key_Code is Real_Key_Code range
84     Character'Pos (Character'First) .. Character'Pos (Character'Last);
85   --  This are the codes for regular (incl. non-graphical) characters.
86
87   --  For those who like to use the original key names we produce them were
88   --  they differ from the original.
89
90   --  Constants for function- and special keys
91   Key_None                    : constant Special_Key_Code
92     := Curses_Constants.KEY_MIN - 1;
93   Key_Min                     : constant Special_Key_Code
94     := Curses_Constants.KEY_MIN;
95   Key_Break                   : constant Special_Key_Code
96     := Curses_Constants.KEY_BREAK;
97   KEY_DOWN                    : constant Special_Key_Code
98     := Curses_Constants.KEY_DOWN;
99   Key_Cursor_Down             : Special_Key_Code renames KEY_DOWN;
100   KEY_UP                      : constant Special_Key_Code
101     := Curses_Constants.KEY_UP;
102   Key_Cursor_Up               : Special_Key_Code renames KEY_UP;
103   KEY_LEFT                    : constant Special_Key_Code
104     := Curses_Constants.KEY_LEFT;
105   Key_Cursor_Left             : Special_Key_Code renames KEY_LEFT;
106   KEY_RIGHT                   : constant Special_Key_Code
107     := Curses_Constants.KEY_RIGHT;
108   Key_Cursor_Right            : Special_Key_Code renames KEY_RIGHT;
109   Key_Home                    : constant Special_Key_Code
110     := Curses_Constants.KEY_HOME;
111   Key_Backspace               : constant Special_Key_Code
112     := Curses_Constants.KEY_BACKSPACE;
113   Key_F0                      : constant Special_Key_Code
114     := Curses_Constants.KEY_F0;
115   Key_F1                      : constant Special_Key_Code
116     := Curses_Constants.KEY_F1;
117   Key_F2                      : constant Special_Key_Code
118     := Curses_Constants.KEY_F2;
119   Key_F3                      : constant Special_Key_Code
120     := Curses_Constants.KEY_F3;
121   Key_F4                      : constant Special_Key_Code
122     := Curses_Constants.KEY_F4;
123   Key_F5                      : constant Special_Key_Code
124     := Curses_Constants.KEY_F5;
125   Key_F6                      : constant Special_Key_Code
126     := Curses_Constants.KEY_F6;
127   Key_F7                      : constant Special_Key_Code
128     := Curses_Constants.KEY_F7;
129   Key_F8                      : constant Special_Key_Code
130     := Curses_Constants.KEY_F8;
131   Key_F9                      : constant Special_Key_Code
132     := Curses_Constants.KEY_F9;
133   Key_F10                     : constant Special_Key_Code
134     := Curses_Constants.KEY_F10;
135   Key_F11                     : constant Special_Key_Code
136     := Curses_Constants.KEY_F11;
137   Key_F12                     : constant Special_Key_Code
138     := Curses_Constants.KEY_F12;
139   Key_F13                     : constant Special_Key_Code
140     := Curses_Constants.KEY_F13;
141   Key_F14                     : constant Special_Key_Code
142     := Curses_Constants.KEY_F14;
143   Key_F15                     : constant Special_Key_Code
144     := Curses_Constants.KEY_F15;
145   Key_F16                     : constant Special_Key_Code
146     := Curses_Constants.KEY_F16;
147   Key_F17                     : constant Special_Key_Code
148     := Curses_Constants.KEY_F17;
149   Key_F18                     : constant Special_Key_Code
150     := Curses_Constants.KEY_F18;
151   Key_F19                     : constant Special_Key_Code
152     := Curses_Constants.KEY_F19;
153   Key_F20                     : constant Special_Key_Code
154     := Curses_Constants.KEY_F20;
155   Key_F21                     : constant Special_Key_Code
156     := Curses_Constants.KEY_F21;
157   Key_F22                     : constant Special_Key_Code
158     := Curses_Constants.KEY_F22;
159   Key_F23                     : constant Special_Key_Code
160     := Curses_Constants.KEY_F23;
161   Key_F24                     : constant Special_Key_Code
162     := Curses_Constants.KEY_F24;
163   KEY_DL                      : constant Special_Key_Code
164     := Curses_Constants.KEY_DL;
165   Key_Delete_Line             : Special_Key_Code renames KEY_DL;
166   KEY_IL                      : constant Special_Key_Code
167     := Curses_Constants.KEY_IL;
168   Key_Insert_Line             : Special_Key_Code renames KEY_IL;
169   KEY_DC                      : constant Special_Key_Code
170     := Curses_Constants.KEY_DC;
171   Key_Delete_Char             : Special_Key_Code renames KEY_DC;
172   KEY_IC                      : constant Special_Key_Code
173     := Curses_Constants.KEY_IC;
174   Key_Insert_Char             : Special_Key_Code renames KEY_IC;
175   KEY_EIC                     : constant Special_Key_Code
176     := Curses_Constants.KEY_EIC;
177   Key_Exit_Insert_Mode        : Special_Key_Code renames KEY_EIC;
178   KEY_CLEAR                   : constant Special_Key_Code
179     := Curses_Constants.KEY_CLEAR;
180   Key_Clear_Screen            : Special_Key_Code renames KEY_CLEAR;
181   KEY_EOS                     : constant Special_Key_Code
182     := Curses_Constants.KEY_EOS;
183   Key_Clear_End_Of_Screen     : Special_Key_Code renames KEY_EOS;
184   KEY_EOL                     : constant Special_Key_Code
185     := Curses_Constants.KEY_EOL;
186   Key_Clear_End_Of_Line       : Special_Key_Code renames KEY_EOL;
187   KEY_SF                      : constant Special_Key_Code
188     := Curses_Constants.KEY_SF;
189   Key_Scroll_1_Forward        : Special_Key_Code renames KEY_SF;
190   KEY_SR                      : constant Special_Key_Code
191     := Curses_Constants.KEY_SR;
192   Key_Scroll_1_Backward       : Special_Key_Code renames KEY_SR;
193   KEY_NPAGE                   : constant Special_Key_Code
194     := Curses_Constants.KEY_NPAGE;
195   Key_Next_Page               : Special_Key_Code renames KEY_NPAGE;
196   KEY_PPAGE                   : constant Special_Key_Code
197     := Curses_Constants.KEY_PPAGE;
198   Key_Previous_Page           : Special_Key_Code renames KEY_PPAGE;
199   KEY_STAB                    : constant Special_Key_Code
200     := Curses_Constants.KEY_STAB;
201   Key_Set_Tab                 : Special_Key_Code renames KEY_STAB;
202   KEY_CTAB                    : constant Special_Key_Code
203     := Curses_Constants.KEY_CTAB;
204   Key_Clear_Tab               : Special_Key_Code renames KEY_CTAB;
205   KEY_CATAB                   : constant Special_Key_Code
206     := Curses_Constants.KEY_CATAB;
207   Key_Clear_All_Tabs          : Special_Key_Code renames KEY_CATAB;
208   KEY_ENTER                   : constant Special_Key_Code
209     := Curses_Constants.KEY_ENTER;
210   Key_Enter_Or_Send           : Special_Key_Code renames KEY_ENTER;
211   KEY_SRESET                  : constant Special_Key_Code
212     := Curses_Constants.KEY_SRESET;
213   Key_Soft_Reset              : Special_Key_Code renames KEY_SRESET;
214   Key_Reset                   : constant Special_Key_Code
215     := Curses_Constants.KEY_RESET;
216   Key_Print                   : constant Special_Key_Code
217     := Curses_Constants.KEY_PRINT;
218   KEY_LL                      : constant Special_Key_Code
219     := Curses_Constants.KEY_LL;
220   Key_Bottom                  : Special_Key_Code renames KEY_LL;
221   KEY_A1                      : constant Special_Key_Code
222     := Curses_Constants.KEY_A1;
223   Key_Upper_Left_Of_Keypad    : Special_Key_Code renames KEY_A1;
224   KEY_A3                      : constant Special_Key_Code
225     := Curses_Constants.KEY_A3;
226   Key_Upper_Right_Of_Keypad   : Special_Key_Code renames KEY_A3;
227   KEY_B2                      : constant Special_Key_Code
228     := Curses_Constants.KEY_B2;
229   Key_Center_Of_Keypad        : Special_Key_Code renames KEY_B2;
230   KEY_C1                      : constant Special_Key_Code
231     := Curses_Constants.KEY_C1;
232   Key_Lower_Left_Of_Keypad    : Special_Key_Code renames KEY_C1;
233   KEY_C3                      : constant Special_Key_Code
234     := Curses_Constants.KEY_C3;
235   Key_Lower_Right_Of_Keypad   : Special_Key_Code renames KEY_C3;
236   KEY_BTAB                    : constant Special_Key_Code
237     := Curses_Constants.KEY_BTAB;
238   Key_Back_Tab                : Special_Key_Code renames KEY_BTAB;
239   KEY_BEG                     : constant Special_Key_Code
240     := Curses_Constants.KEY_BEG;
241   Key_Beginning               : Special_Key_Code renames KEY_BEG;
242   Key_Cancel                  : constant Special_Key_Code
243     := Curses_Constants.KEY_CANCEL;
244   Key_Close                   : constant Special_Key_Code
245     := Curses_Constants.KEY_CLOSE;
246   Key_Command                 : constant Special_Key_Code
247     := Curses_Constants.KEY_COMMAND;
248   Key_Copy                    : constant Special_Key_Code
249     := Curses_Constants.KEY_COPY;
250   Key_Create                  : constant Special_Key_Code
251     := Curses_Constants.KEY_CREATE;
252   Key_End                     : constant Special_Key_Code
253     := Curses_Constants.KEY_END;
254   Key_Exit                    : constant Special_Key_Code
255     := Curses_Constants.KEY_EXIT;
256   Key_Find                    : constant Special_Key_Code
257     := Curses_Constants.KEY_FIND;
258   Key_Help                    : constant Special_Key_Code
259     := Curses_Constants.KEY_HELP;
260   Key_Mark                    : constant Special_Key_Code
261     := Curses_Constants.KEY_MARK;
262   Key_Message                 : constant Special_Key_Code
263     := Curses_Constants.KEY_MESSAGE;
264   Key_Move                    : constant Special_Key_Code
265     := Curses_Constants.KEY_MOVE;
266   Key_Next                    : constant Special_Key_Code
267     := Curses_Constants.KEY_NEXT;
268   Key_Open                    : constant Special_Key_Code
269     := Curses_Constants.KEY_OPEN;
270   Key_Options                 : constant Special_Key_Code
271     := Curses_Constants.KEY_OPTIONS;
272   Key_Previous                : constant Special_Key_Code
273     := Curses_Constants.KEY_PREVIOUS;
274   Key_Redo                    : constant Special_Key_Code
275     := Curses_Constants.KEY_REDO;
276   Key_Reference               : constant Special_Key_Code
277     := Curses_Constants.KEY_REFERENCE;
278   Key_Refresh                 : constant Special_Key_Code
279     := Curses_Constants.KEY_REFRESH;
280   Key_Replace                 : constant Special_Key_Code
281     := Curses_Constants.KEY_REPLACE;
282   Key_Restart                 : constant Special_Key_Code
283     := Curses_Constants.KEY_RESTART;
284   Key_Resume                  : constant Special_Key_Code
285     := Curses_Constants.KEY_RESUME;
286   Key_Save                    : constant Special_Key_Code
287     := Curses_Constants.KEY_SAVE;
288   KEY_SBEG                    : constant Special_Key_Code
289     := Curses_Constants.KEY_SBEG;
290   Key_Shift_Begin             : Special_Key_Code renames KEY_SBEG;
291   KEY_SCANCEL                 : constant Special_Key_Code
292     := Curses_Constants.KEY_SCANCEL;
293   Key_Shift_Cancel            : Special_Key_Code renames KEY_SCANCEL;
294   KEY_SCOMMAND                : constant Special_Key_Code
295     := Curses_Constants.KEY_SCOMMAND;
296   Key_Shift_Command           : Special_Key_Code renames KEY_SCOMMAND;
297   KEY_SCOPY                   : constant Special_Key_Code
298     := Curses_Constants.KEY_SCOPY;
299   Key_Shift_Copy              : Special_Key_Code renames KEY_SCOPY;
300   KEY_SCREATE                 : constant Special_Key_Code
301     := Curses_Constants.KEY_SCREATE;
302   Key_Shift_Create            : Special_Key_Code renames KEY_SCREATE;
303   KEY_SDC                     : constant Special_Key_Code
304     := Curses_Constants.KEY_SDC;
305   Key_Shift_Delete_Char       : Special_Key_Code renames KEY_SDC;
306   KEY_SDL                     : constant Special_Key_Code
307     := Curses_Constants.KEY_SDL;
308   Key_Shift_Delete_Line       : Special_Key_Code renames KEY_SDL;
309   Key_Select                  : constant Special_Key_Code
310     := Curses_Constants.KEY_SELECT;
311   KEY_SEND                    : constant Special_Key_Code
312     := Curses_Constants.KEY_SEND;
313   Key_Shift_End               : Special_Key_Code renames KEY_SEND;
314   KEY_SEOL                    : constant Special_Key_Code
315     := Curses_Constants.KEY_SEOL;
316   Key_Shift_Clear_End_Of_Line : Special_Key_Code renames KEY_SEOL;
317   KEY_SEXIT                   : constant Special_Key_Code
318     := Curses_Constants.KEY_SEXIT;
319   Key_Shift_Exit              : Special_Key_Code renames KEY_SEXIT;
320   KEY_SFIND                   : constant Special_Key_Code
321     := Curses_Constants.KEY_SFIND;
322   Key_Shift_Find              : Special_Key_Code renames KEY_SFIND;
323   KEY_SHELP                   : constant Special_Key_Code
324     := Curses_Constants.KEY_SHELP;
325   Key_Shift_Help              : Special_Key_Code renames KEY_SHELP;
326   KEY_SHOME                   : constant Special_Key_Code
327     := Curses_Constants.KEY_SHOME;
328   Key_Shift_Home              : Special_Key_Code renames KEY_SHOME;
329   KEY_SIC                     : constant Special_Key_Code
330     := Curses_Constants.KEY_SIC;
331   Key_Shift_Insert_Char       : Special_Key_Code renames KEY_SIC;
332   KEY_SLEFT                   : constant Special_Key_Code
333     := Curses_Constants.KEY_SLEFT;
334   Key_Shift_Cursor_Left       : Special_Key_Code renames KEY_SLEFT;
335   KEY_SMESSAGE                : constant Special_Key_Code
336     := Curses_Constants.KEY_SMESSAGE;
337   Key_Shift_Message           : Special_Key_Code renames KEY_SMESSAGE;
338   KEY_SMOVE                   : constant Special_Key_Code
339     := Curses_Constants.KEY_SMOVE;
340   Key_Shift_Move              : Special_Key_Code renames KEY_SMOVE;
341   KEY_SNEXT                   : constant Special_Key_Code
342     := Curses_Constants.KEY_SNEXT;
343   Key_Shift_Next_Page         : Special_Key_Code renames KEY_SNEXT;
344   KEY_SOPTIONS                : constant Special_Key_Code
345     := Curses_Constants.KEY_SOPTIONS;
346   Key_Shift_Options           : Special_Key_Code renames KEY_SOPTIONS;
347   KEY_SPREVIOUS               : constant Special_Key_Code
348     := Curses_Constants.KEY_SPREVIOUS;
349   Key_Shift_Previous_Page     : Special_Key_Code renames KEY_SPREVIOUS;
350   KEY_SPRINT                  : constant Special_Key_Code
351     := Curses_Constants.KEY_SPRINT;
352   Key_Shift_Print             : Special_Key_Code renames KEY_SPRINT;
353   KEY_SREDO                   : constant Special_Key_Code
354     := Curses_Constants.KEY_SREDO;
355   Key_Shift_Redo              : Special_Key_Code renames KEY_SREDO;
356   KEY_SREPLACE                : constant Special_Key_Code
357     := Curses_Constants.KEY_SREPLACE;
358   Key_Shift_Replace           : Special_Key_Code renames KEY_SREPLACE;
359   KEY_SRIGHT                  : constant Special_Key_Code
360     := Curses_Constants.KEY_SRIGHT;
361   Key_Shift_Cursor_Right      : Special_Key_Code renames KEY_SRIGHT;
362   KEY_SRSUME                  : constant Special_Key_Code
363     := Curses_Constants.KEY_SRSUME;
364   Key_Shift_Resume            : Special_Key_Code renames KEY_SRSUME;
365   KEY_SSAVE                   : constant Special_Key_Code
366     := Curses_Constants.KEY_SSAVE;
367   Key_Shift_Save              : Special_Key_Code renames KEY_SSAVE;
368   KEY_SSUSPEND                : constant Special_Key_Code
369     := Curses_Constants.KEY_SSUSPEND;
370   Key_Shift_Suspend           : Special_Key_Code renames KEY_SSUSPEND;
371   KEY_SUNDO                   : constant Special_Key_Code
372     := Curses_Constants.KEY_SUNDO;
373   Key_Shift_Undo              : Special_Key_Code renames KEY_SUNDO;
374   Key_Suspend                 : constant Special_Key_Code
375     := Curses_Constants.KEY_SUSPEND;
376   Key_Undo                    : constant Special_Key_Code
377     := Curses_Constants.KEY_UNDO;
378   Key_Mouse                   : constant Special_Key_Code
379     := Curses_Constants.KEY_MOUSE;
380   Key_Resize                  : constant Special_Key_Code
381     := Curses_Constants.KEY_RESIZE;
382   Key_Max                     : constant Special_Key_Code
383     := Special_Key_Code'Last;
384
385   subtype User_Key_Code is Key_Code
386     range (Key_Max + 129) .. Key_Code'Last;
387   --  This is reserved for user defined key codes. The range between Key_Max
388   --  and the first user code is reserved for subsystems like menu and forms.
389
390   --------------------------------------------------------------------------
391
392   type Color_Number is range -1 .. Integer (Interfaces.C.short'Last);
393   for Color_Number'Size use Interfaces.C.short'Size;
394   --  (n)curses uses a short for the color index
395   --  The model is, that a Color_Number is an index into an array of
396   --  (potentially) definable colors. Some of those indices are
397   --  predefined (see below), although they may not really exist.
398
399   Black   : constant Color_Number := Curses_Constants.COLOR_BLACK;
400   Red     : constant Color_Number := Curses_Constants.COLOR_RED;
401   Green   : constant Color_Number := Curses_Constants.COLOR_GREEN;
402   Yellow  : constant Color_Number := Curses_Constants.COLOR_YELLOW;
403   Blue    : constant Color_Number := Curses_Constants.COLOR_BLUE;
404   Magenta : constant Color_Number := Curses_Constants.COLOR_MAGENTA;
405   Cyan    : constant Color_Number := Curses_Constants.COLOR_CYAN;
406   White   : constant Color_Number := Curses_Constants.COLOR_WHITE;
407
408   type RGB_Value is range 0 .. Integer (Interfaces.C.short'Last);
409   for RGB_Value'Size use Interfaces.C.short'Size;
410   --  Some system may allow to redefine a color by setting RGB values.
411
412   type Color_Pair is range 0 .. 255;
413   for Color_Pair'Size use 8;
414   subtype Redefinable_Color_Pair is Color_Pair range 1 .. 255;
415   --  (n)curses reserves 1 Byte for the color-pair number. Color Pair 0
416   --  is fixed (Black & White). A color pair is simply a combination of
417   --  two colors described by Color_Numbers, one for the foreground and
418   --  the other for the background
419
420   type Character_Attribute_Set is
421      record
422         Stand_Out               : Boolean;
423         Under_Line              : Boolean;
424         Reverse_Video           : Boolean;
425         Blink                   : Boolean;
426         Dim_Character           : Boolean;
427         Bold_Character          : Boolean;
428         Protected_Character     : Boolean;
429         Invisible_Character     : Boolean;
430         Alternate_Character_Set : Boolean;
431         Horizontal              : Boolean;
432         Left                    : Boolean;
433         Low                     : Boolean;
434         Right                   : Boolean;
435         Top                     : Boolean;
436         Vertical                : Boolean;
437      end record;
438
439   for Character_Attribute_Set use
440      record
441         Stand_Out at 0 range
442           Curses_Constants.A_STANDOUT_First - Curses_Constants.Attr_First
443           .. Curses_Constants.A_STANDOUT_Last - Curses_Constants.Attr_First;
444         Under_Line at 0 range
445           Curses_Constants.A_UNDERLINE_First - Curses_Constants.Attr_First
446           .. Curses_Constants.A_UNDERLINE_Last - Curses_Constants.Attr_First;
447         Reverse_Video at 0 range
448           Curses_Constants.A_REVERSE_First - Curses_Constants.Attr_First
449           .. Curses_Constants.A_REVERSE_Last - Curses_Constants.Attr_First;
450         Blink at 0 range
451           Curses_Constants.A_BLINK_First - Curses_Constants.Attr_First
452           .. Curses_Constants.A_BLINK_Last - Curses_Constants.Attr_First;
453         Dim_Character at 0 range
454           Curses_Constants.A_DIM_First - Curses_Constants.Attr_First
455           .. Curses_Constants.A_DIM_Last - Curses_Constants.Attr_First;
456         Bold_Character at 0 range
457           Curses_Constants.A_BOLD_First - Curses_Constants.Attr_First
458           .. Curses_Constants.A_BOLD_Last - Curses_Constants.Attr_First;
459         Protected_Character at 0 range
460           Curses_Constants.A_PROTECT_First - Curses_Constants.Attr_First
461           .. Curses_Constants.A_PROTECT_Last - Curses_Constants.Attr_First;
462         Invisible_Character at 0 range
463           Curses_Constants.A_INVIS_First - Curses_Constants.Attr_First
464           .. Curses_Constants.A_INVIS_Last - Curses_Constants.Attr_First;
465         Alternate_Character_Set at 0 range
466           Curses_Constants.A_ALTCHARSET_First - Curses_Constants.Attr_First
467           .. Curses_Constants.A_ALTCHARSET_Last - Curses_Constants.Attr_First;
468         Horizontal at 0 range
469           Curses_Constants.A_HORIZONTAL_First - Curses_Constants.Attr_First
470           .. Curses_Constants.A_HORIZONTAL_Last - Curses_Constants.Attr_First;
471         Left at 0 range
472           Curses_Constants.A_LEFT_First - Curses_Constants.Attr_First
473           .. Curses_Constants.A_LEFT_Last - Curses_Constants.Attr_First;
474         Low at 0 range
475           Curses_Constants.A_LOW_First - Curses_Constants.Attr_First
476           .. Curses_Constants.A_LOW_Last - Curses_Constants.Attr_First;
477         Right at 0 range
478           Curses_Constants.A_RIGHT_First - Curses_Constants.Attr_First
479           .. Curses_Constants.A_RIGHT_Last - Curses_Constants.Attr_First;
480         Top at 0 range
481           Curses_Constants.A_TOP_First - Curses_Constants.Attr_First
482           .. Curses_Constants.A_TOP_Last - Curses_Constants.Attr_First;
483         Vertical at 0 range
484           Curses_Constants.A_VERTICAL_First - Curses_Constants.Attr_First
485           .. Curses_Constants.A_VERTICAL_Last - Curses_Constants.Attr_First;
486      end record;
487
488   Normal_Video : constant Character_Attribute_Set := (others => False);
489
490   type Attributed_Character is
491      record
492         Attr  : Character_Attribute_Set;
493         Color : Color_Pair;
494         Ch    : Character;
495      end record;
496   pragma Convention (C_Pass_By_Copy, Attributed_Character);
497   --  This is the counterpart for the chtype in C.
498
499   for Attributed_Character use
500      record
501         Ch    at 0 range Curses_Constants.A_CHARTEXT_First
502           .. Curses_Constants.A_CHARTEXT_Last;
503         Color at 0 range Curses_Constants.A_COLOR_First
504           .. Curses_Constants.A_COLOR_Last;
505         pragma Warnings (Off);
506         Attr  at 0 range Curses_Constants.Attr_First
507           .. Curses_Constants.Attr_Last;
508         pragma Warnings (On);
509      end record;
510   for Attributed_Character'Size use Curses_Constants.chtype_Size;
511
512   Default_Character : constant Attributed_Character
513     := (Ch    => Character'First,
514         Color => Color_Pair'First,
515         Attr  => (others => False));  --  preelaboratable Normal_Video
516
517   type Attributed_String is array (Positive range <>) of Attributed_Character;
518   pragma Convention (C, Attributed_String);
519   --  In this binding we allow strings of attributed characters.
520
521   ------------------
522   --  Exceptions  --
523   ------------------
524   Curses_Exception     : exception;
525   Wrong_Curses_Version : exception;
526
527   --  Those exceptions are raised by the ETI (Extended Terminal Interface)
528   --  subpackets for Menu and Forms handling.
529   --
530   Eti_System_Error    : exception;
531   Eti_Bad_Argument    : exception;
532   Eti_Posted          : exception;
533   Eti_Connected       : exception;
534   Eti_Bad_State       : exception;
535   Eti_No_Room         : exception;
536   Eti_Not_Posted      : exception;
537   Eti_Unknown_Command : exception;
538   Eti_No_Match        : exception;
539   Eti_Not_Selectable  : exception;
540   Eti_Not_Connected   : exception;
541   Eti_Request_Denied  : exception;
542   Eti_Invalid_Field   : exception;
543   Eti_Current         : exception;
544
545   --------------------------------------------------------------------------
546   --  External C variables
547   --  Conceptually even in C this are kind of constants, but they are
548   --  initialized and sometimes changed by the library routines at runtime
549   --  depending on the type of terminal. I believe the best way to model
550   --  this is to use functions.
551   --------------------------------------------------------------------------
552
553   function Lines            return Line_Count;
554   pragma Inline (Lines);
555
556   function Columns          return Column_Count;
557   pragma Inline (Columns);
558
559   function Tab_Size         return Natural;
560   pragma Inline (Tab_Size);
561
562   function Number_Of_Colors return Natural;
563   pragma Inline (Number_Of_Colors);
564
565   function Number_Of_Color_Pairs return Natural;
566   pragma Inline (Number_Of_Color_Pairs);
567
568   subtype ACS_Index is Character range
569     Character'Val (0) .. Character'Val (127);
570   function ACS_Map (Index : ACS_Index) return Attributed_Character;
571   pragma Import (C, ACS_Map, "acs_map_as_function");
572
573   --  Constants for several characters from the Alternate Character Set
574   --  You must use these constants as indices into the ACS_Map function
575   --  to get the corresponding attributed character at runtime
576   ACS_Upper_Left_Corner  : constant ACS_Index
577      := Character'Val (Curses_Constants.ACS_ULCORNER);
578   ACS_Lower_Left_Corner  : constant ACS_Index
579      := Character'Val (Curses_Constants.ACS_LLCORNER);
580   ACS_Upper_Right_Corner : constant ACS_Index
581      := Character'Val (Curses_Constants.ACS_URCORNER);
582   ACS_Lower_Right_Corner : constant ACS_Index
583      := Character'Val (Curses_Constants.ACS_LRCORNER);
584   ACS_Left_Tee           : constant ACS_Index
585      := Character'Val (Curses_Constants.ACS_LTEE);
586   ACS_Right_Tee          : constant ACS_Index
587      := Character'Val (Curses_Constants.ACS_RTEE);
588   ACS_Bottom_Tee         : constant ACS_Index
589      := Character'Val (Curses_Constants.ACS_BTEE);
590   ACS_Top_Tee            : constant ACS_Index
591      := Character'Val (Curses_Constants.ACS_TTEE);
592   ACS_Horizontal_Line    : constant ACS_Index
593      := Character'Val (Curses_Constants.ACS_HLINE);
594   ACS_Vertical_Line      : constant ACS_Index
595      := Character'Val (Curses_Constants.ACS_VLINE);
596   ACS_Plus_Symbol        : constant ACS_Index
597      := Character'Val (Curses_Constants.ACS_PLUS);
598   ACS_Scan_Line_1        : constant ACS_Index
599      := Character'Val (Curses_Constants.ACS_S1);
600   ACS_Scan_Line_9        : constant ACS_Index
601      := Character'Val (Curses_Constants.ACS_S9);
602   ACS_Diamond            : constant ACS_Index
603      := Character'Val (Curses_Constants.ACS_DIAMOND);
604   ACS_Checker_Board      : constant ACS_Index
605      := Character'Val (Curses_Constants.ACS_CKBOARD);
606   ACS_Degree             : constant ACS_Index
607      := Character'Val (Curses_Constants.ACS_DEGREE);
608   ACS_Plus_Minus         : constant ACS_Index
609      := Character'Val (Curses_Constants.ACS_PLMINUS);
610   ACS_Bullet             : constant ACS_Index
611      := Character'Val (Curses_Constants.ACS_BULLET);
612   ACS_Left_Arrow         : constant ACS_Index
613      := Character'Val (Curses_Constants.ACS_LARROW);
614   ACS_Right_Arrow        : constant ACS_Index
615      := Character'Val (Curses_Constants.ACS_RARROW);
616   ACS_Down_Arrow         : constant ACS_Index
617      := Character'Val (Curses_Constants.ACS_DARROW);
618   ACS_Up_Arrow           : constant ACS_Index
619      := Character'Val (Curses_Constants.ACS_UARROW);
620   ACS_Board_Of_Squares   : constant ACS_Index
621      := Character'Val (Curses_Constants.ACS_BOARD);
622   ACS_Lantern            : constant ACS_Index
623      := Character'Val (Curses_Constants.ACS_LANTERN);
624   ACS_Solid_Block        : constant ACS_Index
625      := Character'Val (Curses_Constants.ACS_BLOCK);
626   ACS_Scan_Line_3        : constant ACS_Index
627      := Character'Val (Curses_Constants.ACS_S3);
628   ACS_Scan_Line_7        : constant ACS_Index
629      := Character'Val (Curses_Constants.ACS_S7);
630   ACS_Less_Or_Equal      : constant ACS_Index
631      := Character'Val (Curses_Constants.ACS_LEQUAL);
632   ACS_Greater_Or_Equal   : constant ACS_Index
633      := Character'Val (Curses_Constants.ACS_GEQUAL);
634   ACS_PI                 : constant ACS_Index
635      := Character'Val (Curses_Constants.ACS_PI);
636   ACS_Not_Equal          : constant ACS_Index
637      := Character'Val (Curses_Constants.ACS_NEQUAL);
638   ACS_Sterling           : constant ACS_Index
639      := Character'Val (Curses_Constants.ACS_STERLING);
640
641   --  MANPAGE(`curs_initscr.3x')
642   --  | Not implemented: newterm, set_term, delscreen
643
644   --  ANCHOR(`stdscr',`Standard_Window')
645   function Standard_Window return Window;
646   --  AKA
647   pragma Import (C, Standard_Window, "stdscr_as_function");
648   pragma Inline (Standard_Window);
649
650   --  ANCHOR(`curscr',`Current_Window')
651   function Current_Window return Window;
652   --  AKA
653   pragma Import (C, Current_Window, "curscr_as_function");
654   pragma Inline (Current_Window);
655
656   --  ANCHOR(`initscr()',`Init_Screen')
657   procedure Init_Screen;
658
659   --  ANCHOR(`initscr()',`Init_Windows')
660   procedure Init_Windows renames Init_Screen;
661   --  AKA
662   pragma Inline (Init_Screen);
663   --  pragma Inline (Init_Windows);
664
665   --  ANCHOR(`endwin()',`End_Windows')
666   procedure End_Windows;
667   --  AKA
668   procedure End_Screen renames End_Windows;
669   pragma Inline (End_Windows);
670   --  pragma Inline (End_Screen);
671
672   --  ANCHOR(`isendwin()',`Is_End_Window')
673   function Is_End_Window return Boolean;
674   --  AKA
675   pragma Inline (Is_End_Window);
676
677   --  MANPAGE(`curs_move.3x')
678
679   --  ANCHOR(`wmove()',`Move_Cursor')
680   procedure Move_Cursor (Win    : Window := Standard_Window;
681                          Line   : Line_Position;
682                          Column : Column_Position);
683   --  AKA
684   --  ALIAS(`move()')
685   pragma Inline (Move_Cursor);
686
687   --  MANPAGE(`curs_addch.3x')
688
689   --  ANCHOR(`waddch()',`Add')
690   procedure Add (Win : Window := Standard_Window;
691                  Ch  : Attributed_Character);
692   --  AKA
693   --  ALIAS(`addch()')
694
695   procedure Add (Win : Window := Standard_Window;
696                  Ch  : Character);
697   --  Add a single character at the current logical cursor position to
698   --  the window. Use the current windows attributes.
699
700   --  ANCHOR(`mvwaddch()',`Add')
701   procedure Add
702     (Win    : Window := Standard_Window;
703      Line   : Line_Position;
704      Column : Column_Position;
705      Ch     : Attributed_Character);
706   --  AKA
707   --  ALIAS(`mvaddch()')
708
709   procedure Add
710     (Win    : Window := Standard_Window;
711      Line   : Line_Position;
712      Column : Column_Position;
713      Ch     : Character);
714   --  Move to the position and add a single character into the window
715   --  There are more Add routines, so the Inline pragma follows later
716
717   --  ANCHOR(`wechochar()',`Add_With_Immediate_Echo')
718   procedure Add_With_Immediate_Echo
719     (Win : Window := Standard_Window;
720      Ch  : Attributed_Character);
721   --  AKA
722   --  ALIAS(`echochar()')
723
724   procedure Add_With_Immediate_Echo
725     (Win : Window := Standard_Window;
726      Ch  : Character);
727   --  Add a character and do an immediate refresh of the screen.
728   pragma Inline (Add_With_Immediate_Echo);
729
730   --  MANPAGE(`curs_window.3x')
731   --  Not Implemented: wcursyncup
732
733   --  ANCHOR(`newwin()',`Create')
734   function Create
735     (Number_Of_Lines       : Line_Count;
736      Number_Of_Columns     : Column_Count;
737      First_Line_Position   : Line_Position;
738      First_Column_Position : Column_Position) return Window;
739   --  Not Implemented: Default Number_Of_Lines, Number_Of_Columns
740   --  the C version lets them be 0, see the man page.
741   --  AKA
742   pragma Inline (Create);
743
744   function New_Window
745     (Number_Of_Lines       : Line_Count;
746      Number_Of_Columns     : Column_Count;
747      First_Line_Position   : Line_Position;
748      First_Column_Position : Column_Position) return Window
749     renames Create;
750   --  pragma Inline (New_Window);
751
752   --  ANCHOR(`delwin()',`Delete')
753   procedure Delete (Win : in out Window);
754   --  AKA
755   --  Reset Win to Null_Window
756   pragma Inline (Delete);
757
758   --  ANCHOR(`subwin()',`Sub_Window')
759   function Sub_Window
760     (Win                   : Window := Standard_Window;
761      Number_Of_Lines       : Line_Count;
762      Number_Of_Columns     : Column_Count;
763      First_Line_Position   : Line_Position;
764      First_Column_Position : Column_Position) return Window;
765   --  AKA
766   pragma Inline (Sub_Window);
767
768   --  ANCHOR(`derwin()',`Derived_Window')
769   function Derived_Window
770     (Win                   : Window := Standard_Window;
771      Number_Of_Lines       : Line_Count;
772      Number_Of_Columns     : Column_Count;
773      First_Line_Position   : Line_Position;
774      First_Column_Position : Column_Position) return Window;
775   --  AKA
776   pragma Inline (Derived_Window);
777
778   --  ANCHOR(`dupwin()',`Duplicate')
779   function Duplicate (Win : Window) return Window;
780   --  AKA
781   pragma Inline (Duplicate);
782
783   --  ANCHOR(`mvwin()',`Move_Window')
784   procedure Move_Window (Win    : Window;
785                          Line   : Line_Position;
786                          Column : Column_Position);
787   --  AKA
788   pragma Inline (Move_Window);
789
790   --  ANCHOR(`mvderwin()',`Move_Derived_Window')
791   procedure Move_Derived_Window (Win    : Window;
792                                  Line   : Line_Position;
793                                  Column : Column_Position);
794   --  AKA
795   pragma Inline (Move_Derived_Window);
796
797   --  ANCHOR(`wsyncup()',`Synchronize_Upwards')
798   procedure Synchronize_Upwards (Win : Window);
799   --  AKA
800   pragma Import (C, Synchronize_Upwards, "wsyncup");
801
802   --  ANCHOR(`wsyncdown()',`Synchronize_Downwards')
803   procedure Synchronize_Downwards (Win : Window);
804   --  AKA
805   pragma Import (C, Synchronize_Downwards, "wsyncdown");
806
807   --  ANCHOR(`syncok()',`Set_Synch_Mode')
808   procedure Set_Synch_Mode (Win  : Window := Standard_Window;
809                             Mode : Boolean := False);
810   --  AKA
811   pragma Inline (Set_Synch_Mode);
812
813   --  MANPAGE(`curs_addstr.3x')
814
815   --  ANCHOR(`waddnstr()',`Add')
816   procedure Add (Win : Window := Standard_Window;
817                  Str : String;
818                  Len : Integer := -1);
819   --  AKA
820   --  ALIAS(`waddstr()')
821   --  ALIAS(`addnstr()')
822   --  ALIAS(`addstr()')
823
824   --  ANCHOR(`mvwaddnstr()',`Add')
825   procedure Add (Win    : Window := Standard_Window;
826                  Line   : Line_Position;
827                  Column : Column_Position;
828                  Str    : String;
829                  Len    : Integer := -1);
830   --  AKA
831   --  ALIAS(`mvwaddstr()')
832   --  ALIAS(`mvaddnstr()')
833   --  ALIAS(`mvaddstr()')
834
835   --  MANPAGE(`curs_addchstr.3x')
836
837   --  ANCHOR(`waddchnstr()',`Add')
838   procedure Add (Win : Window := Standard_Window;
839                  Str : Attributed_String;
840                  Len : Integer := -1);
841   --  AKA
842   --  ALIAS(`waddchstr()')
843   --  ALIAS(`addchnstr()')
844   --  ALIAS(`addchstr()')
845
846   --  ANCHOR(`mvwaddchnstr()',`Add')
847   procedure Add (Win    : Window := Standard_Window;
848                  Line   : Line_Position;
849                  Column : Column_Position;
850                  Str    : Attributed_String;
851                  Len    : Integer := -1);
852   --  AKA
853   --  ALIAS(`mvwaddchstr()')
854   --  ALIAS(`mvaddchnstr()')
855   --  ALIAS(`mvaddchstr()')
856   pragma Inline (Add);
857
858   --  MANPAGE(`curs_border.3x')
859   --  | Not implemented: mvhline,  mvwhline, mvvline, mvwvline
860   --  | use Move_Cursor then Horizontal_Line or Vertical_Line
861
862   --  ANCHOR(`wborder()',`Border')
863   procedure Border
864     (Win                       : Window := Standard_Window;
865      Left_Side_Symbol          : Attributed_Character := Default_Character;
866      Right_Side_Symbol         : Attributed_Character := Default_Character;
867      Top_Side_Symbol           : Attributed_Character := Default_Character;
868      Bottom_Side_Symbol        : Attributed_Character := Default_Character;
869      Upper_Left_Corner_Symbol  : Attributed_Character := Default_Character;
870      Upper_Right_Corner_Symbol : Attributed_Character := Default_Character;
871      Lower_Left_Corner_Symbol  : Attributed_Character := Default_Character;
872      Lower_Right_Corner_Symbol : Attributed_Character := Default_Character
873     );
874   --  AKA
875   --  ALIAS(`border()')
876   pragma Inline (Border);
877
878   --  ANCHOR(`box()',`Box')
879   procedure Box
880     (Win               : Window := Standard_Window;
881      Vertical_Symbol   : Attributed_Character := Default_Character;
882      Horizontal_Symbol : Attributed_Character := Default_Character);
883   --  AKA
884   pragma Inline (Box);
885
886   --  ANCHOR(`whline()',`Horizontal_Line')
887   procedure Horizontal_Line
888     (Win         : Window := Standard_Window;
889      Line_Size   : Natural;
890      Line_Symbol : Attributed_Character := Default_Character);
891   --  AKA
892   --  ALIAS(`hline()')
893   pragma Inline (Horizontal_Line);
894
895   --  ANCHOR(`wvline()',`Vertical_Line')
896   procedure Vertical_Line
897     (Win         : Window := Standard_Window;
898      Line_Size   : Natural;
899      Line_Symbol : Attributed_Character := Default_Character);
900   --  AKA
901   --  ALIAS(`vline()')
902   pragma Inline (Vertical_Line);
903
904   --  MANPAGE(`curs_getch.3x')
905   --  Not implemented: mvgetch, mvwgetch
906
907   --  ANCHOR(`wgetch()',`Get_Keystroke')
908   function Get_Keystroke (Win : Window := Standard_Window)
909                           return Real_Key_Code;
910   --  AKA
911   --  ALIAS(`getch()')
912   --  Get a character from the keyboard and echo it - if enabled - to the
913   --  window.
914   --  If for any reason (i.e. a timeout) we could not get a character the
915   --  returned keycode is Key_None.
916   pragma Inline (Get_Keystroke);
917
918   --  ANCHOR(`ungetch()',`Undo_Keystroke')
919   procedure Undo_Keystroke (Key : Real_Key_Code);
920   --  AKA
921   pragma Inline (Undo_Keystroke);
922
923   --  ANCHOR(`has_key()',`Has_Key')
924   function Has_Key (Key : Special_Key_Code) return Boolean;
925   --  AKA
926   pragma Inline (Has_Key);
927
928   --  |
929   --  | Some helper functions
930   --  |
931   function Is_Function_Key (Key : Special_Key_Code) return Boolean;
932   --  Return True if the Key is a function key (i.e. one of F0 .. F63)
933   pragma Inline (Is_Function_Key);
934
935   subtype Function_Key_Number is Integer range 0 .. 63;
936   --  (n)curses allows for 64 function keys.
937
938   function Function_Key (Key : Real_Key_Code) return Function_Key_Number;
939   --  Return the number of the function key. If the code is not a
940   --  function key, a CONSTRAINT_ERROR will be raised.
941   pragma Inline (Function_Key);
942
943   function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code;
944   --  Return the key code for a given function-key number.
945   pragma Inline (Function_Key_Code);
946
947   --  MANPAGE(`curs_attr.3x')
948   --  | Not implemented attr_off,  wattr_off,
949   --  |  attr_on, wattr_on, attr_set, wattr_set
950
951   --  PAIR_NUMBER
952   --  PAIR_NUMBER(c) is the same as c.Color
953
954   --  ANCHOR(`standout()',`Standout')
955   procedure Standout (Win : Window  := Standard_Window;
956                       On  : Boolean := True);
957   --  ALIAS(`wstandout()')
958   --  ALIAS(`wstandend()')
959
960   --  ANCHOR(`wattron()',`Switch_Character_Attribute')
961   procedure Switch_Character_Attribute
962     (Win  : Window := Standard_Window;
963      Attr : Character_Attribute_Set := Normal_Video;
964      On   : Boolean := True); --  if False we switch Off.
965   --  Switches those Attributes set to true in the list.
966   --  AKA
967   --  ALIAS(`wattroff()')
968   --  ALIAS(`attron()')
969   --  ALIAS(`attroff()')
970
971   --  ANCHOR(`wattrset()',`Set_Character_Attributes')
972   procedure Set_Character_Attributes
973     (Win   : Window := Standard_Window;
974      Attr  : Character_Attribute_Set := Normal_Video;
975      Color : Color_Pair := Color_Pair'First);
976   --  AKA
977   --  ALIAS(`attrset()')
978   pragma Inline (Set_Character_Attributes);
979
980   --  ANCHOR(`wattr_get()',`Get_Character_Attributes')
981   function Get_Character_Attribute
982     (Win : Window := Standard_Window) return Character_Attribute_Set;
983   --  AKA
984   --  ALIAS(`attr_get()')
985
986   --  ANCHOR(`wattr_get()',`Get_Character_Attribute')
987   function Get_Character_Attribute
988     (Win : Window := Standard_Window) return Color_Pair;
989   --  AKA
990   pragma Inline (Get_Character_Attribute);
991
992   --  ANCHOR(`wcolor_set()',`Set_Color')
993   procedure Set_Color (Win  : Window := Standard_Window;
994                        Pair : Color_Pair);
995   --  AKA
996   --  ALIAS(`color_set()')
997   pragma Inline (Set_Color);
998
999   --  ANCHOR(`wchgat()',`Change_Attributes')
1000   procedure Change_Attributes
1001     (Win   : Window := Standard_Window;
1002      Count : Integer := -1;
1003      Attr  : Character_Attribute_Set := Normal_Video;
1004      Color : Color_Pair := Color_Pair'First);
1005   --  AKA
1006   --  ALIAS(`chgat()')
1007
1008   --  ANCHOR(`mvwchgat()',`Change_Attributes')
1009   procedure Change_Attributes
1010     (Win    : Window := Standard_Window;
1011      Line   : Line_Position := Line_Position'First;
1012      Column : Column_Position := Column_Position'First;
1013      Count  : Integer := -1;
1014      Attr   : Character_Attribute_Set := Normal_Video;
1015      Color  : Color_Pair := Color_Pair'First);
1016   --  AKA
1017   --  ALIAS(`mvchgat()')
1018   pragma Inline (Change_Attributes);
1019
1020   --  MANPAGE(`curs_beep.3x')
1021
1022   --  ANCHOR(`beep()',`Beep')
1023   procedure Beep;
1024   --  AKA
1025   pragma Inline (Beep);
1026
1027   --  ANCHOR(`flash()',`Flash_Screen')
1028   procedure Flash_Screen;
1029   --  AKA
1030   pragma Inline (Flash_Screen);
1031
1032   --  MANPAGE(`curs_inopts.3x')
1033
1034   --  | Not implemented : typeahead
1035   --
1036   --  ANCHOR(`cbreak()',`Set_Cbreak_Mode')
1037   procedure Set_Cbreak_Mode (SwitchOn : Boolean := True);
1038   --  AKA
1039   --  ALIAS(`nocbreak()')
1040   pragma Inline (Set_Cbreak_Mode);
1041
1042   --  ANCHOR(`raw()',`Set_Raw_Mode')
1043   procedure Set_Raw_Mode (SwitchOn : Boolean := True);
1044   --  AKA
1045   --  ALIAS(`noraw()')
1046   pragma Inline (Set_Raw_Mode);
1047
1048   --  ANCHOR(`echo()',`Set_Echo_Mode')
1049   procedure Set_Echo_Mode (SwitchOn : Boolean := True);
1050   --  AKA
1051   --  ALIAS(`noecho()')
1052   pragma Inline (Set_Echo_Mode);
1053
1054   --  ANCHOR(`meta()',`Set_Meta_Mode')
1055   procedure Set_Meta_Mode (Win      : Window := Standard_Window;
1056                            SwitchOn : Boolean := True);
1057   --  AKA
1058   pragma Inline (Set_Meta_Mode);
1059
1060   --  ANCHOR(`keypad()',`Set_KeyPad_Mode')
1061   procedure Set_KeyPad_Mode (Win      : Window := Standard_Window;
1062                              SwitchOn : Boolean := True);
1063   --  AKA
1064   pragma Inline (Set_KeyPad_Mode);
1065
1066   function Get_KeyPad_Mode (Win : Window := Standard_Window)
1067                             return Boolean;
1068   --  This has no pendant in C. There you've to look into the WINDOWS
1069   --  structure to get the value. Bad practice, not repeated in Ada.
1070
1071   type Half_Delay_Amount is range 1 .. 255;
1072
1073   --  ANCHOR(`halfdelay()',`Half_Delay')
1074   procedure Half_Delay (Amount : Half_Delay_Amount);
1075   --  AKA
1076   pragma Inline (Half_Delay);
1077
1078   --  ANCHOR(`intrflush()',`Set_Flush_On_Interrupt_Mode')
1079   procedure Set_Flush_On_Interrupt_Mode
1080     (Win  : Window := Standard_Window;
1081      Mode : Boolean := True);
1082   --  AKA
1083   pragma Inline (Set_Flush_On_Interrupt_Mode);
1084
1085   --  ANCHOR(`qiflush()',`Set_Queue_Interrupt_Mode')
1086   procedure Set_Queue_Interrupt_Mode
1087     (Win   : Window := Standard_Window;
1088      Flush : Boolean := True);
1089   --  AKA
1090   --  ALIAS(`noqiflush()')
1091   pragma Inline (Set_Queue_Interrupt_Mode);
1092
1093   --  ANCHOR(`nodelay()',`Set_NoDelay_Mode')
1094   procedure Set_NoDelay_Mode
1095     (Win  : Window := Standard_Window;
1096      Mode : Boolean := False);
1097   --  AKA
1098   pragma Inline (Set_NoDelay_Mode);
1099
1100   type Timeout_Mode is (Blocking, Non_Blocking, Delayed);
1101
1102   --  ANCHOR(`wtimeout()',`Set_Timeout_Mode')
1103   procedure Set_Timeout_Mode (Win    : Window := Standard_Window;
1104                               Mode   : Timeout_Mode;
1105                               Amount : Natural); --  in Milliseconds
1106   --  AKA
1107   --  ALIAS(`timeout()')
1108   --  Instead of overloading the semantic of the sign of amount, we
1109   --  introduce the Timeout_Mode parameter. This should improve
1110   --  readability. For Blocking and Non_Blocking, the Amount is not
1111   --  evaluated.
1112   --  We do not inline this procedure.
1113
1114   --  ANCHOR(`notimeout()',`Set_Escape_Time_Mode')
1115   procedure Set_Escape_Timer_Mode
1116     (Win       : Window := Standard_Window;
1117      Timer_Off : Boolean := False);
1118   --  AKA
1119   pragma Inline (Set_Escape_Timer_Mode);
1120
1121   --  MANPAGE(`curs_outopts.3x')
1122
1123   --  ANCHOR(`nl()',`Set_NL_Mode')
1124   procedure Set_NL_Mode (SwitchOn : Boolean := True);
1125   --  AKA
1126   --  ALIAS(`nonl()')
1127   pragma Inline (Set_NL_Mode);
1128
1129   --  ANCHOR(`clearok()',`Clear_On_Next_Update')
1130   procedure Clear_On_Next_Update
1131     (Win      : Window := Standard_Window;
1132      Do_Clear : Boolean := True);
1133   --  AKA
1134   pragma Inline (Clear_On_Next_Update);
1135
1136   --  ANCHOR(`idlok()',`Use_Insert_Delete_Line')
1137   procedure Use_Insert_Delete_Line
1138     (Win    : Window := Standard_Window;
1139      Do_Idl : Boolean := True);
1140   --  AKA
1141   pragma Inline (Use_Insert_Delete_Line);
1142
1143   --  ANCHOR(`idcok()',`Use_Insert_Delete_Character')
1144   procedure Use_Insert_Delete_Character
1145     (Win    : Window := Standard_Window;
1146      Do_Idc : Boolean := True);
1147   --  AKA
1148   pragma Inline (Use_Insert_Delete_Character);
1149
1150   --  ANCHOR(`leaveok()',`Leave_Cursor_After_Update')
1151   procedure Leave_Cursor_After_Update
1152     (Win      : Window := Standard_Window;
1153      Do_Leave : Boolean := True);
1154   --  AKA
1155   pragma Inline (Leave_Cursor_After_Update);
1156
1157   --  ANCHOR(`immedok()',`Immediate_Update_Mode')
1158   procedure Immediate_Update_Mode
1159     (Win  : Window := Standard_Window;
1160      Mode : Boolean := False);
1161   --  AKA
1162   pragma Inline (Immediate_Update_Mode);
1163
1164   --  ANCHOR(`scrollok()',`Allow_Scrolling')
1165   procedure Allow_Scrolling
1166     (Win  : Window := Standard_Window;
1167      Mode : Boolean := False);
1168   --  AKA
1169   pragma Inline (Allow_Scrolling);
1170
1171   function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean;
1172   --  There is no such function in the C interface.
1173   pragma Inline (Scrolling_Allowed);
1174
1175   --  ANCHOR(`wsetscrreg()',`Set_Scroll_Region')
1176   procedure Set_Scroll_Region
1177     (Win         : Window := Standard_Window;
1178      Top_Line    : Line_Position;
1179      Bottom_Line : Line_Position);
1180   --  AKA
1181   --  ALIAS(`setscrreg()')
1182   pragma Inline (Set_Scroll_Region);
1183
1184   --  MANPAGE(`curs_refresh.3x')
1185
1186   --  ANCHOR(`doupdate()',`Update_Screen')
1187   procedure Update_Screen;
1188   --  AKA
1189   pragma Inline (Update_Screen);
1190
1191   --  ANCHOR(`wrefresh()',`Refresh')
1192   procedure Refresh (Win : Window := Standard_Window);
1193   --  AKA
1194   --  There is an overloaded Refresh for Pads.
1195   --  The Inline pragma appears there
1196   --  ALIAS(`refresh()')
1197
1198   --  ANCHOR(`wnoutrefresh()',`Refresh_Without_Update')
1199   procedure Refresh_Without_Update
1200     (Win : Window := Standard_Window);
1201   --  AKA
1202   --  There is an overloaded Refresh_Without_Update for Pads.
1203   --  The Inline pragma appears there
1204
1205   --  ANCHOR(`redrawwin()',`Redraw')
1206   procedure Redraw (Win : Window := Standard_Window);
1207   --  AKA
1208
1209   --  ANCHOR(`wredrawln()',`Redraw')
1210   procedure Redraw (Win        : Window := Standard_Window;
1211                     Begin_Line : Line_Position;
1212                     Line_Count : Positive);
1213   --  AKA
1214   pragma Inline (Redraw);
1215
1216   --  MANPAGE(`curs_clear.3x')
1217
1218   --  ANCHOR(`werase()',`Erase')
1219   procedure Erase (Win : Window := Standard_Window);
1220   --  AKA
1221   --  ALIAS(`erase()')
1222   pragma Inline (Erase);
1223
1224   --  ANCHOR(`wclear()',`Clear')
1225   procedure Clear
1226     (Win : Window := Standard_Window);
1227   --  AKA
1228   --  ALIAS(`clear()')
1229   pragma Inline (Clear);
1230
1231   --  ANCHOR(`wclrtobot()',`Clear_To_End_Of_Screen')
1232   procedure Clear_To_End_Of_Screen
1233     (Win : Window := Standard_Window);
1234   --  AKA
1235   --  ALIAS(`clrtobot()')
1236   pragma Inline (Clear_To_End_Of_Screen);
1237
1238   --  ANCHOR(`wclrtoeol()',`Clear_To_End_Of_Line')
1239   procedure Clear_To_End_Of_Line
1240     (Win : Window := Standard_Window);
1241   --  AKA
1242   --  ALIAS(`clrtoeol()')
1243   pragma Inline (Clear_To_End_Of_Line);
1244
1245   --  MANPAGE(`curs_bkgd.3x')
1246
1247   --  ANCHOR(`wbkgdset()',`Set_Background')
1248   --  TODO: we could have Set_Background(Window; Character_Attribute_Set)
1249   --  because in C it is common to see bkgdset(A_BOLD) or
1250   --  bkgdset(COLOR_PAIR(n))
1251   procedure Set_Background
1252     (Win : Window := Standard_Window;
1253      Ch  : Attributed_Character);
1254   --  AKA
1255   --  ALIAS(`bkgdset()')
1256   pragma Inline (Set_Background);
1257
1258   --  ANCHOR(`wbkgd()',`Change_Background')
1259   procedure Change_Background
1260     (Win : Window := Standard_Window;
1261      Ch  : Attributed_Character);
1262   --  AKA
1263   --  ALIAS(`bkgd()')
1264   pragma Inline (Change_Background);
1265
1266   --  ANCHOR(`wbkgdget()',`Get_Background')
1267   --  ? wbkgdget is not listed in curs_bkgd, getbkgd is thpough.
1268   function Get_Background (Win : Window := Standard_Window)
1269     return Attributed_Character;
1270   --  AKA
1271   --  ALIAS(`bkgdget()')
1272   pragma Inline (Get_Background);
1273
1274   --  MANPAGE(`curs_touch.3x')
1275
1276   --  ANCHOR(`untouchwin()',`Untouch')
1277   procedure Untouch (Win : Window := Standard_Window);
1278   --  AKA
1279   pragma Inline (Untouch);
1280
1281   --  ANCHOR(`touchwin()',`Touch')
1282   procedure Touch (Win : Window := Standard_Window);
1283   --  AKA
1284
1285   --  ANCHOR(`touchline()',`Touch')
1286   procedure Touch (Win   : Window := Standard_Window;
1287                    Start : Line_Position;
1288                    Count : Positive);
1289   --  AKA
1290   pragma Inline (Touch);
1291
1292   --  ANCHOR(`wtouchln()',`Change_Line_Status')
1293   procedure Change_Lines_Status (Win   : Window := Standard_Window;
1294                                  Start : Line_Position;
1295                                  Count : Positive;
1296                                  State : Boolean);
1297   --  AKA
1298   pragma Inline (Change_Lines_Status);
1299
1300   --  ANCHOR(`is_linetouched()',`Is_Touched')
1301   function Is_Touched (Win  : Window := Standard_Window;
1302                        Line : Line_Position) return Boolean;
1303   --  AKA
1304
1305   --  ANCHOR(`is_wintouched()',`Is_Touched')
1306   function Is_Touched (Win : Window := Standard_Window) return Boolean;
1307   --  AKA
1308   pragma Inline (Is_Touched);
1309
1310   --  MANPAGE(`curs_overlay.3x')
1311
1312   --  ANCHOR(`copywin()',`Copy')
1313   procedure Copy
1314     (Source_Window            : Window;
1315      Destination_Window       : Window;
1316      Source_Top_Row           : Line_Position;
1317      Source_Left_Column       : Column_Position;
1318      Destination_Top_Row      : Line_Position;
1319      Destination_Left_Column  : Column_Position;
1320      Destination_Bottom_Row   : Line_Position;
1321      Destination_Right_Column : Column_Position;
1322      Non_Destructive_Mode     : Boolean := True);
1323   --  AKA
1324   pragma Inline (Copy);
1325
1326   --  ANCHOR(`overwrite()',`Overwrite')
1327   procedure Overwrite (Source_Window      : Window;
1328                        Destination_Window : Window);
1329   --  AKA
1330   pragma Inline (Overwrite);
1331
1332   --  ANCHOR(`overlay()',`Overlay')
1333   procedure Overlay (Source_Window      : Window;
1334                      Destination_Window : Window);
1335   --  AKA
1336   pragma Inline (Overlay);
1337
1338   --  MANPAGE(`curs_deleteln.3x')
1339
1340   --  ANCHOR(`winsdelln()',`Insert_Delete_Lines')
1341   procedure Insert_Delete_Lines
1342     (Win   : Window  := Standard_Window;
1343      Lines : Integer := 1); --  default is to insert one line above
1344   --  AKA
1345   --  ALIAS(`insdelln()')
1346   pragma Inline (Insert_Delete_Lines);
1347
1348   --  ANCHOR(`wdeleteln()',`Delete_Line')
1349   procedure Delete_Line (Win : Window := Standard_Window);
1350   --  AKA
1351   --  ALIAS(`deleteln()')
1352   pragma Inline (Delete_Line);
1353
1354   --  ANCHOR(`winsertln()',`Insert_Line')
1355   procedure Insert_Line (Win : Window := Standard_Window);
1356   --  AKA
1357   --  ALIAS(`insertln()')
1358   pragma Inline (Insert_Line);
1359
1360   --  MANPAGE(`curs_getyx.3x')
1361
1362   --  ANCHOR(`getmaxyx()',`Get_Size')
1363   procedure Get_Size
1364     (Win               : Window := Standard_Window;
1365      Number_Of_Lines   : out Line_Count;
1366      Number_Of_Columns : out Column_Count);
1367   --  AKA
1368   pragma Inline (Get_Size);
1369
1370   --  ANCHOR(`getbegyx()',`Get_Window_Position')
1371   procedure Get_Window_Position
1372     (Win             : Window := Standard_Window;
1373      Top_Left_Line   : out Line_Position;
1374      Top_Left_Column : out Column_Position);
1375   --  AKA
1376   pragma Inline (Get_Window_Position);
1377
1378   --  ANCHOR(`getyx()',`Get_Cursor_Position')
1379   procedure Get_Cursor_Position
1380     (Win    : Window := Standard_Window;
1381      Line   : out Line_Position;
1382      Column : out Column_Position);
1383   --  AKA
1384   pragma Inline (Get_Cursor_Position);
1385
1386   --  ANCHOR(`getparyx()',`Get_Origin_Relative_To_Parent')
1387   procedure Get_Origin_Relative_To_Parent
1388     (Win                : Window;
1389      Top_Left_Line      : out Line_Position;
1390      Top_Left_Column    : out Column_Position;
1391      Is_Not_A_Subwindow : out Boolean);
1392   --  AKA
1393   --  Instead of placing -1 in the coordinates as return, we use a Boolean
1394   --  to return the info that the window has no parent.
1395   pragma Inline (Get_Origin_Relative_To_Parent);
1396
1397   --  MANPAGE(`curs_pad.3x')
1398
1399   --  ANCHOR(`newpad()',`New_Pad')
1400   function New_Pad (Lines   : Line_Count;
1401                     Columns : Column_Count) return Window;
1402   --  AKA
1403   pragma Inline (New_Pad);
1404
1405   --  ANCHOR(`subpad()',`Sub_Pad')
1406   function Sub_Pad
1407     (Pad                   : Window;
1408      Number_Of_Lines       : Line_Count;
1409      Number_Of_Columns     : Column_Count;
1410      First_Line_Position   : Line_Position;
1411      First_Column_Position : Column_Position) return Window;
1412   --  AKA
1413   pragma Inline (Sub_Pad);
1414
1415   --  ANCHOR(`prefresh()',`Refresh')
1416   procedure Refresh
1417     (Pad                      : Window;
1418      Source_Top_Row           : Line_Position;
1419      Source_Left_Column       : Column_Position;
1420      Destination_Top_Row      : Line_Position;
1421      Destination_Left_Column  : Column_Position;
1422      Destination_Bottom_Row   : Line_Position;
1423      Destination_Right_Column : Column_Position);
1424   --  AKA
1425   pragma Inline (Refresh);
1426
1427   --  ANCHOR(`pnoutrefresh()',`Refresh_Without_Update')
1428   procedure Refresh_Without_Update
1429     (Pad                      : Window;
1430      Source_Top_Row           : Line_Position;
1431      Source_Left_Column       : Column_Position;
1432      Destination_Top_Row      : Line_Position;
1433      Destination_Left_Column  : Column_Position;
1434      Destination_Bottom_Row   : Line_Position;
1435      Destination_Right_Column : Column_Position);
1436   --  AKA
1437   pragma Inline (Refresh_Without_Update);
1438
1439   --  ANCHOR(`pechochar()',`Add_Character_To_Pad_And_Echo_It')
1440   procedure Add_Character_To_Pad_And_Echo_It
1441     (Pad : Window;
1442      Ch  : Attributed_Character);
1443   --  AKA
1444
1445   procedure Add_Character_To_Pad_And_Echo_It
1446     (Pad : Window;
1447      Ch  : Character);
1448   pragma Inline (Add_Character_To_Pad_And_Echo_It);
1449
1450   --  MANPAGE(`curs_scroll.3x')
1451
1452   --  ANCHOR(`wscrl()',`Scroll')
1453   procedure Scroll (Win    : Window  := Standard_Window;
1454                     Amount : Integer := 1);
1455   --  AKA
1456   --  ALIAS(`scroll()')
1457   --  ALIAS(`scrl()')
1458   pragma Inline (Scroll);
1459
1460   --  MANPAGE(`curs_delch.3x')
1461
1462   --  ANCHOR(`wdelch()',`Delete_Character')
1463   procedure Delete_Character (Win : Window := Standard_Window);
1464   --  AKA
1465   --  ALIAS(`delch()')
1466
1467   --  ANCHOR(`mvwdelch()',`Delete_Character')
1468   procedure Delete_Character
1469     (Win    : Window := Standard_Window;
1470      Line   : Line_Position;
1471      Column : Column_Position);
1472   --  AKA
1473   --  ALIAS(`mvdelch()')
1474   pragma Inline (Delete_Character);
1475
1476   --  MANPAGE(`curs_inch.3x')
1477
1478   --  ANCHOR(`winch()',`Peek')
1479   function Peek (Win : Window := Standard_Window)
1480     return Attributed_Character;
1481   --  ALIAS(`inch()')
1482   --  AKA
1483
1484   --  ANCHOR(`mvwinch()',`Peek')
1485   function Peek
1486     (Win    : Window := Standard_Window;
1487      Line   : Line_Position;
1488      Column : Column_Position) return Attributed_Character;
1489   --  AKA
1490   --  ALIAS(`mvinch()')
1491   --  More Peek's follow, pragma Inline appears later.
1492
1493   --  MANPAGE(`curs_insch.3x')
1494
1495   --  ANCHOR(`winsch()',`Insert')
1496   procedure Insert (Win : Window := Standard_Window;
1497                     Ch  : Attributed_Character);
1498   --  AKA
1499   --  ALIAS(`insch()')
1500
1501   --  ANCHOR(`mvwinsch()',`Insert')
1502   procedure Insert (Win    : Window := Standard_Window;
1503                     Line   : Line_Position;
1504                     Column : Column_Position;
1505                     Ch     : Attributed_Character);
1506   --  AKA
1507   --  ALIAS(`mvinsch()')
1508
1509   --  MANPAGE(`curs_insstr.3x')
1510
1511   --  ANCHOR(`winsnstr()',`Insert')
1512   procedure Insert (Win : Window := Standard_Window;
1513                     Str : String;
1514                     Len : Integer := -1);
1515   --  AKA
1516   --  ALIAS(`winsstr()')
1517   --  ALIAS(`insnstr()')
1518   --  ALIAS(`insstr()')
1519
1520   --  ANCHOR(`mvwinsnstr()',`Insert')
1521   procedure Insert (Win    : Window := Standard_Window;
1522                     Line   : Line_Position;
1523                     Column : Column_Position;
1524                     Str    : String;
1525                     Len    : Integer := -1);
1526   --  AKA
1527   --  ALIAS(`mvwinsstr()')
1528   --  ALIAS(`mvinsnstr()')
1529   --  ALIAS(`mvinsstr()')
1530   pragma Inline (Insert);
1531
1532   --  MANPAGE(`curs_instr.3x')
1533
1534   --  ANCHOR(`winnstr()',`Peek')
1535   procedure Peek (Win : Window := Standard_Window;
1536                   Str : out String;
1537                   Len : Integer := -1);
1538   --  AKA
1539   --  ALIAS(`winstr()')
1540   --  ALIAS(`innstr()')
1541   --  ALIAS(`instr()')
1542
1543   --  ANCHOR(`mvwinnstr()',`Peek')
1544   procedure Peek (Win    : Window := Standard_Window;
1545                   Line   : Line_Position;
1546                   Column : Column_Position;
1547                   Str    : out String;
1548                   Len    : Integer := -1);
1549   --  AKA
1550   --  ALIAS(`mvwinstr()')
1551   --  ALIAS(`mvinnstr()')
1552   --  ALIAS(`mvinstr()')
1553
1554   --  MANPAGE(`curs_inchstr.3x')
1555
1556   --  ANCHOR(`winchnstr()',`Peek')
1557   procedure Peek (Win : Window := Standard_Window;
1558                   Str : out Attributed_String;
1559                   Len : Integer := -1);
1560   --  AKA
1561   --  ALIAS(`winchstr()')
1562   --  ALIAS(`inchnstr()')
1563   --  ALIAS(`inchstr()')
1564
1565   --  ANCHOR(`mvwinchnstr()',`Peek')
1566   procedure Peek (Win    : Window := Standard_Window;
1567                   Line   : Line_Position;
1568                   Column : Column_Position;
1569                   Str    : out Attributed_String;
1570                   Len    : Integer := -1);
1571   --  AKA
1572   --  ALIAS(`mvwinchstr()')
1573   --  ALIAS(`mvinchnstr()')
1574   --  ALIAS(`mvinchstr()')
1575   --  We do not inline the Peek procedures
1576
1577   --  MANPAGE(`curs_getstr.3x')
1578
1579   --  ANCHOR(`wgetnstr()',`Get')
1580   procedure Get (Win : Window := Standard_Window;
1581                  Str : out String;
1582                  Len : Integer := -1);
1583   --  AKA
1584   --  ALIAS(`wgetstr()')
1585   --  ALIAS(`getnstr()')
1586   --  ALIAS(`getstr()')
1587   --  actually getstr is not supported because that results in buffer
1588   --  overflows.
1589
1590   --  ANCHOR(`mvwgetnstr()',`Get')
1591   procedure Get (Win    : Window := Standard_Window;
1592                  Line   : Line_Position;
1593                  Column : Column_Position;
1594                  Str    : out String;
1595                  Len    : Integer := -1);
1596   --  AKA
1597   --  ALIAS(`mvwgetstr()')
1598   --  ALIAS(`mvgetnstr()')
1599   --  ALIAS(`mvgetstr()')
1600   --  Get is not inlined
1601
1602   --  MANPAGE(`curs_slk.3x')
1603
1604   --  Not Implemented: slk_attr_on, slk_attr_off, slk_attr_set
1605
1606   type Soft_Label_Key_Format is (Three_Two_Three,
1607                                  Four_Four,
1608                                  PC_Style,              --  ncurses specific
1609                                  PC_Style_With_Index);  --  "
1610   type Label_Number is new Positive range 1 .. 12;
1611   type Label_Justification is (Left, Centered, Right);
1612
1613   --  ANCHOR(`slk_init()',`Init_Soft_Label_Keys')
1614   procedure Init_Soft_Label_Keys
1615     (Format : Soft_Label_Key_Format := Three_Two_Three);
1616   --  AKA
1617   pragma Inline (Init_Soft_Label_Keys);
1618
1619   --  ANCHOR(`slk_set()',`Set_Soft_Label_Key')
1620   procedure Set_Soft_Label_Key (Label : Label_Number;
1621                                 Text  : String;
1622                                 Fmt   : Label_Justification := Left);
1623   --  AKA
1624   --  We do not inline this procedure
1625
1626   --  ANCHOR(`slk_refresh()',`Refresh_Soft_Label_Key')
1627   procedure Refresh_Soft_Label_Keys;
1628   --  AKA
1629   pragma Inline (Refresh_Soft_Label_Keys);
1630
1631   --  ANCHOR(`slk_noutrefresh()',`Refresh_Soft_Label_Keys_Without_Update')
1632   procedure Refresh_Soft_Label_Keys_Without_Update;
1633   --  AKA
1634   pragma Inline (Refresh_Soft_Label_Keys_Without_Update);
1635
1636   --  ANCHOR(`slk_label()',`Get_Soft_Label_Key')
1637   procedure Get_Soft_Label_Key (Label : Label_Number;
1638                                 Text  : out String);
1639   --  AKA
1640
1641   --  ANCHOR(`slk_label()',`Get_Soft_Label_Key')
1642   function Get_Soft_Label_Key (Label : Label_Number) return String;
1643   --  AKA
1644   --  Same as function
1645   pragma Inline (Get_Soft_Label_Key);
1646
1647   --  ANCHOR(`slk_clear()',`Clear_Soft_Label_Keys')
1648   procedure Clear_Soft_Label_Keys;
1649   --  AKA
1650   pragma Inline (Clear_Soft_Label_Keys);
1651
1652   --  ANCHOR(`slk_restore()',`Restore_Soft_Label_Keys')
1653   procedure Restore_Soft_Label_Keys;
1654   --  AKA
1655   pragma Inline (Restore_Soft_Label_Keys);
1656
1657   --  ANCHOR(`slk_touch()',`Touch_Soft_Label_Keys')
1658   procedure Touch_Soft_Label_Keys;
1659   --  AKA
1660   pragma Inline (Touch_Soft_Label_Keys);
1661
1662   --  ANCHOR(`slk_attron()',`Switch_Soft_Label_Key_Attributes')
1663   procedure Switch_Soft_Label_Key_Attributes
1664     (Attr : Character_Attribute_Set;
1665      On   : Boolean := True);
1666   --  AKA
1667   --  ALIAS(`slk_attroff()')
1668   pragma Inline (Switch_Soft_Label_Key_Attributes);
1669
1670   --  ANCHOR(`slk_attrset()',`Set_Soft_Label_Key_Attributes')
1671   procedure Set_Soft_Label_Key_Attributes
1672     (Attr  : Character_Attribute_Set := Normal_Video;
1673      Color : Color_Pair := Color_Pair'First);
1674   --  AKA
1675   pragma Inline (Set_Soft_Label_Key_Attributes);
1676
1677   --  ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
1678   function Get_Soft_Label_Key_Attributes return Character_Attribute_Set;
1679   --  AKA
1680
1681   --  ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
1682   function Get_Soft_Label_Key_Attributes return Color_Pair;
1683   --  AKA
1684   pragma Inline (Get_Soft_Label_Key_Attributes);
1685
1686   --  ANCHOR(`slk_color()',`Set_Soft_Label_Key_Color')
1687   procedure Set_Soft_Label_Key_Color (Pair : Color_Pair);
1688   --  AKA
1689   pragma Inline (Set_Soft_Label_Key_Color);
1690
1691   --  MANPAGE(`keybound.3x')
1692   --  Not Implemented: keybound
1693
1694   --  MANPAGE(`keyok.3x')
1695
1696   --  ANCHOR(`keyok()',`Enable_Key')
1697   procedure Enable_Key (Key    : Special_Key_Code;
1698                         Enable : Boolean := True);
1699   --  AKA
1700   pragma Inline (Enable_Key);
1701
1702   --  MANPAGE(`define_key.3x')
1703
1704   --  ANCHOR(`define_key()',`Define_Key')
1705   procedure Define_Key (Definition : String;
1706                         Key        : Special_Key_Code);
1707   --  AKA
1708   pragma Inline (Define_Key);
1709
1710   --  MANPAGE(`curs_util.3x')
1711
1712   --  | Not implemented : filter, use_env
1713   --  | putwin, getwin are in the child package PutWin
1714   --
1715
1716   --  ANCHOR(`keyname()',`Key_Name')
1717   procedure Key_Name (Key  : Real_Key_Code;
1718                       Name : out String);
1719   --  AKA
1720   --  The external name for a real keystroke.
1721
1722   --  ANCHOR(`keyname()',`Key_Name')
1723   function Key_Name (Key  : Real_Key_Code) return String;
1724   --  AKA
1725   --  Same as function
1726   --  We do not inline this routine
1727
1728   --  ANCHOR(`unctrl()',`Un_Control')
1729   procedure Un_Control (Ch  : Attributed_Character;
1730                         Str : out String);
1731   --  AKA
1732
1733   --  ANCHOR(`unctrl()',`Un_Control')
1734   function Un_Control (Ch  : Attributed_Character) return String;
1735   --  AKA
1736   --  Same as function
1737   pragma Inline (Un_Control);
1738
1739   --  ANCHOR(`delay_output()',`Delay_Output')
1740   procedure Delay_Output (Msecs : Natural);
1741   --  AKA
1742   pragma Inline (Delay_Output);
1743
1744   --  ANCHOR(`flushinp()',`Flush_Input')
1745   procedure Flush_Input;
1746   --  AKA
1747   pragma Inline (Flush_Input);
1748
1749   --  MANPAGE(`curs_termattrs.3x')
1750
1751   --  ANCHOR(`baudrate()',`Baudrate')
1752   function Baudrate return Natural;
1753   --  AKA
1754   pragma Inline (Baudrate);
1755
1756   --  ANCHOR(`erasechar()',`Erase_Character')
1757   function Erase_Character return Character;
1758   --  AKA
1759   pragma Inline (Erase_Character);
1760
1761   --  ANCHOR(`killchar()',`Kill_Character')
1762   function Kill_Character return Character;
1763   --  AKA
1764   pragma Inline (Kill_Character);
1765
1766   --  ANCHOR(`has_ic()',`Has_Insert_Character')
1767   function Has_Insert_Character return Boolean;
1768   --  AKA
1769   pragma Inline (Has_Insert_Character);
1770
1771   --  ANCHOR(`has_il()',`Has_Insert_Line')
1772   function Has_Insert_Line return Boolean;
1773   --  AKA
1774   pragma Inline (Has_Insert_Line);
1775
1776   --  ANCHOR(`termattrs()',`Supported_Attributes')
1777   function Supported_Attributes return Character_Attribute_Set;
1778   --  AKA
1779   pragma Inline (Supported_Attributes);
1780
1781   --  ANCHOR(`longname()',`Long_Name')
1782   procedure Long_Name (Name : out String);
1783   --  AKA
1784
1785   --  ANCHOR(`longname()',`Long_Name')
1786   function Long_Name return String;
1787   --  AKA
1788   --  Same as function
1789   pragma Inline (Long_Name);
1790
1791   --  ANCHOR(`termname()',`Terminal_Name')
1792   procedure Terminal_Name (Name : out String);
1793   --  AKA
1794
1795   --  ANCHOR(`termname()',`Terminal_Name')
1796   function Terminal_Name return String;
1797   --  AKA
1798   --  Same as function
1799   pragma Inline (Terminal_Name);
1800
1801   --  MANPAGE(`curs_color.3x')
1802
1803   --  COLOR_PAIR
1804   --  COLOR_PAIR(n) in C is the same as
1805   --  Attributed_Character(Ch => Nul, Color => n, Attr => Normal_Video)
1806   --  In C you often see something like c = c | COLOR_PAIR(n);
1807   --  This is equivalent to c.Color := n;
1808
1809   --  ANCHOR(`start_color()',`Start_Color')
1810   procedure Start_Color;
1811   --  AKA
1812   pragma Import (C, Start_Color, "start_color");
1813
1814   --  ANCHOR(`init_pair()',`Init_Pair')
1815   procedure Init_Pair (Pair : Redefinable_Color_Pair;
1816                        Fore : Color_Number;
1817                        Back : Color_Number);
1818   --  AKA
1819   pragma Inline (Init_Pair);
1820
1821   --  ANCHOR(`pair_content()',`Pair_Content')
1822   procedure Pair_Content (Pair : Color_Pair;
1823                           Fore : out Color_Number;
1824                           Back : out Color_Number);
1825   --  AKA
1826   pragma Inline (Pair_Content);
1827
1828   --  ANCHOR(`has_colors()',`Has_Colors')
1829   function Has_Colors return Boolean;
1830   --  AKA
1831   pragma Inline (Has_Colors);
1832
1833   --  ANCHOR(`init_color()',`Init_Color')
1834   procedure Init_Color (Color : Color_Number;
1835                         Red   : RGB_Value;
1836                         Green : RGB_Value;
1837                         Blue  : RGB_Value);
1838   --  AKA
1839   pragma Inline (Init_Color);
1840
1841   --  ANCHOR(`can_change_color()',`Can_Change_Color')
1842   function Can_Change_Color return Boolean;
1843   --  AKA
1844   pragma Inline (Can_Change_Color);
1845
1846   --  ANCHOR(`color_content()',`Color_Content')
1847   procedure Color_Content (Color : Color_Number;
1848                            Red   : out RGB_Value;
1849                            Green : out RGB_Value;
1850                            Blue  : out RGB_Value);
1851   --  AKA
1852   pragma Inline (Color_Content);
1853
1854   --  MANPAGE(`curs_kernel.3x')
1855   --  | Not implemented: getsyx, setsyx
1856   --
1857   type Curses_Mode is (Curses, Shell);
1858
1859   --  ANCHOR(`def_prog_mode()',`Save_Curses_Mode')
1860   procedure Save_Curses_Mode (Mode : Curses_Mode);
1861   --  AKA
1862   --  ALIAS(`def_shell_mode()')
1863   pragma Inline (Save_Curses_Mode);
1864
1865   --  ANCHOR(`reset_prog_mode()',`Reset_Curses_Mode')
1866   procedure Reset_Curses_Mode (Mode : Curses_Mode);
1867   --  AKA
1868   --  ALIAS(`reset_shell_mode()')
1869   pragma Inline (Reset_Curses_Mode);
1870
1871   --  ANCHOR(`savetty()',`Save_Terminal_State')
1872   procedure Save_Terminal_State;
1873   --  AKA
1874   pragma Inline (Save_Terminal_State);
1875
1876   --  ANCHOR(`resetty();',`Reset_Terminal_State')
1877   procedure Reset_Terminal_State;
1878   --  AKA
1879   pragma Inline (Reset_Terminal_State);
1880
1881   type Stdscr_Init_Proc is access
1882      function (Win     : Window;
1883                Columns : Column_Count) return Integer;
1884   pragma Convention (C, Stdscr_Init_Proc);
1885   --  N.B.: the return value is actually ignored, but it seems to be
1886   --        a good practice to return 0 if you think all went fine
1887   --        and -1 otherwise.
1888
1889   --  ANCHOR(`ripoffline()',`Rip_Off_Lines')
1890   procedure Rip_Off_Lines (Lines : Integer;
1891                            Proc  : Stdscr_Init_Proc);
1892   --  AKA
1893   --  N.B.: to be more precise, this uses a ncurses specific enhancement of
1894   --        ripoffline(), in which the Lines argument absolute value is the
1895   --        number of lines to be ripped of. The official ripoffline() only
1896   --        uses the sign of Lines to remove a single line from bottom or top.
1897   pragma Inline (Rip_Off_Lines);
1898
1899   type Cursor_Visibility is (Invisible, Normal, Very_Visible);
1900
1901   --  ANCHOR(`curs_set()',`Set_Cursor_Visibility')
1902   procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility);
1903   --  AKA
1904   pragma Inline (Set_Cursor_Visibility);
1905
1906   --  ANCHOR(`napms()',`Nap_Milli_Seconds')
1907   procedure Nap_Milli_Seconds (Ms : Natural);
1908   --  AKA
1909   pragma Inline (Nap_Milli_Seconds);
1910
1911   --  |=====================================================================
1912   --  | Some useful helpers.
1913   --  |=====================================================================
1914   type Transform_Direction is (From_Screen, To_Screen);
1915   procedure Transform_Coordinates
1916     (W      : Window := Standard_Window;
1917      Line   : in out Line_Position;
1918      Column : in out Column_Position;
1919      Dir    : Transform_Direction := From_Screen);
1920   --  This procedure transforms screen coordinates into coordinates relative
1921   --  to the window and vice versa, depending on the Dir parameter.
1922   --  Screen coordinates are the position information for the physical device.
1923   --  An Curses_Exception will be raised if Line and Column are not in the
1924   --  Window or if you pass the Null_Window as argument.
1925   --  We do not inline this procedure
1926
1927   --  MANPAGE(`default_colors.3x')
1928
1929   Default_Color : constant Color_Number := -1;
1930
1931   --  ANCHOR(`use_default_colors()',`Use_Default_Colors')
1932   procedure Use_Default_Colors;
1933   --  AKA
1934   pragma Inline (Use_Default_Colors);
1935
1936   --  ANCHOR(`assume_default_colors()',`Assume_Default_Colors')
1937   procedure Assume_Default_Colors (Fore : Color_Number := Default_Color;
1938                                    Back : Color_Number := Default_Color);
1939   --  AKA
1940   pragma Inline (Assume_Default_Colors);
1941
1942   --  MANPAGE(`curs_extend.3x')
1943
1944   --  ANCHOR(`curses_version()',`Curses_Version')
1945   function Curses_Version return String;
1946   --  AKA
1947
1948   --  ANCHOR(`use_extended_names()',`Use_Extended_Names')
1949   --  The returnvalue is the previous setting of the flag
1950   function Use_Extended_Names (Enable : Boolean) return Boolean;
1951   --  AKA
1952
1953   --  MANPAGE(`curs_trace.3x')
1954
1955   --  ANCHOR(`_nc_freeall()',`Curses_Free_All')
1956   procedure Curses_Free_All;
1957   --  AKA
1958
1959   --  MANPAGE(`curs_scr_dump.3x')
1960
1961   --  ANCHOR(`scr_dump()',`Screen_Dump_To_File')
1962   procedure Screen_Dump_To_File (Filename : String);
1963   --  AKA
1964
1965   --  ANCHOR(`scr_restore()',`Screen_Restore_From_File')
1966   procedure Screen_Restore_From_File (Filename : String);
1967   --  AKA
1968
1969   --  ANCHOR(`scr_init()',`Screen_Init_From_File')
1970   procedure Screen_Init_From_File (Filename : String);
1971   --  AKA
1972
1973   --  ANCHOR(`scr_set()',`Screen_Set_File')
1974   procedure Screen_Set_File (Filename : String);
1975   --  AKA
1976
1977   --  MANPAGE(`curs_print.3x')
1978   --  Not implemented: mcprint
1979
1980   --  MANPAGE(`curs_printw.3x')
1981   --  Not implemented: printw,  wprintw, mvprintw, mvwprintw, vwprintw,
1982   --                   vw_printw
1983   --  Please use the Ada style Text_IO child packages for formatted
1984   --  printing. It does not make a lot of sense to map the printf style
1985   --  C functions to Ada.
1986
1987   --  MANPAGE(`curs_scanw.3x')
1988   --  Not implemented: scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw
1989
1990   --  MANPAGE(`resizeterm.3x')
1991   --  Not Implemented: resizeterm
1992
1993   --  MANPAGE(`wresize.3x')
1994
1995   --  ANCHOR(`wresize()',`Resize')
1996   procedure Resize (Win               : Window := Standard_Window;
1997                     Number_Of_Lines   : Line_Count;
1998                     Number_Of_Columns : Column_Count);
1999   --  AKA
2000
2001private
2002   type Window is new System.Storage_Elements.Integer_Address;
2003   Null_Window : constant Window := 0;
2004
2005   --  The next constants are generated and may be different on your
2006   --  architecture.
2007   --
2008
2009   Sizeof_Bool : constant := Curses_Constants.Sizeof_Bool;
2010
2011   type Curses_Bool is mod 2 ** Sizeof_Bool;
2012
2013   Curses_Bool_False : constant Curses_Bool := 0;
2014
2015end Terminal_Interface.Curses;
2016