<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>cpl_vsi.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.3-20001105 on Thu Mar 28 09:47:28 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>cpl_vsi.h</h1><a href="cpl_vsi_h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font> 00002 <font class="comment"> * Copyright (c) 1998, Frank Warmerdam</font> 00003 <font class="comment"> *</font> 00004 <font class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</font> 00005 <font class="comment"> * copy of this software and associated documentation files (the "Software"),</font> 00006 <font class="comment"> * to deal in the Software without restriction, including without limitation</font> 00007 <font class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</font> 00008 <font class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</font> 00009 <font class="comment"> * Software is furnished to do so, subject to the following conditions:</font> 00010 <font class="comment"> *</font> 00011 <font class="comment"> * The above copyright notice and this permission notice shall be included</font> 00012 <font class="comment"> * in all copies or substantial portions of the Software.</font> 00013 <font class="comment"> *</font> 00014 <font class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</font> 00015 <font class="comment"> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</font> 00016 <font class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</font> 00017 <font class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</font> 00018 <font class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</font> 00019 <font class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</font> 00020 <font class="comment"> * DEALINGS IN THE SOFTWARE.</font> 00021 <font class="comment"> ******************************************************************************</font> 00022 <font class="comment"> *</font> 00023 <font class="comment"> * cpl_vsi.h</font> 00024 <font class="comment"> *</font> 00025 <font class="comment"> * Include file defining the Virtual System Interface (VSI) functions. This</font> 00026 <font class="comment"> * should normally be included by all translators using VSI functions for</font> 00027 <font class="comment"> * accessing system services. It is also used by the GDAL core, and can be</font> 00028 <font class="comment"> * used by higher level applications which adhere to VSI use.</font> 00029 <font class="comment"> *</font> 00030 <font class="comment"> * Most VSI functions are direct analogs of Posix C library functions.</font> 00031 <font class="comment"> * VSI exists to allow ``hooking'' these functions to provide application</font> 00032 <font class="comment"> * specific checking, io redirection and so on. </font> 00033 <font class="comment"> * </font> 00034 <font class="comment"> * $Log: cpl_vsi_h-source.html,v $ 00034 <font class="comment"> * Revision 1.10 2002/04/16 13:11:48 warmerda 00034 <font class="comment"> * updated 00034 <font class="comment"> *</font> 00035 <font class="comment"> * Revision 1.11 2001/04/30 18:19:06 warmerda</font> 00036 <font class="comment"> * avoid stat on macos_pre10</font> 00037 <font class="comment"> *</font> 00038 <font class="comment"> * Revision 1.10 2001/01/19 21:16:41 warmerda</font> 00039 <font class="comment"> * expanded tabs</font> 00040 <font class="comment"> *</font> 00041 <font class="comment"> * Revision 1.9 2001/01/03 17:41:44 warmerda</font> 00042 <font class="comment"> * added #define for VSIFFlushL</font> 00043 <font class="comment"> *</font> 00044 <font class="comment"> * Revision 1.8 2001/01/03 16:17:50 warmerda</font> 00045 <font class="comment"> * added large file API</font> 00046 <font class="comment"> *</font> 00047 <font class="comment"> * Revision 1.7 2000/12/14 18:29:48 warmerda</font> 00048 <font class="comment"> * added VSIMkdir</font> 00049 <font class="comment"> *</font> 00050 <font class="comment"> * Revision 1.6 2000/01/25 03:11:03 warmerda</font> 00051 <font class="comment"> * added unlink and mkdir</font> 00052 <font class="comment"> *</font> 00053 <font class="comment"> * Revision 1.5 1999/05/23 02:43:57 warmerda</font> 00054 <font class="comment"> * Added documentation block.</font> 00055 <font class="comment"> *</font> 00056 <font class="comment"> * Revision 1.4 1999/02/25 04:48:11 danmo</font> 00057 <font class="comment"> * Added VSIStat() macros specific to _WIN32 (for MSVC++)</font> 00058 <font class="comment"> *</font> 00059 <font class="comment"> * Revision 1.3 1999/01/28 18:31:25 warmerda</font> 00060 <font class="comment"> * Test on _WIN32 rather than WIN32. It seems to be more reliably defined.</font> 00061 <font class="comment"> *</font> 00062 <font class="comment"> * Revision 1.2 1998/12/04 21:42:57 danmo</font> 00063 <font class="comment"> * Added #ifndef WIN32 arounf #include <unistd.h></font> 00064 <font class="comment"> *</font> 00065 <font class="comment"> * Revision 1.1 1998/12/03 18:26:02 warmerda</font> 00066 <font class="comment"> * New</font> 00067 <font class="comment"> *</font> 00068 <font class="comment"> */</font> 00069 00070 <font class="preprocessor">#ifndef CPL_VSI_H_INCLUDED</font> 00071 <font class="preprocessor"></font><font class="preprocessor">#define CPL_VSI_H_INCLUDED</font> 00072 <font class="preprocessor"></font> 00073 <font class="preprocessor">#include "<a class="code" href="cpl_port_h.html">cpl_port.h</a>"</font> 00093 <font class="comment">/* -------------------------------------------------------------------- */</font> 00094 <font class="comment">/* We need access to ``struct stat''. */</font> 00095 <font class="comment">/* -------------------------------------------------------------------- */</font> 00096 <font class="preprocessor">#ifndef _WIN32</font> 00097 <font class="preprocessor"></font><font class="preprocessor"># include <unistd.h></font> 00098 <font class="preprocessor">#endif</font> 00099 <font class="preprocessor"></font><font class="preprocessor">#if !defined(macos_pre10)</font> 00100 <font class="preprocessor"></font><font class="preprocessor"># include <sys/stat.h></font> 00101 <font class="preprocessor">#endif</font> 00102 <font class="preprocessor"></font> 00103 CPL_C_START 00104 00105 <font class="comment">/* ==================================================================== */</font> 00106 <font class="comment">/* stdio file access functions. */</font> 00107 <font class="comment">/* ==================================================================== */</font> 00108 00109 FILE CPL_DLL * VSIFOpen( <font class="keyword">const</font> <font class="keywordtype">char</font> *, <font class="keyword">const</font> <font class="keywordtype">char</font> * ); 00110 <font class="keywordtype">int</font> CPL_DLL VSIFClose( FILE * ); 00111 <font class="keywordtype">int</font> CPL_DLL VSIFSeek( FILE *, <font class="keywordtype">long</font>, <font class="keywordtype">int</font> ); 00112 <font class="keywordtype">long</font> CPL_DLL VSIFTell( FILE * ); 00113 <font class="keywordtype">void</font> CPL_DLL VSIRewind( FILE * ); 00114 <font class="keywordtype">void</font> CPL_DLL VSIFFlush( FILE * ); 00115 00116 size_t CPL_DLL VSIFRead( <font class="keywordtype">void</font> *, size_t, size_t, FILE * ); 00117 size_t CPL_DLL VSIFWrite( <font class="keywordtype">void</font> *, size_t, size_t, FILE * ); 00118 <font class="keywordtype">char</font> CPL_DLL *VSIFGets( <font class="keywordtype">char</font> *, <font class="keywordtype">int</font>, FILE * ); 00119 <font class="keywordtype">int</font> CPL_DLL VSIFPuts( <font class="keyword">const</font> <font class="keywordtype">char</font> *, FILE * ); 00120 <font class="keywordtype">int</font> CPL_DLL VSIFPrintf( FILE *, <font class="keyword">const</font> <font class="keywordtype">char</font> *, ... ); 00121 00122 <font class="keywordtype">int</font> CPL_DLL VSIFGetc( FILE * ); 00123 <font class="keywordtype">int</font> CPL_DLL VSIFPutc( <font class="keywordtype">int</font>, FILE * ); 00124 <font class="keywordtype">int</font> CPL_DLL VSIUngetc( <font class="keywordtype">int</font>, FILE * ); 00125 <font class="keywordtype">int</font> CPL_DLL VSIFEof( FILE * ); 00126 00127 <font class="comment">/* ==================================================================== */</font> 00128 <font class="comment">/* 64bit stdio file access functions. If we have a big size */</font> 00129 <font class="comment">/* defined, then provide protypes for the large file API, */</font> 00130 <font class="comment">/* otherwise redefine to use the regular api. */</font> 00131 <font class="comment">/* ==================================================================== */</font> 00132 <font class="preprocessor">#ifdef VSI_LARGE_API_SUPPORTED</font> 00133 <font class="preprocessor"></font> 00134 <font class="keyword">typedef</font> GUIntBig vsi_l_offset; 00135 00136 FILE CPL_DLL * VSIFOpenL( <font class="keyword">const</font> <font class="keywordtype">char</font> *, <font class="keyword">const</font> <font class="keywordtype">char</font> * ); 00137 <font class="keywordtype">int</font> CPL_DLL VSIFCloseL( FILE * ); 00138 <font class="keywordtype">int</font> CPL_DLL VSIFSeekL( FILE *, vsi_l_offset, <font class="keywordtype">int</font> ); 00139 vsi_l_offset CPL_DLL VSIFTellL( FILE * ); 00140 <font class="keywordtype">void</font> CPL_DLL VSIRewindL( FILE * ); 00141 size_t CPL_DLL VSIFReadL( <font class="keywordtype">void</font> *, size_t, size_t, FILE * ); 00142 size_t CPL_DLL VSIFWriteL( <font class="keywordtype">void</font> *, size_t, size_t, FILE * ); 00143 <font class="keywordtype">int</font> CPL_DLL VSIFEofL( FILE * ); 00144 <font class="keywordtype">void</font> CPL_DLL VSIFFlushL( FILE * ); 00145 00146 <font class="preprocessor">#else</font> 00147 <font class="preprocessor"></font> 00148 <font class="keyword">typedef</font> <font class="keywordtype">long</font> vsi_l_offset; 00149 00150 <font class="preprocessor">#define vsi_l_offset long</font> 00151 <font class="preprocessor"></font> 00152 <font class="preprocessor">#define VSIFOpenL VSIFOpen</font> 00153 <font class="preprocessor"></font><font class="preprocessor">#define VSIFCloseL VSIFClose</font> 00154 <font class="preprocessor"></font><font class="preprocessor">#define VSIFSeekL VSIFSeek</font> 00155 <font class="preprocessor"></font><font class="preprocessor">#define VSIFTellL VSIFTell</font> 00156 <font class="preprocessor"></font><font class="preprocessor">#define VSIFRewindL VSIFRewind</font> 00157 <font class="preprocessor"></font><font class="preprocessor">#define VSIFReadL VSIFRead</font> 00158 <font class="preprocessor"></font><font class="preprocessor">#define VSIFWriteL VSIFWrite</font> 00159 <font class="preprocessor"></font><font class="preprocessor">#define VSIFEofL VSIFEof</font> 00160 <font class="preprocessor"></font><font class="preprocessor">#define VSIFFlushL VSIFFlush</font> 00161 <font class="preprocessor"></font> 00162 <font class="preprocessor">#endif</font> 00163 <font class="preprocessor"></font> 00164 <font class="comment">/* ==================================================================== */</font> 00165 <font class="comment">/* VSIStat() related. */</font> 00166 <font class="comment">/* ==================================================================== */</font> 00167 00168 <font class="keyword">typedef</font> <font class="keyword">struct </font>stat VSIStatBuf; 00169 <font class="keywordtype">int</font> CPL_DLL VSIStat( <font class="keyword">const</font> <font class="keywordtype">char</font> *, VSIStatBuf * ); 00170 00171 <font class="preprocessor">#ifdef _WIN32</font> 00172 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISLNK(x) ( 0 ) </font><font class="comment">/* N/A on Windows */</font> 00173 <font class="preprocessor"># define VSI_ISREG(x) ((x) & S_IFREG)</font> 00174 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISDIR(x) ((x) & S_IFDIR)</font> 00175 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISCHR(x) ((x) & S_IFCHR)</font> 00176 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISBLK(x) ( 0 ) </font><font class="comment">/* N/A on Windows */</font> 00177 <font class="preprocessor">#else</font> 00178 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISLNK(x) S_ISLNK(x)</font> 00179 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISREG(x) S_ISREG(x)</font> 00180 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISDIR(x) S_ISDIR(x)</font> 00181 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISCHR(x) S_ISCHR(x)</font> 00182 <font class="preprocessor"></font><font class="preprocessor"># define VSI_ISBLK(x) S_ISBLK(x)</font> 00183 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00184 <font class="preprocessor"></font> 00185 <font class="comment">/* ==================================================================== */</font> 00186 <font class="comment">/* Memory allocation */</font> 00187 <font class="comment">/* ==================================================================== */</font> 00188 00189 <font class="keywordtype">void</font> CPL_DLL *VSICalloc( size_t, size_t ); 00190 <font class="keywordtype">void</font> CPL_DLL *VSIMalloc( size_t ); 00191 <font class="keywordtype">void</font> CPL_DLL VSIFree( <font class="keywordtype">void</font> * ); 00192 <font class="keywordtype">void</font> CPL_DLL *VSIRealloc( <font class="keywordtype">void</font> *, size_t ); 00193 <font class="keywordtype">char</font> CPL_DLL *VSIStrdup( <font class="keyword">const</font> <font class="keywordtype">char</font> * ); 00194 00195 <font class="comment">/* ==================================================================== */</font> 00196 <font class="comment">/* Other... */</font> 00197 <font class="comment">/* ==================================================================== */</font> 00198 00199 <font class="keywordtype">int</font> CPL_DLL VSIMkdir( <font class="keyword">const</font> <font class="keywordtype">char</font> * pathname, <font class="keywordtype">long</font> mode ); 00200 <font class="keywordtype">int</font> CPL_DLL VSIRmdir( <font class="keyword">const</font> <font class="keywordtype">char</font> * pathname ); 00201 <font class="keywordtype">int</font> CPL_DLL VSIUnlink( <font class="keyword">const</font> <font class="keywordtype">char</font> * pathname ); 00202 00203 CPL_C_END 00204 00205 <font class="preprocessor">#endif </font><font class="comment">/* ndef CPL_VSI_H_INCLUDED */</font> </div></pre><hr><address><small>Generated at Thu Mar 28 09:47:28 2002 for GDAL by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.3-20001105 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2000</small></address> </body> </html>