1 | BEGIN {
|
---|
2 | print "/****************************************************************************"
|
---|
3 | print " * Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. *"
|
---|
4 | print " * *"
|
---|
5 | print " * Permission is hereby granted, free of charge, to any person obtaining a *"
|
---|
6 | print " * copy of this software and associated documentation files (the *"
|
---|
7 | print " * \"Software\"), to deal in the Software without restriction, including *"
|
---|
8 | print " * without limitation the rights to use, copy, modify, merge, publish, *"
|
---|
9 | print " * distribute, distribute with modifications, sublicense, and/or sell *"
|
---|
10 | print " * copies of the Software, and to permit persons to whom the Software is *"
|
---|
11 | print " * furnished to do so, subject to the following conditions: *"
|
---|
12 | print " * *"
|
---|
13 | print " * The above copyright notice and this permission notice shall be included *"
|
---|
14 | print " * in all copies or substantial portions of the Software. *"
|
---|
15 | print " * *"
|
---|
16 | print " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS *"
|
---|
17 | print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *"
|
---|
18 | print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *"
|
---|
19 | print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *"
|
---|
20 | print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *"
|
---|
21 | print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *"
|
---|
22 | print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *"
|
---|
23 | print " * *"
|
---|
24 | print " * Except as contained in this notice, the name(s) of the above copyright *"
|
---|
25 | print " * holders shall not be used in advertising or otherwise to promote the *"
|
---|
26 | print " * sale, use or other dealings in this Software without prior written *"
|
---|
27 | print " * authorization. *"
|
---|
28 | print " ****************************************************************************/"
|
---|
29 | print ""
|
---|
30 | print "/****************************************************************************/"
|
---|
31 | print "/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */"
|
---|
32 | print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */"
|
---|
33 | print "/* and: Thomas E. Dickey 1995-2003 */"
|
---|
34 | print "/****************************************************************************/"
|
---|
35 | print ""
|
---|
36 | print "/* $Id: MKterm.h.awk.in,v 1.42 2003/12/27 19:09:16 tom Exp $ */"
|
---|
37 | print ""
|
---|
38 | print "/*"
|
---|
39 | print "** term.h -- Definition of struct term"
|
---|
40 | print "*/"
|
---|
41 | print ""
|
---|
42 | print "#ifndef NCURSES_TERM_H_incl"
|
---|
43 | print "#define NCURSES_TERM_H_incl 1"
|
---|
44 | print ""
|
---|
45 | print "#undef NCURSES_VERSION"
|
---|
46 | print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\""
|
---|
47 | print ""
|
---|
48 | print "#include <ncurses_dll.h>"
|
---|
49 | print ""
|
---|
50 | print "#ifdef __cplusplus"
|
---|
51 | print "extern \"C\" {"
|
---|
52 | print "#endif"
|
---|
53 | print ""
|
---|
54 | print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H"
|
---|
55 | print " * definition (based on the system for which this was configured)."
|
---|
56 | print " */"
|
---|
57 | print ""
|
---|
58 | print "#undef HAVE_TERMIOS_H"
|
---|
59 | print "#define HAVE_TERMIOS_H 1/*default*/"
|
---|
60 | print ""
|
---|
61 | print "#undef HAVE_TCGETATTR"
|
---|
62 | print "#define HAVE_TCGETATTR 1/*default*/"
|
---|
63 | print ""
|
---|
64 | print "#undef NCURSES_CONST"
|
---|
65 | print "#define NCURSES_CONST @NCURSES_CONST@"
|
---|
66 | print ""
|
---|
67 | print "#undef NCURSES_XNAMES"
|
---|
68 | print "#define NCURSES_XNAMES @NCURSES_XNAMES@"
|
---|
69 | print ""
|
---|
70 | print "/* We will use these symbols to hide differences between"
|
---|
71 | print " * termios/termio/sgttyb interfaces."
|
---|
72 | print " */"
|
---|
73 | print "#undef TTY"
|
---|
74 | print "#undef SET_TTY"
|
---|
75 | print "#undef GET_TTY"
|
---|
76 | print ""
|
---|
77 | print "/* Assume POSIX termio if we have the header and function */"
|
---|
78 | print "#if HAVE_TERMIOS_H && HAVE_TCGETATTR"
|
---|
79 | print ""
|
---|
80 | print "#undef TERMIOS"
|
---|
81 | print "#define TERMIOS 1"
|
---|
82 | print ""
|
---|
83 | print "#include <termios.h>"
|
---|
84 | print "#define TTY struct termios"
|
---|
85 | print ""
|
---|
86 | print "#else /* !HAVE_TERMIOS_H */"
|
---|
87 | print ""
|
---|
88 | print "#if HAVE_TERMIO_H"
|
---|
89 | print ""
|
---|
90 | print "#undef TERMIOS"
|
---|
91 | print "#define TERMIOS 1"
|
---|
92 | print ""
|
---|
93 | print "#include <termio.h>"
|
---|
94 | print "#define TTY struct termio"
|
---|
95 | print ""
|
---|
96 | print "/* Add definitions to make termio look like termios."
|
---|
97 | print " * But ifdef it, since there are some implementations"
|
---|
98 | print " * that try to do this for us in a fake <termio.h>."
|
---|
99 | print " */"
|
---|
100 | print "#ifndef TCSANOW"
|
---|
101 | print "#define TCSANOW TCSETA"
|
---|
102 | print "#endif"
|
---|
103 | print "#ifndef TCSADRAIN"
|
---|
104 | print "#define TCSADRAIN TCSETAW"
|
---|
105 | print "#endif"
|
---|
106 | print "#ifndef TCSAFLUSH"
|
---|
107 | print "#define TCSAFLUSH TCSETAF"
|
---|
108 | print "#endif"
|
---|
109 | print "#ifndef tcsetattr"
|
---|
110 | print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)"
|
---|
111 | print "#endif"
|
---|
112 | print "#ifndef tcgetattr"
|
---|
113 | print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)"
|
---|
114 | print "#endif"
|
---|
115 | print "#ifndef cfgetospeed"
|
---|
116 | print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)"
|
---|
117 | print "#endif"
|
---|
118 | print "#ifndef TCIFLUSH "
|
---|
119 | print "#define TCIFLUSH 0"
|
---|
120 | print "#endif"
|
---|
121 | print "#ifndef TCOFLUSH "
|
---|
122 | print "#define TCOFLUSH 1"
|
---|
123 | print "#endif"
|
---|
124 | print "#ifndef TCIOFLUSH "
|
---|
125 | print "#define TCIOFLUSH 2"
|
---|
126 | print "#endif"
|
---|
127 | print "#ifndef tcflush"
|
---|
128 | print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)"
|
---|
129 | print "#endif"
|
---|
130 | print ""
|
---|
131 | print "#else /* !HAVE_TERMIO_H */"
|
---|
132 | print ""
|
---|
133 | print "#undef TERMIOS"
|
---|
134 | print "#include <sgtty.h>"
|
---|
135 | print "#include <sys/ioctl.h>"
|
---|
136 | print "#define TTY struct sgttyb"
|
---|
137 | print ""
|
---|
138 | print "#endif /* HAVE_TERMIO_H */"
|
---|
139 | print ""
|
---|
140 | print "#endif /* HAVE_TERMIOS_H */"
|
---|
141 | print ""
|
---|
142 | print "#ifdef TERMIOS"
|
---|
143 | print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)"
|
---|
144 | print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)"
|
---|
145 | print "#else"
|
---|
146 | print "#define GET_TTY(fd, buf) gtty(fd, buf)"
|
---|
147 | print "#define SET_TTY(fd, buf) stty(fd, buf)"
|
---|
148 | print "#endif"
|
---|
149 | print ""
|
---|
150 | print "#define NAMESIZE 256"
|
---|
151 | print ""
|
---|
152 | print "#define CUR cur_term->type."
|
---|
153 | print ""
|
---|
154 | }
|
---|
155 |
|
---|
156 | $2 == "%%-STOP-HERE-%%" {
|
---|
157 | print ""
|
---|
158 | printf "#define BOOLWRITE %d\n", BoolCount
|
---|
159 | printf "#define NUMWRITE %d\n", NumberCount
|
---|
160 | printf "#define STRWRITE %d\n", StringCount
|
---|
161 | print ""
|
---|
162 | print "/* older synonyms for some capabilities */"
|
---|
163 | print "#define beehive_glitch no_esc_ctlc"
|
---|
164 | print "#define teleray_glitch dest_tabs_magic_smso"
|
---|
165 | print "#define micro_char_size micro_col_size"
|
---|
166 | print ""
|
---|
167 | print "#ifdef __INTERNAL_CAPS_VISIBLE"
|
---|
168 | }
|
---|
169 |
|
---|
170 | /^#/ {next;}
|
---|
171 |
|
---|
172 | $1 == "acs_chars" {acsindex = StringCount}
|
---|
173 |
|
---|
174 | $3 == "bool" {
|
---|
175 | printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++
|
---|
176 | }
|
---|
177 |
|
---|
178 | $3 == "num" {
|
---|
179 | printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++
|
---|
180 | }
|
---|
181 |
|
---|
182 | $3 == "str" {
|
---|
183 | printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++
|
---|
184 | }
|
---|
185 |
|
---|
186 | END {
|
---|
187 | print "#endif /* __INTERNAL_CAPS_VISIBLE */"
|
---|
188 | print ""
|
---|
189 | print ""
|
---|
190 | print "/*"
|
---|
191 | print " * Predefined terminfo array sizes"
|
---|
192 | print " */"
|
---|
193 | printf "#define BOOLCOUNT %d\n", BoolCount
|
---|
194 | printf "#define NUMCOUNT %d\n", NumberCount
|
---|
195 | printf "#define STRCOUNT %d\n", StringCount
|
---|
196 | print ""
|
---|
197 | print "/* used by code for comparing entries */"
|
---|
198 | print "#define acs_chars_index ", acsindex
|
---|
199 | print ""
|
---|
200 | print "typedef struct termtype { /* in-core form of terminfo data */"
|
---|
201 | print " char *term_names; /* str_table offset of term names */"
|
---|
202 | print " char *str_table; /* pointer to string table */"
|
---|
203 | print " char *Booleans; /* array of boolean values */"
|
---|
204 | print " short *Numbers; /* array of integer values */"
|
---|
205 | print " char **Strings; /* array of string offsets */"
|
---|
206 | print ""
|
---|
207 | print "#if NCURSES_XNAMES"
|
---|
208 | print " char *ext_str_table; /* pointer to extended string table */"
|
---|
209 | print " char **ext_Names; /* corresponding names */"
|
---|
210 | print ""
|
---|
211 | print " unsigned short num_Booleans;/* count total Booleans */"
|
---|
212 | print " unsigned short num_Numbers; /* count total Numbers */"
|
---|
213 | print " unsigned short num_Strings; /* count total Strings */"
|
---|
214 | print ""
|
---|
215 | print " unsigned short ext_Booleans;/* count extensions to Booleans */"
|
---|
216 | print " unsigned short ext_Numbers; /* count extensions to Numbers */"
|
---|
217 | print " unsigned short ext_Strings; /* count extensions to Strings */"
|
---|
218 | print "#endif /* NCURSES_XNAMES */"
|
---|
219 | print ""
|
---|
220 | print "} TERMTYPE;"
|
---|
221 | print ""
|
---|
222 | print "typedef struct term { /* describe an actual terminal */"
|
---|
223 | print " TERMTYPE type; /* terminal type description */"
|
---|
224 | print " short Filedes; /* file description being written to */"
|
---|
225 | print " TTY Ottyb, /* original state of the terminal */"
|
---|
226 | print " Nttyb; /* current state of the terminal */"
|
---|
227 | print " int _baudrate; /* used to compute padding */"
|
---|
228 | print " char * _termname; /* used for termname() */"
|
---|
229 | print "} TERMINAL;"
|
---|
230 | print ""
|
---|
231 | print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
|
---|
232 | print ""
|
---|
233 | print "#if BROKEN_LINKER"
|
---|
234 | print "#define boolnames _nc_boolnames()"
|
---|
235 | print "#define boolcodes _nc_boolcodes()"
|
---|
236 | print "#define boolfnames _nc_boolfnames()"
|
---|
237 | print "#define numnames _nc_numnames()"
|
---|
238 | print "#define numcodes _nc_numcodes()"
|
---|
239 | print "#define numfnames _nc_numfnames()"
|
---|
240 | print "#define strnames _nc_strnames()"
|
---|
241 | print "#define strcodes _nc_strcodes()"
|
---|
242 | print "#define strfnames _nc_strfnames()"
|
---|
243 | print ""
|
---|
244 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolnames (void);"
|
---|
245 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolcodes (void);"
|
---|
246 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolfnames (void);"
|
---|
247 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numnames (void);"
|
---|
248 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numcodes (void);"
|
---|
249 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numfnames (void);"
|
---|
250 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strnames (void);"
|
---|
251 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strcodes (void);"
|
---|
252 | print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strfnames (void);"
|
---|
253 | print ""
|
---|
254 | print "#else"
|
---|
255 | print ""
|
---|
256 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];"
|
---|
257 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];"
|
---|
258 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];"
|
---|
259 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];"
|
---|
260 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];"
|
---|
261 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];"
|
---|
262 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];"
|
---|
263 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];"
|
---|
264 | print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];"
|
---|
265 | print ""
|
---|
266 | print "#endif"
|
---|
267 | print ""
|
---|
268 | print "/* internals */"
|
---|
269 | print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);"
|
---|
270 | print "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);"
|
---|
271 | print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);"
|
---|
272 | print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);"
|
---|
273 | print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);"
|
---|
274 | print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);"
|
---|
275 | print "extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);"
|
---|
276 | print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);"
|
---|
277 | print ""
|
---|
278 | print "/* entry points */"
|
---|
279 | print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);"
|
---|
280 | print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);"
|
---|
281 | print ""
|
---|
282 | print "/* miscellaneous entry points */"
|
---|
283 | print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);"
|
---|
284 | print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);"
|
---|
285 | print ""
|
---|
286 | print "/* terminfo entry points, also declared in curses.h */"
|
---|
287 | print "#if !defined(__NCURSES_H)"
|
---|
288 | print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);"
|
---|
289 | print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);"
|
---|
290 | print "extern NCURSES_EXPORT_VAR(char) ttytype[];"
|
---|
291 | print "extern NCURSES_EXPORT(int) putp (const char *);"
|
---|
292 | print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);"
|
---|
293 | print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);"
|
---|
294 | print "#endif /* __NCURSES_H */"
|
---|
295 | print ""
|
---|
296 | print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
|
---|
297 | print "#if !defined(NCURSES_TERMCAP_H_incl)"
|
---|
298 | print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);"
|
---|
299 | print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);"
|
---|
300 | print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);"
|
---|
301 | print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);"
|
---|
302 | print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);"
|
---|
303 | print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));"
|
---|
304 | print "#endif /* NCURSES_TERMCAP_H_incl */"
|
---|
305 | print ""
|
---|
306 | print "#ifdef __cplusplus"
|
---|
307 | print "}"
|
---|
308 | print "#endif"
|
---|
309 | print ""
|
---|
310 | print "#endif /* NCURSES_TERM_H_incl */"
|
---|
311 | }
|
---|