1
/******************************************************************************
2
* Copyright (c) 1998, Frank Warmerdam
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
11
* The above copyright notice and this permission notice shall be included
12
* in all copies or substantial portions of the Software.
14
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
* DEALINGS IN THE SOFTWARE.
21
******************************************************************************
25
* Include file defining the Virtual System Interface (VSI) functions. This
26
* should normally be included by all translators using VSI functions for
27
* accessing system services. It is also used by the GDAL core, and can be
28
* used by higher level applications which adhere to VSI use.
30
* Most VSI functions are direct analogs of Posix C library functions.
31
* VSI exists to allow ``hooking'' these functions to provide application
32
* specific checking, io redirection and so on.
35
* Revision 1.4 1999/02/25 04:48:11 danmo
36
* Added VSIStat() macros specific to _WIN32 (for MSVC++)
38
* Revision 1.3 1999/01/28 18:31:25 warmerda
39
* Test on _WIN32 rather than WIN32. It seems to be more reliably defined.
41
* Revision 1.2 1998/12/04 21:42:57 danmo
42
* Added #ifndef WIN32 arounf #include <unistd.h>
44
* Revision 1.1 1998/12/03 18:26:02 warmerda
49
#ifndef CPL_VSI_H_INCLUDED
50
#define CPL_VSI_H_INCLUDED
54
/* -------------------------------------------------------------------- */
55
/* We need access to ``struct stat''. */
56
/* -------------------------------------------------------------------- */
64
/* ==================================================================== */
65
/* stdio file access functions. */
66
/* ==================================================================== */
68
FILE CPL_DLL * VSIFOpen( const char *, const char * );
69
int CPL_DLL VSIFClose( FILE * );
70
int CPL_DLL VSIFSeek( FILE *, long, int );
71
long CPL_DLL VSIFTell( FILE * );
72
void CPL_DLL VSIRewind( FILE * );
74
size_t CPL_DLL VSIFRead( void *, size_t, size_t, FILE * );
75
size_t CPL_DLL VSIFWrite( void *, size_t, size_t, FILE * );
76
char CPL_DLL *VSIFGets( char *, int, FILE * );
77
int CPL_DLL VSIFPuts( const char *, FILE * );
78
int CPL_DLL VSIFPrintf( FILE *, const char *, ... );
80
int CPL_DLL VSIFGetc( FILE * );
81
int CPL_DLL VSIFPutc( int, FILE * );
82
int CPL_DLL VSIUngetc( int, FILE * );
83
int CPL_DLL VSIFEof( FILE * );
85
/* ==================================================================== */
86
/* VSIStat() related. */
87
/* ==================================================================== */
89
typedef struct stat VSIStatBuf;
90
int CPL_DLL VSIStat( const char *, VSIStatBuf * );
93
# define VSI_ISLNK(x) ( 0 ) /* N/A on Windows */
94
# define VSI_ISREG(x) ((x) & S_IFREG)
95
# define VSI_ISDIR(x) ((x) & S_IFDIR)
96
# define VSI_ISCHR(x) ((x) & S_IFCHR)
97
# define VSI_ISBLK(x) ( 0 ) /* N/A on Windows */
99
# define VSI_ISLNK(x) S_ISLNK(x)
100
# define VSI_ISREG(x) S_ISREG(x)
101
# define VSI_ISDIR(x) S_ISDIR(x)
102
# define VSI_ISCHR(x) S_ISCHR(x)
103
# define VSI_ISBLK(x) S_ISBLK(x)
106
/* ==================================================================== */
107
/* Memory allocation */
108
/* ==================================================================== */
110
void CPL_DLL *VSICalloc( size_t, size_t );
111
void CPL_DLL *VSIMalloc( size_t );
112
void CPL_DLL VSIFree( void * );
113
void CPL_DLL *VSIRealloc( void *, size_t );
114
char CPL_DLL *VSIStrdup( const char * );
118
#endif /* ndef CPL_VSI_H_INCLUDED */