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.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-09
|
5KB
|
188 lines
/*
New SPP -- global variable definitions.
Source: glb.c
Started: April 2, 1986
Version:
July 15, 1988
February 16, 1989
o s_disable added.
o fn_name made global.
June 22, 1989
o curly_ok_flag added.
Version 1.4A: July 28, 1989
o slc_flag added
PUBLIC DOMAIN SOFTWARE
Sherlock, including the SPP, SDEL and SDIF programs, was placed in
the public domain on June 15, 1991, by its author,
Edward K. Ream
166 North Prospect Ave.
Madison, WI 53705.
(608) 257-0802
Sherlock may be used for any commercial or non-commercial purpose.
DISCLAIMER OF WARRANTIES
Edward K. Ream (Ream) specifically disclaims all warranties,
expressed or implied, with respect to this computer software,
including but not limited to implied warranties of merchantability
and fitness for a particular purpose. In no event shall Ream be
liable for any loss of profit or any commercial damage, including
but not limited to special, incidental consequential or other damages.
*/
#define no_extern 1
#include "spp.h"
/*
========= increase stack size ========
*/
#ifdef TURBOC
extern unsigned _stklen = 0xf000;
#endif
/*
============= global variables =============
*/
/*
The next character of input.
*/
char ch = '@';
/*
Kludge for expr().
*/
bool curly_ok_flag = FALSE; /* Allow { and } as valid delims. */
/*
User Flags.
*/
bool insert_flag = FALSE; /* TRUE if insert #include "sl.h" */
int nest_flag = FALSE; /* TRUE if comments can nest. */
int com_flag = TRUE; /* TRUE if comments are output. */
bool entry_flag = TRUE; /* TRUE if Sherlock macros on entry. */
bool exit_flag = TRUE; /* TRUE if Sherlock macros on exit. */
bool loop_flag = TRUE; /* TRUE if Sherlock macros in loops. */
bool printf_flag = TRUE; /* TRUE if using printf for output. */
bool usr_flag = FALSE; /* TRUE if using user output routines. */
bool tick_flag = FALSE; /* TRUE if using count statistics only. */
bool slc_flag = TRUE; /* TRUE if single-line comments valid. */
/*
Spellings of ALL Sherlock macros.
*/
char * mn_tab [] = {
"RETURN_BOOL", "RETURN_CHAR", "RETURN_DOUBLE",
"RETURN_FLOAT", "RETURN_INT", "RETURN_LONG",
"RETURN_PTR", "RETURN_STRING", "RETURN_UINT",
"RETURN_ULONG", "RETURN_VOID",
"SL_CLEAR", "SL_DISABLE", "SL_DUMP", "SL_INIT",
"SL_NAME", "SL_OFF", "SL_ON", "SL_PARSE",
"STAT", "STATB", "STATX",
"TICK", "TICKB", "TICKN", "TICKX",
"TRACE", "TRACEB", "TRACEN", "TRACEX",
"TRACEP", "TRACEPB", "TRACEPN", "TRACEPX",
NULL
};
/*
Spellings of macros generated by the code generators.
*/
char * r_bool = "RETURN_BOOL";
char * r_char = "RETURN_CHAR";
char * r_double= "RETURN_DOUBLE";
char * r_float = "RETURN_FLOAT";
char * r_int = "RETURN_INT";
char * r_long = "RETURN_LONG";
char * r_ptr = "RETURN_PTR";
char * r_string= "RETURN_STRING";
char * r_uint = "RETURN_UINT";
char * r_ulong = "RETURN_ULONG";
char * r_void = "RETURN_VOID";
char * s_init = "SL_INIT";
char * s_parse = "SL_PARSE";
char * tick = "TICK";
char * tickb = "TICKB";
char * tickx = "TICKX";
char * pbtrace = "TRACEPB";
char * ptrace = "TRACEP";
/*
Globals for macro expansion.
p_rescan and m_flag are used by sysnext().
*/
bool m_flag = FALSE; /* TRUE if expanding a macro. */
char macro_buf[MAX_RTEXT]; /* Final macro buffer. */
char * p_rescan; /* Pointer into rescan_buf[]. */
/*
White space and held output.
*/
char hws_buf [MAX_HOLD]; /* Held white space. */
int hws_count; /* Count of held white space. */
char hold_buf [MAX_HOLD]; /* Held non-white space. */
int hold_count = 0;
bool hold_flag = TRUE; /* TRUE if holding characters. */
int ch_hold = FALSE; /* TRUE if ch should be buffered. */
char lws_buf [100]; /* Leading white space buffer. */
int lws_count = 0; /* Leading white space count. */
int cnl_count = 0; /* Consecutive newline count. */
int last_tok = NULL_TOK; /* Previous token. */
int last_ch = '@'; /* Last char. */
bool first_tok = FALSE; /* True if token is first in line. */
bool con_flag = FALSE; /* True if in PP constant expr. */
/*
The name of the current function, or NULL.
*/
char * fn_name = "";
/*
Globals describing tokens.
The code assumes that no token or string will ever be longer than
MAX_SYMBOL. If that ever is not so the program may crash. Thus,
MAX_SYMBOL should be very large -- say 1000 or more.
*/
en_tokens token = NULL_TOK; /* The current token. */
int t_subtype; /* The subtype of token class. */
char t_symbol [MAX_SYMBOL]; /* The spelling of the token. */
int t_length; /* The length of the token (in the text)*/
long t_value; /* Value of integer constants. */
/*
The following globals are set ONLY by the system module and
used by the preprocessor.
*/
char * t_file = NULL; /* Name of current input file. */
int t_line = 0; /* Line number within file. */
int t_inlevel = -1; /* Current input file level. */
/*
Globals for use internally to the token routines.
*/
bool t_ifstack [MAX_IF]; /* Stack for nexted #if's */
int t_iflevel = 0; /* Nexting depth of #if's */
long t_errcount = 0; /* Number of errors seen. */
/*
Defines for the path table.
This table is used to search for #include files.
*/
char * paths [MAX_PATHS]; /* Pointers to path names. */
int n_paths = 0; /* Number of paths defined. */