home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / OS2_LEX.ZIP / LEXGET.C < prev    next >
C/C++ Source or Header  |  1989-12-12  |  574b  |  30 lines

  1. /*
  2.  * lexget.c
  3.  *
  4.  * Bob Denny     28-Aug-82    Move stdio dependencies to lexerr(), lexget(),
  5.  *                            lexech() and mapch(). This is one of 4 modules
  6.  *                            in lexlib which depend upon the standard I/O package.
  7.  *
  8.  * Scott Guthery 20-Nov-83  Adapt for IBM PC & DeSmet C.
  9.  */
  10.  
  11. #include <lex.h>
  12.  
  13. int lexgetc(void)
  14. {
  15.     extern FILE *lexin;
  16.  
  17.     return(getc(lexin));
  18. }
  19.  
  20. int lexungetc(int c)
  21. {
  22.     extern char *llp1, llbuf[];
  23.  
  24.     if (llp1 <= llbuf) {
  25.         lexerror("Token buffer underflow");
  26.         exit(1);
  27.         }
  28.     *(-- llp1) = c & 0377;
  29. }
  30.