17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate# Use is subject to license terms.
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# CDDL HEADER START
67c478bd9Sstevel@tonic-gate#
77c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
87c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
97c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
107c478bd9Sstevel@tonic-gate# with the License.
117c478bd9Sstevel@tonic-gate#
127c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
137c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
147c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
157c478bd9Sstevel@tonic-gate# and limitations under the License.
167c478bd9Sstevel@tonic-gate#
177c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
187c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
197c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
207c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
217c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate# CDDL HEADER END
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate# mkterm.awk
287c478bd9Sstevel@tonic-gate#
297c478bd9Sstevel@tonic-gate# XCurses Library
307c478bd9Sstevel@tonic-gate#
317c478bd9Sstevel@tonic-gate# Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
327c478bd9Sstevel@tonic-gate#
337c478bd9Sstevel@tonic-gate# $Header: /rd/src/libc/xcurses/rcs/mkterm.awk 1.12 1995/07/26 17:40:26 ant Exp $
347c478bd9Sstevel@tonic-gate#
357c478bd9Sstevel@tonic-gate# USAGE:
367c478bd9Sstevel@tonic-gate# 	awk -f mkterm.awk caps >term.h
377c478bd9Sstevel@tonic-gate#
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gateBEGIN {
407c478bd9Sstevel@tonic-gateprint "/*"
417c478bd9Sstevel@tonic-gateprint " * term.h"
427c478bd9Sstevel@tonic-gateprint " *"
437c478bd9Sstevel@tonic-gateprint " * XCurses Library"
447c478bd9Sstevel@tonic-gateprint " *"
457c478bd9Sstevel@tonic-gateprint " * **** THIS FILE IS MACHINE GENERATED."
467c478bd9Sstevel@tonic-gateprint " * **** DO NOT EDIT THIS FILE."
477c478bd9Sstevel@tonic-gateprint " *"
487c478bd9Sstevel@tonic-gateprint " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved."
497c478bd9Sstevel@tonic-gateprint " *"
507c478bd9Sstevel@tonic-gateprintf " * $Header%s\n", "$"
517c478bd9Sstevel@tonic-gateprint " */"
52*ac05f74fSCody Peter Melloprint ""
537c478bd9Sstevel@tonic-gateprint "#ifndef __term_h__"
547c478bd9Sstevel@tonic-gateprint "#define __term_h__\t1"
55*ac05f74fSCody Peter Melloprint ""
567c478bd9Sstevel@tonic-gateprint "#define _XOPEN_CURSES"
57*ac05f74fSCody Peter Melloprint ""
587c478bd9Sstevel@tonic-gateprint "#ifndef NCCS"
597c478bd9Sstevel@tonic-gateprint "#include <termios.h>"
607c478bd9Sstevel@tonic-gateprint "#endif"
617c478bd9Sstevel@tonic-gateprint "#ifndef STDIN_FILENO"
627c478bd9Sstevel@tonic-gateprint "#include <sys/types.h>"
637c478bd9Sstevel@tonic-gateprint "#include <unistd.h>"
647c478bd9Sstevel@tonic-gateprint "#endif"
65*ac05f74fSCody Peter Melloprint ""
667c478bd9Sstevel@tonic-gateprint "#define __TERM cur_term->"
677c478bd9Sstevel@tonic-gate}
687c478bd9Sstevel@tonic-gate
697c478bd9Sstevel@tonic-gate$4 == "bool" {
707c478bd9Sstevel@tonic-gate	printf "#define %-30s __TERM _bool[%d]\n", $1, BoolCount++
717c478bd9Sstevel@tonic-gate}
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gate$4 == "number" {
747c478bd9Sstevel@tonic-gate	printf "#define %-30s __TERM _num[%d]\n", $1, NumberCount++
757c478bd9Sstevel@tonic-gate}
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate$4 == "str" {
787c478bd9Sstevel@tonic-gate	printf "#define %-30s __TERM _str[%d]\n", $1, StringCount++
797c478bd9Sstevel@tonic-gate}
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gateEND {
82*ac05f74fSCody Peter Melloprint ""
837c478bd9Sstevel@tonic-gateprintf "#define __COUNT_BOOL\t\t%d\n", BoolCount
847c478bd9Sstevel@tonic-gateprintf "#define __COUNT_NUM\t\t%d\n", NumberCount
857c478bd9Sstevel@tonic-gateprintf "#define __COUNT_STR\t\t%d\n", StringCount
86*ac05f74fSCody Peter Melloprint ""
877c478bd9Sstevel@tonic-gateprint "/*"
887c478bd9Sstevel@tonic-gateprint " * MKS Header format for terminfo database files."
897c478bd9Sstevel@tonic-gateprint " *"
907c478bd9Sstevel@tonic-gateprint " * The header consists of six short integers, stored using VAX/PDP style"
917c478bd9Sstevel@tonic-gateprint " * byte swapping (least-significant byte first).  The integers are"
927c478bd9Sstevel@tonic-gateprint " *"
937c478bd9Sstevel@tonic-gateprint " *  1) magic number (octal 0432);"
947c478bd9Sstevel@tonic-gateprint " *  2) the size, in bytes, of the names sections;"
957c478bd9Sstevel@tonic-gateprint " *  3) the number of bytes in the boolean section;"
967c478bd9Sstevel@tonic-gateprint " *  4) the number of short integers in the numbers section;"
977c478bd9Sstevel@tonic-gateprint " *  5) the number of offsets (short integers) in the strings section;"
987c478bd9Sstevel@tonic-gateprint " *  6) the size, in bytes, of the string table."
997c478bd9Sstevel@tonic-gateprint " *"
1007c478bd9Sstevel@tonic-gateprint " * Between the boolean and number sections, a null byte is inserted, if"
1017c478bd9Sstevel@tonic-gateprint " * necessary, to ensure that the number section begins on an even byte"
1027c478bd9Sstevel@tonic-gateprint " * offset.  All short integers are aligned on a short word boundary."
1037c478bd9Sstevel@tonic-gateprint " */"
104*ac05f74fSCody Peter Melloprint ""
1057c478bd9Sstevel@tonic-gateprint "#define __TERMINFO_MAGIC\t\t0432"
106*ac05f74fSCody Peter Melloprint ""
1077c478bd9Sstevel@tonic-gateprint "typedef struct {"
1087c478bd9Sstevel@tonic-gateprint "\tshort magic;"
1097c478bd9Sstevel@tonic-gateprint "\tshort name_size;"
1107c478bd9Sstevel@tonic-gateprint "\tshort bool_count;"
1117c478bd9Sstevel@tonic-gateprint "\tshort num_count;"
1127c478bd9Sstevel@tonic-gateprint "\tshort str_count;"
1137c478bd9Sstevel@tonic-gateprint "\tshort str_size;"
1147c478bd9Sstevel@tonic-gateprint "} terminfo_header_t;"
115*ac05f74fSCody Peter Melloprint ""
1167c478bd9Sstevel@tonic-gateprint "/*"
1177c478bd9Sstevel@tonic-gateprint " * The following __MOVE_ constants are indices into the _move[] member"
1187c478bd9Sstevel@tonic-gateprint " * of a SCREEN structure.  The array is used by m_mvcur() for cursor"
1197c478bd9Sstevel@tonic-gateprint " * motion costs and initialized by newterm()."
1207c478bd9Sstevel@tonic-gateprint " *"
1217c478bd9Sstevel@tonic-gateprint " * The following indices refer to relative cursor motion actions that"
1227c478bd9Sstevel@tonic-gateprint " * have a base-cost times the distance/count."
1237c478bd9Sstevel@tonic-gateprint " */"
1247c478bd9Sstevel@tonic-gateprint "#define __MOVE_UP\t\t0"
1257c478bd9Sstevel@tonic-gateprint "#define __MOVE_DOWN\t\t1"
1267c478bd9Sstevel@tonic-gateprint "#define __MOVE_LEFT\t\t2"
1277c478bd9Sstevel@tonic-gateprint "#define __MOVE_RIGHT\t\t3"
1287c478bd9Sstevel@tonic-gateprint "#define __MOVE_TAB\t\t4"
1297c478bd9Sstevel@tonic-gateprint "#define __MOVE_BACK_TAB\t\t5"
130*ac05f74fSCody Peter Melloprint ""
1317c478bd9Sstevel@tonic-gateprint "#define __MOVE_MAX_RELATIVE\t6"
132*ac05f74fSCody Peter Melloprint ""
1337c478bd9Sstevel@tonic-gateprint "/*"
1347c478bd9Sstevel@tonic-gateprint " * These should have fixed costs."
1357c478bd9Sstevel@tonic-gateprint " */"
1367c478bd9Sstevel@tonic-gateprint "#define __MOVE_RETURN\t\t6"
1377c478bd9Sstevel@tonic-gateprint "#define __MOVE_HOME\t\t7"
1387c478bd9Sstevel@tonic-gateprint "#define __MOVE_LAST_LINE\t8"
139*ac05f74fSCody Peter Melloprint ""
1407c478bd9Sstevel@tonic-gateprint "/*"
1417c478bd9Sstevel@tonic-gateprint " * These have worst case cost based on moving the maximum possible"
1427c478bd9Sstevel@tonic-gateprint " * value for a parameter given the screen size."
1437c478bd9Sstevel@tonic-gateprint " */"
1447c478bd9Sstevel@tonic-gateprint "#define __MOVE_N_UP\t\t9"
1457c478bd9Sstevel@tonic-gateprint "#define __MOVE_N_DOWN\t\t10"
1467c478bd9Sstevel@tonic-gateprint "#define __MOVE_N_LEFT\t\t11"
1477c478bd9Sstevel@tonic-gateprint "#define __MOVE_N_RIGHT\t\t12"
1487c478bd9Sstevel@tonic-gateprint "#define __MOVE_ROW\t\t13"
1497c478bd9Sstevel@tonic-gateprint "#define __MOVE_COLUMN\t\t14"
1507c478bd9Sstevel@tonic-gateprint "#define __MOVE_ROW_COLUMN\t15"
151*ac05f74fSCody Peter Melloprint ""
1527c478bd9Sstevel@tonic-gateprint "#define __MOVE_MAX\t\t16"
153*ac05f74fSCody Peter Melloprint ""
1547c478bd9Sstevel@tonic-gateprint "/*"
1557c478bd9Sstevel@tonic-gateprint " * For a cursor motion to be used there must be a base-cost of at least 1."
1567c478bd9Sstevel@tonic-gateprint " */"
1577c478bd9Sstevel@tonic-gateprint "#define __MOVE_INFINITY\t\t1000"
158*ac05f74fSCody Peter Melloprint ""
1597c478bd9Sstevel@tonic-gateprint "#define __TERM_ISATTY_IN\t0x0001\t/* Input is a terminal */"
1607c478bd9Sstevel@tonic-gateprint "#define __TERM_ISATTY_OUT\t0x0002\t/* Output is a terminal */"
1617c478bd9Sstevel@tonic-gateprint "#define __TERM_HALF_DELAY\t0x0004\t/* halfdelay() has priority. */"
1627c478bd9Sstevel@tonic-gateprint "#define __TERM_INSERT_MODE\t0x0008\t/* Terminal is in insert mode. */"
1637c478bd9Sstevel@tonic-gateprint "#define __TERM_NL_IS_CRLF\t0x8000\t/* Newline is mapped on output. */"
164*ac05f74fSCody Peter Melloprint ""
1657c478bd9Sstevel@tonic-gateprint "/***"
1667c478bd9Sstevel@tonic-gateprint " *** Opaque data type.  Keep your grubby mits off."
1677c478bd9Sstevel@tonic-gateprint " ***/"
1687c478bd9Sstevel@tonic-gateprint "typedef struct {"
1697c478bd9Sstevel@tonic-gateprint "\tint _ifd;\t\t\t/* Input file descriptor */"
1707c478bd9Sstevel@tonic-gateprint "\tint _ofd;\t\t\t/* Output file descriptor */"
1717c478bd9Sstevel@tonic-gateprint "\tstruct termios _prog;"
1727c478bd9Sstevel@tonic-gateprint "\tstruct termios _shell;"
1737c478bd9Sstevel@tonic-gateprint "\tstruct termios _save;"
1747c478bd9Sstevel@tonic-gateprint "\tshort _co;\t\t\t/* Current colour-pair. */"
1757c478bd9Sstevel@tonic-gateprint "\tunsigned short _at;\t\t/* Current attribute state. */"
1767c478bd9Sstevel@tonic-gateprint "\tshort (*_pair)[2];"
1777c478bd9Sstevel@tonic-gateprint "\tshort (*_color)[3];"
1787c478bd9Sstevel@tonic-gateprint "\tunsigned short _flags;"
1797c478bd9Sstevel@tonic-gateprint "\tchar _bool[__COUNT_BOOL];"
1807c478bd9Sstevel@tonic-gateprint "\tshort _num[__COUNT_NUM];"
1817c478bd9Sstevel@tonic-gateprint "\tchar *_str[__COUNT_STR];\t/* Pointers into _str_table. */"
1827c478bd9Sstevel@tonic-gateprint "\tchar *_str_table;"
1837c478bd9Sstevel@tonic-gateprint "\tchar *_names;\t\t\t/* Terminal alias in _str_table. */"
1847c478bd9Sstevel@tonic-gateprint "\tchar *_term;\t\t\t/* TERM name loaded. */"
1857c478bd9Sstevel@tonic-gateprint "\tstruct {"
1867c478bd9Sstevel@tonic-gateprint "\t\tchar *_seq;"
1877c478bd9Sstevel@tonic-gateprint "\t\tshort _cost;"
1887c478bd9Sstevel@tonic-gateprint "\t} _move[__MOVE_MAX];"
1897c478bd9Sstevel@tonic-gateprint "} TERMINAL;"
190*ac05f74fSCody Peter Melloprint ""
1917c478bd9Sstevel@tonic-gateprint "extern TERMINAL *cur_term;"
192*ac05f74fSCody Peter Melloprint ""
1937c478bd9Sstevel@tonic-gateprint "extern char *__m_boolnames[];"
1947c478bd9Sstevel@tonic-gateprint "extern char *__m_boolcodes[];"
1957c478bd9Sstevel@tonic-gateprint "extern char *__m_boolfnames[];"
1967c478bd9Sstevel@tonic-gateprint "extern char *__m_numnames[];"
1977c478bd9Sstevel@tonic-gateprint "extern char *__m_numcodes[];"
1987c478bd9Sstevel@tonic-gateprint "extern char *__m_numfnames[];"
1997c478bd9Sstevel@tonic-gateprint "extern char *__m_strnames[];"
2007c478bd9Sstevel@tonic-gateprint "extern char *__m_strcodes[];"
2017c478bd9Sstevel@tonic-gateprint "extern char *__m_strfnames[];"
202*ac05f74fSCody Peter Melloprint ""
2037c478bd9Sstevel@tonic-gateprint "#ifndef _XOPEN_SOURCE"
2047c478bd9Sstevel@tonic-gateprint "/*"
2057c478bd9Sstevel@tonic-gateprint " * Old System V array names."
2067c478bd9Sstevel@tonic-gateprint " */"
2077c478bd9Sstevel@tonic-gateprint "#define boolnames\t__m_boolnames"
2087c478bd9Sstevel@tonic-gateprint "#define boolcodes\t__m_boolcodes"
2097c478bd9Sstevel@tonic-gateprint "#define boolfnames\t__m_boolfnames"
2107c478bd9Sstevel@tonic-gateprint "#define numnames\t__m_numnames"
2117c478bd9Sstevel@tonic-gateprint "#define numcodes\t__m_numcodes"
2127c478bd9Sstevel@tonic-gateprint "#define numfnames\t__m_numfnames"
2137c478bd9Sstevel@tonic-gateprint "#define strnames\t__m_strnames"
2147c478bd9Sstevel@tonic-gateprint "#define strcodes\t__m_strcodes"
2157c478bd9Sstevel@tonic-gateprint "#define strfnames\t__m_strfnames"
2167c478bd9Sstevel@tonic-gateprint "#endif /* _XOPEN_SOURCE */"
217*ac05f74fSCody Peter Melloprint ""
2187c478bd9Sstevel@tonic-gateprint "/*"
2197c478bd9Sstevel@tonic-gateprint " * Exposed internal functions."
2207c478bd9Sstevel@tonic-gateprint " */"
2217c478bd9Sstevel@tonic-gateprint "extern int __m_putchar(int);"
2227c478bd9Sstevel@tonic-gateprint "extern int __m_mvcur(int, int, int, int, int (*)(int));"
2237c478bd9Sstevel@tonic-gateprint "extern int __m_read_terminfo(const char *, TERMINAL *);"
2247c478bd9Sstevel@tonic-gateprint "extern int __m_setupterm(const char *, int, int, int *);"
225*ac05f74fSCody Peter Melloprint ""
2267c478bd9Sstevel@tonic-gateprint "/*"
2277c478bd9Sstevel@tonic-gateprint " * Globals"
2287c478bd9Sstevel@tonic-gateprint " */"
2297c478bd9Sstevel@tonic-gateprint "extern int del_curterm(TERMINAL *);"
2307c478bd9Sstevel@tonic-gateprint "extern TERMINAL *set_curterm(TERMINAL *);"
2317c478bd9Sstevel@tonic-gateprint "extern int restartterm(const char *, int, int *);"
2327c478bd9Sstevel@tonic-gateprint "extern int setupterm(const char *, int, int *);"
233*ac05f74fSCody Peter Melloprint ""
2347c478bd9Sstevel@tonic-gateprint "extern int tgetent(char *, char *);"
2357c478bd9Sstevel@tonic-gateprint "extern int tgetflag(const char *);"
2367c478bd9Sstevel@tonic-gateprint "extern int tgetnum(const char *);"
2377c478bd9Sstevel@tonic-gateprint "extern char *tgetstr(const char *, char **);"
2387c478bd9Sstevel@tonic-gateprint "extern char *tgoto(const char *, int, int);"
239*ac05f74fSCody Peter Melloprint ""
2407c478bd9Sstevel@tonic-gateprint "extern int tigetflag(const char *);"
2417c478bd9Sstevel@tonic-gateprint "extern int tigetnum(const char *);"
2427c478bd9Sstevel@tonic-gateprint "extern char *tigetstr(const char *);"
243*ac05f74fSCody Peter Melloprint ""
2447c478bd9Sstevel@tonic-gateprint "extern int putp(const char *);"
2457c478bd9Sstevel@tonic-gateprint "extern const char *tparm("
2467c478bd9Sstevel@tonic-gateprint "\tconst char *, long, long, long, long, long, long, long, long, long);"
2477c478bd9Sstevel@tonic-gateprint "extern int tputs(const char *, int, int (*)(int));"
248*ac05f74fSCody Peter Melloprint ""
2497c478bd9Sstevel@tonic-gateprint "#ifndef _XOPEN_SOURCE_EXTENDED"
250*ac05f74fSCody Peter Melloprint ""
2517c478bd9Sstevel@tonic-gateprint "#define putp(str)\t\ttputs(str,1,__m_putchar)"
2527c478bd9Sstevel@tonic-gateprint "#define del_term\t\tdel_curterm"
2537c478bd9Sstevel@tonic-gateprint "#define setterm(t)\t\tsetupterm(t,STDOUT_FILENO,(int *) 0)"
2547c478bd9Sstevel@tonic-gateprint "#define tgoto(cm,c,r)\t\ttparm((char *)(cm), (long)(r), (long)(c))"
255*ac05f74fSCody Peter Melloprint ""
2567c478bd9Sstevel@tonic-gateprint "#ifndef _XOPEN_SOURCE"
2577c478bd9Sstevel@tonic-gateprint "#define beehive_glitch\t\tno_esc_ctrlc"
2587c478bd9Sstevel@tonic-gateprint "#define teleray_glitch\t\tdest_tabs_magic_smso"
2597c478bd9Sstevel@tonic-gateprint "#endif /* _XOPEN_SOURCE */"
260*ac05f74fSCody Peter Melloprint ""
2617c478bd9Sstevel@tonic-gateprint "#endif /* _XOPEN_SOURCE_EXTENDED */"
262*ac05f74fSCody Peter Melloprint ""
2637c478bd9Sstevel@tonic-gateprint "#endif /* __term_h__ */"
2647c478bd9Sstevel@tonic-gate}
265