home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / equel / globals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1984-12-31  |  5.5 KB  |  217 lines

  1. /*
  2. **  GLOBALS.H -- Equel declarations
  3. **
  4. **    Compilation Flags:
  5. **        xDEBUG -- for Chardebug, to provide compatability
  6. **            with older Equels' "-c" flag, and for 
  7. **            Lex_debug for the "-v" flag.
  8. **
  9. **    Version:
  10. **        @(#)globals.h    8.1    12/31/84
  11. */
  12.  
  13.  
  14.  
  15. /*
  16. **    Structure declarations
  17. */
  18.  
  19.  
  20.     /* parser keyword and operator table node */
  21.  
  22. struct optab
  23. {
  24.     char    *op_term;    /* pointer to terminal */
  25.     int      op_token;    /* lexical token */
  26.     int      op_code;    /* code to distinguish different op_terms 
  27.                  * with the same .op_token
  28.                  */
  29. };
  30.  
  31.  
  32.     /* C variable tree node */
  33.  
  34. struct cvar
  35. {
  36.     char        *c_id;        /* identifier */
  37.     char        c_type;        /* type */
  38.     char        c_indir;    /* indirection level (- 1 for strings) */
  39.     struct cvar    *c_left;    /* < sub-tree */
  40.     struct cvar    *c_right;    /* > sub-tree */
  41. };
  42.  
  43.     /* Display structures (linked list of strings) */
  44.  
  45. struct disp_node
  46. {
  47.     char            *d_elm;        /* display element */
  48.     struct disp_node    *d_next;    /* next node */
  49.     int            d_line;    /* for Symsp nodes, line
  50.                      * where lexeme was seen
  51.                      */
  52. };
  53.  
  54. struct display
  55. {
  56.     struct disp_node    *disp_first;    /* first node in display */
  57.     struct disp_node    *disp_last;    /* last node in display */
  58. };
  59.  
  60.     /* Retrieval list */
  61.  
  62. struct ret_var
  63. {
  64.     char        *r_elm;        /* string invoking variable
  65.                      * e.g. "*intpa [2]"
  66.                      */
  67.     struct ret_var    *r_next;    /* next variable used in "tupret" */
  68.     char        r_type;        /* type of variable */
  69. };
  70.  
  71. struct ret_list
  72. {
  73.     struct ret_var    *ret_first;    /* first node in ret_var chain */
  74.     struct ret_var    *ret_last;    /* last node in chain */
  75. };
  76.  
  77.  
  78.     /* "# include" file processing stack (list) */
  79.  
  80. struct inc_file
  81. {
  82.     int        inc_yyline;    /* old file's yyline */
  83.     int        inc_lineout;    /*  "    "     Lineout */
  84.     char        *inc_fid;    /* name */
  85.     FILE        *inc_infile;    /* In_file */
  86.     FILE        *inc_outfile;    /* Out_file */
  87.     struct inc_file    *inc_next;
  88. };
  89.  
  90.  
  91. /* 
  92. ** Structure for yacc generated terminal codes
  93. **    This avoids having to include functions in
  94. **    [grammar.y] for the function to know the 
  95. **    parser generated token numbers.
  96. */
  97.  
  98. struct special
  99. {
  100.     int    sp_name;        /* NAME */
  101.     int    sp_sconst;        /* SCONST */
  102.     int    sp_i2const;        /* I2CONST */
  103.     int    sp_i4const;        /* I4CONST */
  104.     int    sp_f8const;        /* F8CONST */
  105.     int    sp_quote;        /* QUOTE */
  106.     int    sp_bgncmnt;        /* BGNCMNT */
  107.     int    sp_endcmnt;        /* ENDCMNT */
  108.     int    sp_c_code;        /* C_CODE */
  109.     int    sp_struct_var;
  110. };
  111.  
  112.  
  113. /*
  114. **    Global definitions 
  115. */
  116.  
  117. int        Opcode;            /* operator code to distinguis tokens */
  118. extern int    yychar;            /* yacc input token */
  119. int        yyline;            /* yacc external line counter */
  120. extern int    yydebug;        /* set by "-y" command line arg,
  121.                      * has yacc parser give details
  122.                      * of parse
  123.                      */
  124. int        Newline;        /* less than one token has been
  125.                      * read from the input line, and
  126.                      *  yylex isn't sure yet whether it is
  127.                      * C_CODE or not
  128.                      */
  129. int        Lineout;        /* output line count */
  130. int        In_quote;        /* set if inside an IIwrite("... */
  131. char        *Input_file_name;    /* input file name */
  132. int        Type_spec;        /* used in parser, in C-declarations */
  133. int         C_code_flg;        /* set to indicate C-code in scanner */
  134. int         Pre_proc_flg;        /* set to indicate a 
  135.                      * pre-processor line 
  136.                      */
  137. int        Block_level;        /* > 0 local, 0 global */
  138. int        Indir_level;        /* holds indirection level
  139.                      * of a reference to a C-var
  140.                      */
  141. int        Field_indir;        /* indirection on a field of
  142.                      * a structure variable
  143.                      */
  144. int        Opflag;            /* mode in which to interpret syntax */
  145. int        In_string;        /* set if output is in a string */
  146. int        Fillmode;        /* set if output line is being filled */
  147. int        Fillcnt;        /* count to fill a line to */
  148. int        Charcnt;        /* # chars written onto output line */
  149. int        Lastc;            /* type of last char read (OPCHAR or 
  150.                      * KEYCHAR)
  151.                      */
  152. int        Arg_error;        /* set in argproc() [main.c] on
  153.                      * error in prcessing command line
  154.                      * arguments.
  155.                      */
  156. int        Rtdb;            /* set by "-d" command line arg,
  157.                      * supplies equel runtime support
  158.                      * with info to report file name
  159.                      * and line number in case of an
  160.                      * error
  161.                      */
  162. int        Kwrdnum;        /* # of entries in Kwrdtab [tokens.y] */
  163. char        Line_buf [MAXSTRING + 1];    /* buffer for input line */
  164. char        *Line_pos;        /* position in input line */
  165. int        Peekc [2];        /* holds backup character */
  166. int        Struct_flag;        /* while processing a structure
  167.                      * variable declaration, is set
  168.                      */
  169. struct cvar    *Cvarp, *Fieldp;        /* to process C variables */
  170.  
  171.  
  172.  
  173. struct optab         Kwrdtab [];    /* table of key words [tokens.y] */
  174. struct optab         Optab [];    /* table of operators [tokens.y] */
  175. struct special        Tokens;        /* holds yacc generated lex codes
  176.                      * [tokens.y]
  177.                      */
  178. char            Cmap [];    /* a type for each character [cmap.c] */
  179. struct cvar        *C_globals;    /* Global C-variable tree */
  180. struct cvar        *C_locals;    /* Local C-variable tree */
  181. struct cvar        *F_locals;    /* Local structure fields */
  182. struct cvar        *F_globals;    /* Global structure fields */
  183. struct display        Displays [1];    /* Cv_display is set to point at this
  184.                      * so that Cv_display may be passed
  185.                      * as a parameter instead of &Cv_display
  186.                      */
  187. struct display        *Cv_display;    /* display into which "cvarx"'s 
  188.                      * get put 
  189.                      */
  190. struct display        Symsp;        /* storage for symbols read by
  191.                      * yylex() 
  192.                      */
  193. struct ret_list        Ret_list;    /* list of variables in a "ctlelm" */
  194. struct inc_file        *Inc_files;    /* stack of files pushed by #includes */
  195.  
  196.  
  197.  
  198.  
  199. /*
  200. **    I/O manipulation data structures
  201. */
  202.  
  203. FILE    *In_file;        /* input file */
  204. FILE    *Out_file;        /* output file */
  205.  
  206. # ifdef xDEBUG
  207. char    Lex_debug;        /* debugging info for lexemes in yylex()
  208.                  * [yylex.c]
  209.                  */
  210. char    Chardebug;        /* print debugging info for routine
  211.                  * in getch.c
  212.                  */
  213. # endif
  214.  
  215. extern struct cvar    *getcvar(), *getfield();
  216. extern struct disp_node    *addsym();
  217.