17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 1997 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate /* 317c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 327c478bd9Sstevel@tonic-gate * The Regents of the University of California 337c478bd9Sstevel@tonic-gate * All Rights Reserved 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 367c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 377c478bd9Sstevel@tonic-gate * contributors. 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #ifndef _COMPILER_H 417c478bd9Sstevel@tonic-gate #define _COMPILER_H 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* 447c478bd9Sstevel@tonic-gate * COPYRIGHT NOTICE 457c478bd9Sstevel@tonic-gate * 467c478bd9Sstevel@tonic-gate * This software is copyright(C) 1982 by Pavel Curtis 477c478bd9Sstevel@tonic-gate * 487c478bd9Sstevel@tonic-gate * Permission is granted to reproduce and distribute 497c478bd9Sstevel@tonic-gate * this file by any means so long as no fee is charged 507c478bd9Sstevel@tonic-gate * above a nominal handling fee and so long as this 517c478bd9Sstevel@tonic-gate * notice is always included in the copies. 527c478bd9Sstevel@tonic-gate * 537c478bd9Sstevel@tonic-gate * Other rights are reserved except as explicitly granted 547c478bd9Sstevel@tonic-gate * by written permission of the author. 557c478bd9Sstevel@tonic-gate * Pavel Curtis 567c478bd9Sstevel@tonic-gate * Computer Science Dept. 577c478bd9Sstevel@tonic-gate * 405 Upson Hall 587c478bd9Sstevel@tonic-gate * Cornell University 597c478bd9Sstevel@tonic-gate * Ithaca, NY 14853 607c478bd9Sstevel@tonic-gate * 617c478bd9Sstevel@tonic-gate * Ph- (607) 256-4934 627c478bd9Sstevel@tonic-gate * 637c478bd9Sstevel@tonic-gate * Pavel.Cornell@Udel-Relay(ARPAnet) 647c478bd9Sstevel@tonic-gate * decvax!cornell!pavel (UUCPnet) 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * compiler.h - Global variables and structures for the terminfo 707c478bd9Sstevel@tonic-gate * compiler. 717c478bd9Sstevel@tonic-gate * 727c478bd9Sstevel@tonic-gate * $Header: RCS/compiler.v Revision 2.1 82/10/25 14:46:04 pavel Exp$ 737c478bd9Sstevel@tonic-gate * 747c478bd9Sstevel@tonic-gate * $Log: RCS/compiler.v $ 757c478bd9Sstevel@tonic-gate * Revision 2.1 82/10/25 14:46:04 pavel 767c478bd9Sstevel@tonic-gate * Added Copyright Notice 777c478bd9Sstevel@tonic-gate * 787c478bd9Sstevel@tonic-gate * Revision 2.0 82/10/24 15:17:20 pavel 797c478bd9Sstevel@tonic-gate * Beta-one Test Release 807c478bd9Sstevel@tonic-gate * 817c478bd9Sstevel@tonic-gate * Revision 1.3 82/08/23 22:30:09 pavel 827c478bd9Sstevel@tonic-gate * The REAL Alpha-one Release Version 837c478bd9Sstevel@tonic-gate * 847c478bd9Sstevel@tonic-gate * Revision 1.2 82/08/19 19:10:10 pavel 857c478bd9Sstevel@tonic-gate * Alpha Test Release One 867c478bd9Sstevel@tonic-gate * 877c478bd9Sstevel@tonic-gate * Revision 1.1 82/08/12 18:38:11 pavel 887c478bd9Sstevel@tonic-gate * Initial revision 897c478bd9Sstevel@tonic-gate * 907c478bd9Sstevel@tonic-gate */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #include <stdio.h> 937c478bd9Sstevel@tonic-gate #include <signal.h> /* use this file to determine if this is SVR4.0 system */ 947c478bd9Sstevel@tonic-gate #include <time.h> 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate #ifdef __cplusplus 977c478bd9Sstevel@tonic-gate extern "C" { 987c478bd9Sstevel@tonic-gate #endif 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #ifndef TRUE 1017c478bd9Sstevel@tonic-gate #define TRUE 1 1027c478bd9Sstevel@tonic-gate #define FALSE 0 1037c478bd9Sstevel@tonic-gate #endif 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate #ifndef EXTERN /* for machines w/o multiple externs */ 1067c478bd9Sstevel@tonic-gate #define EXTERN extern 1077c478bd9Sstevel@tonic-gate #endif /* EXTERN */ 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate #define SINGLE /* only one terminal (actually none) */ 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate extern char *destination; /* destination directory for object files */ 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate EXTERN long start_time; /* time at start of compilation */ 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate EXTERN int curr_line; /* current line # in input */ 1167c478bd9Sstevel@tonic-gate EXTERN long curr_file_pos; /* file offset of current line */ 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate EXTERN int debug_level; /* level of debugging output */ 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #define DEBUG(level, fmt, a1) \ 1217c478bd9Sstevel@tonic-gate if (debug_level >= level)\ 1227c478bd9Sstevel@tonic-gate fprintf(stderr, fmt, a1); 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* 1257c478bd9Sstevel@tonic-gate * These are the types of tokens returned by the scanner. 1267c478bd9Sstevel@tonic-gate * The first three are also used in the hash table of capability 1277c478bd9Sstevel@tonic-gate * names. The scanner returns one of these values after loading 1287c478bd9Sstevel@tonic-gate * the specifics into the global structure curr_token. 1297c478bd9Sstevel@tonic-gate * 1307c478bd9Sstevel@tonic-gate */ 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate #define BOOLEAN 0 /* Boolean capability */ 1337c478bd9Sstevel@tonic-gate #define NUMBER 1 /* Numeric capability */ 1347c478bd9Sstevel@tonic-gate #define STRING 2 /* String-valued capability */ 1357c478bd9Sstevel@tonic-gate #define CANCEL 3 /* Capability to be cancelled in following tc's */ 1367c478bd9Sstevel@tonic-gate #define NAMES 4 /* The names for a terminal type */ 137*09a48d4cSRichard Lowe #define UNDEF 5 /* Invalid token type */ 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #define MAXBOOLS 64 /* Maximum # of boolean caps we can handle */ 1407c478bd9Sstevel@tonic-gate #define MAXNUMS 64 /* Maximum # of numeric caps we can handle */ 1417c478bd9Sstevel@tonic-gate #define MAXSTRINGS 512 /* Maximum # of string caps we can handle */ 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate /* 1447c478bd9Sstevel@tonic-gate * The global structure in which the specific parts of a 1457c478bd9Sstevel@tonic-gate * scanned token are returned. 1467c478bd9Sstevel@tonic-gate * 1477c478bd9Sstevel@tonic-gate */ 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate struct token 1507c478bd9Sstevel@tonic-gate { 1517c478bd9Sstevel@tonic-gate char *tk_name; /* name of capability */ 1527c478bd9Sstevel@tonic-gate int tk_valnumber; /* value of capability (if a number) */ 1537c478bd9Sstevel@tonic-gate char *tk_valstring; /* value of capability (if a string) */ 1547c478bd9Sstevel@tonic-gate }; 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate EXTERN struct token curr_token; 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate /* 1597c478bd9Sstevel@tonic-gate * The file comp_captab.c contains an array of these structures, 1607c478bd9Sstevel@tonic-gate * one per possible capability. These are then made into a hash 1617c478bd9Sstevel@tonic-gate * table array of the same structures for use by the parser. 1627c478bd9Sstevel@tonic-gate * 1637c478bd9Sstevel@tonic-gate */ 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate struct name_table_entry 1667c478bd9Sstevel@tonic-gate { 1677c478bd9Sstevel@tonic-gate struct name_table_entry *nte_link; 1687c478bd9Sstevel@tonic-gate char *nte_name; /* name to hash on */ 1697c478bd9Sstevel@tonic-gate int nte_type; /* BOOLEAN, NUMBER or STRING */ 1707c478bd9Sstevel@tonic-gate short nte_index; /* index of associated variable in its array */ 1717c478bd9Sstevel@tonic-gate }; 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate extern struct name_table_entry cap_table[]; 1747c478bd9Sstevel@tonic-gate extern struct name_table_entry *cap_hash_table[]; 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate extern int Captabsize; 1777c478bd9Sstevel@tonic-gate extern int Hashtabsize; 1787c478bd9Sstevel@tonic-gate extern int BoolCount; 1797c478bd9Sstevel@tonic-gate extern int NumCount; 1807c478bd9Sstevel@tonic-gate extern int StrCount; 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate #define NOTFOUND ((struct name_table_entry *)0) 1837c478bd9Sstevel@tonic-gate /* 1847c478bd9Sstevel@tonic-gate * Function types 1857c478bd9Sstevel@tonic-gate * 1867c478bd9Sstevel@tonic-gate */ 1877c478bd9Sstevel@tonic-gate 1887c478bd9Sstevel@tonic-gate struct name_table_entry *find_entry(); /* look up entry in hash table */ 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate int next_char(); 1917c478bd9Sstevel@tonic-gate int trans_string(); 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate #ifdef SIGSTOP /* SVR4.0 and beyond */ 1947c478bd9Sstevel@tonic-gate #define SRCDIR "/usr/share/lib/terminfo" 1957c478bd9Sstevel@tonic-gate #else 1967c478bd9Sstevel@tonic-gate #define SRCDIR "/usr/lib/terminfo" 1977c478bd9Sstevel@tonic-gate #endif 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2007c478bd9Sstevel@tonic-gate } 2017c478bd9Sstevel@tonic-gate #endif 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate #endif /* _COMPILER_H */ 204