1 ------------------------------------------------------------------------------
3 -- GNAT ncurses Binding --
5 -- Terminal_Interface.Curses.Aux --
9 ------------------------------------------------------------------------------
10 -- Copyright (c) 1998 Free Software Foundation, Inc. --
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: --
20 -- The above copyright notice and this permission notice shall be included --
21 -- in all copies or substantial portions of the Software. --
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. --
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 --
35 ------------------------------------------------------------------------------
36 -- Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1996
39 -- Binding Version 00.93
40 ------------------------------------------------------------------------------
43 with Interfaces.C.Strings; use Interfaces.C.Strings;
44 with Unchecked_Conversion;
46 package Terminal_Interface.Curses.Aux is
47 pragma Preelaborate (Aux);
49 use type Interfaces.C.Int;
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;
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;
66 Curses_True : constant C_Int := 1;
67 Curses_False : constant C_Int := 0;
69 subtype Eti_Error is C_Int range -14 .. 0;
70 -- Type for error codes returned by the menu and forms subsystem
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;
88 procedure Eti_Exception (Code : Eti_Error);
89 -- Dispatch the error code and raise the appropriate exception
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,
100 procedure Fill_String (Cp : in chars_ptr;
102 -- Fill the Str parameter with the string denoted by the chars_ptr
105 function Fill_String (Cp : chars_ptr) return String;
106 -- Same but as function.
108 end Terminal_Interface.Curses.Aux;