1 # $DragonFly: src/lib/libncurses/include/MKterm.h.awk,v 1.3 2005/07/29 16:20:11 joerg Exp $
3 print "/****************************************************************************"
4 print " * Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. *"
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: *"
14 print " * The above copyright notice and this permission notice shall be included *"
15 print " * in all copies or substantial portions of the Software. *"
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. *"
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 " ****************************************************************************/"
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-2003 */"
35 print "/****************************************************************************/"
37 print "/* $Id: MKterm.h.awk.in,v 1.42 2003/12/27 19:09:16 tom Exp $ */"
40 print "** term.h -- Definition of struct term"
43 print "#ifndef NCURSES_TERM_H_incl"
44 print "#define NCURSES_TERM_H_incl 1"
46 print "#undef NCURSES_VERSION"
47 print "#define NCURSES_VERSION \"5.4\""
50 print "#include <ncurses_dll.h>"
52 print "/* From ncurses_dll.h */"
53 print "/* This is copied so we don't need to install "
54 print " ncurses_dll.h as well */"
55 print "/* Take care of non-cygwin platforms */"
56 print "#if !defined(NCURSES_IMPEXP)"
57 print "# define NCURSES_IMPEXP /* nothing */"
59 print "#if !defined(NCURSES_API)"
60 print "# define NCURSES_API /* nothing */"
62 print "#if !defined(NCURSES_EXPORT)"
63 print "# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API"
65 print "#if !defined(NCURSES_EXPORT_VAR)"
66 print "# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type"
71 print "#ifdef __cplusplus"
72 print "extern \"C\" {"
75 print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H"
76 print " * definition (based on the system for which this was configured)."
79 print "#undef HAVE_TERMIOS_H"
80 print "#define HAVE_TERMIOS_H 1/*default*/"
82 print "#undef HAVE_TCGETATTR"
83 print "#define HAVE_TCGETATTR 1/*default*/"
85 print "#undef NCURSES_CONST"
86 print "#define NCURSES_CONST const"
88 print "#undef NCURSES_XNAMES"
89 print "#define NCURSES_XNAMES 1"
91 print "/* We will use these symbols to hide differences between"
92 print " * termios/termio/sgttyb interfaces."
95 print "#undef SET_TTY"
96 print "#undef GET_TTY"
98 print "/* Assume POSIX termio if we have the header and function */"
99 print "#if HAVE_TERMIOS_H && HAVE_TCGETATTR"
101 print "#undef TERMIOS"
102 print "#define TERMIOS 1"
104 print "#include <termios.h>"
105 print "#define TTY struct termios"
107 print "#else /* !HAVE_TERMIOS_H */"
109 print "#if HAVE_TERMIO_H"
111 print "#undef TERMIOS"
112 print "#define TERMIOS 1"
114 print "#include <termio.h>"
115 print "#define TTY struct termio"
117 print "/* Add definitions to make termio look like termios."
118 print " * But ifdef it, since there are some implementations"
119 print " * that try to do this for us in a fake <termio.h>."
121 print "#ifndef TCSANOW"
122 print "#define TCSANOW TCSETA"
124 print "#ifndef TCSADRAIN"
125 print "#define TCSADRAIN TCSETAW"
127 print "#ifndef TCSAFLUSH"
128 print "#define TCSAFLUSH TCSETAF"
130 print "#ifndef tcsetattr"
131 print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)"
133 print "#ifndef tcgetattr"
134 print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)"
136 print "#ifndef cfgetospeed"
137 print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)"
139 print "#ifndef TCIFLUSH "
140 print "#define TCIFLUSH 0"
142 print "#ifndef TCOFLUSH "
143 print "#define TCOFLUSH 1"
145 print "#ifndef TCIOFLUSH "
146 print "#define TCIOFLUSH 2"
148 print "#ifndef tcflush"
149 print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)"
152 print "#else /* !HAVE_TERMIO_H */"
154 print "#undef TERMIOS"
155 print "#include <sgtty.h>"
156 print "#include <sys/ioctl.h>"
157 print "#define TTY struct sgttyb"
159 print "#endif /* HAVE_TERMIO_H */"
161 print "#endif /* HAVE_TERMIOS_H */"
163 print "#ifdef TERMIOS"
164 print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)"
165 print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)"
167 print "#define GET_TTY(fd, buf) gtty(fd, buf)"
168 print "#define SET_TTY(fd, buf) stty(fd, buf)"
171 print "#define NAMESIZE 256"
173 print "#define CUR cur_term->type."
177 $
2 ==
"%%-STOP-HERE-%%" {
179 printf "#define BOOLWRITE %d\n", BoolCount
180 printf "#define NUMWRITE %d\n", NumberCount
181 printf "#define STRWRITE %d\n", StringCount
183 print "/* older synonyms for some capabilities */"
184 print "#define beehive_glitch no_esc_ctlc"
185 print "#define teleray_glitch dest_tabs_magic_smso"
186 print "#define micro_char_size micro_col_size"
188 print "#ifdef __INTERNAL_CAPS_VISIBLE"
193 $
1 ==
"acs_chars" {acsindex = StringCount
}
196 printf "#define %-30s CUR Booleans[%d]\n", $
1, BoolCount
++
200 printf "#define %-30s CUR Numbers[%d]\n", $
1, NumberCount
++
204 printf "#define %-30s CUR Strings[%d]\n", $
1, StringCount
++
208 print "#endif /* __INTERNAL_CAPS_VISIBLE */"
212 print " * Predefined terminfo array sizes"
214 printf "#define BOOLCOUNT %d\n", BoolCount
215 printf "#define NUMCOUNT %d\n", NumberCount
216 printf "#define STRCOUNT %d\n", StringCount
218 print "/* used by code for comparing entries */"
219 print "#define acs_chars_index ", acsindex
221 print "typedef struct termtype { /* in-core form of terminfo data */"
222 print " char *term_names; /* str_table offset of term names */"
223 print " char *str_table; /* pointer to string table */"
224 print " char *Booleans; /* array of boolean values */"
225 print " short *Numbers; /* array of integer values */"
226 print " char **Strings; /* array of string offsets */"
228 print "#if NCURSES_XNAMES"
229 print " char *ext_str_table; /* pointer to extended string table */"
230 print " char **ext_Names; /* corresponding names */"
232 print " unsigned short num_Booleans;/* count total Booleans */"
233 print " unsigned short num_Numbers; /* count total Numbers */"
234 print " unsigned short num_Strings; /* count total Strings */"
236 print " unsigned short ext_Booleans;/* count extensions to Booleans */"
237 print " unsigned short ext_Numbers; /* count extensions to Numbers */"
238 print " unsigned short ext_Strings; /* count extensions to Strings */"
239 print "#endif /* NCURSES_XNAMES */"
243 print "typedef struct term { /* describe an actual terminal */"
244 print " TERMTYPE type; /* terminal type description */"
245 print " short Filedes; /* file description being written to */"
246 print " TTY Ottyb, /* original state of the terminal */"
247 print " Nttyb; /* current state of the terminal */"
248 print " int _baudrate; /* used to compute padding */"
249 print " char * _termname; /* used for termname() */"
252 print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
254 print "#if BROKEN_LINKER"
255 print "#define boolnames _nc_boolnames()"
256 print "#define boolcodes _nc_boolcodes()"
257 print "#define boolfnames _nc_boolfnames()"
258 print "#define numnames _nc_numnames()"
259 print "#define numcodes _nc_numcodes()"
260 print "#define numfnames _nc_numfnames()"
261 print "#define strnames _nc_strnames()"
262 print "#define strcodes _nc_strcodes()"
263 print "#define strfnames _nc_strfnames()"
265 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolnames (void);"
266 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolcodes (void);"
267 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolfnames (void);"
268 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numnames (void);"
269 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numcodes (void);"
270 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numfnames (void);"
271 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strnames (void);"
272 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strcodes (void);"
273 print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strfnames (void);"
277 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];"
278 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];"
279 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];"
280 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];"
281 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];"
282 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];"
283 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];"
284 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];"
285 print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];"
289 print "/* internals */"
290 print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);"
291 print "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);"
292 print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);"
293 print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);"
294 print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);"
295 print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);"
296 print "extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);"
297 print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);"
299 print "/* entry points */"
300 print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);"
301 print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);"
303 print "/* miscellaneous entry points */"
304 print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);"
305 print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);"
307 print "/* terminfo entry points, also declared in curses.h */"
308 print "#if !defined(__NCURSES_H)"
309 print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);"
310 print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);"
311 print "extern NCURSES_EXPORT_VAR(char) ttytype[];"
312 print "extern NCURSES_EXPORT(int) putp (const char *);"
313 print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);"
314 print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);"
315 print "#endif /* __NCURSES_H */"
317 print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */"
318 print "#if !defined(NCURSES_TERMCAP_H_incl)"
319 print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);"
320 print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);"
321 print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);"
322 print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);"
323 print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);"
324 print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));"
325 print "#endif /* NCURSES_TERMCAP_H_incl */"
327 print "#ifdef __cplusplus"
331 print "#endif /* NCURSES_TERM_H_incl */"