/usr/include/vtk-5.8/vtkParsePreprocess.h is in libvtk5-dev 5.8.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkParsePreprocess.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright (c) 2010 David Gobbi.
Contributed to the VisualizationToolkit by the author in June 2010
under the terms of the Visualization Toolkit 2008 copyright.
-------------------------------------------------------------------------*/
/**
This file provides subroutines to assist in preprocessing
C/C++ header files. It evaluates preprocessor directives
and stores a list of all preprocessor macros.
The preprocessing is done in-line while the file is being
parsed. Macros that are defined in the file are stored but
are not automatically expanded. The parser can query the
macro definitions, or can ask the preprocessor to evaluate
them and return an integer result. Function-like macros
are not yet supported. Since true macro expansion is not
done, things like symbol concatenation and conversion to
strings are not possible.
The typical usage of this preprocessor is that the main
parser will pass any lines that begin with '#' to the
vtkParsePreprocess_HandleDirective() function, which will
evaluate the line and provide a return code. The return
code will tell the main parser if a syntax error or macro
lookup error occurred, and will also let the parser know
if an #if or #else directive requires that the next block
of code be skipped.
No checks are done for recursively-defined macros. If they
occur, the preprocessor will crash.
*/
#ifndef VTK_PARSE_PREPROCESS_H
#define VTK_PARSE_PREPROCESS_H
/**
* The preprocessor int type. Use the compiler's longest int type.
*/
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
typedef __int64 preproc_int_t;
typedef unsigned __int64 preproc_uint_t;
#else
typedef long long preproc_int_t;
typedef unsigned long long preproc_uint_t;
#endif
/**
* Struct to describe a preprocessor symbol.
*/
typedef struct _MacroInfo
{
const char *Name;
const char *Definition;
const char *Comment; /* unused */
int NumberOfArguments; /* only if IsFunction == 1 */
const char **Arguments; /* symbols for arguments */
int IsFunction; /* this macro takes arguments */
int IsExternal; /* this macro is from an included file */
} MacroInfo;
/**
* Contains all symbols defined thus far (including those defined
* in any included header files).
*/
typedef struct _PreprocessInfo
{
const char *FileName; /* the file that is being parsed */
int NumberOfMacros;
MacroInfo **Macros;
int NumberOfIncludeDirectories;
const char **IncludeDirectories;
int NumberOfIncludeFiles; /* all included files */
const char **IncludeFiles;
int IsExternal; /* label all macros as "external" */
int ConditionalDepth; /* internal state variable */
int ConditionalDone; /* internal state variable */
} PreprocessInfo;
/**
* Platforms. Always choose native unless crosscompiling.
*/
enum _preproc_platform_t {
VTK_PARSE_NATIVE = 0,
};
/**
* Directive return values.
*/
enum _preproc_return_t {
VTK_PARSE_OK = 0,
VTK_PARSE_SKIP = 1, /* skip next block */
VTK_PARSE_PREPROC_DOUBLE = 2, /* encountered a double */
VTK_PARSE_PREPROC_FLOAT = 3, /* encountered a float */
VTK_PARSE_PREPROC_STRING = 4, /* encountered a string */
VTK_PARSE_MACRO_UNDEFINED = 5, /* macro lookup failed */
VTK_PARSE_MACRO_REDEFINED = 6, /* attempt to redefine a macro */
VTK_PARSE_FILE_NOT_FOUND = 7, /* include file not found */
VTK_PARSE_FILE_OPEN_ERROR = 8, /* include file not readable */
VTK_PARSE_FILE_READ_ERROR = 9, /* error during read */
VTK_PARSE_SYNTAX_ERROR = 10 /* any and all syntax errors */
};
/**
* Bitfield for fatal errors.
*/
#define VTK_PARSE_FATAL_ERROR 0xF8
#ifdef __cplusplus
extern "C" {
#endif
/**
* Handle a preprocessor directive. Return value VTK_PARSE_OK
* means that no errors occurred, while VTK_PARSE_SKIP means that
* a conditional directive was encountered and the next code
* block should be skipped. The preprocessor has an internal state
* machine that keeps track of conditional if/else/endif directives.
* All other return values indicate errors, and it is up to the
* parser to decide which errors are fatal. The preprocessor
* only considers syntax errors and I/O errors to be fatal.
*/
int vtkParsePreprocess_HandleDirective(
PreprocessInfo *info, const char *directive);
/**
* Evaluate a preprocessor expression, providing an integer result
* in "val", and whether it is unsigned in "is_unsigned". A return
* value of VTK_PARSE_OK means that no errors occurred, while
* VTK_PREPROC_DOUBLE, VTK_PREPROC_FLOAT, and VTK_PREPROC_STRING
* indicate that the preprocessor encountered a non-integer value.
* Error return values are VTK_PARSE_MACRO_UNDEFINED and
* VTK_PARSE_SYNTAX_ERRORS. Undefined macros evaluate to zero.
*/
int vtkParsePreprocess_EvaluateExpression(
PreprocessInfo *info, const char *text,
preproc_int_t *val, int *is_unsigned);
/**
* Add all standard preprocessor symbols. Use VTK_PARSE_NATIVE
* as the platform. In the future, other platform specifiers
* might be added to allow crosscompiling.
*/
void vtkParsePreprocess_AddStandardMacros(
PreprocessInfo *info, int platform);
/**
* Add a preprocessor symbol, including a definition. Return
* values are VTK_PARSE_OK and VTK_PARSE_MACRO_REDEFINED.
*/
int vtkParsePreprocess_AddMacro(
PreprocessInfo *info, const char *name, const char *definition);
/**
* Remove a preprocessor symbol. Return values are VTK_PARSE_OK
* and VTK_PARSE_MACRO_UNDEFINED.
*/
int vtkParsePreprocess_RemoveMacro(
PreprocessInfo *info, const char *name);
/**
* Return a preprocessor symbol struct, or NULL if not found.
*/
MacroInfo *vtkParsePreprocess_GetMacro(
PreprocessInfo *info, const char *name);
/**
* Add an include directory. The directories that were added
* first will be searched first.
*/
void vtkParsePreprocess_IncludeDirectory(
PreprocessInfo *info, const char *name);
/**
* Find an include file in the path. If system_first is set, then
* the current directory is ignored unless it is explicitly in the
* path. A null return value indicates that the file was not found.
* If already_loaded is set, then the file was already loaded. This
* preprocessor never loads the same file twice.
*/
const char *vtkParsePreprocess_FindIncludeFile(
PreprocessInfo *info, const char *filename, int system_first,
int *already_loaded);
/**
* Initialize a preprocessor symbol struct.
*/
void vtkParsePreprocess_InitMacro(MacroInfo *symbol);
/**
* Initialize a preprocessor struct.
*/
void vtkParsePreprocess_InitPreprocess(PreprocessInfo *info);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
|