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