File: MKterm.h.awk.in

package info (click to toggle)
oldncurses 1.9.9e-2.1
  • links: PTS
  • area: main
  • in suites: hamm, potato, slink
  • size: 3,548 kB
  • ctags: 2,622
  • sloc: ansic: 25,956; cpp: 938; makefile: 880; sh: 607; awk: 311; perl: 72
file content (193 lines) | stat: -rw-r--r-- 7,972 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

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 ""
		    print "/*"
		    print "**	term.h -- Definition of struct term"
		    print "*/"
		    print ""
		    print "#ifndef _TERM_H"
		    print "#define _TERM_H"
		    print "#define NCURSES_VERSION \"@VERSION@\""
		    print ""
		    print "/* Make this file self-contained by providing defaults for the HAVE_TERMIOS_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_TCGETATTR"
		    print "#define HAVE_TCGETATTR 1/*default*/"
		    print "#endif"
		    print ""
		    print "#ifndef BROKEN_LINKER"
		    print "#define BROKEN_LINKER 0"
		    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 <termios.h>"
		    print "#define TTY struct termios"
		    print ""
		    print "#else"
		    print ""
		    print "#undef TERMIOS"
		    print "#include <sgtty.h>"
		    print "#include <sys/ioctl.h>"
		    print "#define TTY struct sgttyb"
		    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 booleans */"
			print  "#define beehive_glitch	no_esc_ctlc"
			print  "#define teleray_glitch	dest_tabs_magic_smso"
			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 *boolnames[], *boolcodes[], *boolfnames[],"
			print "            *numnames[], *numcodes[], *numfnames[],"
			print "            *strnames[], *strcodes[], *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 char *tparam(const char *, char *, int, ...);"
			print "extern int tputs(const char *, int, int (*)(int));"
			print ""
			print "#ifdef __cplusplus"
			print "}"
			print "#endif"
			print ""
            		print "#endif /* TERM_H */"
		}