missing ncurses sources
[tomato.git] / release / src / router / libncurses / include / MKterm.h.awk
blob859a3448550bd4ff377c5ffff0973b966c3134db
1 # vile:awkmode
2 BEGIN {
3 print "/****************************************************************************"
4 print " * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *"
5 print " * *"
6 print " * Permission is hereby granted, free of charge, to any person obtaining a *"
7 print " * copy of this software and associated documentation files (the *"
8 print " * \"Software\"), to deal in the Software without restriction, including *"
9 print " * without limitation the rights to use, copy, modify, merge, publish, *"
10 print " * distribute, distribute with modifications, sublicense, and/or sell *"
11 print " * copies of the Software, and to permit persons to whom the Software is *"
12 print " * furnished to do so, subject to the following conditions: *"
13 print " * *"
14 print " * The above copyright notice and this permission notice shall be included *"
15 print " * in all copies or substantial portions of the Software. *"
16 print " * *"
17 print " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS *"
18 print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *"
19 print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *"
20 print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *"
21 print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *"
22 print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *"
23 print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *"
24 print " * *"
25 print " * Except as contained in this notice, the name(s) of the above copyright *"
26 print " * holders shall not be used in advertising or otherwise to promote the *"
27 print " * sale, use or other dealings in this Software without prior written *"
28 print " * authorization. *"
29 print " ****************************************************************************/"
30 print ""
31 print "/****************************************************************************/"
32 print "/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */"
33 print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */"
34 print "/* and: Thomas E. Dickey 1995-on */"
35 print "/****************************************************************************/"
36 print ""
37 print "/* $Id: MKterm.h.awk.in,v 1.58 2010/01/09 19:53:26 tom Exp $ */"
38 print ""
39 print "/*"
40 print "** term.h -- Definition of struct term"
41 print "*/"
42 print ""
43 print "#ifndef NCURSES_TERM_H_incl"
44 print "#define NCURSES_TERM_H_incl 1"
45 print ""
46 print "#undef NCURSES_VERSION"
47 print "#define NCURSES_VERSION \"5.9\""
48 print ""
49 print "#include <ncurses_dll.h>"
50 print ""
51 print "#ifdef __cplusplus"
52 print "extern \"C\" {"
53 print "#endif"
54 print ""
55 print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H"
56 print " * definition (based on the system for which this was configured)."
57 print " */"
58 print ""
59 print "#undef NCURSES_CONST"
60 print "#define NCURSES_CONST /*nothing*/"
61 print ""
62 print "#undef NCURSES_SBOOL"
63 print "#define NCURSES_SBOOL char"
64 print ""
65 print "#undef NCURSES_XNAMES"
66 print "#define NCURSES_XNAMES 1"
67 print ""
68 print "/* We will use these symbols to hide differences between"
69 print " * termios/termio/sgttyb interfaces."
70 print " */"
71 print "#undef TTY"
72 print "#undef SET_TTY"
73 print "#undef GET_TTY"
74 print ""
75 print "/* Assume POSIX termio if we have the header and function */"
76 print "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */"
77 print "#if 1 && 1"
78 print ""
79 print "#undef TERMIOS"
80 print "#define TERMIOS 1"
81 print ""
82 print "#include <termios.h>"
83 print "#define TTY struct termios"
84 print ""
85 print "#else /* !HAVE_TERMIOS_H */"
86 print ""
87 print "/* #if HAVE_TERMIO_H */"
88 print "#if 1"
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 "#if __MINGW32__"
134 print "# include <ncurses_mingw.h>"
135 print "# define TTY struct termios"
136 print "#else"
137 print "#undef TERMIOS"
138 print "#include <sgtty.h>"
139 print "#include <sys/ioctl.h>"
140 print "#define TTY struct sgttyb"
141 print "#endif /* MINGW32 */"
142 print "#endif /* HAVE_TERMIO_H */"
143 print ""
144 print "#endif /* HAVE_TERMIOS_H */"
145 print ""
146 print "#ifdef TERMIOS"
147 print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)"
148 print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)"
149 print "#else"
150 print "#define GET_TTY(fd, buf) gtty(fd, buf)"
151 print "#define SET_TTY(fd, buf) stty(fd, buf)"
152 print "#endif"
153 print ""
154 print "#define NAMESIZE 256"
155 print ""
156 print "#define CUR cur_term->type."
157 print ""
160 $2 == "%%-STOP-HERE-%%" {
161 print ""
162 printf "#define BOOLWRITE %d\n", BoolCount
163 printf "#define NUMWRITE %d\n", NumberCount
164 printf "#define STRWRITE %d\n", StringCount
165 print ""
166 print "/* older synonyms for some capabilities */"
167 print "#define beehive_glitch no_esc_ctlc"
168 print "#define teleray_glitch dest_tabs_magic_smso"
169 print "#define micro_char_size micro_col_size"
170 print ""
171 print "#ifdef __INTERNAL_CAPS_VISIBLE"
174 /^#/ {next;}
176 $1 == "acs_chars" {acsindex = StringCount}
178 $3 == "bool" {
179 printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++
182 $3 == "num" {
183 printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++
186 $3 == "str" {
187 printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++
190 END {
191 print "#endif /* __INTERNAL_CAPS_VISIBLE */"
192 print ""
193 print ""
194 print "/*"
195 print " * Predefined terminfo array sizes"
196 print " */"
197 printf "#define BOOLCOUNT %d\n", BoolCount
198 printf "#define NUMCOUNT %d\n", NumberCount
199 printf "#define STRCOUNT %d\n", StringCount
200 print ""
201 print "/* used by code for comparing entries */"
202 print "#define acs_chars_index ", acsindex
203 print ""
204 print "typedef struct termtype { /* in-core form of terminfo data */"
205 print " char *term_names; /* str_table offset of term names */"
206 print " char *str_table; /* pointer to string table */"
207 print " NCURSES_SBOOL *Booleans; /* array of boolean values */"
208 print " short *Numbers; /* array of integer values */"
209 print " char **Strings; /* array of string offsets */"
210 print ""
211 print "#if NCURSES_XNAMES"
212 print " char *ext_str_table; /* pointer to extended string table */"
213 print " char **ext_Names; /* corresponding names */"
214 print ""
215 print " unsigned short num_Booleans;/* count total Booleans */"
216 print " unsigned short num_Numbers; /* count total Numbers */"
217 print " unsigned short num_Strings; /* count total Strings */"
218 print ""
219 print " unsigned short ext_Booleans;/* count extensions to Booleans */"
220 print " unsigned short ext_Numbers; /* count extensions to Numbers */"
221 print " unsigned short ext_Strings; /* count extensions to Strings */"
222 print "#endif /* NCURSES_XNAMES */"
223 print ""
224 print "} TERMTYPE;"
225 print ""
226 print "typedef struct term { /* describe an actual terminal */"
227 print " TERMTYPE type; /* terminal type description */"
228 print " short Filedes; /* file description being written to */"
229 print " TTY Ottyb, /* original state of the terminal */"
230 print " Nttyb; /* current state of the terminal */"
231 print " int _baudrate; /* used to compute padding */"
232 print " char * _termname; /* used for termname() */"
233 print "} TERMINAL;"
234 print ""
235 print "#if 0 && !0"
236 print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
237 print "#elif 0"
238 print "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);"
239 print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())"
240 print "#else"
241 print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
242 print "#endif"
243 print ""
244 print "#if 0 || 0"
245 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);"
246 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);"
247 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);"
248 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);"
249 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);"
250 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);"
251 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);"
252 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);"
253 print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);"
254 print ""
255 print "#define boolnames NCURSES_PUBLIC_VAR(boolnames())"
256 print "#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())"
257 print "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())"
258 print "#define numnames NCURSES_PUBLIC_VAR(numnames())"
259 print "#define numcodes NCURSES_PUBLIC_VAR(numcodes())"
260 print "#define numfnames NCURSES_PUBLIC_VAR(numfnames())"
261 print "#define strnames NCURSES_PUBLIC_VAR(strnames())"
262 print "#define strcodes NCURSES_PUBLIC_VAR(strcodes())"
263 print "#define strfnames NCURSES_PUBLIC_VAR(strfnames())"
264 print ""
265 print "#else"
266 print ""
267 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];"
268 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];"
269 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];"
270 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];"
271 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];"
272 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];"
273 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];"
274 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];"
275 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];"
276 print ""
277 print "#endif"
278 print ""
279 print "/* internals */"
280 print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);"
281 print "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);"
282 print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);"
283 print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);"
284 print "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);"
285 print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);"
286 print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);"
287 print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);"
288 print ""
289 print "/* entry points */"
290 print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);"
291 print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);"
292 print ""
293 print "/* miscellaneous entry points */"
294 print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);"
295 print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);"
296 print ""
297 print "/* terminfo entry points, also declared in curses.h */"
298 print "#if !defined(__NCURSES_H)"
299 print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);"
300 print "extern NCURSES_EXPORT_VAR(char) ttytype[];"
301 print "extern NCURSES_EXPORT(int) putp (const char *);"
302 print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);"
303 print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);"
304 print ""
305 print "#if 1 /* NCURSES_TPARM_VARARGS */"
306 print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */"
307 print "#else"
308 print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */"
309 print "extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */"
310 print "#endif"
311 print ""
312 print "extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */"
313 print ""
314 print "#endif /* __NCURSES_H */"
315 print ""
316 print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
317 print "#if !defined(NCURSES_TERMCAP_H_incl)"
318 print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);"
319 print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);"
320 print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);"
321 print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);"
322 print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);"
323 print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));"
324 print "#endif /* NCURSES_TERMCAP_H_incl */"
325 print ""
326 print "/*"
327 print " * Include curses.h before term.h to enable these extensions."
328 print " */"
329 print "#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)"
330 print ""
331 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *);"
332 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *);"
333 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *);"
334 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *);"
335 print ""
336 print "#if 1 /* NCURSES_TPARM_VARARGS */"
337 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */"
338 print "#else"
339 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */"
340 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */"
341 print "#endif"
342 print ""
343 print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
344 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **);"
345 print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);"
346 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);"
347 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);"
348 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);"
349 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);"
350 print ""
351 print "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);"
352 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);"
353 print ""
354 print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);"
355 print "#endif /* NCURSES_SP_FUNCS */"
356 print ""
357 print "#ifdef __cplusplus"
358 print "}"
359 print "#endif"
360 print ""
361 print "#endif /* NCURSES_TERM_H_incl */"