/*
 *  MODULE  : optab.h
 *  Operator table
{*  last modification:	18.02.92  18:01   }

 *  uli 04.03.89 : type optabptr added
 *  uli 16.07.91 : opfset sets true.
 *  uli 16.07.91 : opfclr added, sets false.
 * Dima 22.11.91 : Type management functions added
 *  uli 18.02.92 : NOCOERS added.
*/

#define NOCOERS 32000
                      /* indicates no coersion applicable */

#define op_is(op,flag) (opflag(op,false)->flag)  /* Flags request  */
#define opfset(op,flag) (opflag(op,true)->flag) = true   /* Flags set     */
#define opfclr(op,flag) (opflag(op,true)->flag) = false  /* Flags set     */

#ifdef LINT_ARGS

global void      opinit       (void);
global opptr     opins   (symctype symc, /* Operator symbol */
			  symptr psym,   /* Pascal symbol, if userdefined */
			  symptr csym,   /* C symbol, if function call */
					 /* symNIL, if C Operator */
			  binptr restyp, /* result type */
			  binptr ltyp,   /* left operand type */
			  binptr rtyp,   /* right operand type */
			  boolean varl,  /* var/value of left operand */
			  boolean varr   /* var/value of right operand */
			 );
global opptr     opfnd        (symctype symc, symptr psym,
			       binptr ltyp, binptr rtyp, postype oppos);
global symptr    oppsym       (opptr);
global symptr    opcsym       (opptr);
global symctype  opsymc       (opptr);
global shortint  oppriority   (opptr);
global boolean   opfunct      (opptr);
global binptr    opresult     (opptr);
global idflags * opflag       (opptr op, boolean set);
global binptr    opbin        (opptr);
global idptr     optypl       (opptr);
global idptr     optypr       (opptr);
global void      opsetcsym    (opptr, symptr);
global int       opforw       (optabptr,int);
global void      opsetbin     (opptr, binptr);

#else

global void      opinit       ();
global opptr     opins        (/*symc,func,sym1,sym2,typ1,typ2*/);
global opptr     opfnd        (/*symc,sym,typ1,typ2*/);
global symptr    oppsym       (/*op*/);
global symptr    opcsym       (/*op*/);
global symctype  opsymc       (/*opptr*/);
global shortint  oppriority   (/*op*/);
global boolean   opfunct      (/*op*/);
global binptr    opresult     (/*op*/);
global idflags * opflag       (/*op, set*/);
global binptr    opbin        ();
global idptr     optypl       ();
global idptr     optypr       ();
global void      opsetcsym    ();
global int       opforw       ();
global void      opsetbin     ();

#endif /*LINT_ARGS*/



/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/* The following declaration is necessary to satisfy forward declaration. */
/* Do not use the following names globally. */

struct oprlist {
	  /* status should be the first member!! */
		   idflags      status;      /* flags */
		   idptr        typr;        /* right operand type */
		   symptr       csym;        /* C symbol */
		   binptr       restyp;      /* result type */
		   binptr          bin;      /* Declaration of Operator. */
		   optabptr     op;          /* reference to symbol code */
					     /* and Pascal symbol.       */
		   opptr        next;        /* linear list */
	      };

struct opllist {
		   idptr          typl;           /* left operand type */
		   opptr          rlist;          /* list of right types */
		   struct opllist  *next;         /* linear list */
	     };

struct op {
	     symctype        symc;           /* symbol code of op.symbol */
	     symptr          psym;           /* Pascal symbol */
	     struct opllist *llist;          /* list of left types */
	     optabptr        next;           /* linear list */
	  };

/* Type management functions */
#ifdef LINT_ARGS
global binptr  type_conv     ( binptr exp, binptr act_type ,
			       boolean *not_found);
global void    coerse         ( binptr lista, binptr listf , binptr clist );
global int     binncoers      ( binptr lista, binptr listf );
global boolean compatible     (  binptr left, binptr right );
global boolean typ_compatible (  binptr ltyp, binptr rtyp );
global binptr  stdtyp         ( binptr loctyp);
#else
global binptr  type_conv      ();
global void    coerse         ();
global int     binncoers      ();
global boolean compatible     ();
global boolean typ_compatible ();
global binptr  stdtyp         ();
#endif

