| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
| <HTML> |
| <HEAD> |
| <TITLE>terminal_interface-curses-text_io.adb</TITLE> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| <style type="text/css"> |
| *.comment { |
| color: green; |
| } |
| *.symbol { |
| color: red; |
| } |
| </style> |
| </HEAD> |
| <BODY> |
| <HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-text_io.adb </H1></DIV><HR> |
| <PRE> |
| <span class="comment"><EM>------------------------------------------------------------------------------</EM></span> |
| <span class="comment"><EM>-- --</EM></span> |
| <span class="comment"><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></span> |
| <span class="comment"><EM>-- --</EM></span> |
| <span class="comment"><EM>-- Terminal_Interface.Curses.Text_IO --</EM></span> |
| <span class="comment"><EM>-- --</EM></span> |
| <span class="comment"><EM>-- B O D Y --</EM></span> |
| <span class="comment"><EM>-- --</EM></span> |
| <span class="comment"><EM>------------------------------------------------------------------------------</EM></span> |
| <span class="comment"><EM>-- Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. --</EM></span> |
| <span class="comment"><EM>-- --</EM></span> |
| <span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></span> |
| <span class="comment"><EM>-- copy of this software and associated documentation files (the --</EM></span> |
| <span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including --</EM></span> |
| <span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></span> |
| <span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></span> |
| <span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></span> |
| <span class="comment"><EM>-- furnished to do so, subject to the following conditions: --</EM></span> |
| <span class="comment"><EM>-- --</EM></span> |
| <span class="comment"><EM>-- The above copyright notice and this permission notice shall be included --</EM></span> |
| <span class="comment"><EM>-- in all copies or substantial portions of the Software. --</EM></span> |
| <span class="comment"><EM>-- --</EM></span> |
| <span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></span> |
| <span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></span> |
| <span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></span> |
| <span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></span> |
| <span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></span> |
| <span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></span> |
| <span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></span> |
| <span class="comment"><EM>-- --</EM></span> |
| <span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></span> |
| <span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></span> |
| <span class="comment"><EM>-- sale, use or other dealings in this Software without prior written --</EM></span> |
| <span class="comment"><EM>-- authorization. --</EM></span> |
| <span class="comment"><EM>------------------------------------------------------------------------------</EM></span> |
| <span class="comment"><EM>-- Author: Juergen Pfeifer, 1996</EM></span> |
| <span class="comment"><EM>-- Version Control:</EM></span> |
| <span class="comment"><EM>-- @Revision: 1.22 @</EM></span> |
| <span class="comment"><EM>-- @Date: 2014/05/24 21:32:18 @</EM></span> |
| <span class="comment"><EM>-- Binding Version 01.00</EM></span> |
| <span class="comment"><EM>------------------------------------------------------------------------------</EM></span> |
| <b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_47_28">Curses</A>.<span class="symbol"><A NAME="ref_42_40" HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A></span> <b>is</b> |
| |
| <span class="symbol"><A NAME="ref_44_4">Default_Window</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_56_4">Null_Window</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_46_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_59_14">Set_Window</A></span> (<span class="symbol"><A NAME="ref_46_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_59_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_44_4">Default_Window</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_59_26">Win</A>; |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_59_14">Set_Window</A>; |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_52_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A></span> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A> |
| <b>is</b> |
| <b>begin</b> |
| <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_44_4">Default_Window</A> = <A HREF="terminal_interface-curses__ads.htm#ref_56_4">Null_Window</A> <b>then</b> |
| <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_644_13">Standard_Window</A>; |
| <b>else</b> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_44_4">Default_Window</A>; |
| <b>end</b> <b>if</b>; |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>; |
| <b>pragma</b> Inline (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_63_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_65_14">Flush</A></span> (<span class="symbol"><A NAME="ref_63_21" HREF="terminal_interface-curses-text_io__ads.htm#ref_65_21">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_1215_14">Refresh</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_65_21">Win</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_65_14">Flush</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_69_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_66_14">Flush</A></span> |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_65_14">Flush</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_66_14">Flush</A>; |
| |
| <span class="comment"><EM>--------------------------------------------</EM></span> |
| <span class="comment"><EM>-- Specification of line and page lengths --</EM></span> |
| <span class="comment"><EM>--------------------------------------------</EM></span> |
| |
| <span class="comment"><EM>-- There are no set routines in this package. I assume, that you allocate</EM></span> |
| <span class="comment"><EM>-- the window with an appropriate size.</EM></span> |
| <span class="comment"><EM>-- A scroll-window is interpreted as an page with unbounded page length,</EM></span> |
| <span class="comment"><EM>-- i.e. it returns the conventional 0 as page length.</EM></span> |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_84_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_77_13">Line_Length</A></span> (<span class="symbol"><A NAME="ref_84_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_77_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_86_7">N_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_12">Line_Count</A>; |
| <span class="symbol"><A NAME="ref_87_7">N_Cols</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Column_Count</A>; |
| <b>begin</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_1398_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_77_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_86_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_87_7">N_Cols</A>); |
| <span class="comment"><EM>-- if Natural (N_Cols) > Natural (Count'Last) then</EM></span> |
| <span class="comment"><EM>-- raise Layout_Error;</EM></span> |
| <span class="comment"><EM>-- end if;</EM></span> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_87_7">N_Cols</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_77_13">Line_Length</A>; |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_96_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_78_13">Line_Length</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> |
| <b>is</b> |
| <b>begin</b> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_77_13">Line_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_78_13">Line_Length</A>; |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_102_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A></span> (<span class="symbol"><A NAME="ref_102_26" HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_104_7">N_Lines</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_12">Line_Count</A>; |
| <span class="symbol"><A NAME="ref_105_7">N_Cols</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Column_Count</A>; |
| <b>begin</b> |
| <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_1192_13">Scrolling_Allowed</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A>) <b>then</b> |
| <b>return</b> 0; |
| <b>else</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_1398_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_26">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_104_7">N_Lines</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_105_7">N_Cols</A>); |
| <span class="comment"><EM>-- if Natural (N_Lines) > Natural (Count'Last) then</EM></span> |
| <span class="comment"><EM>-- raise Layout_Error;</EM></span> |
| <span class="comment"><EM>-- end if;</EM></span> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_104_7">N_Lines</A>); |
| <b>end</b> <b>if</b>; |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A>; |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_118_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> |
| <b>is</b> |
| <b>begin</b> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_81_13">Page_Length</A>; |
| |
| <span class="comment"><EM>------------------------------------</EM></span> |
| <span class="comment"><EM>-- Column, Line, and Page Control --</EM></span> |
| <span class="comment"><EM>------------------------------------</EM></span> |
| <b>procedure</b> <span class="symbol"><A NAME="ref_127_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A></span> (<span class="symbol"><A NAME="ref_127_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>; <span class="symbol"><A NAME="ref_127_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_86_38">Spacing</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1) |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_129_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>); |
| <b>begin</b> |
| <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_38">Spacing</A>'Valid <b>then</b> |
| <b>raise</b> Constraint_Error; |
| <b>end</b> <b>if</b>; |
| |
| <b>for</b> <span class="symbol"><A NAME="ref_135_11">I</A></span> <b>in</b> 1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_38">Spacing</A> <b>loop</b> |
| <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_129_7">P_Size</A> > 0 <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>) >= <A HREF="terminal_interface-curses-text_io__adb.htm#ref_129_7">P_Size</A> <b>then</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>); |
| <b>else</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_698_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_24">Win</A>, ASCII.LF); |
| <b>end</b> <b>if</b>; |
| <b>end</b> <b>loop</b>; |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_144_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A></span> (<span class="symbol"><A NAME="ref_144_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Spacing</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_24">Spacing</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_87_14">New_Line</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_150_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A></span> (<span class="symbol"><A NAME="ref_150_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_89_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_1250_14">Clear</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_24">Win</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_156_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A></span> |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_90_14">New_Page</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_162_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_14">Set_Col</A></span> (<span class="symbol"><A NAME="ref_162_23" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>; <span class="symbol"><A NAME="ref_162_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_92_38">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_164_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>; |
| <span class="symbol"><A NAME="ref_165_7">X1</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A>; |
| <span class="symbol"><A NAME="ref_166_7">X2</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A>; |
| <span class="symbol"><A NAME="ref_167_7">N</A></span> : Natural; |
| <b>begin</b> |
| <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_38">To</A>'Valid <b>then</b> |
| <b>raise</b> Constraint_Error; |
| <b>end</b> <b>if</b>; |
| |
| <A HREF="terminal_interface-curses__ads.htm#ref_1414_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_164_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A>); |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_38">To</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">N</A> - 1; |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A> := <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_167_7">N</A>); |
| <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A> > <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A> <b>then</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A>, 1); |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A> := 0; |
| <b>end</b> <b>if</b>; |
| <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A> < <A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A> <b>then</b> |
| <b>declare</b> |
| <span class="symbol"><A NAME="ref_182_13">Filler</A></span> : <b>constant</b> String (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_165_7">X1</A>) .. (Integer (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_166_7">X2</A>) - 1)) |
| := (<b>others</b> => ' '); |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_23">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_182_13">Filler</A>); |
| <b>end</b>; |
| <b>end</b> <b>if</b>; |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_14">Set_Col</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_190_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_14">Set_Col</A></span> (<span class="symbol"><A NAME="ref_190_23" HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_92_14">Set_Col</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_23">To</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_93_14">Set_Col</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_196_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_14">Set_Line</A></span> (<span class="symbol"><A NAME="ref_196_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_24">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>; <span class="symbol"><A NAME="ref_196_38" HREF="terminal_interface-curses-text_io__ads.htm#ref_95_38">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_198_7">Y1</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>; |
| <span class="symbol"><A NAME="ref_199_7">Y2</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>; |
| <span class="symbol"><A NAME="ref_200_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A>; |
| <span class="symbol"><A NAME="ref_201_7">N</A></span> : Natural; |
| <b>begin</b> |
| <b>if</b> <b>not</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_38">To</A>'Valid <b>then</b> |
| <b>raise</b> Constraint_Error; |
| <b>end</b> <b>if</b>; |
| |
| <A HREF="terminal_interface-curses__ads.htm#ref_1414_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_24">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_198_7">Y1</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">X</A>); |
| <b>pragma</b> Warnings (Off, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_200_7">X</A>); <span class="comment"><EM>-- unreferenced</EM></span> |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_38">To</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">N</A> - 1; |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y2</A> := <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_201_7">N</A>); |
| <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y2</A> < <A HREF="terminal_interface-curses-text_io__adb.htm#ref_198_7">Y1</A> <b>then</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_24">Win</A>); |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_198_7">Y1</A> := 0; |
| <b>end</b> <b>if</b>; |
| <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_198_7">Y1</A> < <A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y2</A> <b>then</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_24">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_199_7">Y2</A> - <A HREF="terminal_interface-curses-text_io__adb.htm#ref_198_7">Y1</A>)); |
| <b>end</b> <b>if</b>; |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_14">Set_Line</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_220_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_14">Set_Line</A></span> (<span class="symbol"><A NAME="ref_220_24" HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">To</A></span> : <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_95_14">Set_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_24">To</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_96_14">Set_Line</A>; |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_226_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_98_13">Col</A></span> (<span class="symbol"><A NAME="ref_226_18" HREF="terminal_interface-curses-text_io__ads.htm#ref_98_18">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_228_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>; |
| <span class="symbol"><A NAME="ref_229_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A>; |
| <span class="symbol"><A NAME="ref_230_7">N</A></span> : Natural; |
| <b>begin</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_1414_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_98_18">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_228_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_229_7">X</A>); |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_229_7">X</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">N</A> + 1; |
| <span class="comment"><EM>-- if N > Natural (Count'Last) then</EM></span> |
| <span class="comment"><EM>-- raise Layout_Error;</EM></span> |
| <span class="comment"><EM>-- end if;</EM></span> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_230_7">N</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_98_13">Col</A>; |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_240_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_99_13">Col</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> |
| <b>is</b> |
| <b>begin</b> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_98_13">Col</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_99_13">Col</A>; |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_246_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A></span> (<span class="symbol"><A NAME="ref_246_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_101_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_248_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>; |
| <span class="symbol"><A NAME="ref_249_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A>; |
| <span class="symbol"><A NAME="ref_250_7">N</A></span> : Natural; |
| <b>begin</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_1414_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_248_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_249_7">X</A>); |
| <A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">N</A> := Natural (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_248_7">Y</A>); <A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">N</A> := <A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">N</A> + 1; |
| <span class="comment"><EM>-- if N > Natural (Count'Last) then</EM></span> |
| <span class="comment"><EM>-- raise Layout_Error;</EM></span> |
| <span class="comment"><EM>-- end if;</EM></span> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_250_7">N</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A>; |
| |
| <b>function</b> <span class="symbol"><A NAME="ref_260_13" HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A></span> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> |
| <b>is</b> |
| <b>begin</b> |
| <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_101_13">Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_102_13">Line</A>; |
| |
| <span class="comment"><EM>-----------------------</EM></span> |
| <span class="comment"><EM>-- Characters Output --</EM></span> |
| <span class="comment"><EM>-----------------------</EM></span> |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_270_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A></span> (<span class="symbol"><A NAME="ref_270_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>; <span class="symbol"><A NAME="ref_270_34" HREF="terminal_interface-curses-text_io__ads.htm#ref_108_34">Item</A></span> : Character) |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_272_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>); |
| <span class="symbol"><A NAME="ref_273_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>; |
| <span class="symbol"><A NAME="ref_274_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A>; |
| <span class="symbol"><A NAME="ref_275_7">L</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_12">Line_Count</A>; |
| <span class="symbol"><A NAME="ref_276_7">C</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Column_Count</A>; |
| <b>begin</b> |
| <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_272_7">P_Size</A> > 0 <b>then</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_1414_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_273_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_274_7">X</A>); |
| <A HREF="terminal_interface-curses__ads.htm#ref_1398_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_275_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_276_7">C</A>); |
| <b>if</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_273_7">Y</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_275_7">L</A> <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_274_7">X</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_276_7">C</A> <b>then</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>); |
| <b>end</b> <b>if</b>; |
| <b>end</b> <b>if</b>; |
| <A HREF="terminal_interface-curses__ads.htm#ref_698_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_34">Item</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_288_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_14">Put</A></span> (<span class="symbol"><A NAME="ref_288_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Item</A></span> : Character) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_108_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_19">Item</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_109_14">Put</A>; |
| |
| <span class="comment"><EM>--------------------</EM></span> |
| <span class="comment"><EM>-- Strings-Output --</EM></span> |
| <span class="comment"><EM>--------------------</EM></span> |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_298_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A></span> (<span class="symbol"><A NAME="ref_298_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>; <span class="symbol"><A NAME="ref_298_34" HREF="terminal_interface-curses-text_io__ads.htm#ref_115_34">Item</A></span> : String) |
| <b>is</b> |
| <span class="symbol"><A NAME="ref_300_7">P_Size</A></span> : <b>constant</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> := <A HREF="terminal_interface-curses-text_io__ads.htm#ref_80_13">Page_Length</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>); |
| <span class="symbol"><A NAME="ref_301_7">Y</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>; |
| <span class="symbol"><A NAME="ref_302_7">X</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A>; |
| <span class="symbol"><A NAME="ref_303_7">L</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_61_12">Line_Count</A>; |
| <span class="symbol"><A NAME="ref_304_7">C</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_63_12">Column_Count</A>; |
| <b>begin</b> |
| <b>if</b> <A HREF="terminal_interface-curses-text_io__adb.htm#ref_300_7">P_Size</A> > 0 <b>then</b> |
| <A HREF="terminal_interface-curses__ads.htm#ref_1414_14">Get_Cursor_Position</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_301_7">Y</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_302_7">X</A>); |
| <A HREF="terminal_interface-curses__ads.htm#ref_1398_14">Get_Size</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_303_7">L</A>, <A HREF="terminal_interface-curses-text_io__adb.htm#ref_304_7">C</A>); |
| <b>if</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_301_7">Y</A> + 1) = <A HREF="terminal_interface-curses-text_io__adb.htm#ref_303_7">L</A> <b>and</b> <b>then</b> (<A HREF="terminal_interface-curses-text_io__adb.htm#ref_302_7">X</A> + 1 + <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_34">Item</A>'Length) >= <A HREF="terminal_interface-curses-text_io__adb.htm#ref_304_7">C</A> <b>then</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_89_14">New_Page</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>); |
| <b>end</b> <b>if</b>; |
| <b>end</b> <b>if</b>; |
| <A HREF="terminal_interface-curses__ads.htm#ref_823_14">Add</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_19">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_34">Item</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_316_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A></span> (<span class="symbol"><A NAME="ref_316_19" HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Item</A></span> : String) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_19">Item</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_116_14">Put</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_322_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_118_14">Put_Line</A></span> |
| (<span class="symbol"><A NAME="ref_323_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_119_7">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>; |
| <span class="symbol"><A NAME="ref_324_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_120_7">Item</A></span> : String) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_115_14">Put</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_119_7">Win</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_120_7">Item</A>); |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_86_14">New_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_119_7">Win</A>, 1); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_118_14">Put_Line</A>; |
| |
| <b>procedure</b> <span class="symbol"><A NAME="ref_331_14" HREF="terminal_interface-curses-text_io__ads.htm#ref_122_14">Put_Line</A></span> |
| (<span class="symbol"><A NAME="ref_332_7" HREF="terminal_interface-curses-text_io__ads.htm#ref_123_7">Item</A></span> : String) |
| <b>is</b> |
| <b>begin</b> |
| <A HREF="terminal_interface-curses-text_io__ads.htm#ref_118_14">Put_Line</A> (<A HREF="terminal_interface-curses-text_io__ads.htm#ref_62_13">Get_Window</A>, <A HREF="terminal_interface-curses-text_io__ads.htm#ref_123_7">Item</A>); |
| <b>end</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_122_14">Put_Line</A>; |
| |
| <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_47_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>; |
| </PRE></BODY></HTML> |