1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * pdtmatch() returns YES if the type labels in type label buffer tb
   9:  * satisfy the boolean postfix type label expression, otherwise NO.
  10:  */
  11: #include "null.h"
  12: #include "pdtyp.h"
  13: #include "truefalse.h"
  14: #include "yesno.h"
  15: 
  16: pdtmatch(postfix, tb)
  17:     register PDTYP *postfix;    /* postfix expression struct */
  18:     register char *tb;      /* type label buffer */
  19: {
  20:     register int i;         /* postfix expression index */
  21:     register int j;         /* top-of-evaluation stack pointer */
  22:     char *pdtfind();        /* find type label in buffer */
  23: 
  24:     j = -1;
  25:     for (i = 0; i < postfix->pfxsize; i++)
  26:         switch ((postfix->pfx)[i].p_class)
  27:             {
  28:             case B_ID:
  29:                 j++;
  30:                 (postfix->pfx)[i].p_label =
  31:                 pdtfind((postfix->pfx)[i].p_id, tb);
  32:                 (postfix->pfx)[i].p_sw = (postfix->eval)[j] =
  33:                 (postfix->pfx)[i].p_label != NULL;
  34:                 break;
  35:             case B_OR:
  36:                 j--;
  37:                 (postfix->pfx)[i].p_sw = (postfix->eval)[j] =
  38:                 (postfix->eval)[j] == TRUE ||
  39:                 (postfix->eval)[j+1] == TRUE;
  40:                 break;
  41:             case B_AND:
  42:                 j--;
  43:                 (postfix->pfx)[i].p_sw = (postfix->eval)[j] =
  44:                 (postfix->eval)[j] == TRUE &&
  45:                 (postfix->eval)[j+1] == TRUE;
  46:                 break;
  47:             case B_NOT:
  48:                 (postfix->pfx)[i].p_sw = (postfix->eval)[j] =
  49:                 !(postfix->eval)[j];
  50:                 break;
  51:             }
  52:     return(((postfix->eval)[j] == TRUE) ? YES : NO);
  53: }

Defined functions

pdtmatch defined in line 16; never used
Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 477
Valid CSS Valid XHTML 1.0 Strict