ncurses 5.4
[ncurses.git] / doc / html / ada / terminal_interface-curses-aux__adb.htm
1 <HTML><HEAD><TITLE>terminal_interface-curses-aux.adb</TITLE></HEAD>
2 <BODY>
3 <HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-aux.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.Aux                       --</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:  Juergen Pfeifer, 1996</EM></FONT>
41 <FONT COLOR=green><EM>--  Version Control:</EM></FONT>
42 <FONT COLOR=green><EM>--  @Revision: 1.10 @</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> <A HREF="terminal_interface__ads.htm#41_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#48_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#50_35">Aux</A> <b>is</b>
46    <FONT COLOR=green><EM>--</EM></FONT>
47    <FONT COLOR=green><EM>--  Some helpers</EM></FONT>
48    <b>procedure</b> <A HREF="terminal_interface-curses-aux__ads.htm#116_14">Fill_String</A><FONT COLOR=red><A NAME="44_14"></A></FONT> (<A HREF="terminal_interface-curses-aux__ads.htm#116_27">Cp</A>  : <b>in</b>  chars_ptr;
49                           <A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A> : <b>out</b> String)
50    <b>is</b>
51       <FONT COLOR=green><EM>--  Fill the string with the characters referenced by the</EM></FONT>
52       <FONT COLOR=green><EM>--  chars_ptr.</EM></FONT>
53       <FONT COLOR=green><EM>--</EM></FONT>
54       <FONT COLOR=red><A NAME="50_7">Len</A></FONT> : Natural;
55    <b>begin</b>
56       <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#116_27">Cp</A> /= Null_Ptr <b>then</b>
57          <A HREF="terminal_interface-curses-aux__adb.htm#50_7">Len</A> := Natural (Strlen (<A HREF="terminal_interface-curses-aux__ads.htm#116_27">Cp</A>));
58          <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A>'Length &lt; <A HREF="terminal_interface-curses-aux__adb.htm#50_7">Len</A> <b>then</b>
59             <b>raise</b> Constraint_Error;
60          <b>end</b> <b>if</b>;
61          <b>declare</b>
62             <FONT COLOR=red><A NAME="58_13">S</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-aux__adb.htm#50_7">Len</A>);
63          <b>begin</b>
64             <A HREF="terminal_interface-curses-aux__adb.htm#58_13">S</A> := Value (<A HREF="terminal_interface-curses-aux__ads.htm#116_27">Cp</A>);
65             <A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A> (<A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A>'First .. (<A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A>'First + <A HREF="terminal_interface-curses-aux__adb.htm#50_7">Len</A> - 1)) := <A HREF="terminal_interface-curses-aux__adb.htm#58_13">S</A> (<A HREF="terminal_interface-curses-aux__adb.htm#58_13">S</A>'<b>Range</b>);
66          <b>end</b>;
67       <b>else</b>
68          <A HREF="terminal_interface-curses-aux__adb.htm#50_7">Len</A> := 0;
69       <b>end</b> <b>if</b>;
70
71       <b>if</b> <A HREF="terminal_interface-curses-aux__adb.htm#50_7">Len</A> &lt; <A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A>'Length <b>then</b>
72          <A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A> ((<A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A>'First + <A HREF="terminal_interface-curses-aux__adb.htm#50_7">Len</A>) .. <A HREF="terminal_interface-curses-aux__ads.htm#117_27">Str</A>'Last) := (<b>others</b> =&gt; ' ');
73       <b>end</b> <b>if</b>;
74
75    <b>end</b> <A HREF="terminal_interface-curses-aux__ads.htm#116_14">Fill_String</A><A HREF="terminal_interface-curses-aux__ads.htm#116_14">;</A>
76
77    <b>function</b> <A HREF="terminal_interface-curses-aux__ads.htm#121_13">Fill_String</A> (<A HREF="terminal_interface-curses-aux__ads.htm#121_26">Cp</A> : chars_ptr) <b>return</b> String
78    <b>is</b>
79       <FONT COLOR=red><A NAME="75_7">Len</A></FONT> : Natural;
80    <b>begin</b>
81       <b>if</b> <A HREF="terminal_interface-curses-aux__ads.htm#121_26">Cp</A> /= Null_Ptr <b>then</b>
82          <A HREF="terminal_interface-curses-aux__adb.htm#75_7">Len</A> := Natural (Strlen (<A HREF="terminal_interface-curses-aux__ads.htm#121_26">Cp</A>));
83          <b>if</b> <A HREF="terminal_interface-curses-aux__adb.htm#75_7">Len</A> = 0 <b>then</b>
84             <b>return</b> "";
85          <b>else</b>
86             <b>declare</b>
87                <FONT COLOR=red><A NAME="83_16">S</A></FONT> : String (1 .. <A HREF="terminal_interface-curses-aux__adb.htm#75_7">Len</A>);
88             <b>begin</b>
89                <A HREF="terminal_interface-curses-aux__ads.htm#116_14">Fill_String</A> (<A HREF="terminal_interface-curses-aux__ads.htm#121_26">Cp</A>, <A HREF="terminal_interface-curses-aux__adb.htm#83_16">S</A>);
90                <b>return</b> <A HREF="terminal_interface-curses-aux__adb.htm#83_16">S</A>;
91             <b>end</b>;
92          <b>end</b> <b>if</b>;
93       <b>else</b>
94          <b>return</b> "";
95       <b>end</b> <b>if</b>;
96    <b>end</b> <A HREF="terminal_interface-curses-aux__ads.htm#121_13">Fill_String</A><A HREF="terminal_interface-curses-aux__ads.htm#121_13">;</A>
97
98    <b>procedure</b> <A HREF="terminal_interface-curses-aux__ads.htm#96_14">Eti_Exception</A><FONT COLOR=red><A NAME="94_14"></A></FONT> (<A HREF="terminal_interface-curses-aux__ads.htm#96_29">Code</A> : <A HREF="terminal_interface-curses-aux__ads.htm#78_12">Eti_Error</A>)
99    <b>is</b>
100    <b>begin</b>
101       <b>case</b> <A HREF="terminal_interface-curses-aux__ads.htm#96_29">Code</A> <b>is</b>
102          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#80_4">E_Ok</A>              =&gt; <b>null</b>;
103          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#81_4">E_System_Error</A>    =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#388_4">Eti_System_Error</A>;
104          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#82_4">E_Bad_Argument</A>    =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#389_4">Eti_Bad_Argument</A>;
105          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#83_4">E_Posted</A>          =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#390_4">Eti_Posted</A>;
106          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#84_4">E_Connected</A>       =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#391_4">Eti_Connected</A>;
107          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#85_4">E_Bad_State</A>       =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#392_4">Eti_Bad_State</A>;
108          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#86_4">E_No_Room</A>         =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#393_4">Eti_No_Room</A>;
109          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#87_4">E_Not_Posted</A>      =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#394_4">Eti_Not_Posted</A>;
110          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#88_4">E_Unknown_Command</A> =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#395_4">Eti_Unknown_Command</A>;
111          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#89_4">E_No_Match</A>        =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#396_4">Eti_No_Match</A>;
112          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#90_4">E_Not_Selectable</A>  =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#397_4">Eti_Not_Selectable</A>;
113          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#91_4">E_Not_Connected</A>   =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#398_4">Eti_Not_Connected</A>;
114          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#92_4">E_Request_Denied</A>  =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#399_4">Eti_Request_Denied</A>;
115          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#93_4">E_Invalid_Field</A>   =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#400_4">Eti_Invalid_Field</A>;
116          <b>when</b> <A HREF="terminal_interface-curses-aux__ads.htm#94_4">E_Current</A>         =&gt; <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#401_4">Eti_Current</A>;
117       <b>end</b> <b>case</b>;
118    <b>end</b> <A HREF="terminal_interface-curses-aux__ads.htm#96_14">Eti_Exception</A><A HREF="terminal_interface-curses-aux__ads.htm#96_14">;</A>
119
120 <b>end</b> <A HREF="terminal_interface__ads.htm#41_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#48_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#50_35">Aux</A><A HREF="terminal_interface-curses-aux__ads.htm#50_35">;</A>
121 </PRE></BODY></HTML>