VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkParseString.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 /* 00017 String allocation routines used by vtkParse. 00018 00019 The parser uses "const char *" as its string object type, and expects 00020 all string objects to persist and be constant for the entire lifetime 00021 of the data generated by the parse (usually this means until the parser 00022 executable has exited). All strings that are stored in the parser's 00023 data objects should either be statically allocated, or allocated with 00024 the vtkParse_NewString() or vtkParse_CacheString() methods declared here. 00025 */ 00026 00027 #ifndef VTK_PARSE_STRING_H 00028 #define VTK_PARSE_STRING_H 00029 00030 #include <stddef.h> 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00041 typedef struct _StringCache 00042 { 00043 unsigned long NumberOfChunks; 00044 char **Chunks; 00045 size_t ChunkSize; 00046 size_t Position; 00047 } StringCache; 00048 00052 void vtkParse_InitStringCache(StringCache *cache); 00053 00058 char *vtkParse_NewString(StringCache *cache, size_t n); 00059 00066 const char *vtkParse_CacheString(StringCache *cache, const char *cp, size_t n); 00067 00072 void vtkParse_FreeStringCache(StringCache *cache); 00073 00074 #ifdef __cplusplus 00075 } /* extern "C" */ 00076 #endif 00077 00078 #endif