1: # include "../ingres.h" 2: # include "../pipes.h" 3: 4: /* 5: ** GETSCR 6: ** returns a single character from the R_up pipe. 7: ** modes are: 8: ** 0 = read normally 9: ** 1 = prime the pipe 10: ** 2 = sync (or flush) the pipe 11: */ 12: getscr(mode) 13: int mode; 14: { 15: extern int Pctr; /* vble for backup stack in scanner */ 16: static struct pipfrmt a; 17: register int ctr; 18: char c; 19: # ifdef xPTM 20: static int Ptimflg; /* marks the first time through */ 21: # endif 22: 23: if (!mode) 24: { 25: ctr = rdpipe(P_NORM, &a, R_up, &c, 1); 26: # ifdef xPTM 27: if (Ptimflg == 0 && tTf(76, 1)) 28: { 29: timtrace(1, 0); 30: Ptimflg = 1; 31: } 32: if (tTf(76, 3)) 33: qtrace(ctr ? c : '\0'); 34: # endif 35: return (ctr ? c : 0); 36: } 37: if (mode == 1) 38: { 39: rdpipe(P_PRIME, &a); 40: Pctr = 0; 41: return (0); 42: } 43: if (mode == 2) 44: { 45: # ifdef xPTM 46: if (tTf(76, 1)) 47: { 48: timtrace(2, 0); 49: Ptimflg = 0; 50: } 51: # endif 52: rdpipe(P_SYNC, &a, R_up); 53: return (0); 54: } 55: syserr("bad arg '%d' in getscr", mode); 56: }