ncurses 5.3
[ncurses.git] / doc / html / ada / terminal_interface-curses-text_io__adb.htm
1 <HTML><HEAD><TITLE>terminal_interface-curses-text_io.adb</TITLE></HEAD>
2 <BODY>
3 <HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io.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.Text_IO                    --</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://www.familiepfeifer.de/juergen">J&uuml;rgen Pfeifer</A>, 1996</EM></FONT>
41 <FONT COLOR=green><EM>--  Contact: <A HREF="http://www.familiepfeifer.de/Contact.aspx?Lang=en">www.familiepfeifer.de/Contact.aspx?Lang=en</A></EM></FONT>
42 <FONT COLOR=green><EM>--  Version Control:</EM></FONT>
43 <FONT COLOR=green><EM>--  @Revision: 1.13 @</EM></FONT>
44 <FONT COLOR=green><EM>--  Binding Version 01.00</EM></FONT>
45 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
46 <b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#45_35">Text_IO</A><FONT COLOR=red><A NAME="42_40"></A></FONT> <b>is</b>
47
48    <FONT COLOR=red><A NAME="44_4">Default_Window</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#58_4">Null_Window</A>;
49
50    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#60_14">Set_Window</A><FONT COLOR=red><A NAME="46_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#60_26">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>)
51    <b>is</b>
52    <b>begin</b>
53       <A HREF="terminal_interface-curses-text_io__adb.htm#44_4">Default_Window</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#60_26">Win</A>;
54    <b>end</b> Set_Window;
55
56    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A><FONT COLOR=red><A NAME="52_13"></A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>
57    <b>is</b>
58    <b>begin</b>
59       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#44_4">Default_Window</A> = <A HREF="terminal_interface-curses__ads.htm#58_4">Null_Window</A> <b>then</b>
60          <b>return</b> <A HREF="terminal_interface-curses__ads.htm#475_13">Standard_Window</A>;
61       <b>else</b>
62          <b>return</b> <A HREF="terminal_interface-curses-text_io__adb.htm#44_4">Default_Window</A>;
63       <b>end</b> <b>if</b>;
64    <b>end</b> Get_Window;
65    <b>pragma</b> Inline (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>);
66
67    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#66_14">Flush</A><FONT COLOR=red><A NAME="63_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#66_21">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>)
68    <b>is</b>
69    <b>begin</b>
70       <A HREF="terminal_interface-curses__ads.htm#1039_14">Refresh</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#66_21">Win</A>);
71    <b>end</b> Flush;
72
73    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#67_14">Flush</A><FONT COLOR=red><A NAME="69_14"></A></FONT>
74    <b>is</b>
75    <b>begin</b>
76       <A HREF="terminal_interface-curses-text_io__ads.htm#66_14">Flush</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>);
77    <b>end</b> Flush;
78
79    <FONT COLOR=green><EM>--------------------------------------------</EM></FONT>
80    <FONT COLOR=green><EM>-- Specification of line and page lengths --</EM></FONT>
81    <FONT COLOR=green><EM>--------------------------------------------</EM></FONT>
82
83    <FONT COLOR=green><EM>--  There are no set routines in this package. I assume, that you allocate</EM></FONT>
84    <FONT COLOR=green><EM>--  the window with an appropriate size.</EM></FONT>
85    <FONT COLOR=green><EM>--  A scroll-window is interpreted as an page with unbounded page length,</EM></FONT>
86    <FONT COLOR=green><EM>--  i.e. it returns the conventional 0 as page length.</EM></FONT>
87
88    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#78_13">Line_Length</A><FONT COLOR=red><A NAME="84_13"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#78_26">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A>
89    <b>is</b>
90       <FONT COLOR=red><A NAME="86_7">N_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#63_12">Line_Count</A>;
91       <FONT COLOR=red><A NAME="87_7">N_Cols</A></FONT>  : <A HREF="terminal_interface-curses__ads.htm#65_12">Column_Count</A>;
92    <b>begin</b>
93       <A HREF="terminal_interface-curses__ads.htm#1222_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#78_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#86_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#87_7">N_Cols</A>);
94       <b>if</b> Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#87_7">N_Cols</A>) &gt; Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A>'Last) <b>then</b>
95          <b>raise</b> <A HREF="terminal_interface-curses-text_io__ads.htm#135_4">Layout_Error</A>;
96       <b>end</b> <b>if</b>;
97       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#87_7">N_Cols</A>);
98    <b>end</b> Line_Length;
99
100    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#79_13">Line_Length</A><FONT COLOR=red><A NAME="96_13"></A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A>
101    <b>is</b>
102    <b>begin</b>
103       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#78_13">Line_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>);
104    <b>end</b> Line_Length;
105
106    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#81_13">Page_Length</A><FONT COLOR=red><A NAME="102_13"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#81_26">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A>
107    <b>is</b>
108       <FONT COLOR=red><A NAME="104_7">N_Lines</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#63_12">Line_Count</A>;
109       <FONT COLOR=red><A NAME="105_7">N_Cols</A></FONT>  : <A HREF="terminal_interface-curses__ads.htm#65_12">Column_Count</A>;
110    <b>begin</b>
111       <b>if</b> <A HREF="terminal_interface-curses__ads.htm#1016_13">Scrolling_Allowed</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#81_26">Win</A>) <b>then</b>
112          <b>return</b> 0;
113       <b>else</b>
114          <A HREF="terminal_interface-curses__ads.htm#1222_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#81_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#104_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#105_7">N_Cols</A>);
115          <b>if</b> Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#104_7">N_Lines</A>) &gt; Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A>'Last) <b>then</b>
116             <b>raise</b> <A HREF="terminal_interface-curses-text_io__ads.htm#135_4">Layout_Error</A>;
117          <b>end</b> <b>if</b>;
118          <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#104_7">N_Lines</A>);
119       <b>end</b> <b>if</b>;
120    <b>end</b> Page_Length;
121
122    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#82_13">Page_Length</A><FONT COLOR=red><A NAME="118_13"></A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A>
123    <b>is</b>
124    <b>begin</b>
125       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#81_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>);
126    <b>end</b> Page_Length;
127
128    <FONT COLOR=green><EM>------------------------------------</EM></FONT>
129    <FONT COLOR=green><EM>-- Column, Line, and Page Control --</EM></FONT>
130    <FONT COLOR=green><EM>------------------------------------</EM></FONT>
131    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#87_14">New_Line</A><FONT COLOR=red><A NAME="127_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#87_24">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>; <A HREF="terminal_interface-curses-text_io__ads.htm#87_41">Spacing</A> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A> := 1)
132    <b>is</b>
133       <FONT COLOR=red><A NAME="129_7">P_Size</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#81_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#87_24">Win</A>);
134    <b>begin</b>
135       <b>if</b> <A HREF="terminal_interface-curses-text_io__ads.htm#87_41">Spacing</A> <b>not</b> <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A> <b>then</b>
136          <b>raise</b> Constraint_Error;
137       <b>end</b> <b>if</b>;
138
139       <b>for</b> <FONT COLOR=red><A NAME="135_11">I</A></FONT> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#87_41">Spacing</A> <b>loop</b>
140          <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#129_7">P_Size</A> &gt; 0 <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-text_io__ads.htm#102_13">Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#87_24">Win</A>) &gt;= <A HREF="terminal_interface-curses-text_io__adb.htm#129_7">P_Size</A> <b>then</b>
141             <A HREF="terminal_interface-curses-text_io__ads.htm#90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#87_24">Win</A>);
142          <b>else</b>
143             <A HREF="terminal_interface-curses__ads.htm#522_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#87_24">Win</A>, ASCII.LF);
144          <b>end</b> <b>if</b>;
145       <b>end</b> <b>loop</b>;
146    <b>end</b> New_Line;
147
148    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#88_14">New_Line</A><FONT COLOR=red><A NAME="144_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#88_24">Spacing</A> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A> := 1)
149    <b>is</b>
150    <b>begin</b>
151       <A HREF="terminal_interface-curses-text_io__ads.htm#87_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#88_24">Spacing</A>);
152    <b>end</b> New_Line;
153
154    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#90_14">New_Page</A><FONT COLOR=red><A NAME="150_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#90_24">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>)
155    <b>is</b>
156    <b>begin</b>
157       <A HREF="terminal_interface-curses__ads.htm#1074_14">Clear</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#90_24">Win</A>);
158    <b>end</b> New_Page;
159
160    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#91_14">New_Page</A><FONT COLOR=red><A NAME="156_14"></A></FONT>
161    <b>is</b>
162    <b>begin</b>
163       <A HREF="terminal_interface-curses-text_io__ads.htm#90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>);
164    <b>end</b> New_Page;
165
166    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#93_14">Set_Col</A><FONT COLOR=red><A NAME="162_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#93_23">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>;  <A HREF="terminal_interface-curses-text_io__ads.htm#93_41">To</A> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A>)
167    <b>is</b>
168       <FONT COLOR=red><A NAME="164_7">Y</A></FONT>  : <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>;
169       <FONT COLOR=red><A NAME="165_7">X1</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A>;
170       <FONT COLOR=red><A NAME="166_7">X2</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A>;
171       <FONT COLOR=red><A NAME="167_7">N</A></FONT>  : Natural;
172    <b>begin</b>
173       <b>if</b> <A HREF="terminal_interface-curses-text_io__ads.htm#93_41">To</A> <b>not</b> <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A> <b>then</b>
174          <b>raise</b> Constraint_Error;
175       <b>end</b> <b>if</b>;
176
177       <A HREF="terminal_interface-curses__ads.htm#1238_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#93_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#164_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#165_7">X1</A>);
178       <A HREF="terminal_interface-curses-text_io__adb.htm#167_7">N</A>  := Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#93_41">To</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#167_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#167_7">N</A> - 1;
179       <A HREF="terminal_interface-curses-text_io__adb.htm#166_7">X2</A> := <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#167_7">N</A>);
180       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#165_7">X1</A> &gt; <A HREF="terminal_interface-curses-text_io__adb.htm#166_7">X2</A> <b>then</b>
181          <A HREF="terminal_interface-curses-text_io__ads.htm#87_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#93_23">Win</A>, 1);
182          <A HREF="terminal_interface-curses-text_io__adb.htm#165_7">X1</A> := 0;
183       <b>end</b> <b>if</b>;
184       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#165_7">X1</A> &lt; <A HREF="terminal_interface-curses-text_io__adb.htm#166_7">X2</A> <b>then</b>
185          <b>declare</b>
186             <FONT COLOR=red><A NAME="182_13">Filler</A></FONT> : <b>constant</b> String (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#165_7">X1</A>) .. (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#166_7">X2</A>) - 1))
187               := (<b>others</b> =&gt; ' ');
188          <b>begin</b>
189             <A HREF="terminal_interface-curses-text_io__ads.htm#116_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#93_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#182_13">Filler</A>);
190          <b>end</b>;
191       <b>end</b> <b>if</b>;
192    <b>end</b> Set_Col;
193
194    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#94_14">Set_Col</A><FONT COLOR=red><A NAME="190_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#94_23">To</A> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A>)
195    <b>is</b>
196    <b>begin</b>
197       <A HREF="terminal_interface-curses-text_io__ads.htm#93_14">Set_Col</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#94_23">To</A>);
198    <b>end</b> Set_Col;
199
200    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#96_14">Set_Line</A><FONT COLOR=red><A NAME="196_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#96_24">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>; <A HREF="terminal_interface-curses-text_io__ads.htm#96_41">To</A> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A>)
201    <b>is</b>
202       <FONT COLOR=red><A NAME="198_7">Y1</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>;
203       <FONT COLOR=red><A NAME="199_7">Y2</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>;
204       <FONT COLOR=red><A NAME="200_7">X</A></FONT>  : <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A>;
205       <FONT COLOR=red><A NAME="201_7">N</A></FONT>  : Natural;
206    <b>begin</b>
207       <b>if</b> <A HREF="terminal_interface-curses-text_io__ads.htm#96_41">To</A> <b>not</b> <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A> <b>then</b>
208          <b>raise</b> Constraint_Error;
209       <b>end</b> <b>if</b>;
210
211       <A HREF="terminal_interface-curses__ads.htm#1238_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#96_24">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#198_7">Y1</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#200_7">X</A>);
212       <A HREF="terminal_interface-curses-text_io__adb.htm#201_7">N</A>  := Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#96_41">To</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#201_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#201_7">N</A> - 1;
213       <A HREF="terminal_interface-curses-text_io__adb.htm#199_7">Y2</A> := <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#201_7">N</A>);
214       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#199_7">Y2</A> &lt; <A HREF="terminal_interface-curses-text_io__adb.htm#198_7">Y1</A> <b>then</b>
215          <A HREF="terminal_interface-curses-text_io__ads.htm#90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#96_24">Win</A>);
216          <A HREF="terminal_interface-curses-text_io__adb.htm#198_7">Y1</A> := 0;
217       <b>end</b> <b>if</b>;
218       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#198_7">Y1</A> &lt; <A HREF="terminal_interface-curses-text_io__adb.htm#199_7">Y2</A> <b>then</b>
219          <A HREF="terminal_interface-curses-text_io__ads.htm#87_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#96_24">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#199_7">Y2</A> - <A HREF="terminal_interface-curses-text_io__adb.htm#198_7">Y1</A>));
220       <b>end</b> <b>if</b>;
221    <b>end</b> Set_Line;
222
223    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#97_14">Set_Line</A><FONT COLOR=red><A NAME="219_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#97_24">To</A> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A>)
224    <b>is</b>
225    <b>begin</b>
226       <A HREF="terminal_interface-curses-text_io__ads.htm#96_14">Set_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#97_24">To</A>);
227    <b>end</b> Set_Line;
228
229    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#99_13">Col</A><FONT COLOR=red><A NAME="225_13"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#99_18">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A>
230    <b>is</b>
231       <FONT COLOR=red><A NAME="227_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>;
232       <FONT COLOR=red><A NAME="228_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A>;
233       <FONT COLOR=red><A NAME="229_7">N</A></FONT> : Natural;
234    <b>begin</b>
235       <A HREF="terminal_interface-curses__ads.htm#1238_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#99_18">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#227_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#228_7">X</A>);
236       <A HREF="terminal_interface-curses-text_io__adb.htm#229_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#228_7">X</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#229_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#229_7">N</A> + 1;
237       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#229_7">N</A> &gt; Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A>'Last) <b>then</b>
238          <b>raise</b> <A HREF="terminal_interface-curses-text_io__ads.htm#135_4">Layout_Error</A>;
239       <b>end</b> <b>if</b>;
240       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#229_7">N</A>);
241    <b>end</b> Col;
242
243    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#100_13">Col</A><FONT COLOR=red><A NAME="239_13"></A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A>
244    <b>is</b>
245    <b>begin</b>
246       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#99_13">Col</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>);
247    <b>end</b> Col;
248
249    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#102_13">Line</A><FONT COLOR=red><A NAME="245_13"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#102_19">Win</A> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A>
250    <b>is</b>
251       <FONT COLOR=red><A NAME="247_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>;
252       <FONT COLOR=red><A NAME="248_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A>;
253       <FONT COLOR=red><A NAME="249_7">N</A></FONT> : Natural;
254    <b>begin</b>
255       <A HREF="terminal_interface-curses__ads.htm#1238_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#102_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#247_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#248_7">X</A>);
256       <A HREF="terminal_interface-curses-text_io__adb.htm#249_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#247_7">Y</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#249_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#249_7">N</A> + 1;
257       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#249_7">N</A> &gt; Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A>'Last) <b>then</b>
258          <b>raise</b> <A HREF="terminal_interface-curses-text_io__ads.htm#135_4">Layout_Error</A>;
259       <b>end</b> <b>if</b>;
260       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#249_7">N</A>);
261    <b>end</b> Line;
262
263    <b>function</b> <A HREF="terminal_interface-curses-text_io__ads.htm#103_13">Line</A><FONT COLOR=red><A NAME="259_13"></A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#49_12">Positive_Count</A>
264    <b>is</b>
265    <b>begin</b>
266       <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#102_13">Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>);
267    <b>end</b> Line;
268
269    <FONT COLOR=green><EM>-----------------------</EM></FONT>
270    <FONT COLOR=green><EM>-- Characters Output --</EM></FONT>
271    <FONT COLOR=green><EM>-----------------------</EM></FONT>
272
273    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#109_14">Put</A><FONT COLOR=red><A NAME="269_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#109_19">Win</A>  : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>; <A HREF="terminal_interface-curses-text_io__ads.htm#109_37">Item</A> : <b>in</b> Character)
274    <b>is</b>
275       <FONT COLOR=red><A NAME="271_7">P_Size</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#81_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#109_19">Win</A>);
276       <FONT COLOR=red><A NAME="272_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>;
277       <FONT COLOR=red><A NAME="273_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A>;
278       <FONT COLOR=red><A NAME="274_7">L</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#63_12">Line_Count</A>;
279       <FONT COLOR=red><A NAME="275_7">C</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#65_12">Column_Count</A>;
280    <b>begin</b>
281       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#271_7">P_Size</A> &gt; 0 <b>then</b>
282          <A HREF="terminal_interface-curses__ads.htm#1238_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#109_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#272_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#273_7">X</A>);
283          <A HREF="terminal_interface-curses__ads.htm#1222_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#109_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#274_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#275_7">C</A>);
284          <b>if</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#272_7">Y</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#274_7">L</A> <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#273_7">X</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#275_7">C</A> <b>then</b>
285             <A HREF="terminal_interface-curses-text_io__ads.htm#90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#109_19">Win</A>);
286          <b>end</b> <b>if</b>;
287       <b>end</b> <b>if</b>;
288       <A HREF="terminal_interface-curses__ads.htm#522_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#109_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#109_37">Item</A>);
289    <b>end</b> Put;
290
291    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#110_14">Put</A><FONT COLOR=red><A NAME="287_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#110_19">Item</A> : <b>in</b> Character)
292    <b>is</b>
293    <b>begin</b>
294       <A HREF="terminal_interface-curses-text_io__ads.htm#109_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#110_19">Item</A>);
295    <b>end</b> Put;
296
297    <FONT COLOR=green><EM>--------------------</EM></FONT>
298    <FONT COLOR=green><EM>-- Strings-Output --</EM></FONT>
299    <FONT COLOR=green><EM>--------------------</EM></FONT>
300
301    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#116_14">Put</A><FONT COLOR=red><A NAME="297_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#116_19">Win</A>  : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>; <A HREF="terminal_interface-curses-text_io__ads.htm#116_37">Item</A> : <b>in</b> String)
302    <b>is</b>
303       <FONT COLOR=red><A NAME="299_7">P_Size</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#48_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#81_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#116_19">Win</A>);
304       <FONT COLOR=red><A NAME="300_7">Y</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>;
305       <FONT COLOR=red><A NAME="301_7">X</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A>;
306       <FONT COLOR=red><A NAME="302_7">L</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#63_12">Line_Count</A>;
307       <FONT COLOR=red><A NAME="303_7">C</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#65_12">Column_Count</A>;
308    <b>begin</b>
309       <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#299_7">P_Size</A> &gt; 0 <b>then</b>
310          <A HREF="terminal_interface-curses__ads.htm#1238_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#116_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#300_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#301_7">X</A>);
311          <A HREF="terminal_interface-curses__ads.htm#1222_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#116_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#302_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#303_7">C</A>);
312          <b>if</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#300_7">Y</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#302_7">L</A> <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#301_7">X</A> + 1 + <A HREF="terminal_interface-curses-text_io__ads.htm#116_37">Item</A>'Length) &gt;= <A HREF="terminal_interface-curses-text_io__adb.htm#303_7">C</A> <b>then</b>
313             <A HREF="terminal_interface-curses-text_io__ads.htm#90_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#116_19">Win</A>);
314          <b>end</b> <b>if</b>;
315       <b>end</b> <b>if</b>;
316       <A HREF="terminal_interface-curses__ads.htm#647_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#116_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#116_37">Item</A>);
317    <b>end</b> Put;
318
319    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#117_14">Put</A><FONT COLOR=red><A NAME="315_14"></A></FONT> (<A HREF="terminal_interface-curses-text_io__ads.htm#117_19">Item</A> : <b>in</b> String)
320    <b>is</b>
321    <b>begin</b>
322       <A HREF="terminal_interface-curses-text_io__ads.htm#116_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#117_19">Item</A>);
323    <b>end</b> Put;
324
325    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#119_14">Put_Line</A><FONT COLOR=red><A NAME="321_14"></A></FONT>
326      (<A HREF="terminal_interface-curses-text_io__ads.htm#120_7">Win</A>  : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>;
327       <A HREF="terminal_interface-curses-text_io__ads.htm#121_7">Item</A> : <b>in</b> String)
328    <b>is</b>
329    <b>begin</b>
330       <A HREF="terminal_interface-curses-text_io__ads.htm#116_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#120_7">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#121_7">Item</A>);
331       <A HREF="terminal_interface-curses-text_io__ads.htm#87_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#120_7">Win</A>, 1);
332    <b>end</b> Put_Line;
333
334    <b>procedure</b> <A HREF="terminal_interface-curses-text_io__ads.htm#123_14">Put_Line</A><FONT COLOR=red><A NAME="330_14"></A></FONT>
335      (<A HREF="terminal_interface-curses-text_io__ads.htm#124_7">Item</A> : <b>in</b> String)
336    <b>is</b>
337    <b>begin</b>
338       <A HREF="terminal_interface-curses-text_io__ads.htm#119_14">Put_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#63_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#124_7">Item</A>);
339    <b>end</b> Put_Line;
340
341 <b>end</b> Terminal_Interface.Curses.Text_IO;
342 </PRE></BODY></HTML>