MKterm.h.awk.in revision 76726
150276Speter 250276SpeterBEGIN { 350276Speter print "/****************************************************************************" 462449Speter print " * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *" 550276Speter print " * *" 650276Speter print " * Permission is hereby granted, free of charge, to any person obtaining a *" 750276Speter print " * copy of this software and associated documentation files (the *" 856639Speter print " * \"Software\"), to deal in the Software without restriction, including *" 950276Speter print " * without limitation the rights to use, copy, modify, merge, publish, *" 1050276Speter print " * distribute, distribute with modifications, sublicense, and/or sell *" 1150276Speter print " * copies of the Software, and to permit persons to whom the Software is *" 1250276Speter print " * furnished to do so, subject to the following conditions: *" 1350276Speter print " * *" 1450276Speter print " * The above copyright notice and this permission notice shall be included *" 1550276Speter print " * in all copies or substantial portions of the Software. *" 1650276Speter print " * *" 1756639Speter print " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS *" 1850276Speter print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *" 1950276Speter print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *" 2050276Speter print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *" 2150276Speter print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *" 2250276Speter print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *" 2350276Speter print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *" 2450276Speter print " * *" 2550276Speter print " * Except as contained in this notice, the name(s) of the above copyright *" 2650276Speter print " * holders shall not be used in advertising or otherwise to promote the *" 2750276Speter print " * sale, use or other dealings in this Software without prior written *" 2850276Speter print " * authorization. *" 2950276Speter print " ****************************************************************************/" 3050276Speter print "" 3150276Speter print "/****************************************************************************/" 3250276Speter print "/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */" 3350276Speter print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */" 3450276Speter print "/****************************************************************************/" 3550276Speter print "" 3676726Speter print "/* $Id: MKterm.h.awk.in,v 1.39 2001/03/24 21:53:32 tom Exp $ */" 3750276Speter print "" 3850276Speter print "/*" 3950276Speter print "** term.h -- Definition of struct term" 4050276Speter print "*/" 4150276Speter print "" 4276726Speter print "#ifndef NCURSES_TERM_H_incl" 4376726Speter print "#define NCURSES_TERM_H_incl 1" 4450276Speter print "" 4550276Speter print "#undef NCURSES_VERSION" 4650276Speter print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\"" 4750276Speter print "" 4876726Speter print "#include <ncurses_dll.h>" 4976726Speter print "" 5050276Speter print "#ifdef __cplusplus" 5150276Speter print "extern \"C\" {" 5250276Speter print "#endif" 5350276Speter print "" 5450276Speter print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H" 5550276Speter print " * and BROKEN_LINKER definition (based on the system for which this was" 5650276Speter print " * configured)." 5750276Speter print " */" 5850276Speter print "" 5950276Speter print "#undef HAVE_TERMIOS_H" 6050276Speter print "#define HAVE_TERMIOS_H 1/*default*/" 6150276Speter print "" 6250276Speter print "#undef HAVE_TERMIO_H" 6350276Speter print "#define HAVE_TERMIO_H 0/*default*/" 6450276Speter print "" 6550276Speter print "#undef HAVE_TCGETATTR" 6650276Speter print "#define HAVE_TCGETATTR 1/*default*/" 6750276Speter print "" 6850276Speter print "#undef BROKEN_LINKER" 6950276Speter print "#define BROKEN_LINKER 0/*default*/" 7050276Speter print "" 7150276Speter print "#undef NCURSES_CONST" 7250276Speter print "#define NCURSES_CONST @NCURSES_CONST@" 7350276Speter print "" 7450276Speter print "#undef NCURSES_XNAMES" 7550276Speter print "#define NCURSES_XNAMES @NCURSES_XNAMES@" 7650276Speter print "" 7750276Speter print "/* We will use these symbols to hide differences between" 7850276Speter print " * termios/termio/sgttyb interfaces." 7950276Speter print " */" 8050276Speter print "#undef TTY" 8150276Speter print "#undef SET_TTY" 8250276Speter print "#undef GET_TTY" 8350276Speter print "" 8450276Speter print "/* Assume Posix termio if we have the header and function */" 8550276Speter print "#if HAVE_TERMIOS_H && HAVE_TCGETATTR" 8650276Speter print "" 8750276Speter print "#undef TERMIOS" 8850276Speter print "#define TERMIOS 1" 8950276Speter print "" 9050276Speter print "#include <termios.h>" 9150276Speter print "#define TTY struct termios" 9250276Speter print "" 9350276Speter print "#else /* !HAVE_TERMIOS_H */" 9450276Speter print "" 9550276Speter print "#if HAVE_TERMIO_H" 9650276Speter print "" 9750276Speter print "#undef TERMIOS" 9850276Speter print "#define TERMIOS 1" 9950276Speter print "" 10050276Speter print "#include <termio.h>" 10150276Speter print "#define TTY struct termio" 10250276Speter print "" 10350276Speter print "/* Add definitions to make termio look like termios." 10450276Speter print " * But ifdef it, since there are some implementations" 10550276Speter print " * that try to do this for us in a fake <termio.h>." 10650276Speter print " */" 10750276Speter print "#ifndef TCSANOW" 10850276Speter print "#define TCSANOW TCSETA" 10950276Speter print "#endif" 11050276Speter print "#ifndef TCSADRAIN" 11150276Speter print "#define TCSADRAIN TCSETAW" 11250276Speter print "#endif" 11350276Speter print "#ifndef TCSAFLUSH" 11450276Speter print "#define TCSAFLUSH TCSETAF" 11550276Speter print "#endif" 11650276Speter print "#ifndef tcsetattr" 11750276Speter print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)" 11850276Speter print "#endif" 11950276Speter print "#ifndef tcgetattr" 12050276Speter print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)" 12150276Speter print "#endif" 12250276Speter print "#ifndef cfgetospeed" 12350276Speter print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)" 12450276Speter print "#endif" 12550276Speter print "#ifndef TCIFLUSH " 12650276Speter print "#define TCIFLUSH 0" 12750276Speter print "#endif" 12850276Speter print "#ifndef TCOFLUSH " 12950276Speter print "#define TCOFLUSH 1" 13050276Speter print "#endif" 13150276Speter print "#ifndef TCIOFLUSH " 13250276Speter print "#define TCIOFLUSH 2" 13350276Speter print "#endif" 13450276Speter print "#ifndef tcflush" 13550276Speter print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)" 13650276Speter print "#endif" 13750276Speter print "" 13850276Speter print "#else /* !HAVE_TERMIO_H */" 13950276Speter print "" 14050276Speter print "#undef TERMIOS" 14150276Speter print "#include <sgtty.h>" 14250276Speter print "#include <sys/ioctl.h>" 14350276Speter print "#define TTY struct sgttyb" 14450276Speter print "" 14550276Speter print "#endif /* HAVE_TERMIO_H */" 14650276Speter print "" 14750276Speter print "#endif /* HAVE_TERMIOS_H */" 14850276Speter print "" 14950276Speter print "#ifdef TERMIOS" 15050276Speter print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)" 15150276Speter print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)" 15250276Speter print "#else" 15350276Speter print "#define GET_TTY(fd, buf) gtty(fd, buf)" 15450276Speter print "#define SET_TTY(fd, buf) stty(fd, buf)" 15550276Speter print "#endif" 15650276Speter print "" 15750276Speter print "#define NAMESIZE 256" 15850276Speter print "" 15950276Speter print "#define CUR cur_term->type." 16050276Speter print "" 16150276Speter } 16250276Speter 16350276Speter$2 == "%%-STOP-HERE-%%" { 16450276Speter print "" 16550276Speter printf "#define BOOLWRITE %d\n", BoolCount 16650276Speter printf "#define NUMWRITE %d\n", NumberCount 16750276Speter printf "#define STRWRITE %d\n", StringCount 16850276Speter print "" 16950276Speter print "/* older synonyms for some capabilities */" 17050276Speter print "#define beehive_glitch no_esc_ctlc" 17150276Speter print "#define teleray_glitch dest_tabs_magic_smso" 17250276Speter print "#define micro_char_size micro_col_size" 17350276Speter print "" 17450276Speter print "#ifdef __INTERNAL_CAPS_VISIBLE" 17550276Speter } 17650276Speter 17750276Speter/^#/ {next;} 17850276Speter 17962449Speter$1 == "acs_chars" {acsindex = StringCount} 18062449Speter 18150276Speter$3 == "bool" { 18250276Speter printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++ 18350276Speter } 18450276Speter 18550276Speter$3 == "num" { 18650276Speter printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++ 18750276Speter } 18850276Speter 18950276Speter$3 == "str" { 19050276Speter printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++ 19150276Speter } 19250276Speter 19350276SpeterEND { 19450276Speter print "#endif /* __INTERNAL_CAPS_VISIBLE */" 19550276Speter print "" 19650276Speter print "" 19750276Speter print "/*" 19850276Speter print " * Predefined terminfo array sizes" 19950276Speter print " */" 20050276Speter printf "#define BOOLCOUNT %d\n", BoolCount 20150276Speter printf "#define NUMCOUNT %d\n", NumberCount 20250276Speter printf "#define STRCOUNT %d\n", StringCount 20350276Speter print "" 20462449Speter print "/* used by code for comparing entries */" 20562449Speter print "#define acs_chars_index ", acsindex 20662449Speter print "" 20750276Speter print "typedef struct termtype { /* in-core form of terminfo data */" 20850276Speter print " char *term_names; /* str_table offset of term names */" 20950276Speter print " char *str_table; /* pointer to string table */" 21050276Speter print " char *Booleans; /* array of boolean values */" 21150276Speter print " short *Numbers; /* array of integer values */" 21250276Speter print " char **Strings; /* array of string offsets */" 21350276Speter print "" 21450276Speter print "#if NCURSES_XNAMES" 21550276Speter print " char *ext_str_table; /* pointer to extended string table */" 21650276Speter print " char **ext_Names; /* corresponding names */" 21750276Speter print "" 21850276Speter print " unsigned short num_Booleans;/* count total Booleans */" 21950276Speter print " unsigned short num_Numbers; /* count total Numbers */" 22050276Speter print " unsigned short num_Strings; /* count total Strings */" 22150276Speter print "" 22250276Speter print " unsigned short ext_Booleans;/* count extensions to Booleans */" 22350276Speter print " unsigned short ext_Numbers; /* count extensions to Numbers */" 22450276Speter print " unsigned short ext_Strings; /* count extensions to Strings */" 22550276Speter print "#endif /* NCURSES_XNAMES */" 22650276Speter print "" 22750276Speter print "} TERMTYPE;" 22850276Speter print "" 22950276Speter print "typedef struct term { /* describe an actual terminal */" 23050276Speter print " TERMTYPE type; /* terminal type description */" 23150276Speter print " short Filedes; /* file description being written to */" 23250276Speter print " TTY Ottyb, /* original state of the terminal */" 23350276Speter print " Nttyb; /* current state of the terminal */" 23450276Speter print " int _baudrate; /* used to compute padding */" 23550276Speter print "} TERMINAL;" 23650276Speter print "" 23776726Speter print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" 23850276Speter print "" 23950276Speter print "#if BROKEN_LINKER" 24050276Speter print "#define boolnames _nc_boolnames()" 24150276Speter print "#define boolcodes _nc_boolcodes()" 24250276Speter print "#define boolfnames _nc_boolfnames()" 24350276Speter print "#define numnames _nc_numnames()" 24450276Speter print "#define numcodes _nc_numcodes()" 24550276Speter print "#define numfnames _nc_numfnames()" 24650276Speter print "#define strnames _nc_strnames()" 24750276Speter print "#define strcodes _nc_strcodes()" 24850276Speter print "#define strfnames _nc_strfnames()" 24950276Speter print "" 25076726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolnames (void);" 25176726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolcodes (void);" 25276726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolfnames (void);" 25376726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numnames (void);" 25476726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numcodes (void);" 25576726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numfnames (void);" 25676726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strnames (void);" 25776726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strcodes (void);" 25876726Speter print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strfnames (void);" 25950276Speter print "" 26050276Speter print "#else" 26150276Speter print "" 26276726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];" 26376726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];" 26476726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];" 26576726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];" 26676726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];" 26776726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];" 26876726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];" 26976726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];" 27076726Speter print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];" 27150276Speter print "" 27250276Speter print "#endif" 27350276Speter print "" 27450276Speter print "/* internals */" 27576726Speter print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);" 27676726Speter print "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);" 27776726Speter print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);" 27876726Speter print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);" 27976726Speter print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);" 28076726Speter print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);" 28176726Speter print "extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);" 28276726Speter print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);" 28350276Speter print "" 28450276Speter print "/* entry points */" 28576726Speter print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);" 28676726Speter print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);" 28750276Speter print "" 28850276Speter print "/* miscellaneous entry points */" 28976726Speter print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);" 29076726Speter print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);" 29150276Speter print "" 29250276Speter print "/* terminfo entry points, also declared in curses.h */" 29350276Speter print "#if !defined(__NCURSES_H)" 29476726Speter print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);" 29576726Speter print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);" 29676726Speter print "extern NCURSES_EXPORT_VAR(char) ttytype[];" 29776726Speter print "extern NCURSES_EXPORT(int) putp (const char *);" 29876726Speter print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);" 29976726Speter print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);" 30050276Speter print "#endif /* __NCURSES_H */" 30150276Speter print "" 30250276Speter print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */" 30376726Speter print "#if !defined(NCURSES_TERMCAP_H_incl)" 30476726Speter print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);" 30576726Speter print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);" 30676726Speter print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);" 30776726Speter print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);" 30876726Speter print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);" 30976726Speter print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));" 31076726Speter print "#endif /* NCURSES_TERMCAP_H_incl */" 31150276Speter print "" 31250276Speter print "#ifdef __cplusplus" 31350276Speter print "}" 31450276Speter print "#endif" 31550276Speter print "" 31676726Speter print "#endif /* NCURSES_TERM_H_incl */" 31750276Speter } 318