]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/report_offsets.c
ncurses 6.1 - patch 20180127
[ncurses.git] / ncurses / report_offsets.c
1 /****************************************************************************
2  * Copyright (c) 2017 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                                                *
31  ****************************************************************************/
32
33 #include <curses.priv.h>
34
35 MODULE_ID("$Id: report_offsets.c,v 1.5 2017/06/03 13:52:28 tom Exp $")
36
37 #define show_size(type) \
38         printf("%6ld\t" #type "\n", (long)sizeof(type))
39 #define show_offset(type,member) \
40         printf("%6ld\t" #type "." #member "\n", (long)offsetof(type,member))
41
42 int
43 main(void)
44 {
45     printf("Size/offsets of data structures:\n");
46
47     show_size(attr_t);
48     show_size(chtype);
49 #if NCURSES_WIDECHAR
50     show_size(cchar_t);
51 #endif
52     show_size(mmask_t);
53     show_size(MEVENT);
54     show_size(NCURSES_BOOL);
55
56     printf("\n");
57     show_size(SCREEN);
58     show_offset(SCREEN, _panelHook);
59 #if USE_REENTRANT
60     show_offset(SCREEN, _ttytype);
61 #endif
62 #ifdef TRACE
63     show_offset(SCREEN, tracechr_buf);
64 #endif
65 #ifdef USE_SP_WINDOWLIST
66     show_offset(SCREEN, _windowlist);
67 #endif
68     show_offset(SCREEN, rsp);
69 #if NCURSES_EXT_FUNCS
70 #if USE_NEW_PAIR
71     show_offset(SCREEN, _ordered_pairs);
72 #endif
73 #if NCURSES_SP_FUNCS
74     show_offset(SCREEN, use_tioctl);
75 #endif
76 #endif
77 #if USE_WIDEC_SUPPORT
78     show_offset(SCREEN, _screen_acs_fix);
79 #endif
80
81     printf("\n");
82     show_size(TERMINAL);
83     show_offset(TERMINAL, type);
84     show_offset(TERMINAL, Filedes);
85 #if defined(TERMIOS)
86     show_offset(TERMINAL, Ottyb);
87     show_offset(TERMINAL, Nttyb);
88 #endif
89     show_offset(TERMINAL, _baudrate);
90     show_offset(TERMINAL, _termname);
91 #if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR
92     show_offset(TERMINAL, type2);
93 #endif
94
95     printf("\n");
96     show_size(TERMTYPE);
97 #if NCURSES_XNAMES
98     show_offset(TERMTYPE, ext_str_table);
99     show_offset(TERMTYPE, ext_Strings);
100 #endif
101
102     printf("\n");
103     show_size(WINDOW);
104 #if NCURSES_WIDECHAR
105     show_offset(WINDOW, _bkgrnd);
106 #if NCURSES_EXT_COLORS
107     show_offset(WINDOW, _color);
108 #endif
109 #endif
110     return EXIT_SUCCESS;
111 }