Back to index

salome-paravis  6.5.0
vtkParsePreprocess.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkParsePreprocess.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright (c) 2010 David Gobbi.
00017 
00018   Contributed to the VisualizationToolkit by the author in June 2010
00019   under the terms of the Visualization Toolkit 2008 copyright.
00020 -------------------------------------------------------------------------*/
00021 
00046 #ifndef VTK_PARSE_PREPROCESS_H
00047 #define VTK_PARSE_PREPROCESS_H
00048 
00052 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
00053 typedef __int64 preproc_int_t;
00054 typedef unsigned __int64 preproc_uint_t;
00055 #else
00056 typedef long long preproc_int_t;
00057 typedef unsigned long long preproc_uint_t;
00058 #endif
00059 
00063 typedef struct _MacroInfo
00064 {
00065   const char    *Name;
00066   const char    *Definition;
00067   const char    *Comment; /* unused */
00068   int            NumberOfArguments; /* only if IsFunction == 1 */
00069   const char   **Arguments;  /* symbols for arguments */
00070   int            IsFunction; /* this macro takes arguments */
00071   int            IsExternal; /* this macro is from an included file */
00072 } MacroInfo;
00073 
00078 typedef struct _PreprocessInfo
00079 {
00080   const char    *FileName;         /* the file that is being parsed */
00081   int            NumberOfMacros;
00082   MacroInfo    **Macros;
00083   int            NumberOfIncludeDirectories;
00084   const char   **IncludeDirectories;
00085   int            NumberOfIncludeFiles; /* all included files */
00086   const char   **IncludeFiles;
00087   int            IsExternal;       /* label all macros as "external" */
00088   int            ConditionalDepth; /* internal state variable */
00089   int            ConditionalDone;  /* internal state variable */
00090 } PreprocessInfo;
00091 
00095 enum _preproc_platform_t {
00096   VTK_PARSE_NATIVE = 0,
00097 };
00098 
00102 enum _preproc_return_t {
00103   VTK_PARSE_OK = 0,
00104   VTK_PARSE_SKIP = 1,            /* skip next block */
00105   VTK_PARSE_PREPROC_DOUBLE = 2,  /* encountered a double */
00106   VTK_PARSE_PREPROC_FLOAT = 3,   /* encountered a float */
00107   VTK_PARSE_PREPROC_STRING = 4,  /* encountered a string */
00108   VTK_PARSE_MACRO_UNDEFINED = 5, /* macro lookup failed */
00109   VTK_PARSE_MACRO_REDEFINED = 6, /* attempt to redefine a macro */
00110   VTK_PARSE_FILE_NOT_FOUND = 7,  /* include file not found */
00111   VTK_PARSE_FILE_OPEN_ERROR = 8, /* include file not readable */
00112   VTK_PARSE_FILE_READ_ERROR = 9, /* error during read */
00113   VTK_PARSE_MACRO_NUMARGS = 10,  /* wrong number of args to func macro */
00114   VTK_PARSE_SYNTAX_ERROR = 11    /* any and all syntax errors */
00115 };
00116 
00120 #define VTK_PARSE_FATAL_ERROR 0xF8
00121 
00122 #ifdef __cplusplus
00123 extern "C" {
00124 #endif
00125 
00136 int vtkParsePreprocess_HandleDirective(
00137   PreprocessInfo *info, const char *directive);
00138 
00148 int vtkParsePreprocess_EvaluateExpression(
00149   PreprocessInfo *info, const char *text,
00150   preproc_int_t *val, int *is_unsigned);
00151 
00157 void vtkParsePreprocess_AddStandardMacros(
00158   PreprocessInfo *info, int platform);
00159 
00164 int vtkParsePreprocess_AddMacro(
00165   PreprocessInfo *info, const char *name, const char *definition);
00166 
00171 int vtkParsePreprocess_RemoveMacro(
00172   PreprocessInfo *info, const char *name);
00173 
00177 MacroInfo *vtkParsePreprocess_GetMacro(
00178   PreprocessInfo *info, const char *name);
00179 
00185 const char *vtkParsePreprocess_ExpandMacro(
00186   MacroInfo *macro, const char *argstring);
00187 
00191 void vtkParsePreprocess_FreeExpandedMacro(const char *emacro);
00192 
00197 void vtkParsePreprocess_IncludeDirectory(
00198   PreprocessInfo *info, const char *name);
00199 
00207 const char *vtkParsePreprocess_FindIncludeFile(
00208   PreprocessInfo *info, const char *filename, int system_first,
00209   int *already_loaded);
00210 
00214 void vtkParsePreprocess_InitMacro(MacroInfo *symbol);
00215 
00219 void vtkParsePreprocess_InitPreprocess(PreprocessInfo *info);
00220 
00221 #ifdef __cplusplus
00222 } /* extern "C" */
00223 #endif
00224 
00225 #endif