From aa1565525232adf39e5551bdc2e8885b5dba140f Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Tue, 31 Oct 1989 17:57:56 +0000 Subject: [PATCH] ING_DB --- WEGA/contrib/ingres/dbs/src/pqr/rc.h | 166 +++++++++++++++++ WEGA/contrib/ingres/dbs/src/pqr/rc_main.c | 211 ++++++++++++++++++++++ 2 files changed, 377 insertions(+) create mode 100644 WEGA/contrib/ingres/dbs/src/pqr/rc.h create mode 100644 WEGA/contrib/ingres/dbs/src/pqr/rc_main.c diff --git a/WEGA/contrib/ingres/dbs/src/pqr/rc.h b/WEGA/contrib/ingres/dbs/src/pqr/rc.h new file mode 100644 index 0000000..02fe65d --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/pqr/rc.h @@ -0,0 +1,166 @@ +/* +** --- RC.H ------------ BASIC DECLARATIONS --------------------------------- +** +** Report Compiler Definitions +** +** contains the global structures and variable +** declarations needed by the lexical analyzer. +** This includes Manifest constants and certain +** variables for internal communication purposes. +** Therefore, extreme care should be exercised +** when modifying this file. +** +** Version: @(#)rc.h 4.0 02/05/89 +** +*/ + + +# include "r_code.h" + + +/* SYSTEM VARIABLES */ + +# define SYS_COL 1 +# define SYS_LINE 2 +# define SYS_ALL_LINE 3 +# define SYS_PAGE 4 +# define SYS_TUPL 5 + + +/* CHARACTER TYPES */ + +# define ALPHA 1 +# define NUMBR 2 +# define OPATR 3 +# define PUNCT 4 +# define CNTRL 5 + + +/* character type mapping */ + +extern char Cmap[]; + +# ifdef EBCDIC + +# ifdef ESER_PSU +extern char _etoa_[]; +# define ETOA(c) _etoa_[(c) & BYTE_MASK] +# endif + +# define CMAP(c) Cmap[(ETOA(c)) & ASCII_MASK] + +# else + +# define CMAP(c) Cmap[(c) & ASCII_MASK] + +# endif + + +/* INTEGER CONSTANT */ + +# define GOVAL -1 + + +/* SYMBOL TABLE ENTRY */ + +struct s_entry +{ + struct s_entry *nextsym; + char symbl[1]; +}; + + + +/* KEYWORD AND OPERATOR TABLE */ + +struct optab +{ + char *term; + int token; + int opcode; +}; +typedef struct optab OPTAB; + + /* in rc_tables.y */ +extern struct optab Optab[]; /* operator table */ +extern struct optab Keyword[]; /* keyword table */ +extern int Keyent; /* # of entries in the Keyword table */ + + +/* SPECIAL TOKENS FOR SCANNER */ + +struct special +{ + int name; + int sconst; + int bgncmnt; + int endcmnt; + int iconst; + int lconst; + int rconst; +}; + + /* in rc_tables.y */ +extern struct special Tokens; /* special tokens for scanner */ + + +/* FORMAT STRUCTURE (formatted output) */ + +struct format +{ + int data; + int length; + double scale; + int str_len; + char *str_adr; + int before; + int point; + int ignore; + int norm; + char *fr_to[2]; + int batch_len; + int fr_to_v[2]; + double fr_to_8[2]; +}; + +/* PROCEDURE handling */ + +# define MAX_PROCS 128 + +extern char *Proc[]; + + +/* CASE HANDLING */ + +# define MAX_CASES 50 + +extern int Case_no; +extern char *Case[]; + + +/* MACRO HANDLING */ + +# define MAX_MACROS 500 + +struct macro +{ + char *templt; + int subst; +}; + +extern int Macro_no; +extern struct macro Macro[]; + + +/* DECLARATIONS */ + +extern struct desc_t Desc[MAX_DOM]; /* domain desriptions */ +extern int Line; /* source line counter */ +extern int Lcase; /* UPPER->lower conversion flag */ +extern int Compile; /* FALSE for only compilation */ +extern int Iflag; /* read from standard input */ +extern int Oflag; /* write to file "r_code" */ +extern int Sflag; /* be silent if FALSE */ +extern int S_error; /* # of errors found */ +extern char *S_name; /* name of R_CODE file */ +extern char *S_desc; /* name of DESC file */ diff --git a/WEGA/contrib/ingres/dbs/src/pqr/rc_main.c b/WEGA/contrib/ingres/dbs/src/pqr/rc_main.c new file mode 100644 index 0000000..1703200 --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/pqr/rc_main.c @@ -0,0 +1,211 @@ +/* +** --- RC_MAIN.C ------- MAIN ----------------------------------------------- +** +** Version: @(#)rc_main.c 4.0 02/05/89 +** +*/ + +# include +# include "rc.h" + +# define FLAG '-' + +# define COMPILE 'c' +# define INPUT 'i' +# undef LCASE +# define LCASE 'l' +# define OUTPUT 'o' +# define SILENT 's' +# define VERBOSE 'v' + +# ifdef RC_TRACE +# define YYPARSE 'Y' +# define YYLEX 'L' +# define YYINPUT 'I' +# define YYOUTPUT 'O' +# define YYR_CODE 'R' +# endif + +/* SETEXIT | RESET */ +# ifdef P8000 +ret_buf AAjmp_buf; +# else +jmp_buf AAjmp_buf; +# endif + +extern FILE *Input; +static int catch; + +rc_catch() +{ + signal(2, rc_catch); + signal(3, rc_catch); + catch++; + if (Sflag) + { + printf("\n----------------\n"); + printf("COMPILING aborted\n"); + } + if (Iflag) + Iflag = FALSE; + else + fclose(Input); + reset(); +} + + +main(argc, argv) +int argc; +char *argv[]; +{ + register char *p; + register int i; + register int files; +# ifdef SETBUF + char out_buf[BUFSIZ]; +# endif + +# ifdef SETBUF + setbuf(stdout, out_buf); +# endif + PQR_system = "compiler"; + signal(2, rc_catch); + signal(3, rc_catch); + files = 0; + setexit(); + + while (--argc > 0) + { + ++argv; + if (**argv == FLAG) + { + p = *argv; + p++; + while (*p) + { + switch (*p) + { +# ifdef RC_TRACE + case YYPARSE: + setbit(01, rc_debug); + break; + + case YYLEX: + setbit(02, rc_debug); + break; + + case YYINPUT: + setbit(04, rc_debug); + break; + + case YYOUTPUT: + setbit(010, rc_debug); + break; + + case YYR_CODE: + setbit(020, rc_debug); + break; +# endif + + case COMPILE: + case 'C': + Compile = FALSE; + break; + + case INPUT: + Iflag = TRUE; + Input = stdin; + goto compile; + + case LCASE: + Lcase = FALSE; + break; + + case OUTPUT: + Oflag = TRUE; + break; + + case SILENT: + case 'S': + Sflag = FALSE; + break; + + case VERBOSE: + case 'V': + Sflag = TRUE; + break; + + default: + printf("? Option: -%c\n", *p); + } + p++; + } + continue; + } + if (!(Input = fopen(*argv, "r"))) + { + printf("Cannot open *** %s ***\n", *argv); + continue; + } + +compile: + Doms = 0; + Line = 1; + S_error = 0; + + R_cols = D_COLS; + R_lines = D_LINES; + R_all_lines = D_ALL_LINES; + R_for_all = D_FOR_ALL; + R_first_page = D_FIRST_PAGE; + R_last_page = D_LAST_PAGE; + R_from_tuple = D_FROM_TUPLE; + R_to_tuple = D_TO_TUPLE; + R_big = FALSE; + R_rc = &R_code[1]; + + Macro_no = 0; + for (i = 0; i < MAX_PROCS; i++) + Proc[i] = (char *) 0; + if (Sflag) + { + if (!files) + PQR(); + printf("\nCompiling REPORT "); + } + + printf("%s:\n", *argv); + + if (Sflag) + { + printf("----------------\n"); + printf("%4d: ", Line); + } + files++; + + rc_parse(); + rc_freesym(); + if (Iflag) + Iflag = FALSE; + else + fclose(Input); + + if (Sflag) + { + printf("\n----------------\n"); + printf("ERRORS\treported\t%d\n", S_error); + printf("R_CODE\ton file\t\t\"%s\"\n", S_name); + if (Doms && S_desc) + printf("DESC\ton file\t\t\"%s\"\n", S_desc); + } + sync(); + Oflag = FALSE; + } + if (Sflag && files > 1) + { + printf("\nTOTAL\tfiles\t\t%d\n", files); + printf("\tinterrupts\t%d\n", catch); + } + fflush(stdout); + exit (S_error); +}