17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate# with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate# Copyright (c) 1995-1998 by Sun Microsystems, Inc.
237c478bd9Sstevel@tonic-gate# All rights reserved.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# mkterm.awk
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate# XCurses Library
287c478bd9Sstevel@tonic-gate#
297c478bd9Sstevel@tonic-gate# Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
307c478bd9Sstevel@tonic-gate#
317c478bd9Sstevel@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 $
327c478bd9Sstevel@tonic-gate#
337c478bd9Sstevel@tonic-gate# USAGE:
347c478bd9Sstevel@tonic-gate# 	awk -f mkterm.awk caps >term.h
35*1da57d55SToomas Soome#
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gateBEGIN {
387c478bd9Sstevel@tonic-gateprint "/*"
397c478bd9Sstevel@tonic-gateprint " * Copyright (c) 1998 by Sun Microsystems, Inc."
407c478bd9Sstevel@tonic-gateprint " * All rights reserved."
417c478bd9Sstevel@tonic-gateprint " */"
42ac05f74fSCody Peter Melloprint ""
437c478bd9Sstevel@tonic-gateprint "#ifndef	_TERM_H"
447c478bd9Sstevel@tonic-gateprint "#define	_TERM_H"
45ac05f74fSCody Peter Melloprint ""
467c478bd9Sstevel@tonic-gateprint "/*"
477c478bd9Sstevel@tonic-gateprint " * term.h"
487c478bd9Sstevel@tonic-gateprint " *"
497c478bd9Sstevel@tonic-gateprint " * XCurses Library"
507c478bd9Sstevel@tonic-gateprint " *"
517c478bd9Sstevel@tonic-gateprint " * **** THIS FILE IS MACHINE GENERATED."
527c478bd9Sstevel@tonic-gateprint " * **** DO NOT EDIT THIS FILE."
537c478bd9Sstevel@tonic-gateprint " *"
547c478bd9Sstevel@tonic-gateprint " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved."
557c478bd9Sstevel@tonic-gateprint " *"
567c478bd9Sstevel@tonic-gateprintf " * $Header%s\n", "$"
577c478bd9Sstevel@tonic-gateprint " */"
58ac05f74fSCody Peter Melloprint ""
59ac05f74fSCody Peter Melloprint ""
607c478bd9Sstevel@tonic-gateprint "#ifdef	__cplusplus"
617c478bd9Sstevel@tonic-gateprint "extern \"C\" {"
627c478bd9Sstevel@tonic-gateprint "#endif"
63ac05f74fSCody Peter Melloprint ""
647c478bd9Sstevel@tonic-gateprint "#define	__TERM cur_term->"
657c478bd9Sstevel@tonic-gate}
667c478bd9Sstevel@tonic-gate
677c478bd9Sstevel@tonic-gate$4 == "bool" {
687c478bd9Sstevel@tonic-gate	printf "#define	%s\t\t__TERM _bool[%d]\n", $1, BoolCount++
697c478bd9Sstevel@tonic-gate}
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gate$4 == "number" {
727c478bd9Sstevel@tonic-gate	printf "#define	%s\t\t__TERM _num[%d]\n", $1, NumberCount++
737c478bd9Sstevel@tonic-gate}
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate$4 == "str" {
767c478bd9Sstevel@tonic-gate	printf "#define	%s\t\t__TERM _str[%d]\n", $1, StringCount++
777c478bd9Sstevel@tonic-gate}
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gateEND {
80ac05f74fSCody Peter Melloprint ""
817c478bd9Sstevel@tonic-gateprintf "#define	__COUNT_BOOL\t\t%d\n", BoolCount
827c478bd9Sstevel@tonic-gateprintf "#define	__COUNT_NUM\t\t%d\n", NumberCount
837c478bd9Sstevel@tonic-gateprintf "#define	__COUNT_STR\t\t%d\n", StringCount
84ac05f74fSCody Peter Melloprint ""
857c478bd9Sstevel@tonic-gate#print "/*"
867c478bd9Sstevel@tonic-gate#print " * MKS Header format for terminfo database files."
877c478bd9Sstevel@tonic-gate#print " *"
887c478bd9Sstevel@tonic-gate#print " * The header consists of six short integers, stored using VAX/PDP style"
897c478bd9Sstevel@tonic-gate#print " * byte swapping (least-significant byte first).  The integers are"
907c478bd9Sstevel@tonic-gate#print " *"
917c478bd9Sstevel@tonic-gate#print " *  1) magic number (octal 0432);"
927c478bd9Sstevel@tonic-gate#print " *  2) the size, in bytes, of the names sections;"
937c478bd9Sstevel@tonic-gate#print " *  3) the number of bytes in the boolean section;"
947c478bd9Sstevel@tonic-gate#print " *  4) the number of short integers in the numbers section;"
957c478bd9Sstevel@tonic-gate#print " *  5) the number of offsets (short integers) in the strings section;"
967c478bd9Sstevel@tonic-gate#print " *  6) the size, in bytes, of the string table."
977c478bd9Sstevel@tonic-gate#print " *"
987c478bd9Sstevel@tonic-gate#print " * Between the boolean and number sections, a null byte is inserted, if"
997c478bd9Sstevel@tonic-gate#print " * necessary, to ensure that the number section begins on an even byte"
1007c478bd9Sstevel@tonic-gate#print " * offset.  All short integers are aligned on a short word boundary."
1017c478bd9Sstevel@tonic-gate#print " */"
1027c478bd9Sstevel@tonic-gate#print
1037c478bd9Sstevel@tonic-gate#print "#define	__TERMINFO_MAGIC\t\t0432"
1047c478bd9Sstevel@tonic-gate#print
1057c478bd9Sstevel@tonic-gate#print "typedef struct {"
1067c478bd9Sstevel@tonic-gate#print "\tshort magic;"
1077c478bd9Sstevel@tonic-gate#print "\tshort name_size;"
1087c478bd9Sstevel@tonic-gate#print "\tshort bool_count;"
1097c478bd9Sstevel@tonic-gate#print "\tshort num_count;"
1107c478bd9Sstevel@tonic-gate#print "\tshort str_count;"
1117c478bd9Sstevel@tonic-gate#print "\tshort str_size;"
1127c478bd9Sstevel@tonic-gate#print "} terminfo_header_t;"
1137c478bd9Sstevel@tonic-gate#print
1147c478bd9Sstevel@tonic-gateprint "/*"
1157c478bd9Sstevel@tonic-gateprint " * The following __MOVE_ constants are indices into the _move[] member"
1167c478bd9Sstevel@tonic-gateprint " * of a SCREEN structure.  The array is used by m_mvcur() for cursor"
1177c478bd9Sstevel@tonic-gateprint " * motion costs and initialized by newterm()."
1187c478bd9Sstevel@tonic-gateprint " *"
1197c478bd9Sstevel@tonic-gateprint " * The following indices refer to relative cursor motion actions that"
1207c478bd9Sstevel@tonic-gateprint " * have a base-cost times the distance/count."
1217c478bd9Sstevel@tonic-gateprint " */"
1227c478bd9Sstevel@tonic-gateprint "#define	__MOVE_UP\t\t0"
1237c478bd9Sstevel@tonic-gateprint "#define	__MOVE_DOWN\t\t1"
1247c478bd9Sstevel@tonic-gateprint "#define	__MOVE_LEFT\t\t2"
1257c478bd9Sstevel@tonic-gateprint "#define	__MOVE_RIGHT\t\t3"
1267c478bd9Sstevel@tonic-gateprint "#define	__MOVE_TAB\t\t4"
1277c478bd9Sstevel@tonic-gateprint "#define	__MOVE_BACK_TAB\t\t5"
128ac05f74fSCody Peter Melloprint ""
1297c478bd9Sstevel@tonic-gateprint "#define	__MOVE_MAX_RELATIVE\t6"
130ac05f74fSCody Peter Melloprint ""
1317c478bd9Sstevel@tonic-gateprint "/*"
1327c478bd9Sstevel@tonic-gateprint " * These should have fixed costs."
1337c478bd9Sstevel@tonic-gateprint " */"
1347c478bd9Sstevel@tonic-gateprint "#define	__MOVE_RETURN\t\t6"
1357c478bd9Sstevel@tonic-gateprint "#define	__MOVE_HOME\t\t7"
1367c478bd9Sstevel@tonic-gateprint "#define	__MOVE_LAST_LINE\t8"
137ac05f74fSCody Peter Melloprint ""
1387c478bd9Sstevel@tonic-gateprint "/*"
1397c478bd9Sstevel@tonic-gateprint " * These have worst case cost based on moving the maximum possible"
1407c478bd9Sstevel@tonic-gateprint " * value for a parameter given the screen size."
1417c478bd9Sstevel@tonic-gateprint " */"
1427c478bd9Sstevel@tonic-gateprint "#define	__MOVE_N_UP\t\t9"
1437c478bd9Sstevel@tonic-gateprint "#define	__MOVE_N_DOWN\t\t10"
1447c478bd9Sstevel@tonic-gateprint "#define	__MOVE_N_LEFT\t\t11"
1457c478bd9Sstevel@tonic-gateprint "#define	__MOVE_N_RIGHT\t\t12"
1467c478bd9Sstevel@tonic-gateprint "#define	__MOVE_ROW\t\t13"
1477c478bd9Sstevel@tonic-gateprint "#define	__MOVE_COLUMN\t\t14"
1487c478bd9Sstevel@tonic-gateprint "#define	__MOVE_ROW_COLUMN\t15"
149ac05f74fSCody Peter Melloprint ""
1507c478bd9Sstevel@tonic-gateprint "#define	__MOVE_MAX\t\t16"
151ac05f74fSCody Peter Melloprint ""
1527c478bd9Sstevel@tonic-gateprint "/*"
1537c478bd9Sstevel@tonic-gateprint " * For a cursor motion to be used there must be a base-cost of at least 1."
1547c478bd9Sstevel@tonic-gateprint " */"
1557c478bd9Sstevel@tonic-gateprint "#define	__MOVE_INFINITY\t\t1000"
156ac05f74fSCody Peter Melloprint ""
1577c478bd9Sstevel@tonic-gateprint "#define	__TERM_ISATTY_IN\t0x0001\t/* Input is a terminal */"
1587c478bd9Sstevel@tonic-gateprint "#define	__TERM_ISATTY_OUT\t0x0002\t/* Output is a terminal */"
1597c478bd9Sstevel@tonic-gateprint "#define	__TERM_HALF_DELAY\t0x0004\t/* halfdelay() has priority. */"
1607c478bd9Sstevel@tonic-gateprint "#define	__TERM_INSERT_MODE\t0x0008\t/* Terminal is in insert mode. */"
1617c478bd9Sstevel@tonic-gateprint "#define	__TERM_NL_IS_CRLF\t0x8000\t/* Newline is mapped on output. */"
162ac05f74fSCody Peter Melloprint ""
1637c478bd9Sstevel@tonic-gateprint "/*"
1647c478bd9Sstevel@tonic-gateprint " * Opaque data type.  Keep your grubby mits off."
1657c478bd9Sstevel@tonic-gateprint " */"
1667c478bd9Sstevel@tonic-gateprint "typedef struct {"
1677c478bd9Sstevel@tonic-gateprint "\tint	_ifd;\t/* Input file descriptor */"
1687c478bd9Sstevel@tonic-gateprint "\tint	_ofd;\t/* Output file descriptor */"
1697c478bd9Sstevel@tonic-gate#print "\tstruct termios	_prog;"
1707c478bd9Sstevel@tonic-gate#print "\tstruct termios	_shell;"
1717c478bd9Sstevel@tonic-gate#print "\tstruct termios	_save;"
1727c478bd9Sstevel@tonic-gate#print "\tstruct termios	_actual;\t/* What has actually been set in the terminal */"
1737c478bd9Sstevel@tonic-gateprint "\tvoid	*_prog;"
1747c478bd9Sstevel@tonic-gateprint "\tvoid	*_shell;"
1757c478bd9Sstevel@tonic-gateprint "\tvoid	*_save;"
1767c478bd9Sstevel@tonic-gateprint "\tvoid	*_actual;\t/* What has actually been set in the terminal */"
1777c478bd9Sstevel@tonic-gateprint "\tshort	_co;\t/* Current color-pair. */"
1787c478bd9Sstevel@tonic-gateprint "\tunsigned short	_at;\t/* Current attribute state. */"
1797c478bd9Sstevel@tonic-gateprint "\tshort	(*_pair)[2];"
1807c478bd9Sstevel@tonic-gateprint "\tshort	(*_color)[3];"
1817c478bd9Sstevel@tonic-gateprint "\tunsigned short	_flags;"
1827c478bd9Sstevel@tonic-gateprint "\tchar	_bool[__COUNT_BOOL];"
1837c478bd9Sstevel@tonic-gateprint "\tshort	_num[__COUNT_NUM];"
1847c478bd9Sstevel@tonic-gateprint "\tchar	*_str[__COUNT_STR];\t/* Pointers into _str_table. */"
1857c478bd9Sstevel@tonic-gateprint "\tchar	*_str_table;"
1867c478bd9Sstevel@tonic-gateprint "\tchar	*_names;\t/* Terminal alias in _str_table. */"
1877c478bd9Sstevel@tonic-gateprint "\tchar	*_term;\t/* TERM name loaded. */"
1887c478bd9Sstevel@tonic-gateprint "\tstruct {"
1897c478bd9Sstevel@tonic-gateprint "\t\tchar	*_seq;"
1907c478bd9Sstevel@tonic-gateprint "\t\tshort	_cost;"
1917c478bd9Sstevel@tonic-gateprint "\t} _move[__MOVE_MAX];"
1927c478bd9Sstevel@tonic-gateprint "} TERMINAL;"
193ac05f74fSCody Peter Melloprint ""
1947c478bd9Sstevel@tonic-gateprint "extern TERMINAL *cur_term;"
195ac05f74fSCody Peter Melloprint ""
1967c478bd9Sstevel@tonic-gateprint "#if !(defined(__cplusplus) && defined(_BOOL))"
1977c478bd9Sstevel@tonic-gateprint "#ifndef _BOOL_DEFINED"
1987c478bd9Sstevel@tonic-gateprint "typedef short	bool;"
1997c478bd9Sstevel@tonic-gateprint "#define	_BOOL_DEFINED"
2007c478bd9Sstevel@tonic-gateprint "#endif"
2017c478bd9Sstevel@tonic-gateprint "#endif"
202ac05f74fSCody Peter Melloprint ""
2037c478bd9Sstevel@tonic-gateprint "/*"
2047c478bd9Sstevel@tonic-gateprint " * Globals"
2057c478bd9Sstevel@tonic-gateprint " */"
2067c478bd9Sstevel@tonic-gateprint "extern int del_curterm(TERMINAL *);"
2077c478bd9Sstevel@tonic-gateprint "extern int putp(const char *);"
2087c478bd9Sstevel@tonic-gateprint "extern int restartterm(char *, int, int *);"
2097c478bd9Sstevel@tonic-gateprint "extern TERMINAL *set_curterm(TERMINAL *);"
2107c478bd9Sstevel@tonic-gateprint "extern int setupterm(char *, int, int *);"
2117c478bd9Sstevel@tonic-gateprint "extern int tgetent(char *, const char *);"
2127c478bd9Sstevel@tonic-gateprint "extern int tgetflag(char *);"
2137c478bd9Sstevel@tonic-gateprint "extern int tgetnum(char *);"
2147c478bd9Sstevel@tonic-gateprint "extern char *tgetstr(char *, char **);"
2157c478bd9Sstevel@tonic-gateprint "extern char *tgoto(char *, int, int);"
2167c478bd9Sstevel@tonic-gateprint "extern int tigetflag(char *);"
2177c478bd9Sstevel@tonic-gateprint "extern int tigetnum(char *);"
2187c478bd9Sstevel@tonic-gateprint "extern char *tigetstr(char *);"
2197c478bd9Sstevel@tonic-gateprint "extern char *tparm("
2207c478bd9Sstevel@tonic-gateprint "\tchar *, long, long, long, long, long, long, long, long, long);"
2217c478bd9Sstevel@tonic-gateprint "extern int tputs(const char *, int, int (*)(int));"
222ac05f74fSCody Peter Melloprint ""
2237c478bd9Sstevel@tonic-gateprint "#ifdef	__cplusplus"
2247c478bd9Sstevel@tonic-gateprint "}"
2257c478bd9Sstevel@tonic-gateprint "#endif"
226ac05f74fSCody Peter Melloprint ""
2277c478bd9Sstevel@tonic-gateprint "#endif /* _TERM_H */"
2287c478bd9Sstevel@tonic-gate}
229