29 #ifndef CPL_SERV_H_INCLUDED
30 #define CPL_SERV_H_INCLUDED
36 #include "geo_config.h"
44 #if defined(HAVE_STRINGS_H) && !defined(HAVE_STRING_H)
55 # if defined(_WIN32) && defined(BUILD_AS_DLL)
56 # define CPL_DLL __declspec(dllexport)
66 # define CPL_C_START extern "C" {
86 # define MIN(a,b) ((a<b) ? a : b)
87 # define MAX(a,b) ((a>b) ? a : b)
95 # define ABS(x) ((x<0) ? (-1*(x)) : x)
99 #if defined(_WIN32) && !defined(__CYGWIN__)
100 # define EQUALN(a,b,n) (strnicmp(a,b,n)==0)
101 # define EQUAL(a,b) (stricmp(a,b)==0)
103 # define EQUALN(a,b,n) (strncasecmp(a,b,n)==0)
104 # define EQUAL(a,b) (strcasecmp(a,b)==0)
112 #define VSIFOpen fopen
113 #define VSIFClose fclose
115 #define VSIFPrintf fprintf
116 #define VSIFPuts fputs
117 #define VSIFPutc fputc
118 #define VSIFGets fgets
119 #define VSIRewind rewind
120 #define VSIFSeek fseek
121 #define VSIFTell ftell
122 #define VSIFRead fread
125 #define VSICalloc(x,y) _GTIFcalloc(x*y)
126 #define VSIMalloc _GTIFcalloc
127 #define VSIFree _GTIFFree
128 #define VSIRealloc _GTIFrealloc
130 #define VSICalloc(x,y) (((char *) _GTIFcalloc(x*y+4)) + 4)
131 #define VSIMalloc(x) (((char *) _GTIFcalloc((x)+4)) + 4)
132 #define VSIFree(x) _GTIFFree(((char *) (x)) - 4)
133 #define VSIRealloc(p,n) (((char *) _GTIFrealloc(((char *)p)-4,(n)+4)) + 4)
142 #define CPLMalloc gtCPLMalloc
143 #define CPLCalloc gtCPLCalloc
144 #define CPLRealloc gtCPLRealloc
145 #define CPLStrdup gtCPLStrdup
147 void CPL_DLL *CPLMalloc(
int );
148 void CPL_DLL *CPLCalloc(
int,
int );
149 void CPL_DLL *CPLRealloc(
void *,
int );
150 char CPL_DLL *CPLStrdup(
const char * );
152 #define CPLFree(x) { if( x != NULL ) VSIFree(x); }
158 #define CPLReadLine gtCPLReadLine
160 const char CPL_DLL *CPLReadLine( FILE * );
175 #define CPLError gtCPLError
176 #define CPLErrorReset gtCPLErrorReset
177 #define CPLGetLastErrorNo gtCPLGetLastErrorNo
178 #define CPLGetLastErrorMsg gtCPLGetLastErrorMsg
179 #define CPLSetErrorHandler gtCPLSetErrorHandler
180 #define _CPLAssert gt_CPLAssert
182 void CPL_DLL CPLError(CPLErr eErrClass,
int err_no,
const char *fmt, ...);
183 void CPL_DLL CPLErrorReset();
184 int CPL_DLL CPLGetLastErrorNo();
185 const char CPL_DLL * CPLGetLastErrorMsg();
186 void CPL_DLL CPLSetErrorHandler(
void(*pfnErrorHandler)(CPLErr,
int,
188 void CPL_DLL _CPLAssert(
const char *,
const char *,
int );
191 # define CPLAssert(expr) ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
193 # define CPLAssert(expr)
202 #define CPLE_AppDefined 1
203 #define CPLE_OutOfMemory 2
204 #define CPLE_FileIO 3
205 #define CPLE_OpenFailed 4
206 #define CPLE_IllegalArg 5
207 #define CPLE_NotSupported 6
208 #define CPLE_AssertionFailed 7
209 #define CPLE_NoWriteAccess 8
216 #define CSLAddString gtCSLAddString
217 #define CSLCount gtCSLCount
218 #define CSLGetField gtCSLGetField
219 #define CSLDestroy gtCSLDestroy
220 #define CSLDuplicate gtCSLDuplicate
221 #define CSLTokenizeString gtCSLTokenizeString
222 #define CSLTokenizeStringComplex gtCSLTokenizeStringComplex
224 char CPL_DLL **CSLAddString(
char **papszStrList,
const char *pszNewString);
225 int CPL_DLL CSLCount(
char **papszStrList);
226 const char CPL_DLL *CSLGetField(
char **,
int );
227 void CPL_DLL CSLDestroy(
char **papszStrList);
228 char CPL_DLL **CSLDuplicate(
char **papszStrList);
230 char CPL_DLL **CSLTokenizeString(
const char *pszString );
231 char CPL_DLL **CSLTokenizeStringComplex(
const char *pszString,
232 const char *pszDelimiter,
233 int bHonourStrings,
int bAllowEmptyTokens );
243 } CSVCompareCriteria;
245 #define CSVFilename gtCSVFilename
246 #define CSVReadParseLine gtCSVReadParseLine
247 #define CSVScanLines gtCSVScanLines
248 #define CSVScanFile gtCSVScanFile
249 #define CSVScanFileByName gtCSVScanFileByName
250 #define CSVGetFieldId gtCSVGetFieldId
251 #define CSVDeaccess gtCSVDeaccess
252 #define CSVGetField gtCSVGetField
253 #define SetCSVFilenameHook gtSetCSVFilenameHook
254 #define CSVGetFileFieldId gtCSVGetFileFieldId
256 const char CPL_DLL *CSVFilename(
const char * );
258 char CPL_DLL **CSVReadParseLine( FILE * );
259 char CPL_DLL **CSVScanLines( FILE *,
int,
const char *, CSVCompareCriteria );
260 char CPL_DLL **CSVScanFile(
const char *,
int,
const char *,
261 CSVCompareCriteria );
262 char CPL_DLL **CSVScanFileByName(
const char *,
const char *,
const char *,
263 CSVCompareCriteria );
264 int CPL_DLL CSVGetFieldId( FILE *,
const char * );
265 int CPL_DLL CSVGetFileFieldId(
const char *,
const char * );
267 void CPL_DLL CSVDeaccess(
const char * );
269 const char CPL_DLL *CSVGetField(
const char *,
const char *,
const char *,
270 CSVCompareCriteria,
const char * );
void CPL_DLL SetCSVFilenameHook(const char *(*CSVFileOverride)(const char *))
Definition: cpl_csv.c:1012