00001 /****************************************************************************** 00002 * $Id: cpl_conv_h-source.html,v 1.8 2001/07/05 13:24:08 warmerda Exp $ 00003 * 00004 * Project: CPL - Common Portability Library 00005 * Purpose: Convenience functions declarations. 00006 * This is intended to remain light weight. 00007 * Author: Frank Warmerdam, warmerdam@pobox.com 00008 * 00009 ****************************************************************************** 00010 * Copyright (c) 1998, Frank Warmerdam 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining a 00013 * copy of this software and associated documentation files (the "Software"), 00014 * to deal in the Software without restriction, including without limitation 00015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00016 * and/or sell copies of the Software, and to permit persons to whom the 00017 * Software is furnished to do so, subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be included 00020 * in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00023 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00025 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00026 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00027 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00028 * DEALINGS IN THE SOFTWARE. 00029 ****************************************************************************** 00030 * 00031 * $Log: cpl_conv_h-source.html,v $ 00031 * Revision 1.8 2001/07/05 13:24:08 warmerda 00031 * *** empty log message *** 00031 * 00032 * Revision 1.12 2001/03/16 22:15:08 warmerda 00033 * added CPLResetExtension 00034 * 00035 * Revision 1.1 1998/10/18 06:15:11 warmerda 00036 * Initial implementation. 00037 * 00038 */ 00039 00040 #ifndef CPL_CONV_H_INCLUDED 00041 #define CPL_CONV_H_INCLUDED 00042 00043 #include "cpl_port.h" 00044 #include "cpl_vsi.h" 00045 #include "cpl_error.h" 00046 00054 /* -------------------------------------------------------------------- */ 00055 /* Runtime check of various configuration items. */ 00056 /* -------------------------------------------------------------------- */ 00057 void CPLVerifyConfiguration(); 00058 00059 /* -------------------------------------------------------------------- */ 00060 /* Safe malloc() API. Thin cover over VSI functions with fatal */ 00061 /* error reporting if memory allocation fails. */ 00062 /* -------------------------------------------------------------------- */ 00063 CPL_C_START 00064 void CPL_DLL *CPLMalloc( size_t ); 00065 void CPL_DLL *CPLCalloc( size_t, size_t ); 00066 void CPL_DLL *CPLRealloc( void *, size_t ); 00067 char CPL_DLL *CPLStrdup( const char * ); 00068 00069 #define CPLFree VSIFree 00070 00071 /* -------------------------------------------------------------------- */ 00072 /* Read a line from a text file, and strip of CR/LF. */ 00073 /* -------------------------------------------------------------------- */ 00074 const char *CPLReadLine( FILE * ); 00075 00076 /* -------------------------------------------------------------------- */ 00077 /* Fetch a function from DLL / so. */ 00078 /* -------------------------------------------------------------------- */ 00079 00080 void CPL_DLL *CPLGetSymbol( const char *, const char * ); 00081 00082 /* -------------------------------------------------------------------- */ 00083 /* Read a directory (cpl_dir.c) */ 00084 /* -------------------------------------------------------------------- */ 00085 char CPL_DLL **CPLReadDir( const char *pszPath ); 00086 00087 /* -------------------------------------------------------------------- */ 00088 /* Filename handling functions. */ 00089 /* -------------------------------------------------------------------- */ 00090 const char CPL_DLL *CPLGetPath( const char * ); 00091 const char CPL_DLL *CPLGetFilename( const char * ); 00092 const char CPL_DLL *CPLGetBasename( const char * ); 00093 const char CPL_DLL *CPLGetExtension( const char * ); 00094 const char CPL_DLL *CPLFormFilename( const char *pszPath, 00095 const char *pszBasename, 00096 const char *pszExtension ); 00097 const char CPL_DLL *CPLFormCIFilename( const char *pszPath, 00098 const char *pszBasename, 00099 const char *pszExtension ); 00100 const char CPL_DLL *CPLResetExtension( const char *, const char * ); 00101 00102 /* -------------------------------------------------------------------- */ 00103 /* Find File Function */ 00104 /* -------------------------------------------------------------------- */ 00105 typedef const char *(*CPLFileFinder)(const char *, const char *); 00106 00107 const char CPL_DLL *CPLFindFile(const char *pszClass, 00108 const char *pszBasename); 00109 const char CPL_DLL *CPLDefaultFindFile(const char *pszClass, 00110 const char *pszBasename); 00111 void CPL_DLL CPLPushFileFinder( CPLFileFinder pfnFinder ); 00112 CPLFileFinder CPL_DLL CPLPopFileFinder(); 00113 void CPL_DLL CPLPushFinderLocation( const char * ); 00114 00115 00116 CPL_C_END 00117 00118 #endif /* ndef CPL_CONV_H_INCLUDED */