~ubuntu-branches/ubuntu/wily/e00compr/wily

« back to all changes in this revision

Viewing changes to cpl_vsi.h

  • Committer: Bazaar Package Importer
  • Author(s): Paul Wise
  • Date: 2005-11-15 15:43:39 UTC
  • Revision ID: james.westby@ubuntu.com-20051115154339-tmt82iiu3dwtk94a
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 * Copyright (c) 1998, Frank Warmerdam
 
3
 *
 
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:
 
10
 *
 
11
 * The above copyright notice and this permission notice shall be included
 
12
 * in all copies or substantial portions of the Software.
 
13
 *
 
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
 ******************************************************************************
 
22
 *
 
23
 * cpl_vsi.h
 
24
 *
 
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.
 
29
 *
 
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. 
 
33
 * 
 
34
 * $Log: cpl_vsi.h,v $
 
35
 * Revision 1.4  1999/02/25 04:48:11  danmo
 
36
 * Added VSIStat() macros specific to _WIN32 (for MSVC++)
 
37
 *
 
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.
 
40
 *
 
41
 * Revision 1.2  1998/12/04 21:42:57  danmo
 
42
 * Added #ifndef WIN32 arounf #include <unistd.h>
 
43
 *
 
44
 * Revision 1.1  1998/12/03 18:26:02  warmerda
 
45
 * New
 
46
 *
 
47
 */
 
48
 
 
49
#ifndef CPL_VSI_H_INCLUDED
 
50
#define CPL_VSI_H_INCLUDED
 
51
 
 
52
#include "cpl_port.h"
 
53
 
 
54
/* -------------------------------------------------------------------- */
 
55
/*      We need access to ``struct stat''.                              */
 
56
/* -------------------------------------------------------------------- */
 
57
#ifndef _WIN32
 
58
#  include <unistd.h>
 
59
#endif
 
60
#include <sys/stat.h>
 
61
 
 
62
CPL_C_START
 
63
 
 
64
/* ==================================================================== */
 
65
/*      stdio file access functions.                                    */
 
66
/* ==================================================================== */
 
67
 
 
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 * );
 
73
 
 
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 *, ... );
 
79
 
 
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 * );
 
84
 
 
85
/* ==================================================================== */
 
86
/*      VSIStat() related.                                              */
 
87
/* ==================================================================== */
 
88
 
 
89
typedef struct stat VSIStatBuf;
 
90
int CPL_DLL     VSIStat( const char *, VSIStatBuf * );
 
91
 
 
92
#ifdef _WIN32
 
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 */
 
98
#else
 
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)
 
104
#endif
 
105
 
 
106
/* ==================================================================== */
 
107
/*      Memory allocation                                               */
 
108
/* ==================================================================== */
 
109
 
 
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 * );
 
115
 
 
116
CPL_C_END
 
117
 
 
118
#endif /* ndef CPL_VSI_H_INCLUDED */