Previous: uttems Up: ../plot79_u.html Next: uttepp


UTTEOP

       SUBROUTINE  UTTEOP (ERRCDE,STACK,TYPE,TOP,CINDEX,CHEKCT)
 C$    (Expression Evaluate - Internal - Operator)
 C$    Evaluate a function or operator  with arguments on the  top
 C$    of a reverse Polish stack, replacing them with the function
 C$    result and data  type.  This routine  is a service  routine
 C$    for  UTTEXP,   the  general   expression  evaluator.    The
 C$    arguments are:
 C$
 C$    ERRCDE.........Error code  returned, one of ERRNON, ERROPR,
 C$                   ERRWNA, or ERRUDF.
 C$    STACK(*).......Argument stack, with the topmost value being
 C$                   the last argument.
 C$    TYPE(*)........Argument type flags,  one of TYPNIL, TYPBOO,
 C$                   TYPINT,  or   TYPFLT.    TYPNIL   flags   an
 C$                   undefined value  and  will  raise  an  error
 C$                   condition.
 C$    TOP............Index  of top  of stack.   It is  updated on
 C$                   return to the new top containing the result,
 C$                   unless an error occurred,  in which case  it
 C$                   is unchanged.
 C$    CINDEX.........CASE  statement  index  in  range  0  ..  79
 C$                   selecting operator  or  function.   It  must
 C$                   match  the  operator  and  function  keyword
 C$                   order in UTTEXP.
 C$    CHEKCT......... .TRUE. - check  argument  count;  TOP  must
 C$                             match  the   required  number   of
 C$                             arguments, or if a variable number
 C$                             is permitted,  must  not  be  less
 C$                             than   the   minimum   number   of
 C$                             arguments.
 C$                   .FALSE. - check  that   minimum  number   of
 C$                             required  arguments  are  present,
 C$                             but ignore extra arguments.
 C$
 C$    The type precedence ordering is TYPBOO < TYPINT < TYPFLT  <
 C$    TYPNIL.   If  operand  types  differ,  the  one  of   lower
 C$    precedence is promoted  to that of  the other.  For  .AND.,
 C$    .OR., .NOT., and .XOR., and TYPBOO or TYPFLT operands,  the
 C$    result has  type  TYPBOO.   For TYPINT  operands,  the  bit
 C$    primitives are used to  compute the corresponding  fullword
 C$    operation, and  the  result  has TYPINT.   For  the  divide
 C$    operation, operands of TYPBOO and TYPINT are divided with a
 C$    truncating  integer  divide;  otherwise  a   floating-point
 C$    divide is performed.
 C$
 C$    For MAX and  MIN, the  type of the  result is  that of  the
 C$    operand of highest type giving the function result, so that
 C$    MAX(1,1.0) would have type TYPFLT.
 C$
 C$    For CASE, IF, and SELECT, the type of the result is that of
 C$    the selected value.
 C$
 C$    Functions DACOSH,  DASINH,  DATANH,  DBINOM,  DERF,  DERFC,
 C$    DGAMMA, and DLNGAM are not part of the 1977 or 1966 FORTRAN
 C$    Standards.   They   are   available,  however,   in   Wayne
 C$    Fullerton's  Portable  Special  Function  Library,   FNLIB,
 C$    included in <PLOT79>.
 C$
 C$    For CASE, IF,  and SWITCH, TYPE(TOP+1)  on return  contains
 C$    the argument number selected for the function result.
 C$    (24-AUG-83)