4 print "/***************************************************************************"
5 print "* COPYRIGHT NOTICE *"
6 print "****************************************************************************"
7 print "* ncurses is copyright (C) 1992-1995 *"
8 print "* Zeyd M. Ben-Halim *"
9 print "* zmbenhal@netcom.com *"
10 print "* Eric S. Raymond *"
11 print "* esr@snark.thyrsus.com *"
13 print "* Permission is hereby granted to reproduce and distribute ncurses *"
14 print "* by any means and for any fee, whether alone or as part of a *"
15 print "* larger distribution, in source or in binary form, PROVIDED *"
16 print "* this notice is included with any such distribution, and is not *"
17 print "* removed from any of its header files. Mention of ncurses in any *"
18 print "* applications linked with it is highly appreciated. *"
20 print "* ncurses comes AS IS with no warranty, implied or expressed. *"
22 print "***************************************************************************/"
24 print "/* $Id: MKterm.h.awk.in,v 1.17 1997/02/08 21:20:22 tom Exp $ */"
27 print "** term.h -- Definition of struct term"
30 print "#ifndef _TERM_H"
31 print "#define _TERM_H"
33 print "#undef NCURSES_VERSION"
34 print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\""
36 print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H"
37 print " * and BROKEN_LINKER definition (based on the system for which this was configured)."
40 print "#ifndef HAVE_TERMIOS_H"
41 print "#define HAVE_TERMIOS_H 1/*default*/"
44 print "#ifndef HAVE_TERMIO_H"
45 print "#define HAVE_TERMIO_H 0/*default*/"
48 print "#ifndef HAVE_TCGETATTR"
49 print "#define HAVE_TCGETATTR 1/*default*/"
52 print "#ifndef BROKEN_LINKER"
53 print "#define BROKEN_LINKER 0/*default*/"
57 print "/* Assume Posix termio if we have the header and function */"
58 print "#if HAVE_TERMIOS_H && HAVE_TCGETATTR"
59 print "#ifndef TERMIOS"
60 print "#define TERMIOS 1"
62 print "#include <termios.h>"
63 print "#define TTY struct termios"
65 print "#else /* !HAVE_TERMIOS_H */"
67 print "#if HAVE_TERMIO_H"
68 print "#ifndef TERMIOS"
69 print "#define TERMIOS 1"
71 print "#include <termio.h>"
72 print "#define TTY struct termio"
73 print "#define TCSANOW TCSETA"
74 print "#define TCSADRAIN TCSETAW"
75 print "#define TCSAFLUSH TCSETAF"
76 print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)"
77 print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)"
78 print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)"
79 print "#define TCIFLUSH 0"
80 print "#define TCOFLUSH 1"
81 print "#define TCIOFLUSH 2"
82 print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)"
84 print "#else /* !HAVE_TERMIO_H */"
86 print "#undef TERMIOS"
87 print "#include <sgtty.h>"
88 print "#include <sys/ioctl.h>"
89 print "#define TTY struct sgttyb"
91 print "#endif /* HAVE_TERMIO_H */"
93 print "#endif /* HAVE_TERMIOS_H */"
95 print "#ifdef TERMIOS"
96 print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)"
97 print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)"
99 print "#define GET_TTY(fd, buf) gtty(fd, buf)"
100 print "#define SET_TTY(fd, buf) stty(fd, buf)"
103 print "extern char ttytype[];"
104 print "#define NAMESIZE 256"
106 print "#define CUR cur_term->type."
110 $2 == "%%-STOP-HERE-%%" {
112 printf "#define BOOLWRITE %d\n", BoolCount
113 printf "#define NUMWRITE %d\n", NumberCount
114 printf "#define STRWRITE %d\n", StringCount
116 print "/* older synonyms for some capabilities */"
117 print "#define beehive_glitch no_esc_ctlc"
118 print "#define teleray_glitch dest_tabs_magic_smso"
120 print "/* XSI synonyms */"
121 print "#define micro_col_size micro_char_size"
123 print "#ifdef __INTERNAL_CAPS_VISIBLE"
129 printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++
133 printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++
137 printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++
141 print "#endif /* __INTERNAL_CAPS_VISIBLE */"
144 printf "#define BOOLCOUNT %d\n", BoolCount
145 printf "#define NUMCOUNT %d\n", NumberCount
146 printf "#define STRCOUNT %d\n", StringCount
148 print "typedef struct termtype { /* in-core form of terminfo data */"
149 print " char *term_names; /* str_table offset of term names */"
150 print " char *str_table; /* pointer to string table */"
151 print " char Booleans[BOOLCOUNT]; /* array of values */"
152 print " short Numbers[NUMCOUNT]; /* array of values */"
153 print " char *Strings[STRCOUNT]; /* array of string offsets */"
156 print "typedef struct term { /* describe an actual terminal */"
157 print " TERMTYPE type; /* terminal type description */"
158 print " short Filedes; /* file description being written to */"
159 print " TTY Ottyb, /* original state of the terminal */"
160 print " Nttyb; /* current state of the terminal */"
163 print "extern TERMINAL *cur_term;"
166 print "#ifdef __cplusplus"
167 print "extern \"C\" {"
170 print "#if BROKEN_LINKER"
171 print "#define boolnames _nc_boolnames()"
172 print "#define boolcodes _nc_boolcodes()"
173 print "#define boolfnames _nc_boolfnames()"
174 print "#define numnames _nc_numnames()"
175 print "#define numcodes _nc_numcodes()"
176 print "#define numfnames _nc_numfnames()"
177 print "#define strnames _nc_strnames()"
178 print "#define strcodes _nc_strcodes()"
179 print "#define strfnames _nc_strfnames()"
181 print "extern char * const *_nc_boolnames(void);"
182 print "extern char * const *_nc_boolcodes(void);"
183 print "extern char * const *_nc_boolfnames(void);"
184 print "extern char * const *_nc_numnames(void);"
185 print "extern char * const *_nc_numcodes(void);"
186 print "extern char * const *_nc_numfnames(void);"
187 print "extern char * const *_nc_strnames(void);"
188 print "extern char * const *_nc_strcodes(void);"
189 print "extern char * const *_nc_strfnames(void);"
193 print "extern char *const boolnames[];"
194 print "extern char *const boolcodes[];"
195 print "extern char *const boolfnames[];"
196 print "extern char *const numnames[];"
197 print "extern char *const numcodes[];"
198 print "extern char *const numfnames[];"
199 print "extern char *const strnames[];"
200 print "extern char *const strcodes[];"
201 print "extern char *const strfnames[];"
205 print "/* internals */"
206 print "extern int _nc_read_entry(const char * const, char * const, TERMTYPE *const);"
207 print "extern int _nc_read_file_entry(const char *const, TERMTYPE *);"
208 print "extern char *_nc_first_name(const char *const);"
209 print "extern int _nc_name_match(const char *const, const char *const, const char *const);"
210 print "extern int _nc_read_termcap_entry(const char *const, TERMTYPE *const);"
211 print "extern const TERMTYPE *_nc_fallback(const char *);"
213 print "/* entry points */"
214 print "extern TERMINAL *set_curterm(TERMINAL *);"
215 print "extern int del_curterm(TERMINAL *);"
217 print "/* entry points */"
218 print "extern int putp(const char *);"
219 print "extern int restartterm(const char *, int, int *);"
220 print "extern int setupterm(const char *,int,int *);"
221 print "extern int tgetent(char *, const char *);"
222 print "extern int tgetflag(const char *);"
223 print "extern int tgetnum(const char *);"
224 print "extern char *tgetstr(const char *, char **);"
225 print "extern char *tgoto(const char *, int, int);"
226 print "extern int tigetflag(const char *);"
227 print "extern int tigetnum(const char *);"
228 print "extern char *tigetstr(const char *);"
229 print "extern char *tparm(const char *, ...);"
230 print "extern int tputs(const char *, int, int (*)(int));"
232 print "#ifdef __cplusplus"
236 print "#endif /* TERM_H */"