]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/ada_include/terminal_interface-curses-aux.ads
ncurses 4.1
[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 --  Version 00.92                                                           --
10 --                                                                          --
11 --  The ncurses Ada95 binding is copyrighted 1996 by                        --
12 --  Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                     --
13 --                                                                          --
14 --  Permission is hereby granted to reproduce and distribute this           --
15 --  binding by any means and for any fee, whether alone or as part          --
16 --  of a larger distribution, in source or in binary form, PROVIDED         --
17 --  this notice is included with any such distribution, and is not          --
18 --  removed from any of its header files. Mention of ncurses and the        --
19 --  author of this binding in any applications linked with it is            --
20 --  highly appreciated.                                                     --
21 --                                                                          --
22 --  This binding comes AS IS with no warranty, implied or expressed.        --
23 ------------------------------------------------------------------------------
24 --  Version Control:
25 --  $Revision: 1.4 $
26 ------------------------------------------------------------------------------
27 with System;
28 with Interfaces.C;
29 with Interfaces.C.Strings; use Interfaces.C.Strings;
30 with Unchecked_Conversion;
31
32 package Terminal_Interface.Curses.Aux is
33
34    use type Interfaces.C.Int;
35
36    subtype C_Int      is Interfaces.C.Int;
37    subtype C_Short    is Interfaces.C.Short;
38    subtype C_Long_Int is Interfaces.C.Long;
39    subtype C_Size_T   is Interfaces.C.Size_T;
40    subtype C_Char_Ptr is Interfaces.C.Strings.Chars_Ptr;
41    type    C_Void_Ptr is new System.Address;
42
43    --  This is how those constants are defined in ncurses. I see them also
44    --  exactly like this in all ETI implementations I ever tested. So it
45    --  could be that this is quite general, but please check with your curses.
46    --  This is critical, because curses sometime mixes boolean returns with
47    --  returning an error status.
48    Curses_Ok    : constant C_Int :=  0;
49    Curses_Err   : constant C_Int := -1;
50
51    Curses_True  : constant C_Int := 1;
52    Curses_False : constant C_Int := 0;
53
54    subtype Eti_Error is C_Int range -14 .. 0;
55    --  Type for error codes returned by the menu and forms subsystem
56
57    E_Ok              : constant Eti_Error := 0;
58    E_System_Error    : constant Eti_Error := -1;
59    E_Bad_Argument    : constant Eti_Error := -2;
60    E_Posted          : constant Eti_Error := -3;
61    E_Connected       : constant Eti_Error := -4;
62    E_Bad_State       : constant Eti_Error := -5;
63    E_No_Room         : constant Eti_Error := -6;
64    E_Not_Posted      : constant Eti_Error := -7;
65    E_Unknown_Command : constant Eti_Error := -8;
66    E_No_Match        : constant Eti_Error := -9;
67    E_Not_Selectable  : constant Eti_Error := -10;
68    E_Not_Connected   : constant Eti_Error := -11;
69    E_Request_Denied  : constant Eti_Error := -12;
70    E_Invalid_Field   : constant Eti_Error := -13;
71    E_Current         : constant Eti_Error := -14;
72
73    procedure Eti_Exception (Code : Eti_Error);
74    --  Dispatch the error code and raise the appropriate exception
75    --
76    --
77    --  Some helpers
78    function CInt_To_Chtype is new
79      Unchecked_Conversion (Source => C_Int,
80                            Target => Attributed_Character);
81    function Chtype_To_CInt is new
82      Unchecked_Conversion (Source => Attributed_Character,
83                            Target => C_Int);
84
85    procedure Fill_String (Cp  : in  chars_ptr;
86                           Str : out String);
87    --  Fill the Str parameter with the string denoted by the chars_ptr
88    --  C-Style string.
89
90 end Terminal_Interface.Curses.Aux;