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