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