1--  -*- ada -*-
2define(`HTMLNAME',`terminal_interface-curses-forms__ads.htm')dnl
3include(M4MACRO)dnl
4------------------------------------------------------------------------------
5--                                                                          --
6--                           GNAT ncurses Binding                           --
7--                                                                          --
8--                      Terminal_Interface.Curses.Form                      --
9--                                                                          --
10--                                 S P E C                                  --
11--                                                                          --
12------------------------------------------------------------------------------
13-- Copyright (c) 1998,2006 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.29 $
42--  $Date: 2006/06/25 14:30:21 $
43--  Binding Version 01.00
44------------------------------------------------------------------------------
45include(`Form_Base_Defs')
46with System;
47with Ada.Characters.Latin_1;
48
49package Terminal_Interface.Curses.Forms is
50   pragma Preelaborate (Terminal_Interface.Curses.Forms);
51include(`Form_Linker_Options')dnl
52include(`Linker_Options')
53   Space : Character renames Ada.Characters.Latin_1.Space;
54
55   type Field        is private;
56   type Form         is private;
57
58   Null_Field        : constant Field;
59   Null_Form         : constant Form;
60
61   type Field_Justification is (None,
62                                Left,
63                                Center,
64                                Right);
65
66   pragma Warnings (Off);
67include(`Field_Rep')Dnl
68
69   pragma Warnings (On);
70
71   function Default_Field_Options return Field_Option_Set;
72   --  The initial defaults for the field options.
73   pragma Inline (Default_Field_Options);
74
75   pragma Warnings (Off);
76include(`Form_Opt_Rep')Dnl
77
78   pragma Warnings (On);
79
80   function Default_Form_Options return Form_Option_Set;
81   --  The initial defaults for the form options.
82   pragma Inline (Default_Form_Options);
83
84   type Buffer_Number is new Natural;
85
86   type Field_Array is array (Positive range <>) of aliased Field;
87   pragma Convention (C, Field_Array);
88
89   type Field_Array_Access is access Field_Array;
90
91   procedure Free (FA          : in out Field_Array_Access;
92                   Free_Fields : in Boolean := False);
93   --  Release the memory for an allocated field array
94   --  If Free_Fields is True, call Delete() for all the fields in
95   --  the array.
96
97   subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57);
98
99   --  The prefix F_ stands for "Form Request"
100   F_Next_Page                : constant Form_Request_Code := Key_Max + 1;
101   F_Previous_Page            : constant Form_Request_Code := Key_Max + 2;
102   F_First_Page               : constant Form_Request_Code := Key_Max + 3;
103   F_Last_Page                : constant Form_Request_Code := Key_Max + 4;
104
105   F_Next_Field               : constant Form_Request_Code := Key_Max + 5;
106   F_Previous_Field           : constant Form_Request_Code := Key_Max + 6;
107   F_First_Field              : constant Form_Request_Code := Key_Max + 7;
108   F_Last_Field               : constant Form_Request_Code := Key_Max + 8;
109   F_Sorted_Next_Field        : constant Form_Request_Code := Key_Max + 9;
110   F_Sorted_Previous_Field    : constant Form_Request_Code := Key_Max + 10;
111   F_Sorted_First_Field       : constant Form_Request_Code := Key_Max + 11;
112   F_Sorted_Last_Field        : constant Form_Request_Code := Key_Max + 12;
113   F_Left_Field               : constant Form_Request_Code := Key_Max + 13;
114   F_Right_Field              : constant Form_Request_Code := Key_Max + 14;
115   F_Up_Field                 : constant Form_Request_Code := Key_Max + 15;
116   F_Down_Field               : constant Form_Request_Code := Key_Max + 16;
117
118   F_Next_Char                : constant Form_Request_Code := Key_Max + 17;
119   F_Previous_Char            : constant Form_Request_Code := Key_Max + 18;
120   F_Next_Line                : constant Form_Request_Code := Key_Max + 19;
121   F_Previous_Line            : constant Form_Request_Code := Key_Max + 20;
122   F_Next_Word                : constant Form_Request_Code := Key_Max + 21;
123   F_Previous_Word            : constant Form_Request_Code := Key_Max + 22;
124   F_Begin_Field              : constant Form_Request_Code := Key_Max + 23;
125   F_End_Field                : constant Form_Request_Code := Key_Max + 24;
126   F_Begin_Line               : constant Form_Request_Code := Key_Max + 25;
127   F_End_Line                 : constant Form_Request_Code := Key_Max + 26;
128   F_Left_Char                : constant Form_Request_Code := Key_Max + 27;
129   F_Right_Char               : constant Form_Request_Code := Key_Max + 28;
130   F_Up_Char                  : constant Form_Request_Code := Key_Max + 29;
131   F_Down_Char                : constant Form_Request_Code := Key_Max + 30;
132
133   F_New_Line                 : constant Form_Request_Code := Key_Max + 31;
134   F_Insert_Char              : constant Form_Request_Code := Key_Max + 32;
135   F_Insert_Line              : constant Form_Request_Code := Key_Max + 33;
136   F_Delete_Char              : constant Form_Request_Code := Key_Max + 34;
137   F_Delete_Previous          : constant Form_Request_Code := Key_Max + 35;
138   F_Delete_Line              : constant Form_Request_Code := Key_Max + 36;
139   F_Delete_Word              : constant Form_Request_Code := Key_Max + 37;
140   F_Clear_EOL                : constant Form_Request_Code := Key_Max + 38;
141   F_Clear_EOF                : constant Form_Request_Code := Key_Max + 39;
142   F_Clear_Field              : constant Form_Request_Code := Key_Max + 40;
143   F_Overlay_Mode             : constant Form_Request_Code := Key_Max + 41;
144   F_Insert_Mode              : constant Form_Request_Code := Key_Max + 42;
145
146   --  Vertical Scrolling
147   F_ScrollForward_Line       : constant Form_Request_Code := Key_Max + 43;
148   F_ScrollBackward_Line      : constant Form_Request_Code := Key_Max + 44;
149   F_ScrollForward_Page       : constant Form_Request_Code := Key_Max + 45;
150   F_ScrollBackward_Page      : constant Form_Request_Code := Key_Max + 46;
151   F_ScrollForward_HalfPage   : constant Form_Request_Code := Key_Max + 47;
152   F_ScrollBackward_HalfPage  : constant Form_Request_Code := Key_Max + 48;
153
154   --  Horizontal Scrolling
155   F_HScrollForward_Char      : constant Form_Request_Code := Key_Max + 49;
156   F_HScrollBackward_Char     : constant Form_Request_Code := Key_Max + 50;
157   F_HScrollForward_Line      : constant Form_Request_Code := Key_Max + 51;
158   F_HScrollBackward_Line     : constant Form_Request_Code := Key_Max + 52;
159   F_HScrollForward_HalfLine  : constant Form_Request_Code := Key_Max + 53;
160   F_HScrollBackward_HalfLine : constant Form_Request_Code := Key_Max + 54;
161
162   F_Validate_Field           : constant Form_Request_Code := Key_Max + 55;
163   F_Next_Choice              : constant Form_Request_Code := Key_Max + 56;
164   F_Previous_Choice          : constant Form_Request_Code := Key_Max + 57;
165
166   --  For those who like the old 'C' style request names
167   REQ_NEXT_PAGE    : Form_Request_Code renames F_Next_Page;
168   REQ_PREV_PAGE    : Form_Request_Code renames F_Previous_Page;
169   REQ_FIRST_PAGE   : Form_Request_Code renames F_First_Page;
170   REQ_LAST_PAGE    : Form_Request_Code renames F_Last_Page;
171
172   REQ_NEXT_FIELD   : Form_Request_Code renames F_Next_Field;
173   REQ_PREV_FIELD   : Form_Request_Code renames F_Previous_Field;
174   REQ_FIRST_FIELD  : Form_Request_Code renames F_First_Field;
175   REQ_LAST_FIELD   : Form_Request_Code renames F_Last_Field;
176   REQ_SNEXT_FIELD  : Form_Request_Code renames F_Sorted_Next_Field;
177   REQ_SPREV_FIELD  : Form_Request_Code renames F_Sorted_Previous_Field;
178   REQ_SFIRST_FIELD : Form_Request_Code renames F_Sorted_First_Field;
179   REQ_SLAST_FIELD  : Form_Request_Code renames F_Sorted_Last_Field;
180   REQ_LEFT_FIELD   : Form_Request_Code renames F_Left_Field;
181   REQ_RIGHT_FIELD  : Form_Request_Code renames F_Right_Field;
182   REQ_UP_FIELD     : Form_Request_Code renames F_Up_Field;
183   REQ_DOWN_FIELD   : Form_Request_Code renames F_Down_Field;
184
185   REQ_NEXT_CHAR    : Form_Request_Code renames F_Next_Char;
186   REQ_PREV_CHAR    : Form_Request_Code renames F_Previous_Char;
187   REQ_NEXT_LINE    : Form_Request_Code renames F_Next_Line;
188   REQ_PREV_LINE    : Form_Request_Code renames F_Previous_Line;
189   REQ_NEXT_WORD    : Form_Request_Code renames F_Next_Word;
190   REQ_PREV_WORD    : Form_Request_Code renames F_Previous_Word;
191   REQ_BEG_FIELD    : Form_Request_Code renames F_Begin_Field;
192   REQ_END_FIELD    : Form_Request_Code renames F_End_Field;
193   REQ_BEG_LINE     : Form_Request_Code renames F_Begin_Line;
194   REQ_END_LINE     : Form_Request_Code renames F_End_Line;
195   REQ_LEFT_CHAR    : Form_Request_Code renames F_Left_Char;
196   REQ_RIGHT_CHAR   : Form_Request_Code renames F_Right_Char;
197   REQ_UP_CHAR      : Form_Request_Code renames F_Up_Char;
198   REQ_DOWN_CHAR    : Form_Request_Code renames F_Down_Char;
199
200   REQ_NEW_LINE     : Form_Request_Code renames F_New_Line;
201   REQ_INS_CHAR     : Form_Request_Code renames F_Insert_Char;
202   REQ_INS_LINE     : Form_Request_Code renames F_Insert_Line;
203   REQ_DEL_CHAR     : Form_Request_Code renames F_Delete_Char;
204   REQ_DEL_PREV     : Form_Request_Code renames F_Delete_Previous;
205   REQ_DEL_LINE     : Form_Request_Code renames F_Delete_Line;
206   REQ_DEL_WORD     : Form_Request_Code renames F_Delete_Word;
207   REQ_CLR_EOL      : Form_Request_Code renames F_Clear_EOL;
208   REQ_CLR_EOF      : Form_Request_Code renames F_Clear_EOF;
209   REQ_CLR_FIELD    : Form_Request_Code renames F_Clear_Field;
210   REQ_OVL_MODE     : Form_Request_Code renames F_Overlay_Mode;
211   REQ_INS_MODE     : Form_Request_Code renames F_Insert_Mode;
212
213   REQ_SCR_FLINE    : Form_Request_Code renames F_ScrollForward_Line;
214   REQ_SCR_BLINE    : Form_Request_Code renames F_ScrollBackward_Line;
215   REQ_SCR_FPAGE    : Form_Request_Code renames F_ScrollForward_Page;
216   REQ_SCR_BPAGE    : Form_Request_Code renames F_ScrollBackward_Page;
217   REQ_SCR_FHPAGE   : Form_Request_Code renames F_ScrollForward_HalfPage;
218   REQ_SCR_BHPAGE   : Form_Request_Code renames F_ScrollBackward_HalfPage;
219
220   REQ_SCR_FCHAR    : Form_Request_Code renames F_HScrollForward_Char;
221   REQ_SCR_BCHAR    : Form_Request_Code renames F_HScrollBackward_Char;
222   REQ_SCR_HFLINE   : Form_Request_Code renames F_HScrollForward_Line;
223   REQ_SCR_HBLINE   : Form_Request_Code renames F_HScrollBackward_Line;
224   REQ_SCR_HFHALF   : Form_Request_Code renames F_HScrollForward_HalfLine;
225   REQ_SCR_HBHALF   : Form_Request_Code renames F_HScrollBackward_HalfLine;
226
227   REQ_VALIDATION   : Form_Request_Code renames F_Validate_Field;
228   REQ_NEXT_CHOICE  : Form_Request_Code renames F_Next_Choice;
229   REQ_PREV_CHOICE  : Form_Request_Code renames F_Previous_Choice;
230
231   procedure Request_Name (Key  : in Form_Request_Code;
232                           Name : out String);
233
234   function  Request_Name (Key : Form_Request_Code) return String;
235   --  Same as function
236   pragma Inline (Request_Name);
237
238   ------------------
239   --  Exceptions  --
240   ------------------
241   Form_Exception : exception;
242
243   --  MANPAGE(`form_field_new.3x')
244
245   --  ANCHOR(`new_field()',`Create')
246   function Create (Height       : Line_Count;
247                    Width        : Column_Count;
248                    Top          : Line_Position;
249                    Left         : Column_Position;
250                    Off_Screen   : Natural := 0;
251                    More_Buffers : Buffer_Number := Buffer_Number'First)
252                    return Field;
253   --  AKA
254   --  An overloaded Create is defined later. Pragma Inline appears there.
255
256   --  ANCHOR(`new_field()',`New_Field')
257   function New_Field (Height       : Line_Count;
258                       Width        : Column_Count;
259                       Top          : Line_Position;
260                       Left         : Column_Position;
261                       Off_Screen   : Natural := 0;
262                       More_Buffers : Buffer_Number := Buffer_Number'First)
263                       return Field renames Create;
264   --  AKA
265   pragma Inline (New_Field);
266
267   --  ANCHOR(`free_field()',`Delete')
268   procedure Delete (Fld : in out Field);
269   --  AKA
270   --  Reset Fld to Null_Field
271   --  An overloaded Delete is defined later. Pragma Inline appears there.
272
273   --  ANCHOR(`dup_field()',`Duplicate')
274   function Duplicate (Fld  : Field;
275                       Top  : Line_Position;
276                       Left : Column_Position) return Field;
277   --  AKA
278   pragma Inline (Duplicate);
279
280   --  ANCHOR(`link_field()',`Link')
281   function Link (Fld  : Field;
282                  Top  : Line_Position;
283                  Left : Column_Position) return Field;
284   --  AKA
285   pragma Inline (Link);
286
287   --  MANPAGE(`form_field_just.3x')
288
289   --  ANCHOR(`set_field_just()',`Set_Justification')
290   procedure Set_Justification (Fld  : in Field;
291                                Just : in Field_Justification := None);
292   --  AKA
293   pragma Inline (Set_Justification);
294
295   --  ANCHOR(`field_just()',`Get_Justification')
296   function Get_Justification (Fld : Field) return Field_Justification;
297   --  AKA
298   pragma Inline (Get_Justification);
299
300   --  MANPAGE(`form_field_buffer.3x')
301
302   --  ANCHOR(`set_field_buffer()',`Set_Buffer')
303   procedure Set_Buffer
304     (Fld    : in Field;
305      Buffer : in Buffer_Number := Buffer_Number'First;
306      Str    : in String);
307   --  AKA
308   --  Not inlined
309
310   --  ANCHOR(`field_buffer()',`Get_Buffer')
311   procedure Get_Buffer
312     (Fld    : in Field;
313      Buffer : in Buffer_Number := Buffer_Number'First;
314      Str    : out String);
315   --  AKA
316
317   function Get_Buffer
318     (Fld    : in Field;
319      Buffer : in Buffer_Number := Buffer_Number'First) return String;
320   --  AKA
321   --  Same but as function
322   pragma Inline (Get_Buffer);
323
324   --  ANCHOR(`set_field_status()',`Set_Status')
325   procedure Set_Status (Fld    : in Field;
326                         Status : in Boolean := True);
327   --  AKA
328   pragma Inline (Set_Status);
329
330   --  ANCHOR(`field_status()',`Changed')
331   function Changed (Fld : Field) return Boolean;
332   --  AKA
333   pragma Inline (Changed);
334
335   --  ANCHOR(`set_field_max()',`Set_Maximum_Size')
336   procedure Set_Maximum_Size (Fld : in Field;
337                               Max : in Natural := 0);
338   --  AKA
339   pragma Inline (Set_Maximum_Size);
340
341   --  MANPAGE(`form_field_opts.3x')
342
343   --  ANCHOR(`set_field_opts()',`Set_Options')
344   procedure Set_Options (Fld     : in Field;
345                          Options : in Field_Option_Set);
346   --  AKA
347   --  An overloaded version is defined later. Pragma Inline appears there
348
349   --  ANCHOR(`field_opts_on()',`Switch_Options')
350   procedure Switch_Options (Fld     : in Field;
351                             Options : in Field_Option_Set;
352                             On      : Boolean := True);
353   --  AKA
354   --  ALIAS(`field_opts_off()')
355   --  An overloaded version is defined later. Pragma Inline appears there
356
357   --  ANCHOR(`field_opts()',`Get_Options')
358   procedure Get_Options (Fld     : in  Field;
359                          Options : out Field_Option_Set);
360   --  AKA
361
362   --  ANCHOR(`field_opts()',`Get_Options')
363   function Get_Options (Fld : Field := Null_Field)
364                         return Field_Option_Set;
365   --  AKA
366   --  An overloaded version is defined later. Pragma Inline appears there
367
368   --  MANPAGE(`form_field_attributes.3x')
369
370   --  ANCHOR(`set_field_fore()',`Set_Foreground')
371   procedure Set_Foreground
372     (Fld   : in Field;
373      Fore  : in Character_Attribute_Set := Normal_Video;
374      Color : in Color_Pair := Color_Pair'First);
375   --  AKA
376   pragma Inline (Set_Foreground);
377
378   --  ANCHOR(`field_fore()',`Foreground')
379   procedure Foreground (Fld  : in  Field;
380                         Fore : out Character_Attribute_Set);
381   --  AKA
382
383   --  ANCHOR(`field_fore()',`Foreground')
384   procedure Foreground (Fld   : in  Field;
385                         Fore  : out Character_Attribute_Set;
386                         Color : out Color_Pair);
387   --  AKA
388   pragma Inline (Foreground);
389
390   --  ANCHOR(`set_field_back()',`Set_Background')
391   procedure Set_Background
392     (Fld   : in Field;
393      Back  : in Character_Attribute_Set := Normal_Video;
394      Color : in Color_Pair := Color_Pair'First);
395   --  AKA
396   pragma Inline (Set_Background);
397
398   --  ANCHOR(`field_back()',`Background')
399   procedure Background (Fld  : in  Field;
400                         Back : out Character_Attribute_Set);
401   --  AKA
402
403   --  ANCHOR(`field_back()',`Background')
404   procedure Background (Fld   : in  Field;
405                         Back  : out Character_Attribute_Set;
406                         Color : out Color_Pair);
407   --  AKA
408   pragma Inline (Background);
409
410   --  ANCHOR(`set_field_pad()',`Set_Pad_Character')
411   procedure Set_Pad_Character (Fld : in Field;
412                                Pad : in Character := Space);
413   --  AKA
414   pragma Inline (Set_Pad_Character);
415
416   --  ANCHOR(`field_pad()',`Pad_Character')
417   procedure Pad_Character (Fld : in  Field;
418                            Pad : out Character);
419   --  AKA
420   pragma Inline (Pad_Character);
421
422   --  MANPAGE(`form_field_info.3x')
423
424   --  ANCHOR(`field_info()',`Info')
425   procedure Info (Fld                : in  Field;
426                   Lines              : out Line_Count;
427                   Columns            : out Column_Count;
428                   First_Row          : out Line_Position;
429                   First_Column       : out Column_Position;
430                   Off_Screen         : out Natural;
431                   Additional_Buffers : out Buffer_Number);
432   --  AKA
433   pragma Inline (Info);
434
435   --  ANCHOR(`dynamic_field_info()',`Dynamic_Info')
436   procedure Dynamic_Info (Fld     : in Field;
437                           Lines   : out Line_Count;
438                           Columns : out Column_Count;
439                           Max     : out Natural);
440   --  AKA
441   pragma Inline (Dynamic_Info);
442
443   --  MANPAGE(`form_win.3x')
444
445   --  ANCHOR(`set_form_win()',`Set_Window')
446   procedure Set_Window (Frm : in Form;
447                         Win : in Window);
448   --  AKA
449   pragma Inline (Set_Window);
450
451   --  ANCHOR(`form_win()',`Get_Window')
452   function Get_Window (Frm : Form) return Window;
453   --  AKA
454   pragma Inline (Get_Window);
455
456   --  ANCHOR(`set_form_sub()',`Set_Sub_Window')
457   procedure Set_Sub_Window (Frm : in Form;
458                             Win : in Window);
459   --  AKA
460   pragma Inline (Set_Sub_Window);
461
462   --  ANCHOR(`form_sub()',`Get_Sub_Window')
463   function Get_Sub_Window (Frm : Form) return Window;
464   --  AKA
465   pragma Inline (Get_Sub_Window);
466
467   --  ANCHOR(`scale_form()',`Scale')
468   procedure Scale (Frm     : in Form;
469                    Lines   : out Line_Count;
470                    Columns : out Column_Count);
471   --  AKA
472   pragma Inline (Scale);
473
474   --  MANPAGE(`form_hook.3x')
475
476   type Form_Hook_Function is access procedure (Frm : in Form);
477   pragma Convention (C, Form_Hook_Function);
478
479   --  ANCHOR(`set_field_init()',`Set_Field_Init_Hook')
480   procedure Set_Field_Init_Hook (Frm  : in Form;
481                                  Proc : in Form_Hook_Function);
482   --  AKA
483   pragma Inline (Set_Field_Init_Hook);
484
485   --  ANCHOR(`set_field_term()',`Set_Field_Term_Hook')
486   procedure Set_Field_Term_Hook (Frm  : in Form;
487                                  Proc : in Form_Hook_Function);
488   --  AKA
489   pragma Inline (Set_Field_Term_Hook);
490
491   --  ANCHOR(`set_form_init()',`Set_Form_Init_Hook')
492   procedure Set_Form_Init_Hook (Frm  : in Form;
493                                 Proc : in Form_Hook_Function);
494   --  AKA
495   pragma Inline (Set_Form_Init_Hook);
496
497   --  ANCHOR(`set_form_term()',`Set_Form_Term_Hook')
498   procedure Set_Form_Term_Hook (Frm  : in Form;
499                                 Proc : in Form_Hook_Function);
500   --  AKA
501   pragma Inline (Set_Form_Term_Hook);
502
503   --  ANCHOR(`field_init()',`Get_Field_Init_Hook')
504   function Get_Field_Init_Hook (Frm : Form) return Form_Hook_Function;
505   --  AKA
506   pragma Import (C, Get_Field_Init_Hook, "field_init");
507
508   --  ANCHOR(`field_term()',`Get_Field_Term_Hook')
509   function Get_Field_Term_Hook (Frm : Form) return Form_Hook_Function;
510   --  AKA
511   pragma Import (C, Get_Field_Term_Hook, "field_term");
512
513   --  ANCHOR(`form_init()',`Get_Form_Init_Hook')
514   function Get_Form_Init_Hook (Frm : Form) return Form_Hook_Function;
515   --  AKA
516   pragma Import (C, Get_Form_Init_Hook, "form_init");
517
518   --  ANCHOR(`form_term()',`Get_Form_Term_Hook')
519   function Get_Form_Term_Hook (Frm : Form) return Form_Hook_Function;
520   --  AKA
521   pragma Import (C, Get_Form_Term_Hook, "form_term");
522
523   --  MANPAGE(`form_field.3x')
524
525   --  ANCHOR(`set_form_fields()',`Redefine')
526   procedure Redefine (Frm  : in Form;
527                       Flds : in Field_Array_Access);
528   --  AKA
529   pragma Inline (Redefine);
530
531   --  ANCHOR(`set_form_fields()',`Set_Fields')
532   procedure Set_Fields (Frm  : in Form;
533                         Flds : in Field_Array_Access) renames Redefine;
534   --  AKA
535   --  pragma Inline (Set_Fields);
536
537   --  ANCHOR(`form_fields()',`Fields')
538   function Fields (Frm   : Form;
539                    Index : Positive) return Field;
540   --  AKA
541   pragma Inline (Fields);
542
543   --  ANCHOR(`field_count()',`Field_Count')
544   function Field_Count (Frm : Form) return Natural;
545   --  AKA
546   pragma Inline (Field_Count);
547
548   --  ANCHOR(`move_field()',`Move')
549   procedure Move (Fld    : in Field;
550                   Line   : in Line_Position;
551                   Column : in Column_Position);
552   --  AKA
553   pragma Inline (Move);
554
555   --  MANPAGE(`form_new.3x')
556
557   --  ANCHOR(`new_form()',`Create')
558   function Create (Fields : Field_Array_Access) return Form;
559   --  AKA
560   pragma Inline (Create);
561
562   --  ANCHOR(`new_form()',`New_Form')
563   function New_Form (Fields : Field_Array_Access) return Form
564     renames Create;
565   --  AKA
566   --  pragma Inline (New_Form);
567
568   --  ANCHOR(`free_form()',`Delete')
569   procedure Delete (Frm : in out Form);
570   --  AKA
571   --  Reset Frm to Null_Form
572   pragma Inline (Delete);
573
574   --  MANPAGE(`form_opts.3x')
575
576   --  ANCHOR(`set_form_opts()',`Set_Options')
577   procedure Set_Options (Frm     : in Form;
578                          Options : in Form_Option_Set);
579   --  AKA
580   pragma Inline (Set_Options);
581
582   --  ANCHOR(`form_opts_on()',`Switch_Options')
583   procedure Switch_Options (Frm     : in Form;
584                             Options : in Form_Option_Set;
585                             On      : Boolean := True);
586   --  AKA
587   --  ALIAS(`form_opts_off()')
588   pragma Inline (Switch_Options);
589
590   --  ANCHOR(`form_opts()',`Get_Options')
591   procedure Get_Options (Frm     : in  Form;
592                          Options : out Form_Option_Set);
593   --  AKA
594
595   --  ANCHOR(`form_opts()',`Get_Options')
596   function Get_Options (Frm : Form := Null_Form) return Form_Option_Set;
597   --  AKA
598   pragma Inline (Get_Options);
599
600   --  MANPAGE(`form_post.3x')
601
602   --  ANCHOR(`post_form()',`Post')
603   procedure Post (Frm  : in Form;
604                   Post : in Boolean := True);
605   --  AKA
606   --  ALIAS(`unpost_form()')
607   pragma Inline (Post);
608
609   --  MANPAGE(`form_cursor.3x')
610
611   --  ANCHOR(`pos_form_cursor()',`Position_Cursor')
612   procedure Position_Cursor (Frm : Form);
613   --  AKA
614   pragma Inline (Position_Cursor);
615
616   --  MANPAGE(`form_data.3x')
617
618   --  ANCHOR(`data_ahead()',`Data_Ahead')
619   function Data_Ahead (Frm : Form) return Boolean;
620   --  AKA
621   pragma Inline (Data_Ahead);
622
623   --  ANCHOR(`data_behind()',`Data_Behind')
624   function Data_Behind (Frm : Form) return Boolean;
625   --  AKA
626   pragma Inline (Data_Behind);
627
628   --  MANPAGE(`form_driver.3x')
629
630   type Driver_Result is (Form_Ok,
631                          Request_Denied,
632                          Unknown_Request,
633                          Invalid_Field);
634
635   --  ANCHOR(`form_driver()',`Driver')
636   function Driver (Frm : Form;
637                    Key : Key_Code) return Driver_Result;
638   --  AKA
639   --  Driver not inlined
640
641   --  MANPAGE(`form_page.3x')
642
643   type Page_Number is new Natural;
644
645   --  ANCHOR(`set_current_field()',`Set_Current')
646   procedure Set_Current (Frm : in Form;
647                          Fld : in Field);
648   --  AKA
649   pragma Inline (Set_Current);
650
651   --  ANCHOR(`current_field()',`Current')
652   function Current (Frm : in Form) return Field;
653   --  AKA
654   pragma Inline (Current);
655
656   --  ANCHOR(`set_form_page()',`Set_Page')
657   procedure Set_Page (Frm  : in Form;
658                       Page : in Page_Number := Page_Number'First);
659   --  AKA
660   pragma Inline (Set_Page);
661
662   --  ANCHOR(`form_page()',`Page')
663   function Page (Frm : Form) return Page_Number;
664   --  AKA
665   pragma Inline (Page);
666
667   --  ANCHOR(`field_index()',`Get_Index')
668   function Get_Index (Fld : Field) return Positive;
669   --  AKA
670   --  Please note that in this binding we start the numbering of fields
671   --  with 1. So this is number is one more than you get from the low
672   --  level call.
673   pragma Inline (Get_Index);
674
675   --  MANPAGE(`form_new_page.3x')
676
677   --  ANCHOR(`set_new_page()',`Set_New_Page')
678   procedure Set_New_Page (Fld      : in Field;
679                           New_Page : in Boolean := True);
680   --  AKA
681   pragma Inline (Set_New_Page);
682
683   --  ANCHOR(`new_page()',`Is_New_Page')
684   function Is_New_Page (Fld : Field) return Boolean;
685   --  AKA
686   pragma Inline (Is_New_Page);
687
688   --  MANPAGE(`form_requestname.3x')
689   --  Not Implemented: form_request_name, form_request_by_name
690
691------------------------------------------------------------------------------
692private
693   type Field is new System.Storage_Elements.Integer_Address;
694   type Form  is new System.Storage_Elements.Integer_Address;
695
696   Null_Field : constant Field := 0;
697   Null_Form  : constant Form  := 0;
698
699end Terminal_Interface.Curses.Forms;
700