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