2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/* Copyright (c) 1988 AT&T */
2N/A/* All Rights Reserved */
2N/A
2N/A/*
2N/A * University Copyright- Copyright (c) 1982, 1986, 1988
2N/A * The Regents of the University of California
2N/A * All Rights Reserved
2N/A *
2N/A * University Acknowledgment- Portions of this document are derived from
2N/A * software developed by the University of California, Berkeley, and its
2N/A * contributors.
2N/A */
2N/A
2N/A#ifndef _COMPILER_H
2N/A#define _COMPILER_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A/*
2N/A * COPYRIGHT NOTICE
2N/A *
2N/A * This software is copyright(C) 1982 by Pavel Curtis
2N/A *
2N/A * Permission is granted to reproduce and distribute
2N/A * this file by any means so long as no fee is charged
2N/A * above a nominal handling fee and so long as this
2N/A * notice is always included in the copies.
2N/A *
2N/A * Other rights are reserved except as explicitly granted
2N/A * by written permission of the author.
2N/A * Pavel Curtis
2N/A * Computer Science Dept.
2N/A * 405 Upson Hall
2N/A * Cornell University
2N/A * Ithaca, NY 14853
2N/A *
2N/A * Ph- (607) 256-4934
2N/A *
2N/A * Pavel.Cornell@Udel-Relay(ARPAnet)
2N/A * decvax!cornell!pavel (UUCPnet)
2N/A */
2N/A
2N/A
2N/A/*
2N/A * compiler.h - Global variables and structures for the terminfo
2N/A * compiler.
2N/A *
2N/A * $Header: RCS/compiler.v Revision 2.1 82/10/25 14:46:04 pavel Exp$
2N/A *
2N/A * $Log: RCS/compiler.v $
2N/A * Revision 2.1 82/10/25 14:46:04 pavel
2N/A * Added Copyright Notice
2N/A *
2N/A * Revision 2.0 82/10/24 15:17:20 pavel
2N/A * Beta-one Test Release
2N/A *
2N/A * Revision 1.3 82/08/23 22:30:09 pavel
2N/A * The REAL Alpha-one Release Version
2N/A *
2N/A * Revision 1.2 82/08/19 19:10:10 pavel
2N/A * Alpha Test Release One
2N/A *
2N/A * Revision 1.1 82/08/12 18:38:11 pavel
2N/A * Initial revision
2N/A *
2N/A */
2N/A
2N/A#include <stdio.h>
2N/A#include <signal.h> /* use this file to determine if this is SVR4.0 system */
2N/A#include <time.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#ifndef TRUE
2N/A#define TRUE 1
2N/A#define FALSE 0
2N/A#endif
2N/A
2N/A#ifndef EXTERN /* for machines w/o multiple externs */
2N/A#define EXTERN extern
2N/A#endif /* EXTERN */
2N/A
2N/A#define SINGLE /* only one terminal (actually none) */
2N/A
2N/Aextern char *destination; /* destination directory for object files */
2N/A
2N/AEXTERN long start_time; /* time at start of compilation */
2N/A
2N/AEXTERN int curr_line; /* current line # in input */
2N/AEXTERN long curr_file_pos; /* file offset of current line */
2N/A
2N/AEXTERN int debug_level; /* level of debugging output */
2N/A
2N/A#define DEBUG(level, fmt, a1) \
2N/A if (debug_level >= level)\
2N/A fprintf(stderr, fmt, a1);
2N/A
2N/A /*
2N/A * These are the types of tokens returned by the scanner.
2N/A * The first three are also used in the hash table of capability
2N/A * names. The scanner returns one of these values after loading
2N/A * the specifics into the global structure curr_token.
2N/A *
2N/A */
2N/A
2N/A#define BOOLEAN 0 /* Boolean capability */
2N/A#define NUMBER 1 /* Numeric capability */
2N/A#define STRING 2 /* String-valued capability */
2N/A#define CANCEL 3 /* Capability to be cancelled in following tc's */
2N/A#define NAMES 4 /* The names for a terminal type */
2N/A
2N/A#define MAXBOOLS 64 /* Maximum # of boolean caps we can handle */
2N/A#define MAXNUMS 64 /* Maximum # of numeric caps we can handle */
2N/A#define MAXSTRINGS 512 /* Maximum # of string caps we can handle */
2N/A
2N/A /*
2N/A * The global structure in which the specific parts of a
2N/A * scanned token are returned.
2N/A *
2N/A */
2N/A
2N/Astruct token
2N/A{
2N/A char *tk_name; /* name of capability */
2N/A int tk_valnumber; /* value of capability (if a number) */
2N/A char *tk_valstring; /* value of capability (if a string) */
2N/A};
2N/A
2N/AEXTERN struct token curr_token;
2N/A
2N/A /*
2N/A * The file comp_captab.c contains an array of these structures,
2N/A * one per possible capability. These are then made into a hash
2N/A * table array of the same structures for use by the parser.
2N/A *
2N/A */
2N/A
2N/Astruct name_table_entry
2N/A{
2N/A struct name_table_entry *nte_link;
2N/A char *nte_name; /* name to hash on */
2N/A int nte_type; /* BOOLEAN, NUMBER or STRING */
2N/A short nte_index; /* index of associated variable in its array */
2N/A};
2N/A
2N/Aextern struct name_table_entry cap_table[];
2N/Aextern struct name_table_entry *cap_hash_table[];
2N/A
2N/Aextern int Captabsize;
2N/Aextern int Hashtabsize;
2N/Aextern int BoolCount;
2N/Aextern int NumCount;
2N/Aextern int StrCount;
2N/A
2N/A#define NOTFOUND ((struct name_table_entry *)0)
2N/A /*
2N/A * Function types
2N/A *
2N/A */
2N/A
2N/Astruct name_table_entry *find_entry(); /* look up entry in hash table */
2N/A
2N/Aint next_char();
2N/Aint trans_string();
2N/A
2N/A#ifdef SIGSTOP /* SVR4.0 and beyond */
2N/A#define SRCDIR "/usr/share/lib/terminfo"
2N/A#else
2N/A#define SRCDIR "/usr/lib/terminfo"
2N/A#endif
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _COMPILER_H */