5 print "/****************************************************************************"
6 print " * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. *"
8 print " * Permission is hereby granted, free of charge, to any person obtaining a *"
9 print " * copy of this software and associated documentation files (the *"
10 print " * \"Software\"), to deal in the Software without restriction, including *"
11 print " * without limitation the rights to use, copy, modify, merge, publish, *"
12 print " * distribute, distribute with modifications, sublicense, and/or sell *"
13 print " * copies of the Software, and to permit persons to whom the Software is *"
14 print " * furnished to do so, subject to the following conditions: *"
16 print " * The above copyright notice and this permission notice shall be included *"
17 print " * in all copies or substantial portions of the Software. *"
19 print " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS *"
20 print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *"
21 print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *"
22 print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *"
23 print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *"
24 print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *"
25 print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *"
27 print " * Except as contained in this notice, the name(s) of the above copyright *"
28 print " * holders shall not be used in advertising or otherwise to promote the *"
29 print " * sale, use or other dealings in this Software without prior written *"
30 print " * authorization. *"
31 print " ****************************************************************************/"
33 print "/****************************************************************************/"
34 print "/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */"
35 print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */"
36 print "/* and: Thomas E. Dickey 1995-on */"
37 print "/****************************************************************************/"
39 print "/* $Id: MKterm.h.awk.in,v 1.66 2017/04/03 08:16:54 tom Exp $ */"
42 print "** term.h -- Definition of struct term"
45 print "#ifndef NCURSES_TERM_H_incl"
46 print "#define NCURSES_TERM_H_incl 1"
48 print "#undef NCURSES_VERSION"
49 print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\""
51 print "#include <ncurses_dll.h>"
53 print "#ifdef __cplusplus"
54 printf "extern \"C\" %s\n", lcurl;
57 print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H"
58 print " * definition (based on the system for which this was configured)."
61 print "#undef NCURSES_CONST"
62 print "#define NCURSES_CONST @NCURSES_CONST@"
64 print "#undef NCURSES_SBOOL"
65 print "#define NCURSES_SBOOL @NCURSES_SBOOL@"
67 print "#undef NCURSES_USE_DATABASE"
68 print "#define NCURSES_USE_DATABASE @NCURSES_USE_DATABASE@"
70 print "#undef NCURSES_USE_TERMCAP"
71 print "#define NCURSES_USE_TERMCAP @NCURSES_USE_TERMCAP@"
73 print "#undef NCURSES_XNAMES"
74 print "#define NCURSES_XNAMES @NCURSES_XNAMES@"
76 print "/* We will use these symbols to hide differences between"
77 print " * termios/termio/sgttyb interfaces."
80 print "#undef SET_TTY"
81 print "#undef GET_TTY"
83 print "/* Assume POSIX termio if we have the header and function */"
84 print "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */"
85 print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@"
87 print "#undef TERMIOS"
88 print "#define TERMIOS 1"
90 print "#include <termios.h>"
91 print "#define TTY struct termios"
93 print "#else /* !HAVE_TERMIOS_H */"
95 print "/* #if HAVE_TERMIO_H */"
96 print "#if @HAVE_TERMIO_H@"
98 print "#undef TERMIOS"
99 print "#define TERMIOS 1"
101 print "#include <termio.h>"
102 print "#define TTY struct termio"
104 print "#else /* !HAVE_TERMIO_H */"
106 print "#if __MINGW32__"
107 print "# include <ncurses_mingw.h>"
108 print "# define TTY struct termios"
110 print "#undef TERMIOS"
111 print "#include <sgtty.h>"
112 print "#include <sys/ioctl.h>"
113 print "#define TTY struct sgttyb"
114 print "#endif /* MINGW32 */"
115 print "#endif /* HAVE_TERMIO_H */"
117 print "#endif /* HAVE_TERMIOS_H */"
119 print "#ifdef TERMIOS"
120 print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)"
121 print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)"
123 print "#define GET_TTY(fd, buf) gtty(fd, buf)"
124 print "#define SET_TTY(fd, buf) stty(fd, buf)"
127 print "#define NAMESIZE 256"
129 print "/* The cast works because TERMTYPE is the first data in TERMINAL */"
130 print "#define CUR ((TERMTYPE *)(cur_term))->"
134 $2 == "%%-STOP-HERE-%%" {
136 printf "#define BOOLWRITE %d\n", BoolCount
137 printf "#define NUMWRITE %d\n", NumberCount
138 printf "#define STRWRITE %d\n", StringCount
140 print "/* older synonyms for some capabilities */"
141 print "#define beehive_glitch no_esc_ctlc"
142 print "#define teleray_glitch dest_tabs_magic_smso"
143 print "#define micro_char_size micro_col_size"
145 print "#ifdef __INTERNAL_CAPS_VISIBLE"
153 acsindex = StringCount;
157 printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++
161 printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++
165 printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++
169 print "#endif /* __INTERNAL_CAPS_VISIBLE */"
173 print " * Predefined terminfo array sizes"
175 printf "#define BOOLCOUNT %d\n", BoolCount
176 printf "#define NUMCOUNT %d\n", NumberCount
177 printf "#define STRCOUNT %d\n", StringCount
179 print "/* used by code for comparing entries */"
180 print "#define acs_chars_index ", acsindex
182 print "typedef struct termtype { /* in-core form of terminfo data */"
183 print " char *term_names; /* str_table offset of term names */"
184 print " char *str_table; /* pointer to string table */"
185 print " NCURSES_SBOOL *Booleans; /* array of boolean values */"
186 print " short *Numbers; /* array of integer values */"
187 print " char **Strings; /* array of string offsets */"
189 print "#if NCURSES_XNAMES"
190 print " char *ext_str_table; /* pointer to extended string table */"
191 print " char **ext_Names; /* corresponding names */"
193 print " unsigned short num_Booleans;/* count total Booleans */"
194 print " unsigned short num_Numbers; /* count total Numbers */"
195 print " unsigned short num_Strings; /* count total Strings */"
197 print " unsigned short ext_Booleans;/* count extensions to Booleans */"
198 print " unsigned short ext_Numbers; /* count extensions to Numbers */"
199 print " unsigned short ext_Strings; /* count extensions to Strings */"
200 print "#endif /* NCURSES_XNAMES */"
205 print " * The only reason these structures are visible is for read-only use."
206 print " * Programs which modify the data are not, never were, portable across"
207 print " * curses implementations."
209 print "#ifdef NCURSES_INTERNALS"
210 print "typedef struct term { /* describe an actual terminal */"
211 print " TERMTYPE type; /* terminal type description */"
212 print " short Filedes; /* file description being written to */"
213 print " TTY Ottyb; /* original state of the terminal */"
214 print " TTY Nttyb; /* current state of the terminal */"
215 print " int _baudrate; /* used to compute padding */"
216 print " char * _termname; /* used for termname() */"
219 print "typedef struct term TERMINAL;"
220 print "#endif /* NCURSES_INTERNALS */"
223 print "#if @BROKEN_LINKER@ && !@cf_cv_enable_reentrant@"
224 print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
225 print "#elif @cf_cv_enable_reentrant@"
226 print "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);"
227 print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())"
229 print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
232 print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@"
233 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);"
234 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);"
235 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);"
236 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);"
237 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);"
238 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);"
239 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);"
240 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);"
241 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);"
243 print "#define boolnames NCURSES_PUBLIC_VAR(boolnames())"
244 print "#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())"
245 print "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())"
246 print "#define numnames NCURSES_PUBLIC_VAR(numnames())"
247 print "#define numcodes NCURSES_PUBLIC_VAR(numcodes())"
248 print "#define numfnames NCURSES_PUBLIC_VAR(numfnames())"
249 print "#define strnames NCURSES_PUBLIC_VAR(strnames())"
250 print "#define strcodes NCURSES_PUBLIC_VAR(strcodes())"
251 print "#define strfnames NCURSES_PUBLIC_VAR(strfnames())"
255 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];"
256 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];"
257 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];"
258 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];"
259 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];"
260 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];"
261 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];"
262 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];"
263 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];"
268 print " * These entrypoints are used only by the ncurses utilities such as tic."
270 print "#ifdef NCURSES_INTERNALS"
272 print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);"
273 print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);"
274 print "extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE *const);"
275 print "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);"
276 print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);"
277 print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);"
279 print "#endif /* NCURSES_INTERNALS */"
283 print " * These entrypoints are used by tack."
285 print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);"
286 print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);"
288 print "/* Normal entry points */"
289 print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);"
290 print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);"
292 print "/* miscellaneous entry points */"
293 print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);"
294 print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);"
296 print "/* terminfo entry points, also declared in curses.h */"
297 print "#if !defined(__NCURSES_H)"
298 print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);"
299 print "extern NCURSES_EXPORT_VAR(char) ttytype[];"
300 print "extern NCURSES_EXPORT(int) putp (const char *);"
301 print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);"
302 print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);"
304 print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */"
305 print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */"
307 print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */"
308 print "extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */"
311 print "extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */"
313 print "#endif /* __NCURSES_H */"
315 print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
316 print "#if !defined(NCURSES_TERMCAP_H_incl)"
317 print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);"
318 print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);"
319 print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);"
320 print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);"
321 print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);"
322 print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));"
323 print "#endif /* NCURSES_TERMCAP_H_incl */"
326 print " * Include curses.h before term.h to enable these extensions."
328 print "#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)"
330 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *);"
331 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *);"
332 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *);"
333 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *);"
335 print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */"
336 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */"
338 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */"
339 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */"
342 print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
343 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **);"
344 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);"
345 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);"
346 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);"
347 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);"
348 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);"
350 print "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);"
351 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);"
353 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);"
354 print "#endif /* NCURSES_SP_FUNCS */"
356 print "#ifdef __cplusplus"
357 printf "%s\n", rcurl;
360 print "#endif /* NCURSES_TERM_H_incl */"