Mon Dec 6 14:41:09 PST 1999

(Raster)

fixed proottype difference in epp... wonder hwo that got there...


SVN revision: 1504
This commit is contained in:
Carsten Haitzler 1999-12-06 16:59:44 +00:00
parent af85621ae6
commit 67a62c504b
9 changed files with 1052 additions and 911 deletions

View File

@ -92,3 +92,10 @@ Thu Oct 28 12:49:19 PDT 1999
(Mandrake)
Tru64 (again)
-------------------------------------------------------------------------------
Mon Dec 6 14:41:09 PST 1999
(Raster)
fixed proottype difference in epp... wonder hwo that got there...

View File

@ -240,7 +240,8 @@ parse_number(pfile, start, olen)
if ((long)n < 0 && !op.unsignedp)
{
if (base == 10)
cpp_warning(pfile, "integer constant is so large that it is unsigned");
cpp_warning(pfile,
"integer constant is so large that it is unsigned");
op.unsignedp = 1;
}
op.value = n;
@ -254,8 +255,7 @@ struct token
int token;
};
static struct token tokentab2[] =
{
static struct token tokentab2[] = {
{"&&", ANDAND},
{"||", OROR},
{"<<", LSH},
@ -335,10 +335,12 @@ cpp_lex(pfile)
unsigned char *ptr = tok_start;
#ifdef MULTIBYTE_CHARS
char token_buffer[MAX_LONG_TYPE_SIZE / MAX_CHAR_TYPE_SIZE + MB_CUR_MAX];
char token_buffer[MAX_LONG_TYPE_SIZE /
MAX_CHAR_TYPE_SIZE + MB_CUR_MAX];
#else
char token_buffer[MAX_LONG_TYPE_SIZE / MAX_CHAR_TYPE_SIZE + 1];
char token_buffer[MAX_LONG_TYPE_SIZE /
MAX_CHAR_TYPE_SIZE + 1];
#endif
@ -405,10 +407,13 @@ cpp_lex(pfile)
sizeof("__CHAR_UNSIGNED__") - 1, -1)
|| ((result >> (num_bits - 1)) & 1) == 0)
op.value
= result & ((unsigned long)~0 >> (HOST_BITS_PER_LONG - num_bits));
=
result & ((unsigned long)~0 >>
(HOST_BITS_PER_LONG - num_bits));
else
op.value
= result | ~((unsigned long)~0 >> (HOST_BITS_PER_LONG - num_bits));
op.value =
result | ~((unsigned long)~0 >>
(HOST_BITS_PER_LONG - num_bits));
}
else
{
@ -426,7 +431,8 @@ cpp_lex(pfile)
if (mbtowc(&wc, token_buffer, num_chars) == num_chars)
result = wc;
else
cpp_warning(pfile, "Ignoring invalid multibyte character");
cpp_warning(pfile,
"Ignoring invalid multibyte character");
}
#endif
op.value = result;
@ -456,7 +462,8 @@ cpp_lex(pfile)
memset(buf, 0, 40);
sprintf(buf, "`%s' not allowed in operand of `#if'", tok_start);
sprintf(buf, "`%s' not allowed in operand of `#if'",
tok_start);
cpp_error(pfile, buf);
free(buf);
}
@ -665,9 +672,9 @@ right_shift(pfile, a, unsignedp, b)
/* Parse and evaluate a C expression, reading from PFILE.
* Returns the value of the expression. */
HOST_WIDE_INT
cpp_parse_expr(pfile)
cpp_reader *pfile;
HOST_WIDE_INT cpp_parse_expr(pfile)
cpp_reader *
pfile;
{
/* The implementation is an operator precedence parser,
* i.e. a bottom-up parser, using a stack for not-yet-reduced tokens.
@ -804,7 +811,8 @@ cpp_parse_expr(pfile)
while (top->rprio > lprio)
{
long v1 = top[-1].value, v2 = top[0].value;
int unsigned1 = top[-1].unsignedp, unsigned2 = top[0].unsignedp;
int unsigned1 = top[-1].unsignedp, unsigned2 =
top[0].unsignedp;
top--;
if ((top[1].flags & LEFT_OPERAND_REQUIRED)
@ -1021,8 +1029,7 @@ cpp_parse_expr(pfile)
case ')':
if ((top[1].flags & HAVE_VALUE)
|| !(top[0].flags & HAVE_VALUE)
|| top[0].op != '('
|| (top[-1].flags & HAVE_VALUE))
|| top[0].op != '(' || (top[-1].flags & HAVE_VALUE))
{
cpp_error(pfile, "mismatched parentheses in #if");
goto syntax_error;
@ -1039,8 +1046,7 @@ cpp_parse_expr(pfile)
fprintf(stderr,
top[1].op >= ' ' && top[1].op <= '~'
? "unimplemented operator '%c'\n"
: "unimplemented operator '\\%03o'\n",
top[1].op);
: "unimplemented operator '\\%03o'\n", top[1].op);
}
}
if (op.op == 0)

View File

@ -26,11 +26,11 @@
#include "cpphash.h"
static HASHNODE *hashtab[HASHSIZE];
HASHNODE *cpp_lookup(struct parse_file *pfile, const unsigned char * name, int len,
int hash);
HASHNODE *cpp_lookup(struct parse_file *pfile,
const unsigned char *name, int len, int hash);
void delete_macro(HASHNODE * hp);
HASHNODE *install(unsigned char * name, int len, enum node_type type, int ivalue,
char *value, int hash);
HASHNODE *install(unsigned char *name, int len, enum node_type type,
int ivalue, char *value, int hash);
/* Define a generic NULL if one hasn't already been defined. */
@ -72,7 +72,8 @@ hashf(const unsigned char *name, int len, int hashsize)
* Otherwise, compute the hash code.
*/
HASHNODE *
cpp_lookup(struct parse_file *pfile, const unsigned char *name, int len, int hash)
cpp_lookup(struct parse_file * pfile, const unsigned char *name, int len,
int hash)
{
const unsigned char *bp;
HASHNODE *bucket;

View File

@ -2,18 +2,20 @@ enum node_type;
/* different kinds of things that can appear in the value field
of a hash node. Actually, this may be useless now. */
union hashval {
union hashval
{
int ival;
char *cpval;
DEFINITION *defn;
};
struct hashnode {
struct hashnode
{
struct hashnode *next; /* double links for easy deletion */
struct hashnode *prev;
struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
chain is kept, in case the node is the head
of the chain and gets deleted. */
* chain is kept, in case the node is the head
* of the chain and gets deleted. */
enum node_type type; /* type of special token */
int length; /* length of token, for quick comparison */
unsigned char *name; /* the actual name */
@ -33,4 +35,5 @@ typedef struct hashnode HASHNODE;
#define HASHSTEP(old, c) ((old << 2) + c)
#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
extern HASHNODE* install PARAMS ((unsigned char*,int,enum node_type, int,char*,int));
extern HASHNODE *install
PARAMS((unsigned char *, int, enum node_type, int, char *, int));

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
/* Definitions for CPP library.
Copyright (C) 1995 Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
@ -24,7 +25,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#include <sys/stat.h>
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
#define STATIC_BUFFERS
@ -35,7 +37,8 @@ typedef struct cpp_buffer cpp_buffer;
typedef struct cpp_options cpp_options;
typedef struct hashnode cpp_hashnode;
enum cpp_token {
enum cpp_token
{
CPP_EOF = -1,
CPP_OTHER = 0,
CPP_COMMENT = 1,
@ -71,7 +74,8 @@ typedef int (*parse_cleanup_t) PARAMS((cpp_buffer *, cpp_reader*));
/* A parse_marker indicates a previous position,
which we can backtrack to. */
struct parse_marker {
struct parse_marker
{
cpp_buffer *buf;
struct parse_marker *next;
int position;
@ -83,16 +87,16 @@ extern void parse_goto_mark PARAMS((struct parse_marker*, cpp_reader*));
extern void parse_move_mark PARAMS((struct parse_marker *, cpp_reader *));
extern int cpp_handle_options PARAMS((cpp_reader *, int, char **));
extern enum cpp_token cpp_get_token PARAMS ((struct parse_marker*));
extern enum cpp_token cpp_get_token PARAMS((cpp_reader *));
extern void cpp_skip_hspace PARAMS((cpp_reader *));
extern enum cpp_token cpp_get_non_space_token PARAMS((cpp_reader *));
/* Maintain and search list of included files, for #import. */
#define IMPORT_HASH_SIZE 31
struct import_file {
struct import_file
{
char *name;
ino_t inode;
dev_t dev;
@ -102,7 +106,8 @@ struct import_file {
/* If we have a huge buffer, may need to cache more recent counts */
#define CPP_LINE_BASE(BUF) ((BUF)->buf + (BUF)->line_base)
struct cpp_buffer {
struct cpp_buffer
{
unsigned char *buf;
unsigned char *cur;
unsigned char *rlimit; /* end of valid data */
@ -114,7 +119,7 @@ struct cpp_buffer {
char *nominal_fname;
/* Record where in the search path this file was found.
For #include_next. */
* For #include_next. */
struct file_name_list *dir;
long line_base;
@ -128,7 +133,7 @@ struct cpp_buffer {
void *data;
struct parse_marker *marks;
/* Value of if_stack at start of this file.
Used to prohibit unmatched #endif (etc) in an include file. */
* Used to prohibit unmatched #endif (etc) in an include file. */
struct if_stack *if_stack;
/* True if this is a header file included using <FILENAME>. */
@ -136,12 +141,12 @@ struct cpp_buffer {
char seen_eof;
/* True if buffer contains escape sequences.
Currently there are are only two kind:
"@-" means following identifier should not be macro-expanded.
"@ " means a token-separator. This turns into " " in final output
if not stringizing and needed to separate tokens; otherwise nothing.
"@@" means a normal '@'.
(An '@' inside a string stands for itself and is never an escape.) */
* Currently there are are only two kind:
* "@-" means following identifier should not be macro-expanded.
* "@ " means a token-separator. This turns into " " in final output
* if not stringizing and needed to separate tokens; otherwise nothing.
* "@@" means a normal '@'.
* (An '@' inside a string stands for itself and is never an escape.) */
char has_escapes;
};
@ -157,7 +162,8 @@ typedef struct assertion_hashnode ASSERTION_HASHNODE;
#define CPP_STACK_MAX 200
#endif
struct cpp_reader {
struct cpp_reader
{
unsigned char *limit;
parse_underflow_t get_token;
cpp_buffer *buffer;
@ -181,12 +187,12 @@ struct cpp_reader {
struct file_name_list *dont_repeat_files;
/* List of other included files.
If ->control_macro if nonzero, the file had a #ifndef
around the entire contents, and ->control_macro gives the macro name. */
* If ->control_macro if nonzero, the file had a #ifndef
* around the entire contents, and ->control_macro gives the macro name. */
struct file_name_list *all_include_files;
/* Current maximum length of directory names in the search path
for include files. (Altered as we get more of them.) */
* for include files. (Altered as we get more of them.) */
int max_include_len;
/* Hash table of files already included with #include or #import. */
@ -195,12 +201,12 @@ struct cpp_reader {
struct if_stack *if_stack;
/* Nonzero means we are inside an IF during a -pcp run. In this mode
macro expansion is done, and preconditions are output for all macro
uses requiring them. */
* macro expansion is done, and preconditions are output for all macro
* uses requiring them. */
char pcp_inside_if;
/* Nonzero means we have printed (while error reporting) a list of
containing files that matches the current status. */
* containing files that matches the current status. */
char input_stack_listing_current;
/* If non-zero, macros are not expanded. */
@ -216,16 +222,16 @@ struct cpp_reader {
char parsing_include_directive;
/* True if escape sequences (as described for has_escapes in
parse_buffer) should be emitted. */
* parse_buffer) should be emitted. */
char output_escapes;
/* 0: Have seen non-white-space on this line.
1: Only seen white space so far on this line.
2: Only seen white space so far in this file. */
* 1: Only seen white space so far on this line.
* 2: Only seen white space so far in this file. */
char only_seen_white;
/* Nonzero means this file was included with a -imacros or -include
command line and should not be recorded as an include file. */
* command line and should not be recorded as an include file. */
int no_record_file;
@ -290,7 +296,8 @@ struct cpp_reader {
#endif
/* Pointed to by parse_file::data. */
struct cpp_options {
struct cpp_options
{
char *in_fname;
/* Name of output file, for error messages. */
@ -314,7 +321,7 @@ struct cpp_options {
char objc;
/* Nonzero means this is an assembly file, and allow
unknown directives, which could be comments. */
* unknown directives, which could be comments. */
int lang_asm;
@ -323,7 +330,7 @@ struct cpp_options {
char for_lint;
/* Nonzero means handle CHILL comment syntax
and output CHILL string delimiter for __DATE___ etc. */
* and output CHILL string delimiter for __DATE___ etc. */
char chill;
@ -336,13 +343,13 @@ struct cpp_options {
char no_trigraphs;
/* Nonzero means print the names of included files rather than
the preprocessed output. 1 means just the #include "...",
2 means #include <...> as well. */
* the preprocessed output. 1 means just the #include "...",
* 2 means #include <...> as well. */
char print_deps;
/* Nonzero if missing .h files in -M output are assumed to be generated
files and not errors. */
* files and not errors. */
char print_deps_missing_files;
@ -374,7 +381,7 @@ struct cpp_options {
char warn_import;
/* Nonzero means warn if a macro argument is (or would be)
stringified with -traditional. */
* stringified with -traditional. */
char warn_stringify;
@ -383,8 +390,8 @@ struct cpp_options {
char warnings_are_errors;
/* Nonzero causes output not to be done,
but directives such as #define that have side effects
are still obeyed. */
* but directives such as #define that have side effects
* are still obeyed. */
char no_output;
@ -398,7 +405,7 @@ struct cpp_options {
char output_conditionals;
/* Nonzero means -I- has been seen,
so don't look for #include "foo" the source-file directory. */
* so don't look for #include "foo" the source-file directory. */
char ignore_srcdir;
/* Zero means dollar signs are punctuation.
@ -424,10 +431,10 @@ struct cpp_options {
struct file_name_list *include; /* First dir to search */
/* First dir to search for <file> */
/* This is the first element to use for #include <...>.
If it is 0, use the entire chain for such includes. */
* If it is 0, use the entire chain for such includes. */
struct file_name_list *first_bracket_include;
/* This is the first element in the chain that corresponds to
a directory of system header files. */
* a directory of system header files. */
struct file_name_list *first_system_include;
struct file_name_list *last_include; /* Last in chain */
@ -440,7 +447,7 @@ struct cpp_options {
struct file_name_list *last_before_system; /* Last in chain */
/* Directory prefix that should replace `/usr' in the standard
include file directories. */
* include file directories. */
char *include_prefix;
char inhibit_predefs;
@ -454,7 +461,8 @@ struct cpp_options {
dump_definitions means pass the whole definition (plus #define) through
*/
enum {dump_none = 0, dump_only, dump_names, dump_definitions}
enum
{ dump_none = 0, dump_only, dump_names, dump_definitions }
dump_macros;
/* Nonzero means pass all #define and #undef directives which we actually
@ -469,7 +477,7 @@ struct cpp_options {
struct cpp_pending *pending;
/* File name which deps are being written to.
This is 0 if deps are being written to stdout. */
* This is 0 if deps are being written to stdout. */
char *deps_file;
/* Target-name to write with the dependency information. */
@ -492,7 +500,8 @@ extern char *progname;
by a separate piece of code. */
/* different flavors of hash nodes --- also used in keyword table */
enum node_type {
enum node_type
{
T_DEFINE = 1, /* the `#define' keyword */
T_INCLUDE, /* the `#include' keyword */
T_INCLUDE_NEXT, /* the `#include_next' keyword */
@ -563,7 +572,8 @@ struct macrodef
where (x, y) means (nchars, argno). */
typedef struct definition DEFINITION;
struct definition {
struct definition
{
int nargs;
int length; /* length of expansion string */
int predefined; /* True if the macro was builtin or */
@ -572,24 +582,28 @@ struct definition {
int line; /* Line number of definition */
char *file; /* File of definition */
char rest_args; /* Nonzero if last arg. absorbs the rest */
struct reflist {
struct reflist
{
struct reflist *next;
char stringify; /* nonzero if this arg was preceded by a
# operator. */
* # operator. */
char raw_before; /* Nonzero if a ## operator before arg. */
char raw_after; /* Nonzero if a ## operator after arg. */
char rest_args; /* Nonzero if this arg. absorbs the rest */
int nchars; /* Number of literal chars to copy before
this arg occurrence. */
* this arg occurrence. */
int argno; /* Number of arg to substitute (origin-0) */
} *pattern;
union {
}
*pattern;
union
{
/* Names of macro args, concatenated in reverse order
with comma-space between them.
The only use of this is that we warn on redefinition
if this differs between the old and new definitions. */
* with comma-space between them.
* The only use of this is that we warn on redefinition
* if this differs between the old and new definitions. */
unsigned char *argnames;
} args;
}
args;
};
extern unsigned char is_idchar[256];
@ -597,14 +611,15 @@ extern unsigned char is_idchar[256];
/* Stack of conditionals currently in progress
(including both successful and failing conditionals). */
struct if_stack {
struct if_stack
{
struct if_stack *next; /* for chaining to the next stack frame */
char *fname; /* copied from input when frame is made */
int lineno; /* similarly */
int if_succeeded; /* true if a leg of this if-group
has been passed through rescan */
* has been passed through rescan */
unsigned char *control_macro; /* For #ifndef at start of file,
this is the macro name tested. */
* this is the macro name tested. */
enum node_type type; /* type of last directive seen in this group */
};
typedef struct if_stack IF_STACK_FRAME;
@ -626,7 +641,8 @@ extern void cpp_pfatal_with_name ();
extern void cpp_grow_buffer PARAMS((cpp_reader *, long));
extern int cpp_parse_escape PARAMS((cpp_reader *, char **));
extern cpp_buffer* cpp_push_buffer PARAMS ((cpp_reader *, unsigned char*, long));
extern cpp_buffer *cpp_push_buffer
PARAMS((cpp_reader *, unsigned char *, long));
extern cpp_buffer *cpp_pop_buffer PARAMS((cpp_reader *));
extern cpp_hashnode *cpp_lookup PARAMS((cpp_reader *, const unsigned char *,

View File

@ -33,10 +33,12 @@ void *xmalloc(unsigned size);
void *xrealloc(void *old, unsigned size);
void *xcalloc(unsigned number, unsigned size);
void cpp_print_containing_files(cpp_reader * pfile);
void cpp_file_line_for_message(cpp_reader *pfile, char *filename, int line,
void cpp_file_line_for_message(cpp_reader * pfile,
char *filename, int line,
int column);
void cpp_message(cpp_reader *pfile, int is_error, char *msg, char *arg1,
char *arg2, char *arg3);
void cpp_message(cpp_reader * pfile, int is_error, char *msg,
char *arg1, char *arg2, char *arg3);
void cpp_pfatal_with_name(cpp_reader * pfile, char *name);
struct operation parse_number(cpp_reader * pfile, char *start, int olen);
struct operation cpp_lex(cpp_reader * pfile);
@ -53,10 +55,14 @@ void cpp_skip_hspace(cpp_reader *pfile);
void copy_rest_of_line(cpp_reader * pfile);
void skip_rest_of_line(cpp_reader * pfile);
int handle_directive(cpp_reader * pfile);
cpp_buffer *cpp_push_buffer(cpp_reader *pfile, unsigned char *buffer, long length);
cpp_buffer *cpp_push_buffer(cpp_reader * pfile, unsigned char *buffer,
long length);
cpp_buffer *cpp_pop_buffer(cpp_reader * pfile);
void cpp_scan_buffer(cpp_reader * pfile);
void cpp_buf_line_and_col(cpp_buffer *pbuf, long *linep, long *colp);
void cpp_buf_line_and_col(cpp_buffer * pbuf, long *linep,
long *colp);
int hashf(const unsigned char *name, int len, int hashsize);
void cpp_hash_cleanup(cpp_reader * pfile);
int cpp_read_check(cpp_reader * pfile);
@ -70,5 +76,7 @@ int cpp_read_check_assertion(cpp_reader *pfile);
void fancy_abort(void);
enum cpp_token cpp_get_token(cpp_reader * pfile);
enum cpp_token cpp_get_non_space_token(cpp_reader * pfile);
int cpp_handle_options(cpp_reader *pfile, int argc, char **argv);
int cpp_handle_options(cpp_reader * pfile, int argc,
char **argv);
void cpp_print_file_and_line(cpp_reader * pfile);

View File

@ -0,0 +1 @@
#define E_CHECKOUT_DATE "$Date$"