xref: /titanic_50/usr/src/lib/libcurses/screen/compiler.h (revision 9584cebb1c69707f4c67306b661c2ed47d8676f1)
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 1997 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1988 AT&T	*/
28 /*	  All Rights Reserved	*/
29 
30 /*
31  * University Copyright- Copyright (c) 1982, 1986, 1988
32  * The Regents of the University of California
33  * All Rights Reserved
34  *
35  * University Acknowledgment- Portions of this document are derived from
36  * software developed by the University of California, Berkeley, and its
37  * contributors.
38  */
39 
40 #ifndef	_COMPILER_H
41 #define	_COMPILER_H
42 
43 /*
44  *			COPYRIGHT NOTICE
45  *
46  *	This software is copyright(C) 1982 by Pavel Curtis
47  *
48  *	Permission is granted to reproduce and distribute
49  *	this file by any means so long as no fee is charged
50  *	above a nominal handling fee and so long as this
51  *	notice is always included in the copies.
52  *
53  *	Other rights are reserved except as explicitly granted
54  *	by written permission of the author.
55  *		Pavel Curtis
56  *		Computer Science Dept.
57  *		405 Upson Hall
58  *		Cornell University
59  *		Ithaca, NY 14853
60  *
61  *		Ph- (607) 256-4934
62  *
63  *		Pavel.Cornell@Udel-Relay(ARPAnet)
64  *		decvax!cornell!pavel		(UUCPnet)
65  */
66 
67 
68 /*
69  *	compiler.h - Global variables and structures for the terminfo
70  *			compiler.
71  *
72  *  $Header:   RCS/compiler.v  Revision 2.1  82/10/25  14:46:04  pavel  Exp$
73  *
74  *  $Log:	RCS/compiler.v $
75  * Revision 2.1  82/10/25  14:46:04  pavel
76  * Added Copyright Notice
77  *
78  * Revision 2.0  82/10/24  15:17:20  pavel
79  * Beta-one Test Release
80  *
81  * Revision 1.3  82/08/23  22:30:09  pavel
82  * The REAL Alpha-one Release Version
83  *
84  * Revision 1.2  82/08/19  19:10:10  pavel
85  * Alpha Test Release One
86  *
87  * Revision 1.1  82/08/12  18:38:11  pavel
88  * Initial revision
89  *
90  */
91 
92 #include <stdio.h>
93 #include <signal.h>   /* use this file to determine if this is SVR4.0 system */
94 #include <time.h>
95 
96 #ifdef	__cplusplus
97 extern "C" {
98 #endif
99 
100 #ifndef TRUE
101 #define	TRUE	1
102 #define	FALSE	0
103 #endif
104 
105 #ifndef EXTERN				/* for machines w/o multiple externs */
106 #define	EXTERN extern
107 #endif /* EXTERN */
108 
109 #define	SINGLE			/* only one terminal (actually none) */
110 
111 extern char	*destination;	/* destination directory for object files */
112 
113 EXTERN long	start_time;	/* time at start of compilation */
114 
115 EXTERN int	curr_line;	/* current line # in input */
116 EXTERN long	curr_file_pos;	/* file offset of current line */
117 
118 EXTERN int	debug_level;	/* level of debugging output */
119 
120 #define	DEBUG(level, fmt, a1) \
121 		if (debug_level >= level)\
122 		    fprintf(stderr, fmt, a1);
123 
124 	/*
125 	 *	These are the types of tokens returned by the scanner.
126 	 *	The first three are also used in the hash table of capability
127 	 *	names.  The scanner returns one of these values after loading
128 	 *	the specifics into the global structure curr_token.
129 	 *
130 	 */
131 
132 #define	BOOLEAN	0	/* Boolean capability */
133 #define	NUMBER	1	/* Numeric capability */
134 #define	STRING	2	/* String-valued capability */
135 #define	CANCEL	3	/* Capability to be cancelled in following tc's */
136 #define	NAMES	4	/* The names for a terminal type */
137 #define	UNDEF	5	/* Invalid token type */
138 
139 #define	MAXBOOLS 64	/* Maximum # of boolean caps we can handle */
140 #define	MAXNUMS	64	/* Maximum # of numeric caps we can handle */
141 #define	MAXSTRINGS 512	/* Maximum # of string caps we can handle */
142 
143 	/*
144 	 *	The global structure in which the specific parts of a
145 	 *	scanned token are returned.
146 	 *
147 	 */
148 
149 struct token
150 {
151 	char	*tk_name;		/* name of capability */
152 	int	tk_valnumber;	/* value of capability (if a number) */
153 	char	*tk_valstring;	/* value of capability (if a string) */
154 };
155 
156 EXTERN struct token	curr_token;
157 
158 	/*
159 	 *	The file comp_captab.c contains an array of these structures,
160 	 *	one per possible capability.  These are then made into a hash
161 	 *	table array of the same structures for use by the parser.
162 	 *
163 	 */
164 
165 struct name_table_entry
166 {
167 	struct name_table_entry *nte_link;
168 	char	*nte_name;	/* name to hash on */
169 	int	nte_type;	/* BOOLEAN, NUMBER or STRING */
170 	short	nte_index;	/* index of associated variable in its array */
171 };
172 
173 extern struct name_table_entry	cap_table[];
174 extern struct name_table_entry	*cap_hash_table[];
175 
176 extern int	Captabsize;
177 extern int	Hashtabsize;
178 extern int	BoolCount;
179 extern int	NumCount;
180 extern int	StrCount;
181 
182 #define	NOTFOUND	((struct name_table_entry *)0)
183 	/*
184 	 *	Function types
185 	 *
186 	 */
187 
188 struct name_table_entry	*find_entry();	/* look up entry in hash table */
189 
190 int	next_char();
191 int	trans_string();
192 
193 #ifdef SIGSTOP	/* SVR4.0 and beyond */
194 #define	SRCDIR "/usr/share/lib/terminfo"
195 #else
196 #define	SRCDIR "/usr/lib/terminfo"
197 #endif
198 
199 #ifdef	__cplusplus
200 }
201 #endif
202 
203 #endif	/* _COMPILER_H */
204