/************************************************************************/
/*                                                                      */
/* Copyright (c) 1988 -                                                 */
/*     The Rector and Visitors of the University of Virginia            */
/*                                                                      */
/* This code may not be distributed further without permission          */
/*      from the University of Virginia.                                */
/* This code is distributed WITHOUT ANY WARRANTY.  No claims are        */
/*      made as to whether it serves any particular purpose or even     */
/*      works at all.                                                   */
/*                                                                      */
/************************************************************************/

/*
 * The DISPLAY is used for up level references, i.e., references to
 * variables declared at an enclosing scope level.  For each static
 * scope level, the display contains the frame pointer %fp and the
 * argument pointer %ap of the most recent activation of a function
 * or procedure defined at that level.
 */

typedef char *DISPLAY[2*OB_MAXLEVEL];

/*
 * A DISPAREA is a struct for saving the current display, the current
 * static scope level, and a function or procedure entry point.
 * This is used when a procedure or function is passed as a parameter.
 */

typedef struct {
	char *d_entrypt;
	int   d_level;
	DISPLAY d_save;
} DISPAREA;

/*
 * A FILEAREA is a structure for storing information about an active
 * file.  Each file variable is allocated a FILEAREA followed by
 * enough memory to hold the file's buffer variable.
 */

typedef  struct _FA {
	char   * _filename;
	FILE   * _stream;
	int      _flags;
	int      _reclength;
	int      _magic;
} FILEAREA;


/*  _flags field bits  */

#define _TEXT	0x1
#define _WNDOLIVE	0x2
#define _PERMFILE	0x4
#define _OPEN	0x8
#define _LAZY	0x10
#define _EOLN	0x20
#define _EOF	0x40
#define _STDIN	0x80
#define _STDOUT	0x100
#define _STDERR	0x200

/* FILEAREA has been initialized when p->_magic == _MAGIC */

# define   _MAGIC	570305


/*
 * A SET is a structure that implements a Pascal set.
 */

#define WBITS    32 	/* bits per WORD */
#define MAPLENG   9		/* number of WORDS in the bit map */
#define MAXELM WBITS*MAPLENG

typedef unsigned long WORD;

typedef struct {
	int st_min, st_max;
	WORD st_bits[MAPLENG];
} SET;
