From 67679562d1a1aa8ded32baba9d58ca730715821d Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Wed, 19 Apr 1989 07:45:34 +0000 Subject: [PATCH] ING_DB --- WEGA/contrib/ingres/dbs/src/parser/s_inout.c | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 WEGA/contrib/ingres/dbs/src/parser/s_inout.c diff --git a/WEGA/contrib/ingres/dbs/src/parser/s_inout.c b/WEGA/contrib/ingres/dbs/src/parser/s_inout.c new file mode 100644 index 0000000..abab6ba --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/parser/s_inout.c @@ -0,0 +1,56 @@ +# include "gen.h" +# include "../h/dbs.h" +# include "../h/scanner.h" + +/* TWO CHARACTER STACK FOR 'UNGETC' BACKUP */ +char Pchar[2]; +int Pctr; + +/* +** GTCHAR +** If 'Lcase' is set, all upper-case alphabetics are +** mapped into lower-case. +** The correct return is > 0; a return = 0 indicates end-of-file. +*/ +gtchar() +{ + extern int yyline; + register int chr; + + /* USE STACKED CHARACTERS IF POSSIBLE */ + if (Pctr) + chr = Pchar[--Pctr]; + else + chr = getscr(0); + + /* UPDATE LINE COUNTER */ + if (chr == '\n') + yyline++; + + if (Lcase && ((chr >= 'A' +# ifdef EBCDIC + && chr <= 'I') || (chr >= 'J' + && chr <= 'R') || (chr >= 'S' +# endif + && chr <= 'Z'))) + chr += 'a' - 'A'; + + return (chr); +} + + +/* +** BACKUP +** saves the character argument in the global stack 'Pchar' +**/ +backup(chr) +char chr; +{ + extern int yyline; + + if (Pctr == 2) + AAsyserr(20002, yyline, Pchar[0], Pchar[1], chr); + Pchar[Pctr++] = chr; + if (chr == '\n') + yyline--; +}