]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/ada/terminal_interface-curses-aux__adb.htm
ncurses 6.3 - patch 20220115
[ncurses.git] / doc / html / ada / terminal_interface-curses-aux__adb.htm
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2 <html>
3 <head>
4 <title>terminal_interface-curses-aux.adb</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <style type="text/css">
7 *.comment {
8         color: green;
9 }
10 *.symbol {
11         color: red;
12 }
13 </style>
14 </head>
15 <body>
16 <hr><div style="text-align:center"><h1> File : terminal_interface-curses-aux.adb </h1></div><hr>
17 <pre>
18 <span class="comment"><em>------------------------------------------------------------------------------</em></span>
19 <span class="comment"><em>--                                                                          --</em></span>
20 <span class="comment"><em>--                           <strong>GNAT</strong> ncurses Binding                           --</em></span>
21 <span class="comment"><em>--                                                                          --</em></span>
22 <span class="comment"><em>--                      Terminal_Interface.Curses.Aux                       --</em></span>
23 <span class="comment"><em>--                                                                          --</em></span>
24 <span class="comment"><em>--                                 B O D Y                                  --</em></span>
25 <span class="comment"><em>--                                                                          --</em></span>
26 <span class="comment"><em>------------------------------------------------------------------------------</em></span>
27 <span class="comment"><em>-- Copyright 2020 Thomas E. Dickey                                          --</em></span>
28 <span class="comment"><em>-- Copyright 1999-2003,2009 Free Software Foundation, Inc.                  --</em></span>
29 <span class="comment"><em>--                                                                          --</em></span>
30 <span class="comment"><em>-- Permission is hereby granted, free of charge, to any person obtaining a  --</em></span>
31 <span class="comment"><em>-- copy of this software and associated documentation files (the            --</em></span>
32 <span class="comment"><em>-- "Software"), to deal in the Software without restriction, including      --</em></span>
33 <span class="comment"><em>-- without limitation the rights to use, copy, modify, merge, publish,      --</em></span>
34 <span class="comment"><em>-- distribute, distribute with modifications, sublicense, and/or sell       --</em></span>
35 <span class="comment"><em>-- copies of the Software, and to permit persons to whom the Software is    --</em></span>
36 <span class="comment"><em>-- furnished to do so, subject to the following conditions:                 --</em></span>
37 <span class="comment"><em>--                                                                          --</em></span>
38 <span class="comment"><em>-- The above copyright notice and this permission notice shall be included  --</em></span>
39 <span class="comment"><em>-- in all copies or substantial portions of the Software.                   --</em></span>
40 <span class="comment"><em>--                                                                          --</em></span>
41 <span class="comment"><em>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --</em></span>
42 <span class="comment"><em>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --</em></span>
43 <span class="comment"><em>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --</em></span>
44 <span class="comment"><em>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --</em></span>
45 <span class="comment"><em>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --</em></span>
46 <span class="comment"><em>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --</em></span>
47 <span class="comment"><em>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --</em></span>
48 <span class="comment"><em>--                                                                          --</em></span>
49 <span class="comment"><em>-- Except as contained in this notice, the name(s) of the above copyright   --</em></span>
50 <span class="comment"><em>-- holders shall not be used in advertising or otherwise to promote the     --</em></span>
51 <span class="comment"><em>-- sale, use or other dealings in this Software without prior written       --</em></span>
52 <span class="comment"><em>-- authorization.                                                           --</em></span>
53 <span class="comment"><em>------------------------------------------------------------------------------</em></span>
54 <span class="comment"><em>--  Author:  Juergen Pfeifer, 1996</em></span>
55 <span class="comment"><em>--  Version Control:</em></span>
56 <span class="comment"><em>--  @Revision: 1.12 @</em></span>
57 <span class="comment"><em>--  Binding Version 01.00</em></span>
58 <span class="comment"><em>------------------------------------------------------------------------------</em></span>
59 <b>package</b> <b>body</b> <a href="terminal_interface__ads.htm#ref_43_9">Terminal_Interface</a>.<a href="terminal_interface-curses__ads.htm#ref_48_28">Curses</a>.<span class="symbol"><a name="ref_42_40" href="terminal_interface-curses-aux__ads.htm#ref_46_35">Aux</a></span> <b>is</b>
60    <span class="comment"><em>--</em></span>
61    <span class="comment"><em>--  Some helpers</em></span>
62    <b>procedure</b> <span class="symbol"><a name="ref_45_14" href="terminal_interface-curses-aux__ads.htm#ref_91_14">Fill_String</a></span> (<span class="symbol"><a name="ref_45_27" href="terminal_interface-curses-aux__ads.htm#ref_91_27">Cp</a></span>  : chars_ptr;
63                           <span class="symbol"><a name="ref_46_27" href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a></span> : <b>out</b> String)
64    <b>is</b>
65       <span class="comment"><em>--  Fill the string with the characters referenced by the</em></span>
66       <span class="comment"><em>--  chars_ptr.</em></span>
67       <span class="comment"><em>--</em></span>
68       <span class="symbol"><a name="ref_51_7">Len</a></span> : Natural;
69    <b>begin</b>
70       <b>if</b> <a href="terminal_interface-curses-aux__ads.htm#ref_91_27">Cp</a> /= Null_Ptr <b>then</b>
71          <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> := Natural (Strlen (<a href="terminal_interface-curses-aux__ads.htm#ref_91_27">Cp</a>));
72          <b>if</b> <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'Length &lt; <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> <b>then</b>
73             <b>raise</b> Constraint_Error;
74          <b>end</b> <b>if</b>;
75          <b>declare</b>
76             <span class="symbol"><a name="ref_59_13">S</a></span> : String (1 .. <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a>);
77          <b>begin</b>
78             <a href="terminal_interface-curses-aux__adb.htm#ref_59_13">S</a> := Value (<a href="terminal_interface-curses-aux__ads.htm#ref_91_27">Cp</a>);
79             <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a> (<a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'First .. (<a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'First + <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> - 1)) := <a href="terminal_interface-curses-aux__adb.htm#ref_59_13">S</a> (<a href="terminal_interface-curses-aux__adb.htm#ref_59_13">S</a>'<b>Range</b>);
80          <b>end</b>;
81       <b>else</b>
82          <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> := 0;
83       <b>end</b> <b>if</b>;
84
85       <b>if</b> <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> &lt; <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'Length <b>then</b>
86          <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a> ((<a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'First + <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a>) .. <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'Last) := (<b>others</b> =&gt; ' ');
87       <b>end</b> <b>if</b>;
88
89    <b>end</b> <a href="terminal_interface-curses-aux__ads.htm#ref_91_14">Fill_String</a>;
90
91    <b>function</b> <span class="symbol"><a name="ref_74_13" href="terminal_interface-curses-aux__ads.htm#ref_96_13">Fill_String</a></span> (<span class="symbol"><a name="ref_74_26" href="terminal_interface-curses-aux__ads.htm#ref_96_26">Cp</a></span> : chars_ptr) <b>return</b> String
92    <b>is</b>
93       <span class="symbol"><a name="ref_76_7">Len</a></span> : Natural;
94    <b>begin</b>
95       <b>if</b> <a href="terminal_interface-curses-aux__ads.htm#ref_96_26">Cp</a> /= Null_Ptr <b>then</b>
96          <a href="terminal_interface-curses-aux__adb.htm#ref_76_7">Len</a> := Natural (Strlen (<a href="terminal_interface-curses-aux__ads.htm#ref_96_26">Cp</a>));
97          <b>if</b> <a href="terminal_interface-curses-aux__adb.htm#ref_76_7">Len</a> = 0 <b>then</b>
98             <b>return</b> "";
99          <b>else</b>
100             <b>declare</b>
101                <span class="symbol"><a name="ref_84_16">S</a></span> : String (1 .. <a href="terminal_interface-curses-aux__adb.htm#ref_76_7">Len</a>);
102             <b>begin</b>
103                <a href="terminal_interface-curses-aux__ads.htm#ref_91_14">Fill_String</a> (<a href="terminal_interface-curses-aux__ads.htm#ref_96_26">Cp</a>, <a href="terminal_interface-curses-aux__adb.htm#ref_84_16">S</a>);
104                <b>return</b> <a href="terminal_interface-curses-aux__adb.htm#ref_84_16">S</a>;
105             <b>end</b>;
106          <b>end</b> <b>if</b>;
107       <b>else</b>
108          <b>return</b> "";
109       <b>end</b> <b>if</b>;
110    <b>end</b> <a href="terminal_interface-curses-aux__ads.htm#ref_96_13">Fill_String</a>;
111
112    <b>procedure</b> <span class="symbol"><a name="ref_95_14" href="terminal_interface-curses-aux__ads.htm#ref_87_14">Eti_Exception</a></span> (<span class="symbol"><a name="ref_95_29" href="terminal_interface-curses-aux__ads.htm#ref_87_29">Code</a></span> : <a href="terminal_interface-curses-aux__ads.htm#ref_70_9">Eti_Error</a>)
113    <b>is</b>
114    <b>begin</b>
115       <b>case</b> <a href="terminal_interface-curses-aux__ads.htm#ref_87_29">Code</a> <b>is</b>
116          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_85_7">E_Ok</a>              =&gt; <b>null</b>;
117          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_84_7">E_System_Error</a>    =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_528_4">Eti_System_Error</a>;
118          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_83_7">E_Bad_Argument</a>    =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_529_4">Eti_Bad_Argument</a>;
119          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_82_7">E_Posted</a>          =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_530_4">Eti_Posted</a>;
120          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_81_7">E_Connected</a>       =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_531_4">Eti_Connected</a>;
121          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_80_7">E_Bad_State</a>       =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_532_4">Eti_Bad_State</a>;
122          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_79_7">E_No_Room</a>         =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_533_4">Eti_No_Room</a>;
123          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_78_7">E_Not_Posted</a>      =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_534_4">Eti_Not_Posted</a>;
124          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_77_7">E_Unknown_Command</a> =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_535_4">Eti_Unknown_Command</a>;
125          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_76_7">E_No_Match</a>        =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_536_4">Eti_No_Match</a>;
126          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_75_7">E_Not_Selectable</a>  =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_537_4">Eti_Not_Selectable</a>;
127          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_74_7">E_Not_Connected</a>   =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_538_4">Eti_Not_Connected</a>;
128          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_73_7">E_Request_Denied</a>  =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_539_4">Eti_Request_Denied</a>;
129          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_72_7">E_Invalid_Field</a>   =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_540_4">Eti_Invalid_Field</a>;
130          <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_71_7">E_Current</a>         =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_541_4">Eti_Current</a>;
131       <b>end</b> <b>case</b>;
132    <b>end</b> <a href="terminal_interface-curses-aux__ads.htm#ref_87_14">Eti_Exception</a>;
133
134 <b>end</b> <a href="terminal_interface__ads.htm#ref_43_9">Terminal_Interface</a>.<a href="terminal_interface-curses__ads.htm#ref_48_28">Curses</a>.<a href="terminal_interface-curses-aux__ads.htm#ref_46_35">Aux</a>;
135 </pre></body></html>