home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CODE4-1.ZIP / SOURCE.ZIP / E4PRIORI.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-13  |  990 b   |  62 lines

  1.  
  2. /* e4priority.c   (c)Copyright Sequiter Software Inc., 1987, 1988, 1989.  All rights reserved.
  3.  
  4.    - used by e4parse to return the priority of an operator
  5. */
  6.  
  7. #include "d4base.h"
  8. #include "e4parse.h"
  9.  
  10.  
  11. e4priority( ch)
  12. char ch ;
  13. {
  14.    switch(ch)
  15.    {
  16.       case Q_NO_FUNCTION:   /* for no operator on stack -  never pop */
  17.      return(0) ;
  18.  
  19.       case Q_COMMA:
  20.      return(1) ;
  21.       case Q_L_BRACKET:
  22.      return(2) ;
  23.  
  24.       case L_OR:
  25.      return(3) ;
  26.       case L_AND:
  27.      return(4) ;
  28.       case L_NOT:
  29.      return(5) ;
  30.  
  31.       case R_GE:
  32.       case R_LE:
  33.       case R_GT:
  34.       case R_LT:
  35.       case R_NE:
  36.       case R_EQ:
  37.       case R_SUB_COMPARE:
  38.      return(6) ;
  39.  
  40.       case A_ADD:
  41.       case A_SUBTRACT:
  42.      return(7) ;
  43.  
  44.       case A_MULTIPLY:
  45.       case A_DIVIDE:
  46.      return(8) ;
  47.                   
  48.       #ifndef UNIX
  49.       case A_POWER:
  50.      return(9) ;
  51.       #endif
  52.  
  53.       case Q_R_BRACKET:
  54.      return(100) ;
  55.  
  56.       default:
  57.      return(7) ;
  58.    }
  59. }
  60.  
  61.  
  62.