Print this page
3764 Semantic of nawk's print statement changed
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libxcurses2/src/libc/xcurses/mkterm.awk
+++ new/usr/src/lib/libxcurses2/src/libc/xcurses/mkterm.awk
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License, Version 1.0 only
6 6 # (the "License"). You may not use this file except in compliance
7 7 # with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 # Copyright (c) 1995-1998 by Sun Microsystems, Inc.
23 23 # All rights reserved.
24 24 #
25 -# ident "%Z%%M% %I% %E% SMI"
26 -#
27 25 # mkterm.awk
28 26 #
29 27 # XCurses Library
30 28 #
31 29 # Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
32 30 #
33 31 # $Header: /team/ps/sun_xcurses/archive/local_changes/xcurses/src/lib/libxcurses/src/libc/xcurses/rcs/mkterm.awk 1.7 1998/06/04 18:43:42 cbates Exp $
34 32 #
35 33 # USAGE:
36 34 # awk -f mkterm.awk caps >term.h
37 35 #
38 36
39 37 BEGIN {
40 38 print "/*"
41 39 print " * Copyright (c) 1998 by Sun Microsystems, Inc."
42 40 print " * All rights reserved."
43 41 print " */"
44 -print
42 +print ""
45 43 print "#ifndef _TERM_H"
46 44 print "#define _TERM_H"
47 -print
45 +print ""
48 46 print "#pragma ident \"@(#)term.h %I% %E% SMI\""
49 -print
47 +print ""
50 48 print "/*"
51 49 print " * term.h"
52 50 print " *"
53 51 print " * XCurses Library"
54 52 print " *"
55 53 print " * **** THIS FILE IS MACHINE GENERATED."
56 54 print " * **** DO NOT EDIT THIS FILE."
57 55 print " *"
58 56 print " * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved."
59 57 print " *"
60 58 printf " * $Header%s\n", "$"
61 59 print " */"
62 -print
63 -print
60 +print ""
61 +print ""
64 62 print "#ifdef __cplusplus"
65 63 print "extern \"C\" {"
66 64 print "#endif"
67 -print
65 +print ""
68 66 print "#define __TERM cur_term->"
69 67 }
70 68
69 +/^#/ || /^$/ {
70 + next
71 +}
72 +
71 73 $4 == "bool" {
72 74 printf "#define %s\t\t__TERM _bool[%d]\n", $1, BoolCount++
73 75 }
74 76
75 77 $4 == "number" {
76 78 printf "#define %s\t\t__TERM _num[%d]\n", $1, NumberCount++
77 79 }
78 80
79 81 $4 == "str" {
80 82 printf "#define %s\t\t__TERM _str[%d]\n", $1, StringCount++
81 83 }
82 84
83 85 END {
84 -print
86 +print ""
85 87 printf "#define __COUNT_BOOL\t\t%d\n", BoolCount
86 88 printf "#define __COUNT_NUM\t\t%d\n", NumberCount
87 89 printf "#define __COUNT_STR\t\t%d\n", StringCount
88 -print
90 +print ""
89 91 #print "/*"
90 92 #print " * MKS Header format for terminfo database files."
91 93 #print " *"
92 94 #print " * The header consists of six short integers, stored using VAX/PDP style"
93 95 #print " * byte swapping (least-significant byte first). The integers are"
94 96 #print " *"
95 97 #print " * 1) magic number (octal 0432);"
96 98 #print " * 2) the size, in bytes, of the names sections;"
97 99 #print " * 3) the number of bytes in the boolean section;"
98 100 #print " * 4) the number of short integers in the numbers section;"
99 101 #print " * 5) the number of offsets (short integers) in the strings section;"
100 102 #print " * 6) the size, in bytes, of the string table."
101 103 #print " *"
102 104 #print " * Between the boolean and number sections, a null byte is inserted, if"
103 105 #print " * necessary, to ensure that the number section begins on an even byte"
104 106 #print " * offset. All short integers are aligned on a short word boundary."
105 107 #print " */"
106 108 #print
107 109 #print "#define __TERMINFO_MAGIC\t\t0432"
108 110 #print
109 111 #print "typedef struct {"
110 112 #print "\tshort magic;"
111 113 #print "\tshort name_size;"
112 114 #print "\tshort bool_count;"
113 115 #print "\tshort num_count;"
114 116 #print "\tshort str_count;"
115 117 #print "\tshort str_size;"
116 118 #print "} terminfo_header_t;"
117 119 #print
118 120 print "/*"
119 121 print " * The following __MOVE_ constants are indices into the _move[] member"
120 122 print " * of a SCREEN structure. The array is used by m_mvcur() for cursor"
121 123 print " * motion costs and initialized by newterm()."
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
122 124 print " *"
123 125 print " * The following indices refer to relative cursor motion actions that"
124 126 print " * have a base-cost times the distance/count."
125 127 print " */"
126 128 print "#define __MOVE_UP\t\t0"
127 129 print "#define __MOVE_DOWN\t\t1"
128 130 print "#define __MOVE_LEFT\t\t2"
129 131 print "#define __MOVE_RIGHT\t\t3"
130 132 print "#define __MOVE_TAB\t\t4"
131 133 print "#define __MOVE_BACK_TAB\t\t5"
132 -print
134 +print ""
133 135 print "#define __MOVE_MAX_RELATIVE\t6"
134 -print
136 +print ""
135 137 print "/*"
136 138 print " * These should have fixed costs."
137 139 print " */"
138 140 print "#define __MOVE_RETURN\t\t6"
139 141 print "#define __MOVE_HOME\t\t7"
140 142 print "#define __MOVE_LAST_LINE\t8"
141 -print
143 +print ""
142 144 print "/*"
143 145 print " * These have worst case cost based on moving the maximum possible"
144 146 print " * value for a parameter given the screen size."
145 147 print " */"
146 148 print "#define __MOVE_N_UP\t\t9"
147 149 print "#define __MOVE_N_DOWN\t\t10"
148 150 print "#define __MOVE_N_LEFT\t\t11"
149 151 print "#define __MOVE_N_RIGHT\t\t12"
150 152 print "#define __MOVE_ROW\t\t13"
151 153 print "#define __MOVE_COLUMN\t\t14"
152 154 print "#define __MOVE_ROW_COLUMN\t15"
153 -print
155 +print ""
154 156 print "#define __MOVE_MAX\t\t16"
155 -print
157 +print ""
156 158 print "/*"
157 159 print " * For a cursor motion to be used there must be a base-cost of at least 1."
158 160 print " */"
159 161 print "#define __MOVE_INFINITY\t\t1000"
160 -print
162 +print ""
161 163 print "#define __TERM_ISATTY_IN\t0x0001\t/* Input is a terminal */"
162 164 print "#define __TERM_ISATTY_OUT\t0x0002\t/* Output is a terminal */"
163 165 print "#define __TERM_HALF_DELAY\t0x0004\t/* halfdelay() has priority. */"
164 166 print "#define __TERM_INSERT_MODE\t0x0008\t/* Terminal is in insert mode. */"
165 167 print "#define __TERM_NL_IS_CRLF\t0x8000\t/* Newline is mapped on output. */"
166 -print
168 +print ""
167 169 print "/*"
168 170 print " * Opaque data type. Keep your grubby mits off."
169 171 print " */"
170 172 print "typedef struct {"
171 173 print "\tint _ifd;\t/* Input file descriptor */"
172 174 print "\tint _ofd;\t/* Output file descriptor */"
173 175 #print "\tstruct termios _prog;"
174 176 #print "\tstruct termios _shell;"
175 177 #print "\tstruct termios _save;"
176 178 #print "\tstruct termios _actual;\t/* What has actually been set in the terminal */"
177 179 print "\tvoid *_prog;"
178 180 print "\tvoid *_shell;"
179 181 print "\tvoid *_save;"
180 182 print "\tvoid *_actual;\t/* What has actually been set in the terminal */"
181 183 print "\tshort _co;\t/* Current color-pair. */"
182 184 print "\tunsigned short _at;\t/* Current attribute state. */"
183 185 print "\tshort (*_pair)[2];"
184 186 print "\tshort (*_color)[3];"
185 187 print "\tunsigned short _flags;"
186 188 print "\tchar _bool[__COUNT_BOOL];"
↓ open down ↓ |
10 lines elided |
↑ open up ↑ |
187 189 print "\tshort _num[__COUNT_NUM];"
188 190 print "\tchar *_str[__COUNT_STR];\t/* Pointers into _str_table. */"
189 191 print "\tchar *_str_table;"
190 192 print "\tchar *_names;\t/* Terminal alias in _str_table. */"
191 193 print "\tchar *_term;\t/* TERM name loaded. */"
192 194 print "\tstruct {"
193 195 print "\t\tchar *_seq;"
194 196 print "\t\tshort _cost;"
195 197 print "\t} _move[__MOVE_MAX];"
196 198 print "} TERMINAL;"
197 -print
199 +print ""
198 200 print "extern TERMINAL *cur_term;"
199 -print
201 +print ""
200 202 print "#if !(defined(__cplusplus) && defined(_BOOL))"
201 203 print "#ifndef _BOOL_DEFINED"
202 204 print "typedef short bool;"
203 205 print "#define _BOOL_DEFINED"
204 206 print "#endif"
205 207 print "#endif"
206 -print
208 +print ""
207 209 print "/*"
208 210 print " * Globals"
209 211 print " */"
210 212 print "extern int del_curterm(TERMINAL *);"
211 213 print "extern int putp(const char *);"
212 214 print "extern int restartterm(char *, int, int *);"
213 215 print "extern TERMINAL *set_curterm(TERMINAL *);"
214 216 print "extern int setupterm(char *, int, int *);"
215 217 print "extern int tgetent(char *, const char *);"
216 218 print "extern int tgetflag(char *);"
217 219 print "extern int tgetnum(char *);"
218 220 print "extern char *tgetstr(char *, char **);"
219 221 print "extern char *tgoto(char *, int, int);"
220 222 print "extern int tigetflag(char *);"
221 223 print "extern int tigetnum(char *);"
222 224 print "extern char *tigetstr(char *);"
223 225 print "extern char *tparm("
224 226 print "\tchar *, long, long, long, long, long, long, long, long, long);"
225 227 print "extern int tputs(const char *, int, int (*)(int));"
226 -print
228 +print ""
227 229 print "#ifdef __cplusplus"
228 230 print "}"
229 231 print "#endif"
230 -print
232 +print ""
231 233 print "#endif /* _TERM_H */"
232 234 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX