1*7c478bd9Sstevel@tonic-gate# 2*7c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 3*7c478bd9Sstevel@tonic-gate# Use is subject to license terms. 4*7c478bd9Sstevel@tonic-gate# 5*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 6*7c478bd9Sstevel@tonic-gate# 7*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 8*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 9*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 10*7c478bd9Sstevel@tonic-gate# with the License. 11*7c478bd9Sstevel@tonic-gate# 12*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 13*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 14*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 15*7c478bd9Sstevel@tonic-gate# and limitations under the License. 16*7c478bd9Sstevel@tonic-gate# 17*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 18*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 19*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 20*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 21*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 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: /rd/src/libc/xcurses/rcs/mkterm.awk 1.12 1995/07/26 17:40:26 ant 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 " * term.h" 42*7c478bd9Sstevel@tonic-gateprint " *" 43*7c478bd9Sstevel@tonic-gateprint " * XCurses Library" 44*7c478bd9Sstevel@tonic-gateprint " *" 45*7c478bd9Sstevel@tonic-gateprint " * **** THIS FILE IS MACHINE GENERATED." 46*7c478bd9Sstevel@tonic-gateprint " * **** DO NOT EDIT THIS FILE." 47*7c478bd9Sstevel@tonic-gateprint " *" 48*7c478bd9Sstevel@tonic-gateprint " * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved." 49*7c478bd9Sstevel@tonic-gateprint " *" 50*7c478bd9Sstevel@tonic-gateprintf " * $Header%s\n", "$" 51*7c478bd9Sstevel@tonic-gateprint " */" 52*7c478bd9Sstevel@tonic-gateprint 53*7c478bd9Sstevel@tonic-gateprint "#ifndef __term_h__" 54*7c478bd9Sstevel@tonic-gateprint "#define __term_h__\t1" 55*7c478bd9Sstevel@tonic-gateprint 56*7c478bd9Sstevel@tonic-gateprint "#define _XOPEN_CURSES" 57*7c478bd9Sstevel@tonic-gateprint 58*7c478bd9Sstevel@tonic-gateprint "#ifndef NCCS" 59*7c478bd9Sstevel@tonic-gateprint "#include <termios.h>" 60*7c478bd9Sstevel@tonic-gateprint "#endif" 61*7c478bd9Sstevel@tonic-gateprint "#ifndef STDIN_FILENO" 62*7c478bd9Sstevel@tonic-gateprint "#include <sys/types.h>" 63*7c478bd9Sstevel@tonic-gateprint "#include <unistd.h>" 64*7c478bd9Sstevel@tonic-gateprint "#endif" 65*7c478bd9Sstevel@tonic-gateprint 66*7c478bd9Sstevel@tonic-gateprint "#define __TERM cur_term->" 67*7c478bd9Sstevel@tonic-gate} 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate$4 == "bool" { 70*7c478bd9Sstevel@tonic-gate printf "#define %-30s __TERM _bool[%d]\n", $1, BoolCount++ 71*7c478bd9Sstevel@tonic-gate} 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate$4 == "number" { 74*7c478bd9Sstevel@tonic-gate printf "#define %-30s __TERM _num[%d]\n", $1, NumberCount++ 75*7c478bd9Sstevel@tonic-gate} 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate$4 == "str" { 78*7c478bd9Sstevel@tonic-gate printf "#define %-30s __TERM _str[%d]\n", $1, StringCount++ 79*7c478bd9Sstevel@tonic-gate} 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gateEND { 82*7c478bd9Sstevel@tonic-gateprint 83*7c478bd9Sstevel@tonic-gateprintf "#define __COUNT_BOOL\t\t%d\n", BoolCount 84*7c478bd9Sstevel@tonic-gateprintf "#define __COUNT_NUM\t\t%d\n", NumberCount 85*7c478bd9Sstevel@tonic-gateprintf "#define __COUNT_STR\t\t%d\n", StringCount 86*7c478bd9Sstevel@tonic-gateprint 87*7c478bd9Sstevel@tonic-gateprint "/*" 88*7c478bd9Sstevel@tonic-gateprint " * MKS Header format for terminfo database files." 89*7c478bd9Sstevel@tonic-gateprint " *" 90*7c478bd9Sstevel@tonic-gateprint " * The header consists of six short integers, stored using VAX/PDP style" 91*7c478bd9Sstevel@tonic-gateprint " * byte swapping (least-significant byte first). The integers are" 92*7c478bd9Sstevel@tonic-gateprint " *" 93*7c478bd9Sstevel@tonic-gateprint " * 1) magic number (octal 0432);" 94*7c478bd9Sstevel@tonic-gateprint " * 2) the size, in bytes, of the names sections;" 95*7c478bd9Sstevel@tonic-gateprint " * 3) the number of bytes in the boolean section;" 96*7c478bd9Sstevel@tonic-gateprint " * 4) the number of short integers in the numbers section;" 97*7c478bd9Sstevel@tonic-gateprint " * 5) the number of offsets (short integers) in the strings section;" 98*7c478bd9Sstevel@tonic-gateprint " * 6) the size, in bytes, of the string table." 99*7c478bd9Sstevel@tonic-gateprint " *" 100*7c478bd9Sstevel@tonic-gateprint " * Between the boolean and number sections, a null byte is inserted, if" 101*7c478bd9Sstevel@tonic-gateprint " * necessary, to ensure that the number section begins on an even byte" 102*7c478bd9Sstevel@tonic-gateprint " * offset. All short integers are aligned on a short word boundary." 103*7c478bd9Sstevel@tonic-gateprint " */" 104*7c478bd9Sstevel@tonic-gateprint 105*7c478bd9Sstevel@tonic-gateprint "#define __TERMINFO_MAGIC\t\t0432" 106*7c478bd9Sstevel@tonic-gateprint 107*7c478bd9Sstevel@tonic-gateprint "typedef struct {" 108*7c478bd9Sstevel@tonic-gateprint "\tshort magic;" 109*7c478bd9Sstevel@tonic-gateprint "\tshort name_size;" 110*7c478bd9Sstevel@tonic-gateprint "\tshort bool_count;" 111*7c478bd9Sstevel@tonic-gateprint "\tshort num_count;" 112*7c478bd9Sstevel@tonic-gateprint "\tshort str_count;" 113*7c478bd9Sstevel@tonic-gateprint "\tshort str_size;" 114*7c478bd9Sstevel@tonic-gateprint "} terminfo_header_t;" 115*7c478bd9Sstevel@tonic-gateprint 116*7c478bd9Sstevel@tonic-gateprint "/*" 117*7c478bd9Sstevel@tonic-gateprint " * The following __MOVE_ constants are indices into the _move[] member" 118*7c478bd9Sstevel@tonic-gateprint " * of a SCREEN structure. The array is used by m_mvcur() for cursor" 119*7c478bd9Sstevel@tonic-gateprint " * motion costs and initialized by newterm()." 120*7c478bd9Sstevel@tonic-gateprint " *" 121*7c478bd9Sstevel@tonic-gateprint " * The following indices refer to relative cursor motion actions that" 122*7c478bd9Sstevel@tonic-gateprint " * have a base-cost times the distance/count." 123*7c478bd9Sstevel@tonic-gateprint " */" 124*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_UP\t\t0" 125*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_DOWN\t\t1" 126*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_LEFT\t\t2" 127*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_RIGHT\t\t3" 128*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_TAB\t\t4" 129*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_BACK_TAB\t\t5" 130*7c478bd9Sstevel@tonic-gateprint 131*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_MAX_RELATIVE\t6" 132*7c478bd9Sstevel@tonic-gateprint 133*7c478bd9Sstevel@tonic-gateprint "/*" 134*7c478bd9Sstevel@tonic-gateprint " * These should have fixed costs." 135*7c478bd9Sstevel@tonic-gateprint " */" 136*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_RETURN\t\t6" 137*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_HOME\t\t7" 138*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_LAST_LINE\t8" 139*7c478bd9Sstevel@tonic-gateprint 140*7c478bd9Sstevel@tonic-gateprint "/*" 141*7c478bd9Sstevel@tonic-gateprint " * These have worst case cost based on moving the maximum possible" 142*7c478bd9Sstevel@tonic-gateprint " * value for a parameter given the screen size." 143*7c478bd9Sstevel@tonic-gateprint " */" 144*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_N_UP\t\t9" 145*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_N_DOWN\t\t10" 146*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_N_LEFT\t\t11" 147*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_N_RIGHT\t\t12" 148*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_ROW\t\t13" 149*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_COLUMN\t\t14" 150*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_ROW_COLUMN\t15" 151*7c478bd9Sstevel@tonic-gateprint 152*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_MAX\t\t16" 153*7c478bd9Sstevel@tonic-gateprint 154*7c478bd9Sstevel@tonic-gateprint "/*" 155*7c478bd9Sstevel@tonic-gateprint " * For a cursor motion to be used there must be a base-cost of at least 1." 156*7c478bd9Sstevel@tonic-gateprint " */" 157*7c478bd9Sstevel@tonic-gateprint "#define __MOVE_INFINITY\t\t1000" 158*7c478bd9Sstevel@tonic-gateprint 159*7c478bd9Sstevel@tonic-gateprint "#define __TERM_ISATTY_IN\t0x0001\t/* Input is a terminal */" 160*7c478bd9Sstevel@tonic-gateprint "#define __TERM_ISATTY_OUT\t0x0002\t/* Output is a terminal */" 161*7c478bd9Sstevel@tonic-gateprint "#define __TERM_HALF_DELAY\t0x0004\t/* halfdelay() has priority. */" 162*7c478bd9Sstevel@tonic-gateprint "#define __TERM_INSERT_MODE\t0x0008\t/* Terminal is in insert mode. */" 163*7c478bd9Sstevel@tonic-gateprint "#define __TERM_NL_IS_CRLF\t0x8000\t/* Newline is mapped on output. */" 164*7c478bd9Sstevel@tonic-gateprint 165*7c478bd9Sstevel@tonic-gateprint "/***" 166*7c478bd9Sstevel@tonic-gateprint " *** Opaque data type. Keep your grubby mits off." 167*7c478bd9Sstevel@tonic-gateprint " ***/" 168*7c478bd9Sstevel@tonic-gateprint "typedef struct {" 169*7c478bd9Sstevel@tonic-gateprint "\tint _ifd;\t\t\t/* Input file descriptor */" 170*7c478bd9Sstevel@tonic-gateprint "\tint _ofd;\t\t\t/* Output file descriptor */" 171*7c478bd9Sstevel@tonic-gateprint "\tstruct termios _prog;" 172*7c478bd9Sstevel@tonic-gateprint "\tstruct termios _shell;" 173*7c478bd9Sstevel@tonic-gateprint "\tstruct termios _save;" 174*7c478bd9Sstevel@tonic-gateprint "\tshort _co;\t\t\t/* Current colour-pair. */" 175*7c478bd9Sstevel@tonic-gateprint "\tunsigned short _at;\t\t/* Current attribute state. */" 176*7c478bd9Sstevel@tonic-gateprint "\tshort (*_pair)[2];" 177*7c478bd9Sstevel@tonic-gateprint "\tshort (*_color)[3];" 178*7c478bd9Sstevel@tonic-gateprint "\tunsigned short _flags;" 179*7c478bd9Sstevel@tonic-gateprint "\tchar _bool[__COUNT_BOOL];" 180*7c478bd9Sstevel@tonic-gateprint "\tshort _num[__COUNT_NUM];" 181*7c478bd9Sstevel@tonic-gateprint "\tchar *_str[__COUNT_STR];\t/* Pointers into _str_table. */" 182*7c478bd9Sstevel@tonic-gateprint "\tchar *_str_table;" 183*7c478bd9Sstevel@tonic-gateprint "\tchar *_names;\t\t\t/* Terminal alias in _str_table. */" 184*7c478bd9Sstevel@tonic-gateprint "\tchar *_term;\t\t\t/* TERM name loaded. */" 185*7c478bd9Sstevel@tonic-gateprint "\tstruct {" 186*7c478bd9Sstevel@tonic-gateprint "\t\tchar *_seq;" 187*7c478bd9Sstevel@tonic-gateprint "\t\tshort _cost;" 188*7c478bd9Sstevel@tonic-gateprint "\t} _move[__MOVE_MAX];" 189*7c478bd9Sstevel@tonic-gateprint "} TERMINAL;" 190*7c478bd9Sstevel@tonic-gateprint 191*7c478bd9Sstevel@tonic-gateprint "extern TERMINAL *cur_term;" 192*7c478bd9Sstevel@tonic-gateprint 193*7c478bd9Sstevel@tonic-gateprint "extern char *__m_boolnames[];" 194*7c478bd9Sstevel@tonic-gateprint "extern char *__m_boolcodes[];" 195*7c478bd9Sstevel@tonic-gateprint "extern char *__m_boolfnames[];" 196*7c478bd9Sstevel@tonic-gateprint "extern char *__m_numnames[];" 197*7c478bd9Sstevel@tonic-gateprint "extern char *__m_numcodes[];" 198*7c478bd9Sstevel@tonic-gateprint "extern char *__m_numfnames[];" 199*7c478bd9Sstevel@tonic-gateprint "extern char *__m_strnames[];" 200*7c478bd9Sstevel@tonic-gateprint "extern char *__m_strcodes[];" 201*7c478bd9Sstevel@tonic-gateprint "extern char *__m_strfnames[];" 202*7c478bd9Sstevel@tonic-gateprint 203*7c478bd9Sstevel@tonic-gateprint "#ifndef _XOPEN_SOURCE" 204*7c478bd9Sstevel@tonic-gateprint "/*" 205*7c478bd9Sstevel@tonic-gateprint " * Old System V array names." 206*7c478bd9Sstevel@tonic-gateprint " */" 207*7c478bd9Sstevel@tonic-gateprint "#define boolnames\t__m_boolnames" 208*7c478bd9Sstevel@tonic-gateprint "#define boolcodes\t__m_boolcodes" 209*7c478bd9Sstevel@tonic-gateprint "#define boolfnames\t__m_boolfnames" 210*7c478bd9Sstevel@tonic-gateprint "#define numnames\t__m_numnames" 211*7c478bd9Sstevel@tonic-gateprint "#define numcodes\t__m_numcodes" 212*7c478bd9Sstevel@tonic-gateprint "#define numfnames\t__m_numfnames" 213*7c478bd9Sstevel@tonic-gateprint "#define strnames\t__m_strnames" 214*7c478bd9Sstevel@tonic-gateprint "#define strcodes\t__m_strcodes" 215*7c478bd9Sstevel@tonic-gateprint "#define strfnames\t__m_strfnames" 216*7c478bd9Sstevel@tonic-gateprint "#endif /* _XOPEN_SOURCE */" 217*7c478bd9Sstevel@tonic-gateprint 218*7c478bd9Sstevel@tonic-gateprint "/*" 219*7c478bd9Sstevel@tonic-gateprint " * Exposed internal functions." 220*7c478bd9Sstevel@tonic-gateprint " */" 221*7c478bd9Sstevel@tonic-gateprint "extern int __m_putchar(int);" 222*7c478bd9Sstevel@tonic-gateprint "extern int __m_mvcur(int, int, int, int, int (*)(int));" 223*7c478bd9Sstevel@tonic-gateprint "extern int __m_read_terminfo(const char *, TERMINAL *);" 224*7c478bd9Sstevel@tonic-gateprint "extern int __m_setupterm(const char *, int, int, int *);" 225*7c478bd9Sstevel@tonic-gateprint 226*7c478bd9Sstevel@tonic-gateprint "/*" 227*7c478bd9Sstevel@tonic-gateprint " * Globals" 228*7c478bd9Sstevel@tonic-gateprint " */" 229*7c478bd9Sstevel@tonic-gateprint "extern int del_curterm(TERMINAL *);" 230*7c478bd9Sstevel@tonic-gateprint "extern TERMINAL *set_curterm(TERMINAL *);" 231*7c478bd9Sstevel@tonic-gateprint "extern int restartterm(const char *, int, int *);" 232*7c478bd9Sstevel@tonic-gateprint "extern int setupterm(const char *, int, int *);" 233*7c478bd9Sstevel@tonic-gateprint 234*7c478bd9Sstevel@tonic-gateprint "extern int tgetent(char *, char *);" 235*7c478bd9Sstevel@tonic-gateprint "extern int tgetflag(const char *);" 236*7c478bd9Sstevel@tonic-gateprint "extern int tgetnum(const char *);" 237*7c478bd9Sstevel@tonic-gateprint "extern char *tgetstr(const char *, char **);" 238*7c478bd9Sstevel@tonic-gateprint "extern char *tgoto(const char *, int, int);" 239*7c478bd9Sstevel@tonic-gateprint 240*7c478bd9Sstevel@tonic-gateprint "extern int tigetflag(const char *);" 241*7c478bd9Sstevel@tonic-gateprint "extern int tigetnum(const char *);" 242*7c478bd9Sstevel@tonic-gateprint "extern char *tigetstr(const char *);" 243*7c478bd9Sstevel@tonic-gateprint 244*7c478bd9Sstevel@tonic-gateprint "extern int putp(const char *);" 245*7c478bd9Sstevel@tonic-gateprint "extern const char *tparm(" 246*7c478bd9Sstevel@tonic-gateprint "\tconst char *, long, long, long, long, long, long, long, long, long);" 247*7c478bd9Sstevel@tonic-gateprint "extern int tputs(const char *, int, int (*)(int));" 248*7c478bd9Sstevel@tonic-gateprint 249*7c478bd9Sstevel@tonic-gateprint "#ifndef _XOPEN_SOURCE_EXTENDED" 250*7c478bd9Sstevel@tonic-gateprint 251*7c478bd9Sstevel@tonic-gateprint "#define putp(str)\t\ttputs(str,1,__m_putchar)" 252*7c478bd9Sstevel@tonic-gateprint "#define del_term\t\tdel_curterm" 253*7c478bd9Sstevel@tonic-gateprint "#define setterm(t)\t\tsetupterm(t,STDOUT_FILENO,(int *) 0)" 254*7c478bd9Sstevel@tonic-gateprint "#define tgoto(cm,c,r)\t\ttparm((char *)(cm), (long)(r), (long)(c))" 255*7c478bd9Sstevel@tonic-gateprint 256*7c478bd9Sstevel@tonic-gateprint "#ifndef _XOPEN_SOURCE" 257*7c478bd9Sstevel@tonic-gateprint "#define beehive_glitch\t\tno_esc_ctrlc" 258*7c478bd9Sstevel@tonic-gateprint "#define teleray_glitch\t\tdest_tabs_magic_smso" 259*7c478bd9Sstevel@tonic-gateprint "#endif /* _XOPEN_SOURCE */" 260*7c478bd9Sstevel@tonic-gateprint 261*7c478bd9Sstevel@tonic-gateprint "#endif /* _XOPEN_SOURCE_EXTENDED */" 262*7c478bd9Sstevel@tonic-gateprint 263*7c478bd9Sstevel@tonic-gateprint "#endif /* __term_h__ */" 264*7c478bd9Sstevel@tonic-gate} 265