ncurses 6.2 - patch 20200222
[ncurses.git] / doc / html / ada / terminal_interface-curses-text_io__adb.htm
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>terminal_interface-curses-text_io.adb</TITLE>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <style type="text/css">
7 *.comment {
8         color: green;
9 }
10 *.symbol {
11         color: red;
12 }
13 </style>
14 </HEAD>
15 <BODY>
16 <HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io.adb </H1></DIV><HR>
17 <PRE>
18 <span class="comment"><EM>------------------------------------------------------------------------------</EM></span>
19 <span class="comment"><EM>--                                                                          --</EM></span>
20 <span class="comment"><EM>--                           <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding                           --</EM></span>
21 <span class="comment"><EM>--                                                                          --</EM></span>
22 <span class="comment"><EM>--                     Terminal_Interface.Curses.Text_IO                    --</EM></span>
23 <span class="comment"><EM>--                                                                          --</EM></span>
24 <span class="comment"><EM>--                                 B O D Y                                  --</EM></span>
25 <span class="comment"><EM>--                                                                          --</EM></span>
26 <span class="comment"><EM>------------------------------------------------------------------------------</EM></span>
27 <span class="comment"><EM>-- Copyright 2020 Thomas E. Dickey                                          --</EM></span>
28 <span class="comment"><EM>-- Copyright 1999-2011,2014 Free Software Foundation, Inc.                  --</EM></span>
29 <span class="comment"><EM>--                                                                          --</EM></span>
30 <span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a  --</EM></span>
31 <span class="comment"><EM>-- copy of this software and associated documentation files (the            --</EM></span>
32 <span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including      --</EM></span>
33 <span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish,      --</EM></span>
34 <span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell       --</EM></span>
35 <span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is    --</EM></span>
36 <span class="comment"><EM>-- furnished to do so, subject to the following conditions:                 --</EM></span>
37 <span class="comment"><EM>--                                                                          --</EM></span>
38 <span class="comment"><EM>-- The above copyright notice and this permission notice shall be included  --</EM></span>
39 <span class="comment"><EM>-- in all copies or substantial portions of the Software.                   --</EM></span>
40 <span class="comment"><EM>--                                                                          --</EM></span>
41 <span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --</EM></span>
42 <span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --</EM></span>
43 <span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --</EM></span>
44 <span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --</EM></span>
45 <span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --</EM></span>
46 <span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --</EM></span>
47 <span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --</EM></span>
48 <span class="comment"><EM>--                                                                          --</EM></span>
49 <span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright   --</EM></span>
50 <span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the     --</EM></span>
51 <span class="comment"><EM>-- sale, use or other dealings in this Software without prior written       --</EM></span>
52 <span class="comment"><EM>-- authorization.                                                           --</EM></span>
53 <span class="comment"><EM>------------------------------------------------------------------------------</EM></span>
54 <span class="comment"><EM>--  Author:  Juergen Pfeifer, 1996</EM></span>
55 <span class="comment"><EM>--  Version Control:</EM></span>
56 <span class="comment"><EM>--  @Revision: 1.23 @</EM></span>
57 <span class="comment"><EM>--  @Date: 2020/02/02 23:34:34 @</EM></span>
58 <span class="comment"><EM>--  Binding Version 01.00</EM></span>
59 <span class="comment"><EM>------------------------------------------------------------------------------</EM></span>
60 <b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_43_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_48_28">Curses</A>.<span class="symbol"><A NAME="ref_43_40" HREF="terminal_interface-curses-text_io__ads.htm#ref_45_35">Text_IO</A></span> <b>is</b>
61
62    <span class="symbol"><A NAME="ref_45_4">Default_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_57_4">Null_Window</A>;
63
64    <b>procedure</b> <span class="symbol"><A NAME="ref_47_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_60_14">Set_Window</A></span> (<span class="symbol"><A NAME="ref_47_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_60_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>)
65    <b>is</b>
66    <b>begin</b>
67       <A HREF="terminal_interface-curses-text_io__adb.htm#ref_45_4">Default_Window</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_60_26">Win</A>;
68    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_60_14">Set_Window</A>;
69
70    <b>function</b> <span class="symbol"><A NAME="ref_53_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>
71    <b>is</b>
72    <b>begin</b>
73       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_45_4">Default_Window</A> = <A HREF="terminal_interface-curses__ads.htm#ref_57_4">Null_Window</A> <b>then</b>
74          <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_645_13">Standard_Window</A>;
75       <b>else</b>
76          <b>return</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_45_4">Default_Window</A>;
77       <b>end</b> <b>if</b>;
78    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>;
79    <b>pragma</b> Inline (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>);
80
81    <b>procedure</b> <span class="symbol"><A NAME="ref_64_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_66_14">Flush</A></span> (<span class="symbol"><A NAME="ref_64_21" HREF="terminal_interface-curses-text_io__ads.htm#ref_66_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>)
82    <b>is</b>
83    <b>begin</b>
84       <A HREF="terminal_interface-curses__ads.htm#ref_1216_14">Refresh</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_66_21">Win</A>);
85    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_66_14">Flush</A>;
86
87    <b>procedure</b> <span class="symbol"><A NAME="ref_70_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_67_14">Flush</A></span>
88    <b>is</b>
89    <b>begin</b>
90       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_66_14">Flush</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>);
91    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_67_14">Flush</A>;
92
93    <span class="comment"><EM>--------------------------------------------</EM></span>
94    <span class="comment"><EM>-- Specification of line and page lengths --</EM></span>
95    <span class="comment"><EM>--------------------------------------------</EM></span>
96
97    <span class="comment"><EM>--  There are no set routines in this package. I assume, that you allocate</EM></span>
98    <span class="comment"><EM>--  the window with an appropriate size.</EM></span>
99    <span class="comment"><EM>--  A scroll-window is interpreted as an page with unbounded page length,</EM></span>
100    <span class="comment"><EM>--  i.e. it returns the conventional 0 as page length.</EM></span>
101
102    <b>function</b> <span class="symbol"><A NAME="ref_85_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_78_13">Line_Length</A></span> (<span class="symbol"><A NAME="ref_85_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_78_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A>
103    <b>is</b>
104       <span class="symbol"><A NAME="ref_87_7">N_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_62_12">Line_Count</A>;
105       <span class="symbol"><A NAME="ref_88_7">N_Cols</A></span>  : <A HREF="terminal_interface-curses__ads.htm#ref_64_12">Column_Count</A>;
106    <b>begin</b>
107       <A HREF="terminal_interface-curses__ads.htm#ref_1399_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_78_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_87_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_88_7">N_Cols</A>);
108       <span class="comment"><EM>--  if Natural (N_Cols) &gt; Natural (Count'Last) then</EM></span>
109       <span class="comment"><EM>--     raise Layout_Error;</EM></span>
110       <span class="comment"><EM>--  end if;</EM></span>
111       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_88_7">N_Cols</A>);
112    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_78_13">Line_Length</A>;
113
114    <b>function</b> <span class="symbol"><A NAME="ref_97_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_79_13">Line_Length</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A>
115    <b>is</b>
116    <b>begin</b>
117       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_78_13">Line_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>);
118    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_79_13">Line_Length</A>;
119
120    <b>function</b> <span class="symbol"><A NAME="ref_103_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A></span> (<span class="symbol"><A NAME="ref_103_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_81_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A>
121    <b>is</b>
122       <span class="symbol"><A NAME="ref_105_7">N_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_62_12">Line_Count</A>;
123       <span class="symbol"><A NAME="ref_106_7">N_Cols</A></span>  : <A HREF="terminal_interface-curses__ads.htm#ref_64_12">Column_Count</A>;
124    <b>begin</b>
125       <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1193_13">Scrolling_Allowed</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_26">Win</A>) <b>then</b>
126          <b>return</b> 0;
127       <b>else</b>
128          <A HREF="terminal_interface-curses__ads.htm#ref_1399_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_105_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_106_7">N_Cols</A>);
129          <span class="comment"><EM>--  if Natural (N_Lines) &gt; Natural (Count'Last) then</EM></span>
130          <span class="comment"><EM>--     raise Layout_Error;</EM></span>
131          <span class="comment"><EM>--  end if;</EM></span>
132          <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_105_7">N_Lines</A>);
133       <b>end</b> <b>if</b>;
134    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A>;
135
136    <b>function</b> <span class="symbol"><A NAME="ref_119_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_82_13">Page_Length</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A>
137    <b>is</b>
138    <b>begin</b>
139       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>);
140    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_82_13">Page_Length</A>;
141
142    <span class="comment"><EM>------------------------------------</EM></span>
143    <span class="comment"><EM>-- Column, Line, and Page Control --</EM></span>
144    <span class="comment"><EM>------------------------------------</EM></span>
145    <b>procedure</b> <span class="symbol"><A NAME="ref_128_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A></span> (<span class="symbol"><A NAME="ref_128_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>; <span class="symbol"><A NAME="ref_128_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_38">Spacing</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A> := 1)
146    <b>is</b>
147       <span class="symbol"><A NAME="ref_130_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Win</A>);
148    <b>begin</b>
149       <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_38">Spacing</A>'Valid <b>then</b>
150          <b>raise</b> Constraint_Error;
151       <b>end</b> <b>if</b>;
152
153       <b>for</b> <span class="symbol"><A NAME="ref_136_11">I</A></span> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_38">Spacing</A> <b>loop</b>
154          <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_130_7">P_Size</A> &gt; 0 <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Win</A>) &gt;= <A HREF="terminal_interface-curses-text_io__adb.htm#ref_130_7">P_Size</A> <b>then</b>
155             <A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Win</A>);
156          <b>else</b>
157             <A HREF="terminal_interface-curses__ads.htm#ref_699_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Win</A>, ASCII.LF);
158          <b>end</b> <b>if</b>;
159       <b>end</b> <b>loop</b>;
160    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A>;
161
162    <b>procedure</b> <span class="symbol"><A NAME="ref_145_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_88_14">New_Line</A></span> (<span class="symbol"><A NAME="ref_145_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_88_24">Spacing</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A> := 1)
163    <b>is</b>
164    <b>begin</b>
165       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_88_24">Spacing</A>);
166    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_88_14">New_Line</A>;
167
168    <b>procedure</b> <span class="symbol"><A NAME="ref_151_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A></span> (<span class="symbol"><A NAME="ref_151_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_90_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>)
169    <b>is</b>
170    <b>begin</b>
171       <A HREF="terminal_interface-curses__ads.htm#ref_1251_14">Clear</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_24">Win</A>);
172    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A>;
173
174    <b>procedure</b> <span class="symbol"><A NAME="ref_157_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_91_14">New_Page</A></span>
175    <b>is</b>
176    <b>begin</b>
177       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>);
178    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_91_14">New_Page</A>;
179
180    <b>procedure</b> <span class="symbol"><A NAME="ref_163_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_14">Set_Col</A></span> (<span class="symbol"><A NAME="ref_163_23" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>;  <span class="symbol"><A NAME="ref_163_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_38">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A>)
181    <b>is</b>
182       <span class="symbol"><A NAME="ref_165_7">Y</A></span>  : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Line_Position</A>;
183       <span class="symbol"><A NAME="ref_166_7">X1</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Column_Position</A>;
184       <span class="symbol"><A NAME="ref_167_7">X2</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Column_Position</A>;
185       <span class="symbol"><A NAME="ref_168_7">N</A></span>  : Natural;
186    <b>begin</b>
187       <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_38">To</A>'Valid <b>then</b>
188          <b>raise</b> Constraint_Error;
189       <b>end</b> <b>if</b>;
190
191       <A HREF="terminal_interface-curses__ads.htm#ref_1415_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X1</A>);
192       <A HREF="terminal_interface-curses-text_io__adb.htm#ref_168_7">N</A>  := Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_38">To</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_168_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_168_7">N</A> - 1;
193       <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">X2</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Column_Position</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_168_7">N</A>);
194       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X1</A> &gt; <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">X2</A> <b>then</b>
195          <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">Win</A>, 1);
196          <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X1</A> := 0;
197       <b>end</b> <b>if</b>;
198       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X1</A> &lt; <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">X2</A> <b>then</b>
199          <b>declare</b>
200             <span class="symbol"><A NAME="ref_183_13">Filler</A></span> : <b>constant</b> String (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X1</A>) .. (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">X2</A>) - 1))
201               := (<b>others</b> =&gt; ' ');
202          <b>begin</b>
203             <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_183_13">Filler</A>);
204          <b>end</b>;
205       <b>end</b> <b>if</b>;
206    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_14">Set_Col</A>;
207
208    <b>procedure</b> <span class="symbol"><A NAME="ref_191_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_94_14">Set_Col</A></span> (<span class="symbol"><A NAME="ref_191_23" HREF="terminal_interface-curses-text_io__ads.htm#ref_94_23">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A>)
209    <b>is</b>
210    <b>begin</b>
211       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_14">Set_Col</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_94_23">To</A>);
212    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_94_14">Set_Col</A>;
213
214    <b>procedure</b> <span class="symbol"><A NAME="ref_197_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_14">Set_Line</A></span> (<span class="symbol"><A NAME="ref_197_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>; <span class="symbol"><A NAME="ref_197_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_38">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A>)
215    <b>is</b>
216       <span class="symbol"><A NAME="ref_199_7">Y1</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Line_Position</A>;
217       <span class="symbol"><A NAME="ref_200_7">Y2</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Line_Position</A>;
218       <span class="symbol"><A NAME="ref_201_7">X</A></span>  : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Column_Position</A>;
219       <span class="symbol"><A NAME="ref_202_7">N</A></span>  : Natural;
220    <b>begin</b>
221       <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_38">To</A>'Valid <b>then</b>
222          <b>raise</b> Constraint_Error;
223       <b>end</b> <b>if</b>;
224
225       <A HREF="terminal_interface-curses__ads.htm#ref_1415_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y1</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">X</A>);
226       <b>pragma</b> Warnings (Off, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">X</A>);         <span class="comment"><EM>--  unreferenced</EM></span>
227       <A HREF="terminal_interface-curses-text_io__adb.htm#ref_202_7">N</A>  := Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_38">To</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_202_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_202_7">N</A> - 1;
228       <A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">Y2</A> := <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Line_Position</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_202_7">N</A>);
229       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">Y2</A> &lt; <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y1</A> <b>then</b>
230          <A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">Win</A>);
231          <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y1</A> := 0;
232       <b>end</b> <b>if</b>;
233       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y1</A> &lt; <A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">Y2</A> <b>then</b>
234          <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">Y2</A> - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y1</A>));
235       <b>end</b> <b>if</b>;
236    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_14">Set_Line</A>;
237
238    <b>procedure</b> <span class="symbol"><A NAME="ref_221_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_97_14">Set_Line</A></span> (<span class="symbol"><A NAME="ref_221_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_97_24">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A>)
239    <b>is</b>
240    <b>begin</b>
241       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_14">Set_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_97_24">To</A>);
242    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_97_14">Set_Line</A>;
243
244    <b>function</b> <span class="symbol"><A NAME="ref_227_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_99_13">Col</A></span> (<span class="symbol"><A NAME="ref_227_18" HREF="terminal_interface-curses-text_io__ads.htm#ref_99_18">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A>
245    <b>is</b>
246       <span class="symbol"><A NAME="ref_229_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Line_Position</A>;
247       <span class="symbol"><A NAME="ref_230_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Column_Position</A>;
248       <span class="symbol"><A NAME="ref_231_7">N</A></span> : Natural;
249    <b>begin</b>
250       <A HREF="terminal_interface-curses__ads.htm#ref_1415_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_99_18">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_229_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">X</A>);
251       <A HREF="terminal_interface-curses-text_io__adb.htm#ref_231_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">X</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_231_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_231_7">N</A> + 1;
252       <span class="comment"><EM>--  if N &gt; Natural (Count'Last) then</EM></span>
253       <span class="comment"><EM>--     raise Layout_Error;</EM></span>
254       <span class="comment"><EM>--  end if;</EM></span>
255       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_231_7">N</A>);
256    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_99_13">Col</A>;
257
258    <b>function</b> <span class="symbol"><A NAME="ref_241_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_100_13">Col</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A>
259    <b>is</b>
260    <b>begin</b>
261       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_99_13">Col</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>);
262    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_100_13">Col</A>;
263
264    <b>function</b> <span class="symbol"><A NAME="ref_247_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A></span> (<span class="symbol"><A NAME="ref_247_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_102_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A>
265    <b>is</b>
266       <span class="symbol"><A NAME="ref_249_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Line_Position</A>;
267       <span class="symbol"><A NAME="ref_250_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Column_Position</A>;
268       <span class="symbol"><A NAME="ref_251_7">N</A></span> : Natural;
269    <b>begin</b>
270       <A HREF="terminal_interface-curses__ads.htm#ref_1415_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_102_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_249_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">X</A>);
271       <A HREF="terminal_interface-curses-text_io__adb.htm#ref_251_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_249_7">Y</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_251_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_251_7">N</A> + 1;
272       <span class="comment"><EM>--  if N &gt; Natural (Count'Last) then</EM></span>
273       <span class="comment"><EM>--     raise Layout_Error;</EM></span>
274       <span class="comment"><EM>--  end if;</EM></span>
275       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_251_7">N</A>);
276    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A>;
277
278    <b>function</b> <span class="symbol"><A NAME="ref_261_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_103_13">Line</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_49_12">Positive_Count</A>
279    <b>is</b>
280    <b>begin</b>
281       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>);
282    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_103_13">Line</A>;
283
284    <span class="comment"><EM>-----------------------</EM></span>
285    <span class="comment"><EM>-- Characters Output --</EM></span>
286    <span class="comment"><EM>-----------------------</EM></span>
287
288    <b>procedure</b> <span class="symbol"><A NAME="ref_271_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_14">Put</A></span> (<span class="symbol"><A NAME="ref_271_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Win</A></span>  : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>; <span class="symbol"><A NAME="ref_271_34" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_34">Item</A></span> : Character)
289    <b>is</b>
290       <span class="symbol"><A NAME="ref_273_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Win</A>);
291       <span class="symbol"><A NAME="ref_274_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Line_Position</A>;
292       <span class="symbol"><A NAME="ref_275_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Column_Position</A>;
293       <span class="symbol"><A NAME="ref_276_7">L</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_62_12">Line_Count</A>;
294       <span class="symbol"><A NAME="ref_277_7">C</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_64_12">Column_Count</A>;
295    <b>begin</b>
296       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_273_7">P_Size</A> &gt; 0 <b>then</b>
297          <A HREF="terminal_interface-curses__ads.htm#ref_1415_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_274_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_275_7">X</A>);
298          <A HREF="terminal_interface-curses__ads.htm#ref_1399_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_276_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_277_7">C</A>);
299          <b>if</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_274_7">Y</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_276_7">L</A> <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_275_7">X</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_277_7">C</A> <b>then</b>
300             <A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Win</A>);
301          <b>end</b> <b>if</b>;
302       <b>end</b> <b>if</b>;
303       <A HREF="terminal_interface-curses__ads.htm#ref_699_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_34">Item</A>);
304    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_14">Put</A>;
305
306    <b>procedure</b> <span class="symbol"><A NAME="ref_289_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_110_14">Put</A></span> (<span class="symbol"><A NAME="ref_289_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_110_19">Item</A></span> : Character)
307    <b>is</b>
308    <b>begin</b>
309       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_110_19">Item</A>);
310    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_110_14">Put</A>;
311
312    <span class="comment"><EM>--------------------</EM></span>
313    <span class="comment"><EM>-- Strings-Output --</EM></span>
314    <span class="comment"><EM>--------------------</EM></span>
315
316    <b>procedure</b> <span class="symbol"><A NAME="ref_299_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A></span> (<span class="symbol"><A NAME="ref_299_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Win</A></span>  : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>; <span class="symbol"><A NAME="ref_299_34" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_34">Item</A></span> : String)
317    <b>is</b>
318       <span class="symbol"><A NAME="ref_301_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Win</A>);
319       <span class="symbol"><A NAME="ref_302_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Line_Position</A>;
320       <span class="symbol"><A NAME="ref_303_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Column_Position</A>;
321       <span class="symbol"><A NAME="ref_304_7">L</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_62_12">Line_Count</A>;
322       <span class="symbol"><A NAME="ref_305_7">C</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_64_12">Column_Count</A>;
323    <b>begin</b>
324       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_301_7">P_Size</A> &gt; 0 <b>then</b>
325          <A HREF="terminal_interface-curses__ads.htm#ref_1415_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_302_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_303_7">X</A>);
326          <A HREF="terminal_interface-curses__ads.htm#ref_1399_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_304_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_305_7">C</A>);
327          <b>if</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_302_7">Y</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_304_7">L</A> <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_303_7">X</A> + 1 + <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_34">Item</A>'Length) &gt;= <A HREF="terminal_interface-curses-text_io__adb.htm#ref_305_7">C</A> <b>then</b>
328             <A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Win</A>);
329          <b>end</b> <b>if</b>;
330       <b>end</b> <b>if</b>;
331       <A HREF="terminal_interface-curses__ads.htm#ref_824_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_34">Item</A>);
332    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A>;
333
334    <b>procedure</b> <span class="symbol"><A NAME="ref_317_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_117_14">Put</A></span> (<span class="symbol"><A NAME="ref_317_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_117_19">Item</A></span> : String)
335    <b>is</b>
336    <b>begin</b>
337       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_117_19">Item</A>);
338    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_117_14">Put</A>;
339
340    <b>procedure</b> <span class="symbol"><A NAME="ref_323_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_119_14">Put_Line</A></span>
341      (<span class="symbol"><A NAME="ref_324_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_120_7">Win</A></span>  : <A HREF="terminal_interface-curses__ads.htm#ref_56_9">Window</A>;
342       <span class="symbol"><A NAME="ref_325_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_121_7">Item</A></span> : String)
343    <b>is</b>
344    <b>begin</b>
345       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_120_7">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_121_7">Item</A>);
346       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_120_7">Win</A>, 1);
347    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_119_14">Put_Line</A>;
348
349    <b>procedure</b> <span class="symbol"><A NAME="ref_332_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_123_14">Put_Line</A></span>
350      (<span class="symbol"><A NAME="ref_333_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_124_7">Item</A></span> : String)
351    <b>is</b>
352    <b>begin</b>
353       <A HREF="terminal_interface-curses-text_io__ads.htm#ref_119_14">Put_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_124_7">Item</A>);
354    <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_123_14">Put_Line</A>;
355
356 <b>end</b> <A HREF="terminal_interface__ads.htm#ref_43_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_48_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_45_35">Text_IO</A>;
357 </PRE></BODY></HTML>