FLTK 1.3.0
|
00001 /* 00002 * "$Id$" 00003 * 00004 * Common string header file for the Fast Light Tool Kit (FLTK). 00005 * 00006 * Copyright 1998-2010 by Bill Spitzak and others. 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 * USA. 00022 * 00023 * Please report all bugs and problems on the following page: 00024 * 00025 * http://www.fltk.org/str.php 00026 */ 00027 00028 #ifndef flstring_h 00029 # define flstring_h 00030 00031 # include <FL/Fl_Export.H> 00032 # include <config.h> 00033 # include <stdio.h> 00034 # include <stdarg.h> 00035 # include <string.h> 00036 # ifdef HAVE_STRINGS_H 00037 # include <strings.h> 00038 # endif /* HAVE_STRINGS_H */ 00039 # include <ctype.h> 00040 00041 /* 00042 * Apparently Unixware defines "index" to strchr (!) rather than 00043 * providing a proper entry point or not providing the (obsolete) 00044 * BSD function. Make sure index is not defined... 00045 */ 00046 00047 # ifdef index 00048 # undef index 00049 # endif /* index */ 00050 00051 # if defined(WIN32) && !defined(__CYGWIN__) 00052 # define strcasecmp(s,t) _stricmp((s), (t)) 00053 # define strncasecmp(s,t,n) _strnicmp((s), (t), (n)) 00054 /* Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs 00055 * on Windows, which is supposed to be POSIX compliant... Some of these 00056 * functions are also defined in ISO C99... 00057 */ 00058 # ifndef __WATCOMC__ 00059 # define strdup _strdup 00060 # define unlink _unlink 00061 # endif /* !__WATCOMC__ */ 00062 # elif defined(__EMX__) 00063 # define strcasecmp(s,t) stricmp((s), (t)) 00064 # define strncasecmp(s,t,n) strnicmp((s), (t), (n)) 00065 # endif /* WIN32 */ 00066 00067 # ifdef __cplusplus 00068 extern "C" { 00069 # endif /* __cplusplus */ 00070 00071 FL_EXPORT extern int fl_snprintf(char *, size_t, const char *, ...); 00072 # if !HAVE_SNPRINTF 00073 # define snprintf fl_snprintf 00074 # endif /* !HAVE_SNPRINTF */ 00075 00076 FL_EXPORT extern int fl_vsnprintf(char *, size_t, const char *, va_list ap); 00077 # if !HAVE_VSNPRINTF 00078 # define vsnprintf fl_vsnprintf 00079 # endif /* !HAVE_VSNPRINTF */ 00080 00081 /* 00082 * strlcpy() and strlcat() are some really useful BSD string functions 00083 * that work the way strncpy() and strncat() *should* have worked. 00084 */ 00085 00086 FL_EXPORT extern size_t fl_strlcat(char *, const char *, size_t); 00087 # if !HAVE_STRLCAT 00088 # define strlcat fl_strlcat 00089 # endif /* !HAVE_STRLCAT */ 00090 00091 FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t); 00092 # if !HAVE_STRLCPY 00093 # define strlcpy fl_strlcpy 00094 # endif /* !HAVE_STRLCPY */ 00095 00096 # ifdef __cplusplus 00097 } 00098 # endif /* __cplusplus */ 00099 #endif /* !flstring_h */ 00100 00101 00102 /* 00103 * End of "$Id$". 00104 */