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