]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/ada/terminal_interface-curses-text_io__adb.htm
ncurses 6.3 - patch 20221001
[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>--                           <strong>GNAT</strong> 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>