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