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