/*
 *  MODULE:  seman.h
 *  semantic Expression analysis and tree modifications
{*  last modification:  26.09.91  10:53   }
     29.01.90 : callclass added
 *Dima 15.07.91 : clrtmp moved from stm
 * uli 26.09.91 : konst and symjustdef moved to stm.h.
*/

#define FCALL IDFUNCTION   /* look only for function call         */
#define PCALL IDPROCEDURE  /* look only for procedure call        */
#define FASGN IDRES1VAR    /* assignment to the function's result */

typedef idkind callclass;

#ifdef LINT_ARGS
global void clrtmp  (binptr root );        /*  c l r t m p  */

						/*  e x p r e s s i o n  */
/* global binptr expression (callclass cc, sc_type * sc) ;         */
  /* expression calls syntax and seman.                            */
  /* expression returns the data type of the expression.           */
  /* expression returns the storage class of the expression in sc. */

#define expression(cc, sc) ( syntax (), seman (binright(binprev), (cc), (sc)) )

							     /*  s e m a n  */
global binptr seman (binptr root, callclass cc, sc_type * sc) ;
  /* seman performs the semantic analysis of expressions and    */
  /*  translates the expression tree to a C tree by adding      */
  /*  address-Operators and temporary variables and so on.      */
  /* seman returns the Pascal data type of the expression,      */
  /*  voidtype is the data type of procedure calls,             */
  /*  anytype indicates error situation.                        */
  /* cc=FASGN, if very left in assignment.                      */
  /* cc=PCALL, if very left and not in assigment.               */
  /* cc=FCALL, if not very left of statement.                   */
  /* seman returns the storage class of the expression in sc.   */
  /*  For the data type of sc, see std.h.                       */

global void chkscalar (binptr datyp, postype pos) ;  /*  c h k s c a l a r  */
  /* report an error at position pos, if the Pascal data type   */
  /*  datyp is not boolean, integer, char, enumeration nor a    */
  /*  subrange of these.                                        */

							  /*  r e c c f n d */
global binptr reccfnd (symptr s, binptr datyp, binptr root) ;
  /* searches in the record datyp for the record element s. */
  /* Appends the union/struct names right of root, if root != NIL */
  /* Returns the data type of the element c. */

global void voidptr ( binptr call,binptr restyp);
#else
global void   clrtmp ();
/* global binptr expression () ; is a macro */
#define expression(cc, sc) ( syntax () , seman (binright(binprev), (cc), (sc)) )
global binptr seman () ;
global void chkscalar () ;
global binptr reccfnd () ;
global void voidptr ();
#endif


