PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/fltk/src/flstring.h

http://luafltk.googlecode.com/
C Header | 104 lines | 48 code | 14 blank | 42 comment | 6 complexity | 4f1b74768428cd2af2b92e3a20c2ca81 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-3.0, 0BSD
  1. /*
  2. * "$Id: flstring.h 7352 2010-03-29 10:47:11Z matt $"
  3. *
  4. * Common string header file for the Fast Light Tool Kit (FLTK).
  5. *
  6. * Copyright 1998-2009 by Bill Spitzak and others.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Library General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Library General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Library General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. * USA.
  22. *
  23. * Please report all bugs and problems on the following page:
  24. *
  25. * http://www.fltk.org/str.php
  26. */
  27. #ifndef flstring_h
  28. # define flstring_h
  29. # include <FL/Fl_Export.H>
  30. # include <config.h>
  31. # include <stdio.h>
  32. # include <stdarg.h>
  33. # include <string.h>
  34. # ifdef HAVE_STRINGS_H
  35. # include <strings.h>
  36. # endif /* HAVE_STRINGS_H */
  37. # include <ctype.h>
  38. /*
  39. * Apparently Unixware defines "index" to strchr (!) rather than
  40. * providing a proper entry point or not providing the (obsolete)
  41. * BSD function. Make sure index is not defined...
  42. */
  43. # ifdef index
  44. # undef index
  45. # endif /* index */
  46. # if defined(WIN32) && !defined(__CYGWIN__)
  47. # define strcasecmp(s,t) _stricmp((s), (t))
  48. # define strncasecmp(s,t,n) _strnicmp((s), (t), (n))
  49. /* Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
  50. * on Windows, which is supposed to be POSIX compliant... Some of these
  51. * functions are also defined in ISO C99...
  52. */
  53. # ifndef __WATCOMC__
  54. # define strdup _strdup
  55. # define unlink _unlink
  56. # endif /* !__WATCOMC__ */
  57. # elif defined(__EMX__)
  58. # define strcasecmp(s,t) stricmp((s), (t))
  59. # define strncasecmp(s,t,n) strnicmp((s), (t), (n))
  60. # endif /* WIN32 */
  61. # ifdef __cplusplus
  62. extern "C" {
  63. # endif /* __cplusplus */
  64. FL_EXPORT extern int fl_snprintf(char *, size_t, const char *, ...);
  65. # if !HAVE_SNPRINTF
  66. # define snprintf fl_snprintf
  67. # endif /* !HAVE_SNPRINTF */
  68. FL_EXPORT extern int fl_vsnprintf(char *, size_t, const char *, va_list ap);
  69. # if !HAVE_VSNPRINTF
  70. # define vsnprintf fl_vsnprintf
  71. # endif /* !HAVE_VSNPRINTF */
  72. /*
  73. * strlcpy() and strlcat() are some really useful BSD string functions
  74. * that work the way strncpy() and strncat() *should* have worked.
  75. */
  76. FL_EXPORT extern size_t fl_strlcat(char *, const char *, size_t);
  77. # if !HAVE_STRLCAT
  78. # define strlcat fl_strlcat
  79. # endif /* !HAVE_STRLCAT */
  80. FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t);
  81. # if !HAVE_STRLCPY
  82. # define strlcpy fl_strlcpy
  83. # endif /* !HAVE_STRLCPY */
  84. # ifdef __cplusplus
  85. }
  86. # endif /* __cplusplus */
  87. #endif /* !flstring_h */
  88. /*
  89. * End of "$Id: flstring.h 7352 2010-03-29 10:47:11Z matt $".
  90. */