typedef enum cpp_token (*parseUnderflow) (cppReader *);
typedef void (*parseCleanup) (cppBuffer *, cppReader *);
+/* Structure returned by create_definition */
+typedef struct s_macrodef macroDef;
+
/* A parse_marker indicates a previous position,
which we can backtrack to. */
struct arglist {
/*@null@*/ struct arglist *next;
/*@dependent@*/ char *name;
- int length;
+ size_t length;
int argno;
int rest_args;
};
-extern enum cpp_token cppGetToken (cppReader *);
+extern enum cpp_token cpplib_getToken (cppReader *);
+extern enum cpp_token cpplib_getTokenForceExpand (cppReader *);
+extern enum cpp_token cpplib_getTokenAux (cppReader *, bool p_forceExpand);
extern int /*@alt void@*/ cppSkipHspace (cppReader *);
/* This frees resources used by PFILE. */
/* Current maximum length of directory names in the search path
for include files. (Altered as we get more of them.) */
- int max_include_len;
+ size_t max_include_len;
/*@null@*/ struct if_stack *if_stack;
int lineno;
/*@null@*/ /*@observer@*/ struct tm *timebuf;
-
-#ifdef __cplusplus
- ~cppReader () { cppCleanup (this); }
-#endif
};
/*@constant int cppReader_fatalErrorLimit; @*/
#define cppReader_fatalErrorLimit 1000
/* True if we have seen a "fatal" error. */
-extern bool cppFatalErrors (cppReader *) /*@*/ ;
-#define cppFatalErrors(READER) ((READER)->errors >= cppReader_fatalErrorLimit)
+extern bool cpplib_fatalErrors (cppReader *) /*@*/ ;
+#define cpplib_fatalErrors(READER) ((READER)->errors >= cppReader_fatalErrorLimit)
-extern int cppBufPeek (cppBuffer *) /*@*/ ;
+extern int cpplib_bufPeek (cppBuffer *) /*@*/ ;
/* Macros for manipulating the token_buffer. */
/* Number of characters currently in PFILE's output buffer. */
-extern size_t cppReader_getWritten (/*@sef@*/ cppReader *) /*@*/ ;
-# define cppReader_getWritten(PFILE) \
+extern size_t cpplib_getWritten (/*@sef@*/ cppReader *) /*@*/ ;
+# define cpplib_getWritten(PFILE) \
(size_fromInt ((PFILE)->limit - (PFILE)->token_buffer))
-extern /*@exposed@*/ char *cppReader_getPWritten (cppReader *) /*@*/ ;
-# define cppReader_getPWritten(PFILE) ((PFILE)->limit)
+extern /*@exposed@*/ char *cpplib_getPWritten (cppReader *) /*@*/ ;
+# define cpplib_getPWritten(PFILE) ((PFILE)->limit)
/* Make sure PFILE->token_buffer has space for at least N more characters. */
-extern void cppReader_reserve (/*@sef@*/ cppReader *, /*@sef@*/ size_t);
-#define cppReader_reserve(PFILE, N) \
- (cppReader_getWritten (PFILE) + (N) > (PFILE)->token_buffer_size \
- && (cppReader_growBuffer (PFILE, (N)), 0))
+extern void cpplib_reserve (/*@sef@*/ cppReader *, /*@sef@*/ size_t);
+#define cpplib_reserve(PFILE, N) \
+ (((cpplib_getWritten (PFILE) + (N) > (PFILE)->token_buffer_size)) ? cppReader_growBuffer (PFILE, (N)) : (void) 0)
/* Append string STR (of length N) to PFILE's output buffer.
Assume there is enough space. */
/* Name of output file, for error messages. */
/*@dependent@*/ cstring out_fname;
- struct file_name_map_list *map_list;
+ /*@only@*/ struct file_name_map_list *map_list;
/* Non-0 means -v, so print the full set of include dirs. */
bool verbose;
bool pedantic_errors;
/* Nonzero means don't print warning messages. -w. */
-
- bool inhibit_warnings;
+ /* bool inhibit_warnings; -- removed evans 2001-07-19 */
/* Nonzero means warn if slash-star appears in a comment. */
-
bool warn_comments;
/* Nonzero means warn if a macro argument is (or would be)
char output_conditionals;
- char ignore_srcdir;
+ bool ignore_srcdir;
/* Zero means dollar signs are punctuation.
This used to be needed for conformance to the C Standard,
/* First dir to search */
/*@owned@*/ struct file_name_list *include;
+
/* 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. */
/*@uses p_pfile->opts@*/
/*@modifies nothing@*/ ;
-#define cppReader_isTraditional(PFILE) (CPPOPTIONS(PFILE)-> traditional)
+#define cppReader_isTraditional(PFILE) (CPPOPTIONS(PFILE)->traditional)
extern bool cppReader_isPedantic (cppReader *) /*@*/;
#define cppReader_isPedantic(PFILE) (CPPOPTIONS (PFILE)->pedantic)
/* different flavors of hash nodes --- also used in keyword table */
enum node_type {
T_NONE = 0,
- T_DEFINE = 1, /* the `#define' keyword */
- T_INCLUDE, /* the `#include' keyword */
- T_INCLUDE_NEXT, /* the `#include_next' keyword */
- T_IFDEF, /* the `#ifdef' keyword */
- T_IFNDEF, /* the `#ifndef' keyword */
- T_IF, /* the `#if' keyword */
- T_ELSE, /* `#else' */
- T_PRAGMA, /* `#pragma' */
- T_ELIF, /* `#elif' */
- T_UNDEF, /* `#undef' */
- T_LINE, /* `#line' */
- T_ERROR, /* `#error' */
- T_WARNING, /* `#warning' */
- T_ENDIF, /* `#endif' */
- T_IDENT, /* `#ident', used on system V. */
- T_SPECLINE, /* special symbol `__LINE__' */
- T_DATE, /* `__DATE__' */
- T_FILE, /* `__FILE__' */
- T_BASE_FILE, /* `__BASE_FILE__' */
- T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
- T_VERSION, /* `__VERSION__' */
- T_SIZE_TYPE, /* `__SIZE_TYPE__' */
- T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */
- T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */
- T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */
- T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */
- T_TIME, /* `__TIME__' */
- T_CONST, /* Constant value, used by `__STDC__' */
- T_MACRO, /* macro defined by `#define' */
+ T_DEFINE = 1, /* the #define keyword */
+ T_INCLUDE, /* the #include keyword */
+ T_INCLUDE_NEXT, /* the #include_next keyword */
+ T_IFDEF, /* the #ifdef keyword */
+ T_IFNDEF, /* the #ifndef keyword */
+ T_IF, /* the #if keyword */
+ T_ELSE, /* #else */
+ T_PRAGMA, /* #pragma */
+ T_ELIF, /* #elif */
+ T_UNDEF, /* #undef */
+ T_LINE, /* #line */
+ T_ERROR, /* #error */
+ T_WARNING, /* #warning */
+ T_ENDIF, /* #endif */
+ T_IDENT, /* #ident, used on system V. */
+ T_SPECLINE, /* special symbol __LINE__ */
+ T_DATE, /* __DATE__ */
+ T_FILE, /* __FILE__ */
+ T_BASE_FILE, /* __BASE_FILE__ */
+ T_INCLUDE_LEVEL, /* __INCLUDE_LEVEL__ */
+ T_FUNC, /* __func__ */
+ T_VERSION, /* __VERSION__ */
+ T_SIZE_TYPE, /* __SIZE_TYPE__ */
+ T_PTRDIFF_TYPE, /* __PTRDIFF_TYPE__ */
+ T_WCHAR_TYPE, /* __WCHAR_TYPE__ */
+ T_USER_LABEL_PREFIX_TYPE, /* __USER_LABEL_PREFIX__ */
+ T_REGISTER_PREFIX_TYPE, /* __REGISTER_PREFIX__ */
+ T_TIME, /* __TIME__ */
+ T_CONST, /* Constant value, used by __STDC__ */
+ T_MACRO, /* macro defined by #define */
T_DISABLED, /* macro temporarily turned off for rescan */
- T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
+ T_SPEC_DEFINED, /* special defined macro for use in #if statements */
T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
T_UNUSED /* Used for something not defined. */
} ;
-/* Structure returned by create_definition */
-typedef struct macrodef MACRODEF;
-struct macrodef
+struct s_macrodef
{
/*@null@*/ struct definition *defn;
- /*@relnull@*/ /*@dependent@*/ char *symnam; /* null if defn is null */
- int symlen;
+ /*@exposed@*/ /*@relnull@*/ char *symnam; /* null if defn is null */
+ size_t symlen;
};
/* Structure allocated for every #define. For a simple replacement
};
typedef struct if_stack cppIfStackFrame;
-extern void cppBuffer_lineAndColumn (/*@null@*/ cppBuffer *, /*@out@*/ int *,
- /*@out@*/ /*@null@*/ int *);
+extern void cppBuffer_getLineAndColumn (/*@null@*/ cppBuffer *, /*@out@*/ int *,
+ /*@out@*/ /*@null@*/ int *);
extern /*@exposed@*/ /*@null@*/ cppBuffer *cppReader_fileBuffer (cppReader *);
extern void cppReader_growBuffer (cppReader *, size_t);
# include <stdlib.h>
-# ifdef WIN32
/*@constant observer char *GCC_INCLUDE_DIR;@*/
-# define GCC_INCLUDE_DIR NULL
-# else
-/*@constant observer char *GCC_INCLUDE_DIR;@*/
-# define GCC_INCLUDE_DIR "/usr/lib/gcc-lib/i386-linux/2.7.2.1/include"
-# endif
+/* This is defined by config.h now. */
-# ifdef WIN32
-/*@constant observer char *GCC_INCLUDE_DIR2@*/
-# define GCC_INCLUDE_DIR2 NULL
-# else
/*@constant observer char *GCC_INCLUDE_DIR2@*/
-# define GCC_INCLUDE_DIR2 "/usr/include"
-# endif
+/* This is defined by config.h now. */
struct file_name_list
{
};
extern void cppReader_addIncludeChain (/*@special@*/ cppReader *p_pfile,
- /*@keep@*/ struct file_name_list *p_dir)
+ /*@only@*/ struct file_name_list *p_dir)
/*@uses p_pfile->opts, p_pfile->max_include_len@*/
/*@modifies p_pfile, p_dir@*/ ;
extern void cppReader_define (cppReader *p_pfile, char *p_str);
extern void cppReader_finish (cppReader *p_pfile);
-extern void cppReader_init (/*@out@*/ cppReader *p_pfile) ;
+extern void cpplib_init (/*@out@*/ cppReader *p_pfile) ;
extern void cppOptions_init (/*@out@*/ cppOptions *p_opts);
-extern void cppReader_initializeReader (cppReader *p_pfile) /*@modifies p_pfile@*/ ;
+extern void cpplib_initializeReader (cppReader *p_pfile) /*@modifies p_pfile@*/ ;
extern int cppReader_startProcess (cppReader *p_pfile, cstring p_fname);
#define INCLUDE_LEN_FUDGE 0
#endif
-extern int cppReader_checkMacroName (cppReader *p_pfile, char *p_symname,
- cstring p_usage);
+extern size_t cppReader_checkMacroName (cppReader *p_pfile, char *p_symname,
+ cstring p_usage);
-extern struct operation cppReader_parseNumber (cppReader *, char *, int);
+extern struct operation cppReader_parseNumber (cppReader * p_pfile, char * p_start, int p_olen) /*@requires maxRead(p_start) >= (p_olen - 1) @*/;