/************************************************************************/
/*                                                                      */
/* 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.                                                   */
/*                                                                      */
/************************************************************************/

/* flags used with objects */

#define OB_EXTERNAL	0x1
#define OB_FORIDX	0x2
#define OB_FORWARD	0x4
#define OB_FREETMP	0x8
#define OB_INIT	0x10
#define OB_PACKED	0x20
#define OB_PARMSUBP	0x40
#define OB_PROGPARM	0x80
#define OB_SEEN	0x100
#define OB_SETCONS	0x200
#define OB_TAGFIELD	0x400
#define OB_THREAT	0x800
#define OB_UNDEFINED	0x1000
#define OB_USED	0x2000

/* kinds of objects */

#define OB_ARRAY	0x1
#define OB_BOUNDID	0x2
#define OB_CONFARRAY	0x4
#define OB_CONST	0x8
#define OB_DIRECTIVE	0x10
#define OB_ENUMER	0x20
#define OB_FIELD	0x40
#define OB_FILE	0x80
#define OB_FUNC	0x100
#define OB_KEEPOFF	0x200
#define OB_LABEL	0x400
#define OB_POINTER	0x800
#define OB_PROC	0x1000
#define OB_RECORD	0x2000
#define OB_SET	0x4000
#define OB_STDTYPE	0x8000
#define OB_SUBRANGE	0x10000
#define OB_TYPE	0x20000
#define OB_VALPARM	0x40000
#define OB_VARIABLE	0x80000
#define OB_VARPARM	0x100000

/* objects that are types */

#define OB_ISATYPE(x) ((x) & (OB_ARRAY|OB_CONFARRAY|OB_ENUMER|OB_FILE|\
	OB_POINTER|OB_RECORD|OB_SET|OB_STDTYPE|OB_SUBRANGE|OB_TYPE))

/* types that fit into a register */ 

#define OB_ISSIMPLE(x) ((x) & (OB_STDTYPE|OB_ENUMER|OB_SUBRANGE|OB_POINTER))

/* ordinal types */

#define OB_ISORDINAL(x) \
	(((x)->ob_kind & (OB_STDTYPE|OB_SUBRANGE|OB_ENUMER)) && (x) != std_real)

#define OB_SAMETYPE(t1,t2) \
	((t1) == (t2) || (t1) == std_universal || (t2) == std_universal)


/* reasons for variable accesses */

#define VA_EXPR	0x1
#define VA_ASSIGN	0x2
#define VA_VARPARM	0x4
#define VA_FORIDX	0x8
#define VA_READ 0x10
#define VA_WITH	0x20

/* frequently used global variables and functions */

extern int
	ob_level,
	ob_reclevel,
	symbol
;

extern OBJECT
	*ob_alloc(),
	*ob_block[],
	*ob_define(),
	*ob_search(),
	*ob_searchall(),
	*ob_tmpvar(),
	*p_array_index(),
	*p_array_type(),
	*p_binop(),
	*p_case_const_list(),
	*p_constant(),
	*p_enum_type(),
	*p_expression(),
	*p_factor(),
	*p_field_select(),
	*p_file_type(),
	*p_fp_list(),
	*p_func_call(),
	*p_get_type(),
	*p_ident_list(),
	*p_index_select(),
	*p_member(),
	*p_nextfp(),
	*p_ordinal_type(),
	*p_p_conf_array_schema(),
	*p_ptr_select(),
	*p_ptr_type(),
	*p_record_type(),
	*p_set_cons(),
	*p_set_type(),
	*p_simple_expr(),
	*p_simple_var(),
	*p_std_func(),
	*p_subp_heading(),
	*p_subr_type(),
	*p_term(),
	*p_type_denoter(),
	*p_type_ident(),
	*p_u_conf_array_schema(),
	*p_var_access(),
	*p_write_parm(),
	*std_boolean,
	*std_char,
	*std_error,
	*std_external,
	*std_forward,
	*std_input,
	*std_integer,
	*std_nil,
	*std_output,
	*std_real,
	*std_string,
	*std_text,
	*std_universal
;

/* labels */

extern LGRAPH
	*lb_current,
	*lb_alloc()
;
