ncurses 5.2
[ncurses.git] / doc / html / ada / terminal_interface-curses-forms-field_types__adb.htm
1 <HTML><HEAD><TITLE>terminal_interface-curses-forms-field_types.adb</TITLE></HEAD>
2 <BODY>
3 <HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-forms-field_types.adb </H1></DIV><HR>
4 <PRE>
5 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
6 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
7 <FONT COLOR=green><EM>--                           <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding                           --</EM></FONT>
8 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
9 <FONT COLOR=green><EM>--                 Terminal_Interface.Curses.Forms.Field_Types              --</EM></FONT>
10 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
11 <FONT COLOR=green><EM>--                                 B O D Y                                  --</EM></FONT>
12 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
13 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
14 <FONT COLOR=green><EM>-- Copyright (c) 1998 Free Software Foundation, Inc.                        --</EM></FONT>
15 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
16 <FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a  --</EM></FONT>
17 <FONT COLOR=green><EM>-- copy of this software and associated documentation files (the            --</EM></FONT>
18 <FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including      --</EM></FONT>
19 <FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish,      --</EM></FONT>
20 <FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell       --</EM></FONT>
21 <FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is    --</EM></FONT>
22 <FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions:                 --</EM></FONT>
23 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
24 <FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included  --</EM></FONT>
25 <FONT COLOR=green><EM>-- in all copies or substantial portions of the Software.                   --</EM></FONT>
26 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
27 <FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --</EM></FONT>
28 <FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --</EM></FONT>
29 <FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --</EM></FONT>
30 <FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --</EM></FONT>
31 <FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --</EM></FONT>
32 <FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --</EM></FONT>
33 <FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --</EM></FONT>
34 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
35 <FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright   --</EM></FONT>
36 <FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the     --</EM></FONT>
37 <FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written       --</EM></FONT>
38 <FONT COLOR=green><EM>-- authorization.                                                           --</EM></FONT>
39 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
40 <FONT COLOR=green><EM>--  Author: <A HREF="http://home.t-online.de/home/Juergen.Pfeifer">J&uuml;rgen Pfeifer</A> &lt;<A HREF="mailto:juergen.pfeifer@gmx.net">&lt;juergen.pfeifer@gmx.net&gt;</A>&gt; 1996</EM></FONT>
41 <FONT COLOR=green><EM>--  Version Control:</EM></FONT>
42 <FONT COLOR=green><EM>--  @Revision: 1.12 @</EM></FONT>
43 <FONT COLOR=green><EM>--  Binding Version 01.00</EM></FONT>
44 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
45 <b>with</b> <A HREF="interfac__ads.htm#23_9">Interfaces</A>.C;
46 <b>with</b> <A HREF="terminal_interface__ads.htm#41_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#48_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#41_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#48_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#50_35">Aux</A>;
47 <b>with</b> Ada.Unchecked_Deallocation;
48 <b>with</b> Ada.Unchecked_Conversion;
49 <FONT COLOR=green><EM>--  |</EM></FONT>
50 <FONT COLOR=green><EM>--  |=====================================================================</EM></FONT>
51 <FONT COLOR=green><EM>--  | man page form_fieldtype.3x</EM></FONT>
52 <FONT COLOR=green><EM>--  |=====================================================================</EM></FONT>
53 <FONT COLOR=green><EM>--  |</EM></FONT>
54 <b>package</b> <b>body</b> Terminal_Interface.Curses.Forms.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#43_41">Field_Types</A><FONT COLOR=red><A NAME="50_46"></A></FONT> <b>is</b>
55
56    <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#23_9">Interfaces</A>.C.int;
57    <b>use</b> <b>type</b> System.Address;
58
59    <b>function</b> <FONT COLOR=red><A NAME="55_13">To_Argument_Access</A></FONT> <b>is</b> <b>new</b> Ada.Unchecked_Conversion
60      (System.Address, Argument_Access);
61
62    <b>function</b> <FONT COLOR=red><A NAME="58_13">Get_Fieldtype</A></FONT> (<FONT COLOR=red><A NAME="58_28">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#55_9">Field</A>) <b>return</b> C_Field_Type;
63    <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-forms-field_types__adb.htm#58_13">Get_Fieldtype</A>, "field_type");
64
65    <b>function</b> <FONT COLOR=red><A NAME="61_13">Get_Arg</A></FONT> (<FONT COLOR=red><A NAME="61_22">F</A></FONT> : <A HREF="terminal_interface-curses-forms__ads.htm#55_9">Field</A>) <b>return</b> System.Address;
66    <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-forms-field_types__adb.htm#61_13">Get_Arg</A>, "field_arg");
67    <FONT COLOR=green><EM>--  |</EM></FONT>
68    <FONT COLOR=green><EM>--  |=====================================================================</EM></FONT>
69    <FONT COLOR=green><EM>--  | man page form_field_validation.3x</EM></FONT>
70    <FONT COLOR=green><EM>--  |=====================================================================</EM></FONT>
71    <FONT COLOR=green><EM>--  |</EM></FONT>
72    <FONT COLOR=green><EM>--  |</EM></FONT>
73    <FONT COLOR=green><EM>--  |</EM></FONT>
74    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#79_13">Get_Type</A><FONT COLOR=red><A NAME="70_13"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#79_23">Fld</A> : <b>in</b> <A HREF="terminal_interface-curses-forms__ads.htm#55_9">Field</A>) <b>return</b> Field_Type_Access
75    <b>is</b>
76       Low_Level : <b>constant</b> C_Field_Type := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#58_13">Get_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#79_23">Fld</A>);
77       Arg : Argument_Access;
78    <b>begin</b>
79       <b>if</b> Low_Level = Null_Field_Type <b>then</b>
80          <b>return</b> <b>null</b>;
81       <b>else</b>
82          <b>if</b> Low_Level = M_Builtin_Router <b>or</b> <b>else</b>
83            Low_Level = M_Generic_Type <b>or</b> <b>else</b>
84            Low_Level = M_Choice_Router <b>or</b> <b>else</b>
85            Low_Level = M_Generic_Choice <b>then</b>
86             Arg := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#55_13">To_Argument_Access</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#61_13">Get_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#79_23">Fld</A>));
87             <b>if</b> Arg = <b>null</b> <b>then</b>
88                <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#288_4">Form_Exception</A>;
89             <b>else</b>
90                <b>return</b> Arg.Typ;
91             <b>end</b> <b>if</b>;
92          <b>else</b>
93             <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#288_4">Form_Exception</A>;
94          <b>end</b> <b>if</b>;
95       <b>end</b> <b>if</b>;
96    <b>end</b> Get_Type;
97
98    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#162_13">Make_Arg</A><FONT COLOR=red><A NAME="94_13"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#162_23">Args</A> : System.Address) <b>return</b> System.Address
99    <b>is</b>
100       <FONT COLOR=green><EM>--  Actually args is a double indirected pointer to the arguments</EM></FONT>
101       <FONT COLOR=green><EM>--  of a C variable argument list. In theory it is now quite</EM></FONT>
102       <FONT COLOR=green><EM>--  complicated to write portable routine that reads the arguments,</EM></FONT>
103       <FONT COLOR=green><EM>--  because one has to know the growth direction of the stack and</EM></FONT>
104       <FONT COLOR=green><EM>--  the sizes of the individual arguments.</EM></FONT>
105       <FONT COLOR=green><EM>--  Fortunately we are only interested in the first argument (#0),</EM></FONT>
106       <FONT COLOR=green><EM>--  we know its size and for the first arg we don't care about</EM></FONT>
107       <FONT COLOR=green><EM>--  into which stack direction we have to proceed. We simply</EM></FONT>
108       <FONT COLOR=green><EM>--  resolve the double indirection and thats it.</EM></FONT>
109       <b>type</b> V <b>is</b> <b>access</b> <b>all</b> System.Address;
110       <b>function</b> <FONT COLOR=red><A NAME="106_16">To_Access</A></FONT> <b>is</b> <b>new</b> Ada.Unchecked_Conversion (System.Address,
111                                                           V);
112    <b>begin</b>
113       <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#106_16">To_Access</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#106_16">To_Access</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#162_23">Args</A>).<b>all</b>).<b>all</b>;
114    <b>end</b> Make_Arg;
115
116    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#167_13">Copy_Arg</A><FONT COLOR=red><A NAME="112_13"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#167_23">Usr</A> : System.Address) <b>return</b> System.Address
117    <b>is</b>
118    <b>begin</b>
119       <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#167_23">Usr</A>;
120    <b>end</b> Copy_Arg;
121
122    <b>procedure</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#172_14">Free_Arg</A><FONT COLOR=red><A NAME="118_14"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#172_24">Usr</A> : <b>in</b> System.Address)
123    <b>is</b>
124       <b>procedure</b> <FONT COLOR=red><A NAME="120_17">Free_Type</A></FONT> <b>is</b> <b>new</b> Ada.Unchecked_Deallocation
125         (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#52_9">Field_Type</A>'Class, Field_Type_Access);
126       <b>procedure</b> <FONT COLOR=red><A NAME="122_17">Freeargs</A></FONT> <b>is</b> <b>new</b> Ada.Unchecked_Deallocation
127         (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#211_9">Argument</A>, Argument_Access);
128
129       To_Be_Free : Argument_Access := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#55_13">To_Argument_Access</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#172_24">Usr</A>);
130       Low_Level  : C_Field_Type;
131    <b>begin</b>
132       <b>if</b> To_Be_Free /= <b>null</b> <b>then</b>
133          <b>if</b> To_Be_Free.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#213_7">Usr</A> /= System.Null_Address <b>then</b>
134             Low_Level := To_Be_Free.Cft;
135             <b>if</b> Low_Level.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#126_10">Freearg</A> /= <b>null</b> <b>then</b>
136                Low_Level.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#126_10">Freearg</A> (To_Be_Free.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#213_7">Usr</A>);
137             <b>end</b> <b>if</b>;
138          <b>end</b> <b>if</b>;
139          <b>if</b> To_Be_Free.Typ /= <b>null</b> <b>then</b>
140             <A HREF="terminal_interface-curses-forms-field_types__adb.htm#120_17">Free_Type</A> (To_Be_Free.Typ);
141          <b>end</b> <b>if</b>;
142          <A HREF="terminal_interface-curses-forms-field_types__adb.htm#122_17">Freeargs</A> (To_Be_Free);
143       <b>end</b> <b>if</b>;
144    <b>end</b> Free_Arg;
145
146
147    <b>procedure</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#151_14">Wrap_Builtin</A><FONT COLOR=red><A NAME="143_14"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#151_28">Fld</A> : <A HREF="terminal_interface-curses-forms__ads.htm#55_9">Field</A>;
148                            <A HREF="terminal_interface-curses-forms-field_types__ads.htm#152_28">Typ</A> : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#52_9">Field_Type</A>'Class;
149                            Cft : C_Field_Type := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#148_13">C_Builtin_Router</A>)
150    <b>is</b>
151       <FONT COLOR=red><A NAME="147_7">Usr_Arg</A></FONT>   : System.Address := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#61_13">Get_Arg</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#151_28">Fld</A>);
152       Low_Level : <b>constant</b> C_Field_Type := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#58_13">Get_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#151_28">Fld</A>);
153       Arg : Argument_Access;
154       <FONT COLOR=red><A NAME="150_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#78_12">Eti_Error</A>;
155       <b>function</b> <FONT COLOR=red><A NAME="151_16">Set_Fld_Type</A></FONT> (<FONT COLOR=red><A NAME="151_30">F</A></FONT>    : <A HREF="terminal_interface-curses-forms__ads.htm#55_9">Field</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#151_28">Fld</A>;
156                              Cf   : C_Field_Type := Cft;
157                              Arg1 : Argument_Access) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#46_12">C_Int</A>;
158       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-forms-field_types__adb.htm#151_16">Set_Fld_Type</A>, "set_field_type");
159
160    <b>begin</b>
161       <b>pragma</b> Assert (Low_Level /= Null_Field_Type);
162       <b>if</b> Cft /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#148_13">C_Builtin_Router</A> <b>and</b> <b>then</b> Cft /= <A HREF="terminal_interface-curses-forms-field_types__ads.htm#149_13">C_Choice_Router</A> <b>then</b>
163          <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#288_4">Form_Exception</A>;
164       <b>else</b>
165          Arg := <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#211_9">Argument</A>'(Usr =&gt; System.Null_Address,
166                               Typ =&gt; <b>new</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#52_9">Field_Type</A>'Class'(<A HREF="terminal_interface-curses-forms-field_types__ads.htm#152_28">Typ</A>),
167                               Cft =&gt; <A HREF="terminal_interface-curses-forms-field_types__adb.htm#58_13">Get_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#151_28">Fld</A>));
168          <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#147_7">Usr_Arg</A> /= System.Null_Address <b>then</b>
169             <b>if</b> Low_Level.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#125_10">Copyarg</A> /= <b>null</b> <b>then</b>
170                Arg.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#213_7">Usr</A> := Low_Level.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#125_10">Copyarg</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#147_7">Usr_Arg</A>);
171             <b>else</b>
172                Arg.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#213_7">Usr</A> := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#147_7">Usr_Arg</A>;
173             <b>end</b> <b>if</b>;
174          <b>end</b> <b>if</b>;
175
176          <A HREF="terminal_interface-curses-forms-field_types__adb.htm#150_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#151_16">Set_Fld_Type</A> (Arg1 =&gt; Arg);
177          <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#150_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#80_4">E_Ok</A> <b>then</b>
178             <A HREF="terminal_interface-curses-aux__ads.htm#96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#150_7">Res</A>);
179          <b>end</b> <b>if</b>;
180       <b>end</b> <b>if</b>;
181    <b>end</b> Wrap_Builtin;
182
183    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#177_13">Field_Check_Router</A><FONT COLOR=red><A NAME="179_13"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#177_33">Fld</A> : <A HREF="terminal_interface-curses-forms__ads.htm#55_9">Field</A>;
184                                 <A HREF="terminal_interface-curses-forms-field_types__ads.htm#178_33">Usr</A> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#46_12">C_Int</A>
185    <b>is</b>
186       Arg  : <b>constant</b> Argument_Access := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#55_13">To_Argument_Access</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#178_33">Usr</A>);
187    <b>begin</b>
188       <b>pragma</b> Assert (Arg /= <b>null</b> <b>and</b> <b>then</b> Arg.Cft /= Null_Field_Type
189                      <b>and</b> <b>then</b> Arg.Typ /= <b>null</b>);
190       <b>if</b> Arg.Cft.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#127_10">Fcheck</A> /= <b>null</b> <b>then</b>
191          <b>return</b> Arg.Cft.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#127_10">Fcheck</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#177_33">Fld</A>, Arg.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#213_7">Usr</A>);
192       <b>else</b>
193          <b>return</b> 1;
194       <b>end</b> <b>if</b>;
195    <b>end</b> Field_Check_Router;
196
197    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#185_13">Char_Check_Router</A><FONT COLOR=red><A NAME="193_13"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#185_32">Ch</A>  : <A HREF="terminal_interface-curses-forms-field_types__ads.htm#46_12">C_Int</A>;
198                                <A HREF="terminal_interface-curses-forms-field_types__ads.htm#186_32">Usr</A> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#46_12">C_Int</A>
199    <b>is</b>
200       Arg  : <b>constant</b> Argument_Access := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#55_13">To_Argument_Access</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#186_32">Usr</A>);
201    <b>begin</b>
202       <b>pragma</b> Assert (Arg /= <b>null</b> <b>and</b> <b>then</b> Arg.Cft /= Null_Field_Type
203                      <b>and</b> <b>then</b> Arg.Typ /= <b>null</b>);
204       <b>if</b> Arg.Cft.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#128_10">Ccheck</A> /= <b>null</b> <b>then</b>
205          <b>return</b> Arg.Cft.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#128_10">Ccheck</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#185_32">Ch</A>, Arg.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#213_7">Usr</A>);
206       <b>else</b>
207          <b>return</b> 1;
208       <b>end</b> <b>if</b>;
209    <b>end</b> Char_Check_Router;
210
211    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#193_13">Next_Router</A><FONT COLOR=red><A NAME="207_13"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#193_26">Fld</A> : <A HREF="terminal_interface-curses-forms__ads.htm#55_9">Field</A>;
212                          <A HREF="terminal_interface-curses-forms-field_types__ads.htm#194_26">Usr</A> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#46_12">C_Int</A>
213    <b>is</b>
214       Arg  : <b>constant</b> Argument_Access := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#55_13">To_Argument_Access</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#194_26">Usr</A>);
215    <b>begin</b>
216       <b>pragma</b> Assert (Arg /= <b>null</b> <b>and</b> <b>then</b> Arg.Cft /= Null_Field_Type
217                      <b>and</b> <b>then</b> Arg.Typ /= <b>null</b>);
218       <b>if</b> Arg.Cft.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#129_10">Next</A> /= <b>null</b> <b>then</b>
219          <b>return</b> Arg.Cft.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#129_10">Next</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#193_26">Fld</A>, Arg.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#213_7">Usr</A>);
220       <b>else</b>
221          <b>return</b> 1;
222       <b>end</b> <b>if</b>;
223    <b>end</b> Next_Router;
224
225    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#201_13">Prev_Router</A><FONT COLOR=red><A NAME="221_13"></A></FONT> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#201_26">Fld</A> : <A HREF="terminal_interface-curses-forms__ads.htm#55_9">Field</A>;
226                          <A HREF="terminal_interface-curses-forms-field_types__ads.htm#202_26">Usr</A> : System.Address) <b>return</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#46_12">C_Int</A>
227    <b>is</b>
228       Arg  : <b>constant</b> Argument_Access := <A HREF="terminal_interface-curses-forms-field_types__adb.htm#55_13">To_Argument_Access</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#202_26">Usr</A>);
229    <b>begin</b>
230       <b>pragma</b> Assert (Arg /= <b>null</b> <b>and</b> <b>then</b> Arg.Cft /= Null_Field_Type
231                      <b>and</b> <b>then</b> Arg.Typ /= <b>null</b>);
232       <b>if</b> Arg.Cft.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#129_16">Prev</A> /= <b>null</b> <b>then</b>
233          <b>return</b> Arg.Cft.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#129_16">Prev</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#201_26">Fld</A>, Arg.<A HREF="terminal_interface-curses-forms-field_types__ads.htm#213_7">Usr</A>);
234       <b>else</b>
235          <b>return</b> 1;
236       <b>end</b> <b>if</b>;
237    <b>end</b> Prev_Router;
238
239    <FONT COLOR=green><EM>--  -----------------------------------------------------------------------</EM></FONT>
240    <FONT COLOR=green><EM>--</EM></FONT>
241    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#148_13">C_Builtin_Router</A><FONT COLOR=red><A NAME="237_13"></A></FONT> <b>return</b> C_Field_Type
242    <b>is</b>
243       <FONT COLOR=red><A NAME="239_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#78_12">Eti_Error</A>;
244       T   : C_Field_Type;
245    <b>begin</b>
246       <b>if</b> M_Builtin_Router = Null_Field_Type <b>then</b>
247          T := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#222_13">New_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#177_13">Field_Check_Router</A>'<b>Access</b>,
248                              <A HREF="terminal_interface-curses-forms-field_types__ads.htm#185_13">Char_Check_Router</A>'<b>Access</b>);
249          <b>if</b> T = Null_Field_Type <b>then</b>
250             <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#288_4">Form_Exception</A>;
251          <b>else</b>
252             <A HREF="terminal_interface-curses-forms-field_types__adb.htm#239_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#227_13">Set_Fieldtype_Arg</A> (T,
253                                       <A HREF="terminal_interface-curses-forms-field_types__ads.htm#162_13">Make_Arg</A>'<b>Access</b>,
254                                       <A HREF="terminal_interface-curses-forms-field_types__ads.htm#167_13">Copy_Arg</A>'<b>Access</b>,
255                                       <A HREF="terminal_interface-curses-forms-field_types__ads.htm#172_14">Free_Arg</A>'<b>Access</b>);
256             <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#239_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#80_4">E_Ok</A> <b>then</b>
257                <A HREF="terminal_interface-curses-aux__ads.htm#96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#239_7">Res</A>);
258             <b>end</b> <b>if</b>;
259          <b>end</b> <b>if</b>;
260          M_Builtin_Router := T;
261       <b>end</b> <b>if</b>;
262       <b>pragma</b> Assert (M_Builtin_Router /= Null_Field_Type);
263       <b>return</b> M_Builtin_Router;
264    <b>end</b> C_Builtin_Router;
265
266    <FONT COLOR=green><EM>--  -----------------------------------------------------------------------</EM></FONT>
267    <FONT COLOR=green><EM>--</EM></FONT>
268    <b>function</b> <A HREF="terminal_interface-curses-forms-field_types__ads.htm#149_13">C_Choice_Router</A><FONT COLOR=red><A NAME="264_13"></A></FONT> <b>return</b> C_Field_Type
269    <b>is</b>
270       <FONT COLOR=red><A NAME="266_7">Res</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#78_12">Eti_Error</A>;
271       T   : C_Field_Type;
272    <b>begin</b>
273       <b>if</b> M_Choice_Router = Null_Field_Type <b>then</b>
274          T := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#222_13">New_Fieldtype</A> (<A HREF="terminal_interface-curses-forms-field_types__ads.htm#177_13">Field_Check_Router</A>'<b>Access</b>,
275                              <A HREF="terminal_interface-curses-forms-field_types__ads.htm#185_13">Char_Check_Router</A>'<b>Access</b>);
276          <b>if</b> T = Null_Field_Type <b>then</b>
277             <b>raise</b> <A HREF="terminal_interface-curses-forms__ads.htm#288_4">Form_Exception</A>;
278          <b>else</b>
279             <A HREF="terminal_interface-curses-forms-field_types__adb.htm#266_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#227_13">Set_Fieldtype_Arg</A> (T,
280                                       <A HREF="terminal_interface-curses-forms-field_types__ads.htm#162_13">Make_Arg</A>'<b>Access</b>,
281                                       <A HREF="terminal_interface-curses-forms-field_types__ads.htm#167_13">Copy_Arg</A>'<b>Access</b>,
282                                       <A HREF="terminal_interface-curses-forms-field_types__ads.htm#172_14">Free_Arg</A>'<b>Access</b>);
283             <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#266_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#80_4">E_Ok</A> <b>then</b>
284                <A HREF="terminal_interface-curses-aux__ads.htm#96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#266_7">Res</A>);
285             <b>end</b> <b>if</b>;
286
287             <A HREF="terminal_interface-curses-forms-field_types__adb.htm#266_7">Res</A> := <A HREF="terminal_interface-curses-forms-field_types__ads.htm#234_13">Set_Fieldtype_Choice</A> (T,
288                                          <A HREF="terminal_interface-curses-forms-field_types__ads.htm#193_13">Next_Router</A>'<b>Access</b>,
289                                          <A HREF="terminal_interface-curses-forms-field_types__ads.htm#201_13">Prev_Router</A>'<b>Access</b>);
290             <b>if</b> <A HREF="terminal_interface-curses-forms-field_types__adb.htm#266_7">Res</A> /= <A HREF="terminal_interface-curses-aux__ads.htm#80_4">E_Ok</A> <b>then</b>
291                <A HREF="terminal_interface-curses-aux__ads.htm#96_14">Eti_Exception</A> (<A HREF="terminal_interface-curses-forms-field_types__adb.htm#266_7">Res</A>);
292             <b>end</b> <b>if</b>;
293          <b>end</b> <b>if</b>;
294          M_Choice_Router := T;
295       <b>end</b> <b>if</b>;
296       <b>pragma</b> Assert (M_Choice_Router /= Null_Field_Type);
297       <b>return</b> M_Choice_Router;
298    <b>end</b> C_Choice_Router;
299
300 <b>end</b> Terminal_Interface.Curses.Forms.Field_Types;
301 </PRE></BODY></HTML>