|
|
1.1 ! root 1: # include <ingres.h> ! 2: # include "scanner.h" ! 3: # include <sccs.h> ! 4: ! 5: SCCSID(@(#)get_scan.c 7.2 5/4/83) ! 6: ! 7: /* ! 8: ** GET_SCAN -- gets characters from monitor ! 9: ** ! 10: ** Parameters: ! 11: ** mode -- ! 12: ** modes are: ! 13: ** NORMAL = read normally ! 14: ** PRIME = prime the pipe ! 15: ** SYNC = sync (or flush) the pipe ! 16: ** ! 17: ** Returns: ! 18: ** character or '\0' on eof ! 19: ** ! 20: ** Trace Flags: ! 21: ** Getscan ~~ 54.0 ! 22: */ ! 23: ! 24: get_scan(mode) ! 25: int mode; ! 26: { ! 27: extern int yyline; ! 28: register int ctr; ! 29: char c; ! 30: ! 31: extern int Pctr; /* vble for backup stack in scanner */ ! 32: extern char Pchar[2]; ! 33: # ifdef xPTR3 ! 34: tTfp(54, 0, "get_scan: mode %d ", mode); ! 35: # endif ! 36: ! 37: switch (mode) ! 38: { ! 39: case NORMAL: ! 40: if (Pctr) ! 41: { ! 42: c = Pchar[--Pctr]; ! 43: ctr = 1; ! 44: } ! 45: else ! 46: ctr = readmon(&c, 1); ! 47: if (c == '\n') ! 48: yyline++; ! 49: c = ((Lcase && c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c); ! 50: break; ! 51: ! 52: case PRIME: ! 53: Pctr = 0; ! 54: ctr = 0; ! 55: break; ! 56: ! 57: case SYNC: /* flush pipe */ ! 58: while (readmon(&c, 1) > 0); ! 59: ctr = 0; ! 60: break; ! 61: ! 62: default: ! 63: syserr("bad arg '%d' in get_scan", mode); ! 64: } ! 65: ! 66: # ifdef xPTR3 ! 67: tTfp(54, 1, " ctr %d: '%c' (0%o).\n", ctr & 0377, c, c); ! 68: # endif ! 69: ! 70: return (ctr ? c : 0); ! 71: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.