xref: /titanic_41/usr/src/lib/libxcurses/src/tic/tic.h (revision 355b4669e025ff377602b6fc7caaf30dbc218371)
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 /*
23  * Copyright (c) 1996, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  *	tic.h			Terminal Information Compiler
31  *
32  *	Copyright 1990, 1992 by Mortice Kern Systems Inc.  All rights reserved.
33  *
34  *	Portions of this code Copyright 1982 by Pavel Curtis.
35  *
36  */
37 
38 #ifndef tic_h
39 #define tic_h	1
40 
41 #ifdef M_RCSID
42 #ifndef lint
43 static char const tic_h_rcsID[] = "$Header: /rd/src/tic/rcs/tic.h 1.11 1995/06/22 20:03:36 ant Exp $";
44 #endif
45 #endif
46 
47 #include <mks.h>
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <string.h>
51 #include <term.h>
52 #include <time.h>
53 
54 extern char *_cmdname;
55 
56 /* Exit Status */
57 #define SUCCESS		0
58 #define NOT_DEFINED	1
59 #define USAGE		2
60 #define BAD_TERMINAL	3
61 #define NOT_VALID	4
62 #define ERROR		5
63 
64 #define TERM_NAMES_LENGTH	128
65 #define TERM_ENTRY_LENGTH	4096
66 #define swap(x)			(((x >> 8) & 0377) + 256 * (x & 0377))
67 
68 extern int term_names;		/* string offset */
69 extern char *string_table;
70 extern char *source_file;
71 
72 #ifdef _XOPEN_CURSES
73 /*
74  * MKS XCurses to be conforming has to avoid name space pollution
75  * by using reserved prefixes.  Map the pre-XCurses names to the
76  * new ones.
77  */
78 #define BOOLCOUNT	__COUNT_BOOL
79 #define NUMCOUNT	__COUNT_NUM
80 #define STRCOUNT	__COUNT_STR
81 #define boolnames       __m_boolnames
82 #define boolcodes       __m_boolcodes
83 #define boolfnames      __m_boolfnames
84 #define numnames        __m_numnames
85 #define numcodes        __m_numcodes
86 #define numfnames       __m_numfnames
87 #define strnames        __m_strnames
88 #define strcodes        __m_strcodes
89 #define strfnames       __m_strfnames
90 #define __t_term_header	terminfo_header_t
91 #define TERMINFO_MAGIC	__TERMINFO_MAGIC
92 #define Booleans	_bool
93 #define Numbers		_num
94 #define Strings		_str
95 #endif
96 
97 extern char boolean[BOOLCOUNT];	/* 0, 1, cancel 2 */
98 extern short number[NUMCOUNT];	/* positive value, missing -1, cancel -2 */
99 extern short string[STRCOUNT];	/* positive offset, missing -1, cancel -2 */
100 
101 extern int check_only;
102 extern char *destination;	/* destination directory for object files */
103 extern time_t start_time;	/* time at start of compilation */
104 extern int curr_line;		/* current line # in input */
105 extern long curr_file_pos;	/* file offset of current line */
106 extern int debug_level;		/* level of debugging output */
107 
108 #define DEBUG(level, fmt, a1) \
109 	if (level <= debug_level) \
110 		 fprintf(stderr, fmt, a1);
111 
112 /*
113  *	These are the types of tokens returned by the scanner.
114  *	The first three are also used in the hash table of capability
115  *	names.  The scanner returns one of these values after loading
116  *	the specifics into the global structure curr_token.
117  */
118 #define BOOLEAN 0	/* Boolean capability */
119 #define NUMBER 1	/* Numeric capability */
120 #define STRING 2	/* String-valued capability */
121 #define CANCEL 3	/* Capability to be cancelled in following tc's */
122 #define NAMES  4	/* The names for a terminal type */
123 
124 /*
125  *	The global structure in which the specific parts of a
126  *	scanned token are returned.
127  */
128 typedef struct token {
129 	char *tk_name;		/* name of capability */
130 	int tk_valnumber;	/* value of capability (if a number) */
131 	char *tk_valstring;	/* value of capability (if a string) */
132 } token;
133 
134 extern token curr_token;
135 
136 /*
137  *	Functions
138  */
139 extern void compile ANSI((void));
140 extern void err_abort(char const *_Fmt, ...);	/* GENTEXT: err_abort */
141 extern int find(char const *_Capname, void **_Arrayp, int *_Indexp);
142 extern void panic_mode ANSI((int _Ch));
143 extern void reset ANSI((void));
144 extern void reset_input ANSI((void));
145 extern void warning(char const *_Fmt, ...);	/* GENTEXT: warning */
146 
147 extern int warnings;
148 
149 #define syserr_abort	err_abort
150 
151 #endif /* tic_h */
152