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