]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
bc44d920 | 2 | * "$Id: string.h 6649 2007-07-11 21:46:42Z mike $" |
ef416fc2 | 3 | * |
4 | * String definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
745129be | 6 | * Copyright 2007-2009 by Apple Inc. |
4400e98d | 7 | * Copyright 1997-2006 by Easy Software Products. |
ef416fc2 | 8 | * |
9 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 10 | * property of Apple Inc. and are protected by Federal copyright |
11 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
12 | * which should have been included with this file. If this file is | |
13 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 14 | * |
15 | * This file is subject to the Apple OS-Developed Software exception. | |
16 | */ | |
17 | ||
18 | #ifndef _CUPS_STRING_H_ | |
19 | # define _CUPS_STRING_H_ | |
20 | ||
21 | /* | |
22 | * Include necessary headers... | |
23 | */ | |
24 | ||
ef416fc2 | 25 | # include <stdio.h> |
a74454a7 | 26 | # include <stdlib.h> |
ef416fc2 | 27 | # include <stdarg.h> |
28 | # include <ctype.h> | |
757d2cad | 29 | # include <locale.h> |
ef416fc2 | 30 | |
a74454a7 | 31 | # include <config.h> |
32 | ||
ef416fc2 | 33 | # ifdef HAVE_STRING_H |
34 | # include <string.h> | |
35 | # endif /* HAVE_STRING_H */ | |
36 | ||
37 | # ifdef HAVE_STRINGS_H | |
38 | # include <strings.h> | |
39 | # endif /* HAVE_STRINGS_H */ | |
40 | ||
41 | # ifdef HAVE_BSTRING_H | |
42 | # include <bstring.h> | |
43 | # endif /* HAVE_BSTRING_H */ | |
44 | ||
45 | ||
46 | /* | |
47 | * Stuff for WIN32 and OS/2... | |
48 | */ | |
49 | ||
50 | # if defined(WIN32) || defined(__EMX__) | |
51 | # define strcasecmp stricmp | |
52 | # define strncasecmp strnicmp | |
53 | # endif /* WIN32 || __EMX__ */ | |
54 | ||
55 | ||
56 | /* | |
57 | * C++ magic... | |
58 | */ | |
59 | ||
60 | # ifdef __cplusplus | |
61 | extern "C" { | |
62 | # endif /* __cplusplus */ | |
63 | ||
64 | ||
4400e98d | 65 | /* |
66 | * String pool structures... | |
67 | */ | |
68 | ||
745129be MS |
69 | # define _CUPS_STR_GUARD 0x12344321 |
70 | ||
4400e98d | 71 | typedef struct _cups_sp_item_s /**** String Pool Item ****/ |
72 | { | |
745129be MS |
73 | # ifdef DEBUG_GUARDS |
74 | unsigned int guard; /* Guard word */ | |
75 | # endif /* DEBUG_GUARDS */ | |
4400e98d | 76 | unsigned int ref_count; /* Reference count */ |
426c6a59 | 77 | char str[1]; /* String */ |
4400e98d | 78 | } _cups_sp_item_t; |
79 | ||
80 | ||
ef416fc2 | 81 | /* |
82 | * Prototypes... | |
83 | */ | |
84 | ||
85 | extern void _cups_strcpy(char *dst, const char *src); | |
86 | ||
87 | # ifndef HAVE_STRDUP | |
88 | extern char *_cups_strdup(const char *); | |
89 | # define strdup _cups_strdup | |
90 | # endif /* !HAVE_STRDUP */ | |
91 | ||
92 | # ifndef HAVE_STRCASECMP | |
93 | extern int _cups_strcasecmp(const char *, const char *); | |
94 | # define strcasecmp _cups_strcasecmp | |
95 | # endif /* !HAVE_STRCASECMP */ | |
96 | ||
97 | # ifndef HAVE_STRNCASECMP | |
98 | extern int _cups_strncasecmp(const char *, const char *, size_t n); | |
99 | # define strncasecmp _cups_strncasecmp | |
100 | # endif /* !HAVE_STRNCASECMP */ | |
101 | ||
102 | # ifndef HAVE_STRLCAT | |
103 | extern size_t _cups_strlcat(char *, const char *, size_t); | |
104 | # define strlcat _cups_strlcat | |
105 | # endif /* !HAVE_STRLCAT */ | |
106 | ||
107 | # ifndef HAVE_STRLCPY | |
108 | extern size_t _cups_strlcpy(char *, const char *, size_t); | |
109 | # define strlcpy _cups_strlcpy | |
110 | # endif /* !HAVE_STRLCPY */ | |
111 | ||
112 | # ifndef HAVE_SNPRINTF | |
113 | extern int _cups_snprintf(char *, size_t, const char *, ...) | |
114 | # ifdef __GNUC__ | |
115 | __attribute__ ((__format__ (__printf__, 3, 4))) | |
116 | # endif /* __GNUC__ */ | |
117 | ; | |
118 | # define snprintf _cups_snprintf | |
119 | # endif /* !HAVE_SNPRINTF */ | |
120 | ||
121 | # ifndef HAVE_VSNPRINTF | |
122 | extern int _cups_vsnprintf(char *, size_t, const char *, va_list); | |
123 | # define vsnprintf _cups_vsnprintf | |
124 | # endif /* !HAVE_VSNPRINTF */ | |
125 | ||
4400e98d | 126 | /* |
127 | * String pool functions... | |
128 | */ | |
129 | ||
757d2cad | 130 | extern char *_cupsStrAlloc(const char *s); |
d6ae789d | 131 | extern void _cupsStrFlush(void); |
757d2cad | 132 | extern void _cupsStrFree(const char *s); |
426c6a59 | 133 | extern char *_cupsStrRetain(char *s); |
757d2cad | 134 | extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes); |
135 | ||
136 | ||
137 | /* | |
138 | * Floating point number functions... | |
139 | */ | |
140 | ||
141 | extern char *_cupsStrFormatd(char *buf, char *bufend, double number, | |
142 | struct lconv *loc); | |
143 | extern double _cupsStrScand(const char *buf, char **bufptr, | |
144 | struct lconv *loc); | |
4400e98d | 145 | |
ef416fc2 | 146 | |
147 | /* | |
148 | * C++ magic... | |
149 | */ | |
150 | ||
151 | # ifdef __cplusplus | |
152 | } | |
153 | # endif /* __cplusplus */ | |
154 | ||
155 | #endif /* !_CUPS_STRING_H_ */ | |
156 | ||
157 | /* | |
bc44d920 | 158 | * End of "$Id: string.h 6649 2007-07-11 21:46:42Z mike $". |
ef416fc2 | 159 | */ |