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