]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/src/ncurses_compat.c
ncurses 5.9 - patch 20110807
[ncurses.git] / Ada95 / src / ncurses_compat.c
1 /****************************************************************************
2  * Copyright (c) 2011 Free Software Foundation, Inc.                        *
3  *                                                                          *
4  * Permission is hereby granted, free of charge, to any person obtaining a  *
5  * copy of this software and associated documentation files (the            *
6  * "Software"), to deal in the Software without restriction, including      *
7  * without limitation the rights to use, copy, modify, merge, publish,      *
8  * distribute, distribute with modifications, sublicense, and/or sell       *
9  * copies of the Software, and to permit persons to whom the Software is    *
10  * furnished to do so, subject to the following conditions:                 *
11  *                                                                          *
12  * The above copyright notice and this permission notice shall be included  *
13  * in all copies or substantial portions of the Software.                   *
14  *                                                                          *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22  *                                                                          *
23  * Except as contained in this notice, the name(s) of the above copyright   *
24  * holders shall not be used in advertising or otherwise to promote the     *
25  * sale, use or other dealings in this Software without prior written       *
26  * authorization.                                                           *
27  ****************************************************************************/
28
29 /****************************************************************************
30  *   Author:  Thomas E. Dickey, 2011                                        *
31  ****************************************************************************/
32
33 /*
34     Version Control
35     $Id: ncurses_compat.c,v 1.2 2011/03/28 00:29:04 tom Exp $
36   --------------------------------------------------------------------------*/
37
38 /*
39  * Provide compatibility with older versions of ncurses.
40  */
41 #include <curses.h>
42
43 #if defined(NCURSES_VERSION_PATCH)
44
45 #if NCURSES_VERSION_PATCH < 20081122
46 extern bool has_mouse(void);
47 extern int _nc_has_mouse(void);
48
49 bool
50 has_mouse(void)
51 {
52   return (bool) _nc_has_mouse();
53 }
54 #endif
55
56 /*
57  * These are provided by lib_gen.c:
58  */
59 #if NCURSES_VERSION_PATCH < 20070331
60 extern bool (is_keypad) (const WINDOW *);
61 extern bool (is_scrollok) (const WINDOW *);
62
63 bool
64 is_keypad(const WINDOW *win)
65 {
66   return ((win)->_use_keypad);
67 }
68
69 bool
70   (is_scrollok) (const WINDOW *win)
71 {
72   return ((win)->_scroll);
73 }
74 #endif
75
76 #if NCURSES_VERSION_PATCH < 20060107
77 extern int (getbegx) (WINDOW *);
78 extern int (getbegy) (WINDOW *);
79 extern int (getcurx) (WINDOW *);
80 extern int (getcury) (WINDOW *);
81 extern int (getmaxx) (WINDOW *);
82 extern int (getmaxy) (WINDOW *);
83 extern int (getparx) (WINDOW *);
84 extern int (getpary) (WINDOW *);
85
86 int
87   (getbegy) (WINDOW *win)
88 {
89   return ((win) ? (win)->_begy : ERR);
90 }
91
92 int
93   (getbegx) (WINDOW *win)
94 {
95   return ((win) ? (win)->_begx : ERR);
96 }
97
98 int
99   (getcury) (WINDOW *win)
100 {
101   return ((win) ? (win)->_cury : ERR);
102 }
103
104 int
105   (getcurx) (WINDOW *win)
106 {
107   return ((win) ? (win)->_curx : ERR);
108 }
109
110 int
111   (getmaxy) (WINDOW *win)
112 {
113   return ((win) ? ((win)->_maxy + 1) : ERR);
114 }
115
116 int
117   (getmaxx) (WINDOW *win)
118 {
119   return ((win) ? ((win)->_maxx + 1) : ERR);
120 }
121
122 int
123   (getpary) (WINDOW *win)
124 {
125   return ((win) ? (win)->_pary : ERR);
126 }
127
128 int
129   (getparx) (WINDOW *win)
130 {
131   return ((win) ? (win)->_parx : ERR);
132 }
133 #endif
134
135 #endif