]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/lib_data.c
ncurses 4.1
[ncurses.git] / ncurses / lib_data.c
1
2 /***************************************************************************
3 *                            COPYRIGHT NOTICE                              *
4 ****************************************************************************
5 *                ncurses is copyright (C) 1992-1995                        *
6 *                          Zeyd M. Ben-Halim                               *
7 *                          zmbenhal@netcom.com                             *
8 *                          Eric S. Raymond                                 *
9 *                          esr@snark.thyrsus.com                           *
10 *                                                                          *
11 *        Permission is hereby granted to reproduce and distribute ncurses  *
12 *        by any means and for any fee, whether alone or as part of a       *
13 *        larger distribution, in source or in binary form, PROVIDED        *
14 *        this notice is included with any such distribution, and is not    *
15 *        removed from any of its header files. Mention of ncurses in any   *
16 *        applications linked with it is highly appreciated.                *
17 *                                                                          *
18 *        ncurses comes AS IS with no warranty, implied or expressed.       *
19 *                                                                          *
20 ***************************************************************************/
21
22 /*
23 **      lib_data.c
24 **
25 **      Common data that may/may not be allocated, but is referenced globally
26 **
27 */
28
29 #include <curses.priv.h>
30
31 MODULE_ID("$Id: lib_data.c,v 1.8 1997/01/18 23:02:54 tom Exp $")
32
33 WINDOW *stdscr, *curscr, *newscr;
34
35 /*
36  * Linked-list of all windows, to support '_nc_resizeall()' and '_nc_freeall()'
37  */
38 WINDOWLIST *_nc_windows;
39
40 /*
41  * These data correspond to the state of the idcok() and idlok() functions.  A
42  * caveat is in order here:  the XSI and SVr4 documentation specify that these
43  * functions apply to the window which is given as an argument.  However,
44  * ncurses implements this logic only for the newscr/curscr update process,
45  * _not_ per-window.
46  */
47 bool _nc_idcok = TRUE;
48 bool _nc_idlok = FALSE;
49
50 /*
51  * The variable 'SP' will be defined as a function on systems that cannot link
52  * data-only modules, since it is used in a lot of places within ncurses and we
53  * cannot guarantee that any application will use any particular function.  We
54  * put the WINDOW variables in this module, because it appears that any
55  * application that uses them will also use 'SP'.
56  *
57  * This module intentionally does not reference other ncurses modules, to avoid
58  * module coupling that increases the size of the executable.
59  */
60 #if BROKEN_LINKER
61 static  SCREEN *my_screen;
62
63 SCREEN *_nc_screen(void)
64 {
65         return my_screen;
66 }
67
68 int _nc_alloc_screen(void)
69 {
70         return ((my_screen = typeCalloc(SCREEN, 1)) != 0);
71 }
72
73 void _nc_set_screen(SCREEN *sp)
74 {
75         my_screen = sp;
76 }
77 #else
78 SCREEN *SP;
79 #endif