]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/src/ncurses_compat.c
ncurses 6.1 - patch 20200118
[ncurses.git] / Ada95 / src / ncurses_compat.c
1 /****************************************************************************
2  * Copyright (c) 2011,2015 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.3 2015/08/06 23:09:10 tom Exp $
36   --------------------------------------------------------------------------*/
37
38 /*
39  * Provide compatibility with older versions of ncurses.
40  */
41 #include <ncurses_cfg.h>
42
43 #if HAVE_INTTYPES_H
44 # include <inttypes.h>
45 #else
46 # if HAVE_STDINT_H
47 #  include <stdint.h>
48 # endif
49 #endif
50
51 #include <curses.h>
52
53 #if defined(NCURSES_VERSION_PATCH)
54
55 #if NCURSES_VERSION_PATCH < 20081122
56 extern bool has_mouse(void);
57 extern int _nc_has_mouse(void);
58
59 bool
60 has_mouse(void)
61 {
62   return (bool)_nc_has_mouse();
63 }
64 #endif
65
66 /*
67  * These are provided by lib_gen.c:
68  */
69 #if NCURSES_VERSION_PATCH < 20070331
70 extern bool (is_keypad) (const WINDOW *);
71 extern bool (is_scrollok) (const WINDOW *);
72
73 bool
74 is_keypad(const WINDOW *win)
75 {
76   return ((win)->_use_keypad);
77 }
78
79 bool
80   (is_scrollok) (const WINDOW *win)
81 {
82   return ((win)->_scroll);
83 }
84 #endif
85
86 #if NCURSES_VERSION_PATCH < 20060107
87 extern int (getbegx) (WINDOW *);
88 extern int (getbegy) (WINDOW *);
89 extern int (getcurx) (WINDOW *);
90 extern int (getcury) (WINDOW *);
91 extern int (getmaxx) (WINDOW *);
92 extern int (getmaxy) (WINDOW *);
93 extern int (getparx) (WINDOW *);
94 extern int (getpary) (WINDOW *);
95
96 int
97   (getbegy) (WINDOW *win)
98 {
99   return ((win) ? (win)->_begy : ERR);
100 }
101
102 int
103   (getbegx) (WINDOW *win)
104 {
105   return ((win) ? (win)->_begx : ERR);
106 }
107
108 int
109   (getcury) (WINDOW *win)
110 {
111   return ((win) ? (win)->_cury : ERR);
112 }
113
114 int
115   (getcurx) (WINDOW *win)
116 {
117   return ((win) ? (win)->_curx : ERR);
118 }
119
120 int
121   (getmaxy) (WINDOW *win)
122 {
123   return ((win) ? ((win)->_maxy + 1) : ERR);
124 }
125
126 int
127   (getmaxx) (WINDOW *win)
128 {
129   return ((win) ? ((win)->_maxx + 1) : ERR);
130 }
131
132 int
133   (getpary) (WINDOW *win)
134 {
135   return ((win) ? (win)->_pary : ERR);
136 }
137
138 int
139   (getparx) (WINDOW *win)
140 {
141   return ((win) ? (win)->_parx : ERR);
142 }
143 #endif
144
145 #endif