[773] | 1 | /* "$Id: string.h 4115 2005-03-14 04:48:51Z spitzak $" |
---|
| 2 | * |
---|
| 3 | * Copyright 1998-2005 by Bill Spitzak and others. |
---|
| 4 | * |
---|
| 5 | * Permission to use, copy, modify, and distribute this software for any |
---|
| 6 | * purpose with or without fee is hereby granted, provided that the above |
---|
| 7 | * copyright notice and this permission notice appear in all copies. |
---|
| 8 | * |
---|
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
---|
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
---|
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
---|
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
| 16 | * |
---|
| 17 | * Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | /* This file is designed to work on Windows, Linux, and BSD systems. |
---|
| 21 | It may need to be edited to work on other systems. Please try |
---|
| 22 | to do this by adding #if statements so this file remains portable. |
---|
| 23 | |
---|
| 24 | Some versions of fltk wrote this file using autoconf. I never liked |
---|
| 25 | this because I could not share the header file between systems, so |
---|
| 26 | I have reverted to a constant version. |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef fltk_string_h |
---|
| 30 | #define fltk_string_h |
---|
| 31 | |
---|
| 32 | #if 1 |
---|
| 33 | # include <string.h> |
---|
| 34 | #endif |
---|
| 35 | |
---|
| 36 | #if 1 /* for va_list */ |
---|
| 37 | # include <stdarg.h> |
---|
| 38 | #endif |
---|
| 39 | |
---|
| 40 | #if 1 /* for sprintf, vsprintf, snprintf and vsnprintf */ |
---|
| 41 | # include <stdio.h> |
---|
| 42 | #endif |
---|
| 43 | |
---|
| 44 | #if 0 |
---|
| 45 | # include <stdlib.h> |
---|
| 46 | #endif |
---|
| 47 | |
---|
| 48 | #if 0 |
---|
| 49 | # include <ctype.h> |
---|
| 50 | /* Unixware defines these macros in above header for the obsolete BSD |
---|
| 51 | functions, get rid of them as it prevents you making a variable |
---|
| 52 | named "index"! */ |
---|
| 53 | # ifdef index |
---|
| 54 | # undef index |
---|
| 55 | # endif |
---|
| 56 | # ifdef rindex |
---|
| 57 | # undef rindex |
---|
| 58 | # endif |
---|
| 59 | #endif |
---|
| 60 | |
---|
| 61 | #if 0 |
---|
| 62 | # include <strings.h> |
---|
| 63 | #endif |
---|
| 64 | |
---|
| 65 | #if 0 /*defined(__MWERKS__)*/ |
---|
| 66 | /* MetroWerks' CodeWarrior put some functions in <extras.h> but that |
---|
| 67 | file does not play well with others, so we don't include it. */ |
---|
| 68 | # include <extras.h> |
---|
| 69 | #endif |
---|
| 70 | |
---|
| 71 | /* Windows has equivalent functions, but being Microsoft they added |
---|
| 72 | gratuitoius changes to the names to stop code from being portable: */ |
---|
| 73 | #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__EMX__) |
---|
| 74 | # define strcasecmp(s,t) stricmp(s, t) |
---|
| 75 | # define strncasecmp(s,t,n) strnicmp(s, t, n) |
---|
| 76 | # define vsnprintf _vsnprintf |
---|
| 77 | # define snprintf _snprintf |
---|
| 78 | #endif |
---|
| 79 | |
---|
| 80 | /*! \addtogroup utilities |
---|
| 81 | \{ */ |
---|
| 82 | |
---|
| 83 | #ifdef __cplusplus |
---|
| 84 | extern "C" { |
---|
| 85 | #endif |
---|
| 86 | |
---|
| 87 | #include "FL_API.h" |
---|
| 88 | |
---|
| 89 | FL_API extern const char* newstring(const char *); |
---|
| 90 | |
---|
| 91 | #if defined(DOXYGEN) || defined(__MWERKS__) |
---|
| 92 | FL_API extern int strcasecmp(const char *, const char *); |
---|
| 93 | #endif |
---|
| 94 | |
---|
| 95 | #if defined(DOXYGEN) || defined(__MWERKS__) |
---|
| 96 | FL_API extern int strncasecmp(const char *, const char *, size_t); |
---|
| 97 | #endif |
---|
| 98 | |
---|
| 99 | #if defined(DOXYGEN) |
---|
| 100 | FL_API extern int snprintf(char *, size_t, const char *, ...); |
---|
| 101 | #endif |
---|
| 102 | |
---|
| 103 | #if defined(DOXYGEN) |
---|
| 104 | FL_API extern int vsnprintf(char *, size_t, const char *, va_list ap); |
---|
| 105 | #endif |
---|
| 106 | |
---|
| 107 | #if defined(DOXYGEN) || !defined(__BSD__) |
---|
| 108 | FL_API extern size_t strlcat(char *, const char *, size_t); |
---|
| 109 | #endif |
---|
| 110 | |
---|
| 111 | #if defined(DOXYGEN) || !defined(__BSD__) |
---|
| 112 | FL_API extern size_t strlcpy(char *, const char *, size_t); |
---|
| 113 | #endif |
---|
| 114 | |
---|
| 115 | #ifdef __cplusplus |
---|
| 116 | } |
---|
| 117 | #endif |
---|
| 118 | |
---|
| 119 | /*! \} */ |
---|
| 120 | |
---|
| 121 | #endif |
---|
| 122 | |
---|
| 123 | /* |
---|
| 124 | * End of "$Id: string.h 4115 2005-03-14 04:48:51Z spitzak $". |
---|
| 125 | */ |
---|