home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 355_02 / slk2.exe / SPP / GLB.H < prev    next >
C/C++ Source or Header  |  1991-06-09  |  6KB  |  195 lines

  1. /*
  2.     New SPP -- global header for variables.
  3.  
  4.     Source:  glb.h
  5.     Started: June 20, 1986
  6.     Version:
  7.         July 15, 1988;
  8.         June 22, 1989:
  9.             o MAX_PATHS increased to 40.
  10.             o curly_ok_flag added.
  11.         Version 1.4A: July 28, 1989
  12.             o slc_flag added
  13.  
  14.  
  15.     PUBLIC DOMAIN SOFTWARE
  16.  
  17.     Sherlock, including the SPP, SDEL and SDIF programs, was placed in
  18.     the public domain on June 15, 1991, by its author,
  19.  
  20.         Edward K. Ream
  21.         166 North Prospect Ave.
  22.         Madison, WI 53705.
  23.         (608) 257-0802
  24.  
  25.     Sherlock may be used for any commercial or non-commercial purpose.
  26.  
  27.  
  28.     DISCLAIMER OF WARRANTIES
  29.  
  30.     Edward K. Ream (Ream) specifically disclaims all warranties,
  31.     expressed or implied, with respect to this computer software,
  32.     including but not limited to implied warranties of merchantability
  33.     and fitness for a particular purpose.  In no event shall Ream be
  34.     liable for any loss of profit or any commercial damage, including
  35.     but not limited to special, incidental consequential or other damages.
  36. */
  37.  
  38. /*
  39.     Constants describing limits.
  40. */
  41. #define MAX_INCLUDE    20    /* Max length of nested includes.    */
  42. #define MAX_SYMBOL    600    /* Max len of symbols/strings.        */
  43. #define MAX_FILE_NAME    50    /* Maximum length of file names.    */
  44. #define MAX_IF        50    /* Max nesting level of #if's.        */
  45. #define MAX_PATHS    40    /* Max number of -s args.        */
  46. #define MAX_HOLD    1000    /* Max length of holding buffer.    */
  47. #define MAX_MAC        100    /* Max depth of macro expansions.    */
  48. #define MAX_RTEXT    1000    /* Max chars in replacement string.    */
  49. #define MAX_ATEXT    1000    /* Max char in actual args.        */
  50. #define MAX_NARGS    50    /* Max number of macro arguments.    */
  51. #define MAX_MDEPTH    100    /* Max depth of macro expansions.    */
  52.  
  53. /*
  54.     The global struct used to define the macros being currently expanded.
  55.     This is NOT the same as the current macro input stream since an
  56.     input stream can be exhausted while expanding a macro.
  57. */
  58. struct x_struct {
  59.     char *    x_name;
  60.     bool    x_done;
  61. };
  62.  
  63. /*
  64.     Exclude the rest if glb.c is the lead-in file.
  65. */
  66. #ifndef no_extern
  67.  
  68. /*
  69.     ============= global variables =============
  70. */
  71.  
  72. /*
  73.     The next character of input.
  74. */
  75. extern char    ch;        /* The NEXT character.            */
  76.  
  77. /*
  78.     Kludge for expr().
  79. */
  80. extern bool    curly_ok_flag;    /* Allow { and } as valid delims.    */
  81.  
  82. /*
  83.     User Flags.
  84. */
  85. extern bool    insert_flag;    /* TRUE if insert #include "sl.h"    */
  86. extern int    nest_flag;    /* TRUE if comments can nest.        */
  87. extern int     com_flag;    /* TRUE if comments are output.        */
  88. extern bool    entry_flag;    /* TRUE if Sherlock macros on entry.    */
  89. extern bool    exit_flag;    /* TRUE if Sherlock macros on exit.    */
  90. extern bool    loop_flag;    /* TRUE if Sherlock macros in loops.    */
  91. extern bool    printf_flag;    /* TRUE if using printf for output.    */
  92. extern bool    usr_flag;    /* TRUE if using user output routines.    */
  93. extern bool    tick_flag;    /* TRUE if using count statistics only.    */
  94. extern bool    slc_flag;    /* TRUE if single-line comments valid.    */
  95.  
  96. /*
  97.     Spellings of macros generated by SPP.
  98. */
  99. extern char *    mn_tab[];
  100.  
  101. extern char *    r_bool;
  102. extern char *    r_char;
  103. extern char *    r_double;
  104. extern char *    r_float;
  105. extern char *    r_int;
  106. extern char *    r_long;
  107. extern char *    r_ptr;
  108. extern char *    r_string;
  109. extern char *    r_uint;
  110. extern char *    r_ulong;
  111. extern char *    r_void;
  112.  
  113. extern char *    s_clear;    /* 2/16/89 */
  114. extern char *    s_init;
  115. extern char *    s_parse;
  116. extern char *    s_disable;    /* 2/16/89 */
  117.  
  118. extern char *    tick;
  119. extern char *    tickb;
  120. extern char *    tickx;
  121.  
  122. extern char *    pbtrace;
  123. extern char *    ptrace;
  124.  
  125. /*
  126.     Globals for macro expansion.
  127.     p_rescan, m_flag are used by sysnext().
  128. */
  129. extern bool    m_flag;            /* TRUE if expanding a macro.    */
  130. extern char    macro_buf[MAX_RTEXT];    /* Final macro buffer.        */
  131. extern char *    p_rescan;        /* Pointer into rescan_buf[].    */
  132.  
  133.  
  134. /*
  135.     White space and held output.
  136. */
  137. extern char    hws_buf [MAX_HOLD];    /* Held white space.        */
  138. extern int    hws_count;        /* Count of held white space.    */
  139. extern char    hold_buf [MAX_HOLD];    /* Held non-white space.    */
  140. extern int    hold_count;
  141. extern bool    hold_flag;        /* TRUE if holding characters.    */
  142. extern int    ch_hold;        /* TRUE if ch should be buffered. */
  143.  
  144. extern char    lws_buf [100];        /* Leading white space buffer.    */
  145. extern int    lws_count;        /* Leading white space count.    */
  146. extern int    cnl_count;        /* Consecutive newline count.    */
  147. extern int    last_tok;        /* Previous token.        */
  148. extern int    last_ch;        /* Last char.            */
  149. extern bool    first_tok;        /* True if token is first in line. */
  150.  
  151. extern bool    con_flag;        /* True if in PP constant expr. */
  152. extern bool    m_flag;            /* TRUE if expanding a macro. */
  153.  
  154. /*
  155.     The name of the current function, or NULL.
  156. */
  157. extern char * fn_name;
  158.  
  159. /*
  160.     Globals describing tokens.
  161.  
  162.     The code assumes that no token or string will ever be longer than
  163.     MAX_SYMBOL.  If that ever is not so the program may crash.  Thus,
  164.     MAX_SYMBOL should be very large -- say 1000 or more.
  165. */
  166. extern en_tokens token;            /* The current token. */
  167. extern int    t_subtype;        /* The subtype of token class.        */
  168. extern char    t_symbol [MAX_SYMBOL];    /* The spelling of the token.        */
  169. extern int    t_length;        /* The length of the token (in the text)*/
  170. extern long    t_value;        /* Value of integer constants.        */
  171.  
  172. /*
  173.     The following globals are set ONLY by the system module and
  174.     used by the preprocessor.
  175. */
  176. extern char *    t_file;            /* Name of current input file.    */
  177. extern int    t_line;            /* Line number within file.    */
  178. extern int    t_inlevel;        /* Current input file level.    */
  179.  
  180. /*
  181.     Globals for use internally to the token routines.
  182. */
  183. extern bool    t_ifstack [MAX_IF];    /* Stack for nexted #if's    */
  184. extern int    t_iflevel;        /* Nexting depth of #if's    */
  185. extern long    t_errcount;        /* Number of errors seen.    */
  186.  
  187. /*
  188.     Defines for the path table.
  189.     This table is used to search for #include files.
  190. */
  191. extern char *    paths [MAX_PATHS];    /* Pointers to path names.    */
  192. extern int    n_paths;        /* Number of paths defined.    */
  193.  
  194. #endif /* no_extern */
  195.