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