MKterm.h.awk.in revision 174994
1160703Sthompsa# vile:awkmode 2160703SthompsaBEGIN { 3160703Sthompsa print "/****************************************************************************" 4160703Sthompsa print " * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *" 5160703Sthompsa print " * *" 6160703Sthompsa print " * Permission is hereby granted, free of charge, to any person obtaining a *" 7160703Sthompsa print " * copy of this software and associated documentation files (the *" 8160703Sthompsa print " * \"Software\"), to deal in the Software without restriction, including *" 9160703Sthompsa print " * without limitation the rights to use, copy, modify, merge, publish, *" 10160703Sthompsa print " * distribute, distribute with modifications, sublicense, and/or sell *" 11160703Sthompsa print " * copies of the Software, and to permit persons to whom the Software is *" 12160703Sthompsa print " * furnished to do so, subject to the following conditions: *" 13160703Sthompsa print " * *" 14160703Sthompsa print " * The above copyright notice and this permission notice shall be included *" 15160703Sthompsa print " * in all copies or substantial portions of the Software. *" 16160703Sthompsa print " * *" 17160703Sthompsa print " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS *" 18160703Sthompsa print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *" 19160703Sthompsa print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *" 20160703Sthompsa print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *" 21160703Sthompsa print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *" 22160703Sthompsa print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *" 23160703Sthompsa print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *" 24160703Sthompsa print " * *" 25160703Sthompsa print " * Except as contained in this notice, the name(s) of the above copyright *" 26160703Sthompsa print " * holders shall not be used in advertising or otherwise to promote the *" 27160703Sthompsa print " * sale, use or other dealings in this Software without prior written *" 28160703Sthompsa print " * authorization. *" 29160703Sthompsa print " ****************************************************************************/" 30160703Sthompsa print "" 31160703Sthompsa print "/****************************************************************************/" 32160703Sthompsa print "/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */" 33160703Sthompsa print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */" 34160703Sthompsa print "/* and: Thomas E. Dickey 1995-on */" 35160703Sthompsa print "/****************************************************************************/" 36160703Sthompsa print "" 37160703Sthompsa print "/* $Id: MKterm.h.awk.in,v 1.49 2007/08/18 11:44:26 tom Exp $ */" 38160703Sthompsa print "" 39160703Sthompsa print "/*" 40160703Sthompsa print "** term.h -- Definition of struct term" 41160703Sthompsa print "*/" 42160703Sthompsa print "" 43160703Sthompsa print "#ifndef NCURSES_TERM_H_incl" 44160703Sthompsa print "#define NCURSES_TERM_H_incl 1" 45160703Sthompsa print "" 46160703Sthompsa print "#undef NCURSES_VERSION" 47160703Sthompsa print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\"" 48160703Sthompsa print "" 49160703Sthompsa print "#include <ncurses_dll.h>" 50160703Sthompsa print "" 51160703Sthompsa print "#ifdef __cplusplus" 52160703Sthompsa print "extern \"C\" {" 53160703Sthompsa print "#endif" 54160703Sthompsa print "" 55160703Sthompsa print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H" 56160703Sthompsa print " * definition (based on the system for which this was configured)." 57160703Sthompsa print " */" 58160703Sthompsa print "" 59160703Sthompsa print "#undef NCURSES_CONST" 60160703Sthompsa print "#define NCURSES_CONST @NCURSES_CONST@" 61160703Sthompsa print "" 62160703Sthompsa print "#undef NCURSES_SBOOL" 63160703Sthompsa print "#define NCURSES_SBOOL @NCURSES_SBOOL@" 64160703Sthompsa print "" 65160703Sthompsa print "#undef NCURSES_XNAMES" 66160703Sthompsa print "#define NCURSES_XNAMES @NCURSES_XNAMES@" 67160703Sthompsa print "" 68160703Sthompsa print "/* We will use these symbols to hide differences between" 69160703Sthompsa print " * termios/termio/sgttyb interfaces." 70160703Sthompsa print " */" 71160703Sthompsa print "#undef TTY" 72160703Sthompsa print "#undef SET_TTY" 73160703Sthompsa print "#undef GET_TTY" 74160703Sthompsa print "" 75160703Sthompsa print "/* Assume POSIX termio if we have the header and function */" 76160703Sthompsa print "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */" 77160703Sthompsa print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@" 78160703Sthompsa print "" 79160703Sthompsa print "#undef TERMIOS" 80160703Sthompsa print "#define TERMIOS 1" 81160703Sthompsa print "" 82160703Sthompsa print "#include <termios.h>" 83160703Sthompsa print "#define TTY struct termios" 84160703Sthompsa print "" 85160703Sthompsa print "#else /* !HAVE_TERMIOS_H */" 86163863Sthompsa print "" 87160703Sthompsa print "/* #if HAVE_TERMIO_H */" 88163863Sthompsa print "#if @HAVE_TERMIO_H@" 89163863Sthompsa print "" 90163863Sthompsa print "#undef TERMIOS" 91163863Sthompsa print "#define TERMIOS 1" 92163863Sthompsa print "" 93163863Sthompsa print "#include <termio.h>" 94163863Sthompsa print "#define TTY struct termio" 95163863Sthompsa print "" 96163863Sthompsa print "/* Add definitions to make termio look like termios." 97163863Sthompsa print " * But ifdef it, since there are some implementations" 98163863Sthompsa print " * that try to do this for us in a fake <termio.h>." 99163863Sthompsa print " */" 100163863Sthompsa print "#ifndef TCSANOW" 101163863Sthompsa print "#define TCSANOW TCSETA" 102163863Sthompsa print "#endif" 103160703Sthompsa print "#ifndef TCSADRAIN" 104160703Sthompsa print "#define TCSADRAIN TCSETAW" 105163863Sthompsa print "#endif" 106163863Sthompsa print "#ifndef TCSAFLUSH" 107163863Sthompsa print "#define TCSAFLUSH TCSETAF" 108163863Sthompsa print "#endif" 109163863Sthompsa print "#ifndef tcsetattr" 110163863Sthompsa print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)" 111165105Sthompsa print "#endif" 112164880Ssyrinx print "#ifndef tcgetattr" 113171724Sthompsa print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)" 114163863Sthompsa print "#endif" 115163863Sthompsa print "#ifndef cfgetospeed" 116163863Sthompsa print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)" 117163863Sthompsa print "#endif" 118163863Sthompsa print "#ifndef TCIFLUSH " 119163863Sthompsa print "#define TCIFLUSH 0" 120163863Sthompsa print "#endif" 121163863Sthompsa print "#ifndef TCOFLUSH " 122163863Sthompsa print "#define TCOFLUSH 1" 123163863Sthompsa print "#endif" 124163863Sthompsa print "#ifndef TCIOFLUSH " 125163863Sthompsa print "#define TCIOFLUSH 2" 126163863Sthompsa print "#endif" 127163863Sthompsa print "#ifndef tcflush" 128163863Sthompsa print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)" 129163863Sthompsa print "#endif" 130163863Sthompsa print "" 131163863Sthompsa print "#else /* !HAVE_TERMIO_H */" 132163863Sthompsa print "" 133163863Sthompsa print "#undef TERMIOS" 134163863Sthompsa print "#include <sgtty.h>" 135163863Sthompsa print "#include <sys/ioctl.h>" 136163863Sthompsa print "#define TTY struct sgttyb" 137163863Sthompsa print "" 138163863Sthompsa print "#endif /* HAVE_TERMIO_H */" 139160703Sthompsa print "" 140160703Sthompsa print "#endif /* HAVE_TERMIOS_H */" 141160703Sthompsa print "" 142160703Sthompsa print "#ifdef TERMIOS" 143160703Sthompsa print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)" 144160703Sthompsa print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)" 145160703Sthompsa print "#else" 146163863Sthompsa print "#define GET_TTY(fd, buf) gtty(fd, buf)" 147163863Sthompsa print "#define SET_TTY(fd, buf) stty(fd, buf)" 148160703Sthompsa print "#endif" 149160703Sthompsa print "" 150160703Sthompsa print "#define NAMESIZE 256" 151163863Sthompsa print "" 152163863Sthompsa print "#define CUR cur_term->type." 153163863Sthompsa print "" 154163863Sthompsa } 155163863Sthompsa 156163863Sthompsa$2 == "%%-STOP-HERE-%%" { 157163863Sthompsa print "" 158163863Sthompsa printf "#define BOOLWRITE %d\n", BoolCount 159163863Sthompsa printf "#define NUMWRITE %d\n", NumberCount 160163863Sthompsa printf "#define STRWRITE %d\n", StringCount 161163863Sthompsa print "" 162160703Sthompsa print "/* older synonyms for some capabilities */" 163160703Sthompsa print "#define beehive_glitch no_esc_ctlc" 164160703Sthompsa print "#define teleray_glitch dest_tabs_magic_smso" 165163863Sthompsa print "#define micro_char_size micro_col_size" 166160703Sthompsa print "" 167160703Sthompsa print "#ifdef __INTERNAL_CAPS_VISIBLE" 168163863Sthompsa } 169163863Sthompsa 170163863Sthompsa/^#/ {next;} 171163863Sthompsa 172163863Sthompsa$1 == "acs_chars" {acsindex = StringCount} 173160703Sthompsa 174174493Sthompsa$3 == "bool" { 175163863Sthompsa printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++ 176163863Sthompsa } 177163863Sthompsa 178163863Sthompsa$3 == "num" { 179163863Sthompsa printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++ 180160703Sthompsa } 181160703Sthompsa 182163863Sthompsa$3 == "str" { 183160703Sthompsa printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++ 184160703Sthompsa } 185163863Sthompsa 186163863SthompsaEND { 187160899Sthompsa print "#endif /* __INTERNAL_CAPS_VISIBLE */" 188163863Sthompsa print "" 189167379Sthompsa print "" 190167379Sthompsa print "/*" 191167379Sthompsa print " * Predefined terminfo array sizes" 192167379Sthompsa print " */" 193160899Sthompsa printf "#define BOOLCOUNT %d\n", BoolCount 194160899Sthompsa printf "#define NUMCOUNT %d\n", NumberCount 195160703Sthompsa printf "#define STRCOUNT %d\n", StringCount 196160703Sthompsa print "" 197160703Sthompsa print "/* used by code for comparing entries */" 198160703Sthompsa print "#define acs_chars_index ", acsindex 199160703Sthompsa print "" 200160703Sthompsa print "typedef struct termtype { /* in-core form of terminfo data */" 201160703Sthompsa print " char *term_names; /* str_table offset of term names */" 202160703Sthompsa print " char *str_table; /* pointer to string table */" 203160703Sthompsa print " NCURSES_SBOOL *Booleans; /* array of boolean values */" 204160703Sthompsa print " short *Numbers; /* array of integer values */" 205160703Sthompsa print " char **Strings; /* array of string offsets */" 206160703Sthompsa print "" 207160703Sthompsa print "#if NCURSES_XNAMES" 208160703Sthompsa print " char *ext_str_table; /* pointer to extended string table */" 209160703Sthompsa print " char **ext_Names; /* corresponding names */" 210160703Sthompsa print "" 211160703Sthompsa print " unsigned short num_Booleans;/* count total Booleans */" 212163863Sthompsa print " unsigned short num_Numbers; /* count total Numbers */" 213160703Sthompsa print " unsigned short num_Strings; /* count total Strings */" 214160703Sthompsa print "" 215160703Sthompsa print " unsigned short ext_Booleans;/* count extensions to Booleans */" 216160703Sthompsa print " unsigned short ext_Numbers; /* count extensions to Numbers */" 217160703Sthompsa print " unsigned short ext_Strings; /* count extensions to Strings */" 218160703Sthompsa print "#endif /* NCURSES_XNAMES */" 219160703Sthompsa print "" 220160703Sthompsa print "} TERMTYPE;" 221160703Sthompsa print "" 222160703Sthompsa print "typedef struct term { /* describe an actual terminal */" 223160703Sthompsa print " TERMTYPE type; /* terminal type description */" 224160703Sthompsa print " short Filedes; /* file description being written to */" 225163863Sthompsa print " TTY Ottyb, /* original state of the terminal */" 226164807Simp print " Nttyb; /* current state of the terminal */" 227163863Sthompsa print " int _baudrate; /* used to compute padding */" 228163863Sthompsa print " char * _termname; /* used for termname() */" 229160703Sthompsa print "} TERMINAL;" 230160703Sthompsa print "" 231160703Sthompsa print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" 232160703Sthompsa print "" 233160703Sthompsa print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@" 234160703Sthompsa print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);" 235160703Sthompsa print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);" 236160703Sthompsa print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);" 237160703Sthompsa print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);" 238164806Simp print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);" 239160703Sthompsa print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);" 240160703Sthompsa print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);" 241160703Sthompsa print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);" 242160703Sthompsa print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);" 243160703Sthompsa print "" 244163863Sthompsa print "#define boolnames NCURSES_PUBLIC_VAR(boolnames())" 245163863Sthompsa print "#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())" 246163863Sthompsa print "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())" 247160703Sthompsa print "#define numnames NCURSES_PUBLIC_VAR(numnames())" 248160703Sthompsa print "#define numcodes NCURSES_PUBLIC_VAR(numcodes())" 249163863Sthompsa print "#define numfnames NCURSES_PUBLIC_VAR(numfnames())" 250163863Sthompsa print "#define strnames NCURSES_PUBLIC_VAR(strnames())" 251163863Sthompsa print "#define strcodes NCURSES_PUBLIC_VAR(strcodes())" 252163863Sthompsa print "#define strfnames NCURSES_PUBLIC_VAR(strfnames())" 253163863Sthompsa print "" 254163863Sthompsa print "#else" 255163863Sthompsa print "" 256163863Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];" 257160703Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];" 258163863Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];" 259160703Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];" 260160703Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];" 261163863Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];" 262160703Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];" 263160703Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];" 264163863Sthompsa print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];" 265160703Sthompsa print "" 266163863Sthompsa print "#endif" 267163863Sthompsa print "" 268163863Sthompsa print "/* internals */" 269163863Sthompsa print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);" 270163863Sthompsa print "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);" 271160703Sthompsa print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);" 272160703Sthompsa print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);" 273160703Sthompsa print "extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);" 274160703Sthompsa print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);" 275160703Sthompsa print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);" 276160703Sthompsa print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);" 277160703Sthompsa print "" 278160703Sthompsa print "/* entry points */" 279160703Sthompsa print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);" 280160703Sthompsa print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);" 281163863Sthompsa print "" 282163863Sthompsa print "/* miscellaneous entry points */" 283163863Sthompsa print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);" 284160703Sthompsa print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);" 285163863Sthompsa print "" 286163863Sthompsa print "/* terminfo entry points, also declared in curses.h */" 287163863Sthompsa print "#if !defined(__NCURSES_H)" 288163863Sthompsa print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);" 289163863Sthompsa print "extern NCURSES_EXPORT_VAR(char) ttytype[];" 290163863Sthompsa print "extern NCURSES_EXPORT(int) putp (const char *);" 291163863Sthompsa print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);" 292163863Sthompsa print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);" 293163863Sthompsa print "" 294163863Sthompsa print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */" 295163863Sthompsa print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */" 296160703Sthompsa print "#else" 297163863Sthompsa print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */" 298163863Sthompsa print "extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */" 299163863Sthompsa print "#endif" 300163863Sthompsa print "" 301163863Sthompsa print "#endif /* __NCURSES_H */" 302163863Sthompsa print "" 303163863Sthompsa print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */" 304160703Sthompsa print "#if !defined(NCURSES_TERMCAP_H_incl)" 305160703Sthompsa print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);" 306163863Sthompsa print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);" 307163863Sthompsa print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);" 308163863Sthompsa print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);" 309163863Sthompsa print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);" 310163863Sthompsa print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));" 311163863Sthompsa print "#endif /* NCURSES_TERMCAP_H_incl */" 312160703Sthompsa print "" 313165105Sthompsa print "#ifdef __cplusplus" 314163863Sthompsa print "}" 315163863Sthompsa print "#endif" 316163863Sthompsa print "" 317163863Sthompsa print "#endif /* NCURSES_TERM_H_incl */" 318163863Sthompsa } 319163863Sthompsa