FLTK 1.4.4: flstring.h Source File

FLTK 1.4.4

Loading...
Searching...
No Matches
flstring.h
1/*
2 * Common string header file for the Fast Light Tool Kit (FLTK).
3 * Internal use only (see "important note" below).
4 *
5 * Copyright 1998-2020 by Bill Spitzak and others.
6 *
7 * This library is free software. Distribution and use rights are outlined in
8 * the file "COPYING" which should have been included with this file. If this
9 * file is missing or damaged, see the license at:
10 *
11 * https://www.fltk.org/COPYING.php
12 *
13 * Please see the following page on how to report bugs and issues:
14 *
15 * https://www.fltk.org/bugs.php
16 */
17
18 /*
19 * Important note: this header file includes '<config.h>' !
20 *
21 * This header MUST NOT be included in public headers (i.e. in 'FL/') and
22 * SHOULD NOT be included in test and demo programs (i.e. in 'test/' or
23 * 'examples/') because it includes '<config.h>'.
24 */
25
26#ifndef flstring_h
27# define flstring_h
28
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# include <FL/fl_string_functions.h>
39
40/*
41 * Apparently Unixware defines "index" to strchr (!) rather than
42 * providing a proper entry point or not providing the (obsolete)
43 * BSD function. Make sure index is not defined...
44 */
45
46# ifdef index
47# undef index
48# endif /* index */
49
50/*
51 * Visual C++ 2005 incorrectly displays a warning about the use of
52 * POSIX APIs on Windows, which is supposed to be POSIX compliant...
53 * Some of these functions are also defined in ISO C99...
54 */
55
56# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
57# define strcasecmp(s,t) _stricmp((s), (t))
58# define strncasecmp(s,t,n) _strnicmp((s), (t), (n))
59# endif /* _WIN32 && ... */
60
61# ifdef __cplusplus
62extern "C" {
63# endif /* __cplusplus */
64
65FL_EXPORT extern int fl_snprintf(char *, size_t, const char *, ...);
66# ifndef HAVE_SNPRINTF
67# define snprintf fl_snprintf
68# endif /* !HAVE_SNPRINTF */
69
70FL_EXPORT extern int fl_vsnprintf(char *, size_t, const char *, va_list ap);
71# ifndef HAVE_VSNPRINTF
72# define vsnprintf fl_vsnprintf
73# endif /* !HAVE_VSNPRINTF */
74
75/*
76 * strlcpy() and strlcat() are some really useful BSD string functions
77 * that work the way strncpy() and strncat() *should* have worked.
78 */
79
80FL_EXPORT extern size_t fl_strlcat(char *, const char *, size_t);
81# ifndef HAVE_STRLCAT
82# define strlcat fl_strlcat
83# endif /* !HAVE_STRLCAT */
84
85/* promoted to <FL/fl_string_functions.h> */
86/* FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t); */
87# ifndef HAVE_STRLCPY
88# define strlcpy fl_strlcpy
89# endif /* !HAVE_STRLCPY */
90
91/*
92 * Locale independent ASCII string compare function,
93 * does not introduce locale issues as with strcasecmp()
94 */
95FL_EXPORT extern int fl_ascii_strcasecmp(const char *s, const char *t);
96
97# ifdef __cplusplus
98}
99# endif /* __cplusplus */
100
101#endif /* !flstring_h */
fl_string_functions.h
Public header for FLTK's platform-agnostic string handling.