/*
 *  MODULE:  std.h
 *  analysis and tree modification for
 *    standard procedures, functions and Operators
 *  initialization of standard identifiers
{*  last modification:	04.02.92  12:36   }

 *  uli 17.05.91: namestring in not LINT_ARGS add.
 *  uli 12.12.91: printname deleted.
 *  uli 04.02.92: varexp added.
*/

extern boolean strong_comp ;/*strong type compatibility ON/OFF */

/* tempvar is the reference to the declaration of the last temporary
 * variable created but not released, if any.
 * Is used for the optimisation of reusing temporary variables.
 * Can be modified by setconstructor, seman for functions with array
 * result, stdOperator for set operations and subarray construction.
 * Must  cleared  immedeately after each call to seman in stm.c
 * In palist must be saved in an array of local variables and
 *  all the array must be cleared at the end of palist
 * In seman for Operators - ???
 * In stdOperator - ???
 *
*/
global binptr tempvar ;




			     /* values for storage class of expressions */
typedef enum { sc_unknown    /* error situation */
	     , sc_const      /* constant expression */
	     , sc_econst     /* Pascal constant, C expression (long real) */
	     , sc_var        /* Pascal-variable */
	     , sc_evar       /* Pascal-variable, C expression (subarray) */
	     , sc_temp       /* variable in C, non variable in Pascal */
	     , sc_expr       /* non variable, non constant */
	     } sc_type ;

#ifdef LINT_ARGS
global binptr illroutine (binptr exp, binptr atyp, boolean *not_found );

global char * namestring  (binptr node) ;            /*  n a m e s t r i n g  */
  /* returns a textual representation of the */
  /*  identifier node *node or a data type, */
  /*  used for errormessages. */
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.                                        */
global void chkvarparam (binptr datyp, postype pos) ; /*  c h k v a r p a r a m  */
  /* report a warning at position pos, if the actual parameter   */
  /*  is not a variable. datyp indicates the storage class.     */
global void   varparam    (binptr actpar, boolean arr) ;/*  v a r p a r a m  */
  /* updates the actual parameter actpar */
  /* by adding the address Operator in case of not arr. */
global void varexp  ( binptr actpar,binptr acttype) ;   /*  v a r e x p  */

global binptr stdroutine  (binptr exp, binptr atyp,
			   boolean *not_found, boolean *fcall,
			   sc_type *sc) ;
global binptr stdOperator (binptr exp, binptr ltyp, binptr rtyp,
			   sc_type lsc, sc_type rsc) ;

global void stdinit (void);                             /*  s t d i n i t  */
  /* initializes standard identifiers: types, constants, */
  /* variables and some functions. */

global void ins_sizeof (binptr p, binptr typ1 );
  /* inserts the size of the arraytype typ1 */
  /* or a string constant typ1 */
  /* (the type of a string constant is the constant itself) */
  /* above the node p, that means fills "," and "sizeof" behind p. */
global unsigned long int rangesize (binptr p) ; /*  r a n g e s i z e  */
  /* determines the size of a scalar data type p */
#else

global binptr illroutine  () ;
global char * namestring  () ;
global void   chkscalar   () ;
global void   chkvarparam () ;
global void   varparam    () ;
global void   varexp      () ;
global binptr stdroutine  () ;
global binptr stdOperator () ;
global void   stdinit     () ;
global void   ins_sizeof  ();
global unsigned long int rangesize () ;
#endif
