/* 
 * $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 */

/*	Copyright (c) 1984 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/
#ident	"$Header: colltbl.h 1.3 90/01/11 $@(#)colltbl.h	1.1 89/12/06"

#include <stdio.h>
#ifndef PARSER
#include "y.tab.h"
#endif

/* Boolean expression mnemonics */
#define TRUE		1
#define FALSE		0
typedef unsigned short	BOOLEAN;

/* Size mnemonics */
#define MAXHASH		100

/* Diagnostic mnemonics */
#define WARNING		0
#define _ERROR		1
#define ABORT		2
#define GEN_ERR		0
#define DUPLICATE	1
#define EXPECTED	2
#define ILLEGAL		3
#define TOO_LONG	4
#define INSERTED	5
#define NOT_FOUND	6
#define NOT_DEFINED	7
#define TOO_MANY	8
#define INVALID		9
#define BAD_OPEN	10
#define NO_SPACE	11
#define NEWLINE		12
#define REGERR		13

/* Structure entry for symbol table */
typedef struct entry {
	char		*name;
	unsigned short	type;
	unsigned short	regexp_len; /* If type Regular expression
				     * length of compiled RE */
	unsigned short	delete_flag;
	union {
		struct {
			unsigned short	primary;
			unsigned short	secondary;
		} symval;
		struct {
			char		*repl_string;
		} replval;
	} uval;
	struct entry	*thread;
	struct entry	*next;
} SYMNODE;

/* Preprocessor macro definitions */
#define TURNON(x)	x = TRUE
#define TURNOFF(x)	x = FALSE
#define EQ(x,y)		(strcmp(x,y) == 0)
#define GE(x,y)		(strcmp(x,y) >= 0)
#define GT(x,y)		(strcmp(x,y) > 0)
#define LE(x,y)		(strcmp(x,y) <= 0)
#define LT(x,y)		(strcmp(x,y) < 0)
#define MAX(x,y)	(x > y ? x : y)
#define DEBUG(x)	if(yydebug) fprintf x

/* Symbol Table Handler Functions and Subroutines */
SYMNODE	*lookup();
SYMNODE *insert();
void	delete();
SYMNODE	*sortlist();

/* Code Generation Routine */
void	codegen();
void	put_value();

/* Diagnostics Functions and Subroutines */
void	error();
void	regerr();
void	usage();
