home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / OS2_LEX.ZIP / LMOVB.C < prev    next >
C/C++ Source or Header  |  1989-10-06  |  742b  |  29 lines

  1. /*
  2.  * Bob Denny     28-Aug-82  Remove reference to stdio.h
  3.  * Scott Guthery 20-Nov-83    Adapt for IBM PC & DeSmet C
  4.  */
  5.  
  6. #include <lex.h>
  7.  
  8. int _lmovb(register struct lextab *lp, register c, register st)
  9. {
  10.         int base;
  11.  
  12.         while ((base = lp->llbase[st]+c) > lp->llnxtmax ||
  13.                         ((int) lp->llcheck[base] & 0377) != st) {
  14.  
  15.                 if (st != lp->llendst) {
  16. /*
  17.  * This miscompiled on Decus C many years ago:
  18.  *                      st = lp->lldefault[st] & 0377;
  19.  */
  20.                         base = lp->lldefault[st] & 0377;
  21.                         st = base;
  22.                 }
  23.                 else
  24.                         return(-1);
  25.         }
  26.         return(lp->llnext[base]&0377);
  27. }
  28.  
  29.