]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/ada_include/terminal_interface-curses-aux.ads
ncurses 4.2
[ncurses.git] / Ada95 / ada_include / terminal_interface-curses-aux.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                           GNAT ncurses Binding                           --
4 --                                                                          --
5 --                       Terminal_Interface.Curses.Aux                      --
6 --                                                                          --
7 --                                 S P E C                                  --
8 --                                                                          --
9 ------------------------------------------------------------------------------
10 -- Copyright (c) 1998 Free Software Foundation, Inc.                        --
11 --                                                                          --
12 -- Permission is hereby granted, free of charge, to any person obtaining a  --
13 -- copy of this software and associated documentation files (the            --
14 -- "Software"), to deal in the Software without restriction, including      --
15 -- without limitation the rights to use, copy, modify, merge, publish,      --
16 -- distribute, distribute with modifications, sublicense, and/or sell       --
17 -- copies of the Software, and to permit persons to whom the Software is    --
18 -- furnished to do so, subject to the following conditions:                 --
19 --                                                                          --
20 -- The above copyright notice and this permission notice shall be included  --
21 -- in all copies or substantial portions of the Software.                   --
22 --                                                                          --
23 -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --
24 -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --
25 -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --
26 -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --
27 -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --
28 -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --
29 -- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --
30 --                                                                          --
31 -- Except as contained in this notice, the name(s) of the above copyright   --
32 -- holders shall not be used in advertising or otherwise to promote the     --
33 -- sale, use or other dealings in this Software without prior written       --
34 -- authorization.                                                           --
35 ------------------------------------------------------------------------------
36 --  Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1996
37 --  Version Control:
38 --  $Revision: 1.8 $
39 --  Binding Version 00.93
40 ------------------------------------------------------------------------------
41 with System;
42 with Interfaces.C;
43 with Interfaces.C.Strings; use Interfaces.C.Strings;
44 with Unchecked_Conversion;
45
46 package Terminal_Interface.Curses.Aux is
47    pragma Preelaborate (Aux);
48
49    use type Interfaces.C.Int;
50
51    subtype C_Int      is Interfaces.C.Int;
52    subtype C_Short    is Interfaces.C.Short;
53    subtype C_Long_Int is Interfaces.C.Long;
54    subtype C_Size_T   is Interfaces.C.Size_T;
55    subtype C_Char_Ptr is Interfaces.C.Strings.Chars_Ptr;
56    type    C_Void_Ptr is new System.Address;
57
58    --  This is how those constants are defined in ncurses. I see them also
59    --  exactly like this in all ETI implementations I ever tested. So it
60    --  could be that this is quite general, but please check with your curses.
61    --  This is critical, because curses sometime mixes boolean returns with
62    --  returning an error status.
63    Curses_Ok    : constant C_Int :=  0;
64    Curses_Err   : constant C_Int := -1;
65
66    Curses_True  : constant C_Int := 1;
67    Curses_False : constant C_Int := 0;
68
69    subtype Eti_Error is C_Int range -14 .. 0;
70    --  Type for error codes returned by the menu and forms subsystem
71
72    E_Ok              : constant Eti_Error := 0;
73    E_System_Error    : constant Eti_Error := -1;
74    E_Bad_Argument    : constant Eti_Error := -2;
75    E_Posted          : constant Eti_Error := -3;
76    E_Connected       : constant Eti_Error := -4;
77    E_Bad_State       : constant Eti_Error := -5;
78    E_No_Room         : constant Eti_Error := -6;
79    E_Not_Posted      : constant Eti_Error := -7;
80    E_Unknown_Command : constant Eti_Error := -8;
81    E_No_Match        : constant Eti_Error := -9;
82    E_Not_Selectable  : constant Eti_Error := -10;
83    E_Not_Connected   : constant Eti_Error := -11;
84    E_Request_Denied  : constant Eti_Error := -12;
85    E_Invalid_Field   : constant Eti_Error := -13;
86    E_Current         : constant Eti_Error := -14;
87
88    procedure Eti_Exception (Code : Eti_Error);
89    --  Dispatch the error code and raise the appropriate exception
90    --
91    --
92    --  Some helpers
93    function CInt_To_Chtype is new
94      Unchecked_Conversion (Source => C_Int,
95                            Target => Attributed_Character);
96    function Chtype_To_CInt is new
97      Unchecked_Conversion (Source => Attributed_Character,
98                            Target => C_Int);
99
100    procedure Fill_String (Cp  : in  chars_ptr;
101                           Str : out String);
102    --  Fill the Str parameter with the string denoted by the chars_ptr
103    --  C-Style string.
104
105    function Fill_String (Cp : chars_ptr) return String;
106    --  Same but as function.
107
108 end Terminal_Interface.Curses.Aux;