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