2 function declare_termtype(number,suffix) {
3 printf "typedef struct termtype%s { /* in-core form of terminfo data */\n", suffix;
4 print " char *term_names; /* str_table offset of term names */"
5 print " char *str_table; /* pointer to string table */"
6 print " NCURSES_SBOOL *Booleans; /* array of boolean values */"
7 printf " %-5s *Numbers; /* array of integer values */\n", number;
8 print " char **Strings; /* array of string offsets */"
10 print "#if NCURSES_XNAMES"
11 print " char *ext_str_table; /* pointer to extended string table */"
12 print " char **ext_Names; /* corresponding names */"
14 print " unsigned short num_Booleans;/* count total Booleans */";
15 print " unsigned short num_Numbers; /* count total Numbers */";
16 print " unsigned short num_Strings; /* count total Strings */";
18 print " unsigned short ext_Booleans;/* count extensions to Booleans */";
19 print " unsigned short ext_Numbers; /* count extensions to Numbers */";
20 print " unsigned short ext_Strings; /* count extensions to Strings */";
21 print "#endif /* NCURSES_XNAMES */"
23 printf "} TERMTYPE%s;\n", suffix;
28 print "/****************************************************************************"
29 print " * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. *"
31 print " * Permission is hereby granted, free of charge, to any person obtaining a *"
32 print " * copy of this software and associated documentation files (the *"
33 print " * \"Software\"), to deal in the Software without restriction, including *"
34 print " * without limitation the rights to use, copy, modify, merge, publish, *"
35 print " * distribute, distribute with modifications, sublicense, and/or sell *"
36 print " * copies of the Software, and to permit persons to whom the Software is *"
37 print " * furnished to do so, subject to the following conditions: *"
39 print " * The above copyright notice and this permission notice shall be included *"
40 print " * in all copies or substantial portions of the Software. *"
42 print " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS *"
43 print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *"
44 print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *"
45 print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *"
46 print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *"
47 print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *"
48 print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *"
50 print " * Except as contained in this notice, the name(s) of the above copyright *"
51 print " * holders shall not be used in advertising or otherwise to promote the *"
52 print " * sale, use or other dealings in this Software without prior written *"
53 print " * authorization. *"
54 print " ****************************************************************************/"
56 print "/****************************************************************************/"
57 print "/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */"
58 print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */"
59 print "/* and: Thomas E. Dickey 1995-on */"
60 print "/****************************************************************************/"
62 print "/* $Id: MKterm.h.awk.in,v 1.67 2017/04/06 00:19:26 tom Exp $ */"
65 print "** term.h -- Definition of struct term"
68 print "#ifndef NCURSES_TERM_H_incl"
69 print "#define NCURSES_TERM_H_incl 1"
71 print "#undef NCURSES_VERSION"
72 print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\""
74 print "#include <ncurses_dll.h>"
76 print "#ifdef __cplusplus"
77 printf "extern \"C\" %s\n", lcurl;
80 print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H"
81 print " * definition (based on the system for which this was configured)."
84 print "#undef NCURSES_CONST"
85 print "#define NCURSES_CONST @NCURSES_CONST@"
87 print "#undef NCURSES_SBOOL"
88 print "#define NCURSES_SBOOL @NCURSES_SBOOL@"
90 print "#undef NCURSES_USE_DATABASE"
91 print "#define NCURSES_USE_DATABASE @NCURSES_USE_DATABASE@"
93 print "#undef NCURSES_USE_TERMCAP"
94 print "#define NCURSES_USE_TERMCAP @NCURSES_USE_TERMCAP@"
96 print "#undef NCURSES_XNAMES"
97 print "#define NCURSES_XNAMES @NCURSES_XNAMES@"
99 print "/* We will use these symbols to hide differences between"
100 print " * termios/termio/sgttyb interfaces."
103 print "#undef SET_TTY"
104 print "#undef GET_TTY"
106 print "/* Assume POSIX termio if we have the header and function */"
107 print "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */"
108 print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@"
110 print "#undef TERMIOS"
111 print "#define TERMIOS 1"
113 print "#include <termios.h>"
114 print "#define TTY struct termios"
116 print "#else /* !HAVE_TERMIOS_H */"
118 print "/* #if HAVE_TERMIO_H */"
119 print "#if @HAVE_TERMIO_H@"
121 print "#undef TERMIOS"
122 print "#define TERMIOS 1"
124 print "#include <termio.h>"
125 print "#define TTY struct termio"
127 print "#else /* !HAVE_TERMIO_H */"
129 print "#if __MINGW32__"
130 print "# include <ncurses_mingw.h>"
131 print "# define TTY struct termios"
133 print "#undef TERMIOS"
134 print "#include <sgtty.h>"
135 print "#include <sys/ioctl.h>"
136 print "#define TTY struct sgttyb"
137 print "#endif /* MINGW32 */"
138 print "#endif /* HAVE_TERMIO_H */"
140 print "#endif /* HAVE_TERMIOS_H */"
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)"
146 print "#define GET_TTY(fd, buf) gtty(fd, buf)"
147 print "#define SET_TTY(fd, buf) stty(fd, buf)"
150 print "#define NAMESIZE 256"
152 print "/* The cast works because TERMTYPE is the first data in TERMINAL */"
153 print "#define CUR ((TERMTYPE *)(cur_term))->"
157 $2 == "%%-STOP-HERE-%%" {
159 printf "#define BOOLWRITE %d\n", BoolCount
160 printf "#define NUMWRITE %d\n", NumberCount
161 printf "#define STRWRITE %d\n", StringCount
163 print "/* older synonyms for some capabilities */"
164 print "#define beehive_glitch no_esc_ctlc"
165 print "#define teleray_glitch dest_tabs_magic_smso"
166 print "#define micro_char_size micro_col_size"
168 print "#ifdef __INTERNAL_CAPS_VISIBLE"
176 acsindex = StringCount;
180 printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++
184 printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++
188 printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++
192 print "#endif /* __INTERNAL_CAPS_VISIBLE */"
196 print " * Predefined terminfo array sizes"
198 printf "#define BOOLCOUNT %d\n", BoolCount
199 printf "#define NUMCOUNT %d\n", NumberCount
200 printf "#define STRCOUNT %d\n", StringCount
202 print "/* used by code for comparing entries */"
203 print "#define acs_chars_index ", acsindex
205 declare_termtype("short","");
208 print " * The only reason these structures are visible is for read-only use."
209 print " * Programs which modify the data are not, never were, portable across"
210 print " * curses implementations."
212 print "#ifdef NCURSES_INTERNALS"
214 if (@NCURSES_EXT_COLORS@) {
215 declare_termtype("int","2");
217 print "typedef TERMTYPE TERMTYPE2;"
220 print "typedef struct term { /* describe an actual terminal */"
221 print " TERMTYPE type; /* terminal type description */"
222 print " short Filedes; /* file description being written to */"
223 print " TTY Ottyb; /* original state of the terminal */"
224 print " TTY Nttyb; /* current state of the terminal */"
225 print " int _baudrate; /* used to compute padding */"
226 print " char * _termname; /* used for termname() */"
227 if (@NCURSES_EXT_COLORS@) {
228 print " TERMTYPE2 type2; /* extended terminal type description */"
232 print "typedef struct term TERMINAL;"
233 print "#endif /* NCURSES_INTERNALS */"
236 print "#if @BROKEN_LINKER@ && !@cf_cv_enable_reentrant@"
237 print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
238 print "#elif @cf_cv_enable_reentrant@"
239 print "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);"
240 print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())"
242 print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
245 print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@"
246 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);"
247 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);"
248 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);"
249 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);"
250 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);"
251 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);"
252 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);"
253 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);"
254 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);"
256 print "#define boolnames NCURSES_PUBLIC_VAR(boolnames())"
257 print "#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())"
258 print "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())"
259 print "#define numnames NCURSES_PUBLIC_VAR(numnames())"
260 print "#define numcodes NCURSES_PUBLIC_VAR(numcodes())"
261 print "#define numfnames NCURSES_PUBLIC_VAR(numfnames())"
262 print "#define strnames NCURSES_PUBLIC_VAR(strnames())"
263 print "#define strcodes NCURSES_PUBLIC_VAR(strcodes())"
264 print "#define strfnames NCURSES_PUBLIC_VAR(strfnames())"
268 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];"
269 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];"
270 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];"
271 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];"
272 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];"
273 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];"
274 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];"
275 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];"
276 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];"
281 print " * These entrypoints are used only by the ncurses utilities such as tic."
283 print "#ifdef NCURSES_INTERNALS"
285 print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);"
286 print "extern NCURSES_EXPORT(int) _nc_read_entry2 (const char * const, char * const, TERMTYPE2 *const);"
287 print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE2 *);"
288 print "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE2 *, char *, int);"
289 print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);"
290 print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);"
292 print "#endif /* NCURSES_INTERNALS */"
296 print " * These entrypoints are used by tack."
298 print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);"
299 print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);"
301 print "/* Normal entry points */"
302 print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);"
303 print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);"
305 print "/* miscellaneous entry points */"
306 print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);"
307 print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);"
309 print "/* terminfo entry points, also declared in curses.h */"
310 print "#if !defined(__NCURSES_H)"
311 print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);"
312 print "extern NCURSES_EXPORT_VAR(char) ttytype[];"
313 print "extern NCURSES_EXPORT(int) putp (const char *);"
314 print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);"
315 print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);"
317 print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */"
318 print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */"
320 print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */"
321 print "extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */"
324 print "extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */"
326 print "#endif /* __NCURSES_H */"
328 print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
329 print "#if !defined(NCURSES_TERMCAP_H_incl)"
330 print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);"
331 print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);"
332 print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);"
333 print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);"
334 print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);"
335 print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));"
336 print "#endif /* NCURSES_TERMCAP_H_incl */"
339 print " * Include curses.h before term.h to enable these extensions."
341 print "#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)"
343 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *);"
344 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *);"
345 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *);"
346 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *);"
348 print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */"
349 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */"
351 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */"
352 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */"
355 print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
356 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **);"
357 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);"
358 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);"
359 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);"
360 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);"
361 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);"
363 print "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);"
364 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);"
366 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);"
367 print "#endif /* NCURSES_SP_FUNCS */"
369 print "#ifdef __cplusplus"
370 printf "%s\n", rcurl;
373 print "#endif /* NCURSES_TERM_H_incl */"