diff options
Diffstat (limited to 'yacc/defs.h')
-rw-r--r-- | yacc/defs.h | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/yacc/defs.h b/yacc/defs.h index 69150826e..0a9d0eea9 100644 --- a/yacc/defs.h +++ b/yacc/defs.h @@ -26,52 +26,52 @@ #include "../byterun/rotatecursor.h" #endif -/* machine-dependent definitions */ -/* the following definitions are for the Tahoe */ -/* they might have to be changed for other machines */ - -/* MAXCHAR is the largest unsigned character value */ -/* MAXSHORT is the largest value of a C short */ -/* MINSHORT is the most negative value of a C short */ -/* MAXTABLE is the maximum table size */ -/* BITS_PER_WORD is the number of bits in a C unsigned */ -/* WORDSIZE computes the number of words needed to */ -/* store n bits */ -/* BIT returns the value of the n-th bit starting */ -/* from r (0-indexed) */ -/* SETBIT sets the n-th bit starting from r */ - -#define MAXCHAR UCHAR_MAX -#define MAXSHORT SHRT_MAX -#define MINSHORT SHRT_MIN -#define MAXTABLE 32500 - -#define BITS_PER_WORD (8*sizeof(unsigned)) -#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD) -#define BIT(r, n) ((((r)[(n)/BITS_PER_WORD])>>((n)%BITS_PER_WORD))&1) -#define SETBIT(r, n) ((r)[(n)/BITS_PER_WORD]|=(1<<((n)%BITS_PER_WORD))) +/* machine-dependent definitions */ +/* the following definitions are for the Tahoe */ +/* they might have to be changed for other machines */ + +/* MAXCHAR is the largest unsigned character value */ +/* MAXSHORT is the largest value of a C short */ +/* MINSHORT is the most negative value of a C short */ +/* MAXTABLE is the maximum table size */ +/* BITS_PER_WORD is the number of bits in a C unsigned */ +/* WORDSIZE computes the number of words needed to */ +/* store n bits */ +/* BIT returns the value of the n-th bit starting */ +/* from r (0-indexed) */ +/* SETBIT sets the n-th bit starting from r */ + +#define MAXCHAR UCHAR_MAX +#define MAXSHORT SHRT_MAX +#define MINSHORT SHRT_MIN +#define MAXTABLE 32500 + +#define BITS_PER_WORD (8*sizeof(unsigned)) +#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD) +#define BIT(r, n) ((((r)[(n)/BITS_PER_WORD])>>((n)%BITS_PER_WORD))&1) +#define SETBIT(r, n) ((r)[(n)/BITS_PER_WORD]|=(1<<((n)%BITS_PER_WORD))) /* character names */ -#define NUL '\0' /* the null character */ -#define NEWLINE '\n' /* line feed */ -#define SP ' ' /* space */ -#define BS '\b' /* backspace */ -#define HT '\t' /* horizontal tab */ -#define VT '\013' /* vertical tab */ -#define CR '\r' /* carriage return */ -#define FF '\f' /* form feed */ -#define QUOTE '\'' /* single quote */ -#define DOUBLE_QUOTE '\"' /* double quote */ -#define BACKSLASH '\\' /* backslash */ +#define NUL '\0' /* the null character */ +#define NEWLINE '\n' /* line feed */ +#define SP ' ' /* space */ +#define BS '\b' /* backspace */ +#define HT '\t' /* horizontal tab */ +#define VT '\013' /* vertical tab */ +#define CR '\r' /* carriage return */ +#define FF '\f' /* form feed */ +#define QUOTE '\'' /* single quote */ +#define DOUBLE_QUOTE '\"' /* double quote */ +#define BACKSLASH '\\' /* backslash */ /* defines for constructing filenames */ -#define CODE_SUFFIX ".code.c" -#define DEFINES_SUFFIX ".tab.h" -#define OUTPUT_SUFFIX ".ml" -#define VERBOSE_SUFFIX ".output" +#define CODE_SUFFIX ".code.c" +#define DEFINES_SUFFIX ".tab.h" +#define OUTPUT_SUFFIX ".ml" +#define VERBOSE_SUFFIX ".output" #define INTERFACE_SUFFIX ".mli" /* keyword codes */ @@ -107,15 +107,15 @@ /* character macros */ -#define IS_IDENT(c) (isalnum(c) || (c) == '_' || (c) == '.' || (c) == '$') -#define IS_OCTAL(c) ((c) >= '0' && (c) <= '7') -#define NUMERIC_VALUE(c) ((c) - '0') +#define IS_IDENT(c) (isalnum(c) || (c) == '_' || (c) == '.' || (c) == '$') +#define IS_OCTAL(c) ((c) >= '0' && (c) <= '7') +#define NUMERIC_VALUE(c) ((c) - '0') /* symbol macros */ -#define ISTOKEN(s) ((s) < start_symbol) -#define ISVAR(s) ((s) >= start_symbol) +#define ISTOKEN(s) ((s) < start_symbol) +#define ISVAR(s) ((s) >= start_symbol) /* storage allocation macros */ @@ -124,21 +124,21 @@ #define INTERACT() ROTATECURSOR_MAGIC () -#define CALLOC(k,n) (INTERACT (), calloc((unsigned)(k),(unsigned)(n))) +#define CALLOC(k,n) (INTERACT (), calloc((unsigned)(k),(unsigned)(n))) #define FREE(x) (INTERACT (), free((char*)(x))) #define MALLOC(n) (INTERACT (), malloc((unsigned)(n))) -#define NEW(t) (INTERACT (), (t*)allocate(sizeof(t))) -#define NEW2(n,t) (INTERACT (), (t*)allocate((unsigned)((n)*sizeof(t)))) +#define NEW(t) (INTERACT (), (t*)allocate(sizeof(t))) +#define NEW2(n,t) (INTERACT (), (t*)allocate((unsigned)((n)*sizeof(t)))) #define REALLOC(p,n) (INTERACT (), realloc((char*)(p),(unsigned)(n))) #else -#define CALLOC(k,n) (calloc((unsigned)(k),(unsigned)(n))) -#define FREE(x) (free((char*)(x))) -#define MALLOC(n) (malloc((unsigned)(n))) -#define NEW(t) ((t*)allocate(sizeof(t))) -#define NEW2(n,t) ((t*)allocate((unsigned)((n)*sizeof(t)))) -#define REALLOC(p,n) (realloc((char*)(p),(unsigned)(n))) +#define CALLOC(k,n) (calloc((unsigned)(k),(unsigned)(n))) +#define FREE(x) (free((char*)(x))) +#define MALLOC(n) (malloc((unsigned)(n))) +#define NEW(t) ((t*)allocate(sizeof(t))) +#define NEW2(n,t) ((t*)allocate((unsigned)((n)*sizeof(t)))) +#define REALLOC(p,n) (realloc((char*)(p),(unsigned)(n))) #endif /* macintosh */ @@ -161,10 +161,10 @@ struct bucket char true_token; }; -/* TABLE_SIZE is the number of entries in the symbol table. */ -/* TABLE_SIZE must be a power of two. */ +/* TABLE_SIZE is the number of entries in the symbol table. */ +/* TABLE_SIZE must be a power of two. */ -#define TABLE_SIZE 4096 +#define TABLE_SIZE 4096 /* the structure of the LR(0) state machine */ |