1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
/*
* (c) Thomas Pornin 1999 - 2002
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. The name of the authors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef UCPP__REENT__
#define UCPP__REENT__
#include "tune.h"
#ifdef UCPP_REENTRANT
#include "nhash.h"
#define pCPP struct CPP *REENTR
#define pCPP_ pCPP,
#define aCPP REENTR
#define aCPP_ aCPP,
#define useCPP (void) aCPP
typedef struct _cppm *CPPM;
struct CPP {
int no_special_macros,
emit_dependencies,
emit_defines,
emit_assertions;
int c99_compliant,
c99_hosted;
FILE *emit_output;
char *current_filename,
*current_long_filename;
/*
* Can be used to store an arbitrary pointer value
* that can be retrieved by the callback functions
* ucpp_(ouch|error|warning).
*/
void *callback_arg;
void (*ucpp_ouch)(pCPP_ char *, ...);
void (*ucpp_error)(pCPP_ long, char *, ...);
void (*ucpp_warning)(pCPP_ long, char *, ...);
int *transient_characters;
struct protect {
char *macro;
int state;
struct found_file *ff;
} protect_detect;
struct {
/* from macro.c */
struct lexer_state dsharp_lexer;
char compile_time[12], compile_date[24];
#ifdef PRAGMA_TOKENIZE
struct lexer_state tokenize_lexer;
#endif
/* from eval.c */
long eval_line;
JMP_BUF eval_exception;
} _global;
struct {
HTT assertions;
int assertions_init_done;
} _assert;
struct {
HTT macros;
int macros_init_done;
} _macro;
struct {
char **include_path;
size_t include_path_nb;
int current_incdir;
struct file_context *ls_stack;
size_t ls_depth;
int find_file_error;
struct protect *protect_detect_stack;
HTT found_files;
HTT found_files_sys;
int found_files_init_done;
int found_files_sys_init_done;
} _cpp;
struct {
int emit_eval_warnings;
} _eval;
struct {
CPPM sm;
} _lexer;
};
#else
#define pCPP void
#define pCPP_
#define aCPP
#define aCPP_
#define useCPP (void) 0
#endif
#endif
|