BEGIN { print "/***************************************************************************" print "* COPYRIGHT NOTICE *" print "****************************************************************************" print "* ncurses is copyright (C) 1992-1995 *" print "* Zeyd M. Ben-Halim *" print "* zmbenhal@netcom.com *" print "* Eric S. Raymond *" print "* esr@snark.thyrsus.com *" print "* *" print "* Permission is hereby granted to reproduce and distribute ncurses *" print "* by any means and for any fee, whether alone or as part of a *" print "* larger distribution, in source or in binary form, PROVIDED *" print "* this notice is included with any such distribution, and is not *" print "* removed from any of its header files. Mention of ncurses in any *" print "* applications linked with it is highly appreciated. *" print "* *" print "* ncurses comes AS IS with no warranty, implied or expressed. *" print "* *" print "***************************************************************************/" print "" print "/* $Id: MKterm.h.awk.in,v 1.17 1997/02/08 21:20:22 tom Exp $ */" print "" print "/*" print "** term.h -- Definition of struct term" print "*/" print "" print "#ifndef _TERM_H" print "#define _TERM_H" print "" print "#undef NCURSES_VERSION" print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\"" print "" print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H" print " * and BROKEN_LINKER definition (based on the system for which this was configured)." print " */" print "" print "#ifndef HAVE_TERMIOS_H" print "#define HAVE_TERMIOS_H 1/*default*/" print "#endif" print "" print "#ifndef HAVE_TERMIO_H" print "#define HAVE_TERMIO_H 0/*default*/" print "#endif" print "" print "#ifndef HAVE_TCGETATTR" print "#define HAVE_TCGETATTR 1/*default*/" print "#endif" print "" print "#ifndef BROKEN_LINKER" print "#define BROKEN_LINKER 0/*default*/" print "#endif" print "" print "" print "/* Assume Posix termio if we have the header and function */" print "#if HAVE_TERMIOS_H && HAVE_TCGETATTR" print "#ifndef TERMIOS" print "#define TERMIOS 1" print "#endif" print "#include " print "#define TTY struct termios" print "" print "#else /* !HAVE_TERMIOS_H */" print "" print "#if HAVE_TERMIO_H" print "#ifndef TERMIOS" print "#define TERMIOS 1" print "#endif" print "#include " print "#define TTY struct termio" print "#define TCSANOW TCSETA" print "#define TCSADRAIN TCSETAW" print "#define TCSAFLUSH TCSETAF" print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)" print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)" print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)" print "#define TCIFLUSH 0" print "#define TCOFLUSH 1" print "#define TCIOFLUSH 2" print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)" print "" print "#else /* !HAVE_TERMIO_H */" print "" print "#undef TERMIOS" print "#include " print "#include " print "#define TTY struct sgttyb" print "" print "#endif /* HAVE_TERMIO_H */" print "" print "#endif /* HAVE_TERMIOS_H */" print "" print "#ifdef TERMIOS" print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)" print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)" print "#else" print "#define GET_TTY(fd, buf) gtty(fd, buf)" print "#define SET_TTY(fd, buf) stty(fd, buf)" print "#endif" print "" print "extern char ttytype[];" print "#define NAMESIZE 256" print "" print "#define CUR cur_term->type." print "" } $2 == "%%-STOP-HERE-%%" { print "" printf "#define BOOLWRITE %d\n", BoolCount printf "#define NUMWRITE %d\n", NumberCount printf "#define STRWRITE %d\n", StringCount print "" print "/* older synonyms for some capabilities */" print "#define beehive_glitch no_esc_ctlc" print "#define teleray_glitch dest_tabs_magic_smso" print "" print "/* XSI synonyms */" print "#define micro_col_size micro_char_size" print "" print "#ifdef __INTERNAL_CAPS_VISIBLE" } /^#/ {next;} $3 == "bool" { printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++ } $3 == "num" { printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++ } $3 == "str" { printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++ } END { print "#endif /* __INTERNAL_CAPS_VISIBLE */" print "" print "" printf "#define BOOLCOUNT %d\n", BoolCount printf "#define NUMCOUNT %d\n", NumberCount printf "#define STRCOUNT %d\n", StringCount print "" print "typedef struct termtype { /* in-core form of terminfo data */" print " char *term_names; /* str_table offset of term names */" print " char *str_table; /* pointer to string table */" print " char Booleans[BOOLCOUNT]; /* array of values */" print " short Numbers[NUMCOUNT]; /* array of values */" print " char *Strings[STRCOUNT]; /* array of string offsets */" print "} TERMTYPE;" print "" print "typedef struct term { /* describe an actual terminal */" print " TERMTYPE type; /* terminal type description */" print " short Filedes; /* file description being written to */" print " TTY Ottyb, /* original state of the terminal */" print " Nttyb; /* current state of the terminal */" print "} TERMINAL;" print "" print "extern TERMINAL *cur_term;" print "" print "" print "#ifdef __cplusplus" print "extern \"C\" {" print "#endif" print "" print "#if BROKEN_LINKER" print "#define boolnames _nc_boolnames()" print "#define boolcodes _nc_boolcodes()" print "#define boolfnames _nc_boolfnames()" print "#define numnames _nc_numnames()" print "#define numcodes _nc_numcodes()" print "#define numfnames _nc_numfnames()" print "#define strnames _nc_strnames()" print "#define strcodes _nc_strcodes()" print "#define strfnames _nc_strfnames()" print "" print "extern char * const *_nc_boolnames(void);" print "extern char * const *_nc_boolcodes(void);" print "extern char * const *_nc_boolfnames(void);" print "extern char * const *_nc_numnames(void);" print "extern char * const *_nc_numcodes(void);" print "extern char * const *_nc_numfnames(void);" print "extern char * const *_nc_strnames(void);" print "extern char * const *_nc_strcodes(void);" print "extern char * const *_nc_strfnames(void);" print "" print "#else" print "" print "extern char *const boolnames[];" print "extern char *const boolcodes[];" print "extern char *const boolfnames[];" print "extern char *const numnames[];" print "extern char *const numcodes[];" print "extern char *const numfnames[];" print "extern char *const strnames[];" print "extern char *const strcodes[];" print "extern char *const strfnames[];" print "" print "#endif" print "" print "/* internals */" print "extern int _nc_read_entry(const char * const, char * const, TERMTYPE *const);" print "extern int _nc_read_file_entry(const char *const, TERMTYPE *);" print "extern char *_nc_first_name(const char *const);" print "extern int _nc_name_match(const char *const, const char *const, const char *const);" print "extern int _nc_read_termcap_entry(const char *const, TERMTYPE *const);" print "extern const TERMTYPE *_nc_fallback(const char *);" print "" print "/* entry points */" print "extern TERMINAL *set_curterm(TERMINAL *);" print "extern int del_curterm(TERMINAL *);" print "" print "/* entry points */" print "extern int putp(const char *);" print "extern int restartterm(const char *, int, int *);" print "extern int setupterm(const char *,int,int *);" print "extern int tgetent(char *, const char *);" print "extern int tgetflag(const char *);" print "extern int tgetnum(const char *);" print "extern char *tgetstr(const char *, char **);" print "extern char *tgoto(const char *, int, int);" print "extern int tigetflag(const char *);" print "extern int tigetnum(const char *);" print "extern char *tigetstr(const char *);" print "extern char *tparm(const char *, ...);" print "extern int tputs(const char *, int, int (*)(int));" print "" print "#ifdef __cplusplus" print "}" print "#endif" print "" print "#endif /* TERM_H */" }