]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
71e16022 | 2 | * "$Id$" |
ef416fc2 | 3 | * |
71e16022 | 4 | * Private string definitions for CUPS. |
ef416fc2 | 5 | * |
71e16022 | 6 | * Copyright 2007-2010 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 | ||
71e16022 MS |
18 | #ifndef _CUPS_STRING_PRIVATE_H_ |
19 | # define _CUPS_STRING_PRIVATE_H_ | |
ef416fc2 | 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> | |
71e16022 | 29 | # include <errno.h> |
757d2cad | 30 | # include <locale.h> |
ef416fc2 | 31 | |
71e16022 | 32 | # include "config.h" |
a74454a7 | 33 | |
ef416fc2 | 34 | # ifdef HAVE_STRING_H |
35 | # include <string.h> | |
36 | # endif /* HAVE_STRING_H */ | |
37 | ||
38 | # ifdef HAVE_STRINGS_H | |
39 | # include <strings.h> | |
40 | # endif /* HAVE_STRINGS_H */ | |
41 | ||
42 | # ifdef HAVE_BSTRING_H | |
43 | # include <bstring.h> | |
44 | # endif /* HAVE_BSTRING_H */ | |
45 | ||
46 | ||
47 | /* | |
48 | * Stuff for WIN32 and OS/2... | |
49 | */ | |
50 | ||
51 | # if defined(WIN32) || defined(__EMX__) | |
536bc2c6 MS |
52 | # define strcasecmp _stricmp |
53 | # define strncasecmp _strnicmp | |
ef416fc2 | 54 | # endif /* WIN32 || __EMX__ */ |
55 | ||
56 | ||
57 | /* | |
58 | * C++ magic... | |
59 | */ | |
60 | ||
61 | # ifdef __cplusplus | |
62 | extern "C" { | |
63 | # endif /* __cplusplus */ | |
64 | ||
65 | ||
4400e98d | 66 | /* |
67 | * String pool structures... | |
68 | */ | |
69 | ||
745129be MS |
70 | # define _CUPS_STR_GUARD 0x12344321 |
71 | ||
4400e98d | 72 | typedef struct _cups_sp_item_s /**** String Pool Item ****/ |
73 | { | |
745129be MS |
74 | # ifdef DEBUG_GUARDS |
75 | unsigned int guard; /* Guard word */ | |
76 | # endif /* DEBUG_GUARDS */ | |
4400e98d | 77 | unsigned int ref_count; /* Reference count */ |
426c6a59 | 78 | char str[1]; /* String */ |
4400e98d | 79 | } _cups_sp_item_t; |
80 | ||
81 | ||
ef416fc2 | 82 | /* |
83 | * Prototypes... | |
84 | */ | |
85 | ||
86 | extern void _cups_strcpy(char *dst, const char *src); | |
87 | ||
88 | # ifndef HAVE_STRDUP | |
89 | extern char *_cups_strdup(const char *); | |
90 | # define strdup _cups_strdup | |
91 | # endif /* !HAVE_STRDUP */ | |
92 | ||
93 | # ifndef HAVE_STRCASECMP | |
94 | extern int _cups_strcasecmp(const char *, const char *); | |
95 | # define strcasecmp _cups_strcasecmp | |
96 | # endif /* !HAVE_STRCASECMP */ | |
97 | ||
98 | # ifndef HAVE_STRNCASECMP | |
99 | extern int _cups_strncasecmp(const char *, const char *, size_t n); | |
100 | # define strncasecmp _cups_strncasecmp | |
101 | # endif /* !HAVE_STRNCASECMP */ | |
102 | ||
103 | # ifndef HAVE_STRLCAT | |
104 | extern size_t _cups_strlcat(char *, const char *, size_t); | |
105 | # define strlcat _cups_strlcat | |
106 | # endif /* !HAVE_STRLCAT */ | |
107 | ||
108 | # ifndef HAVE_STRLCPY | |
109 | extern size_t _cups_strlcpy(char *, const char *, size_t); | |
110 | # define strlcpy _cups_strlcpy | |
111 | # endif /* !HAVE_STRLCPY */ | |
112 | ||
113 | # ifndef HAVE_SNPRINTF | |
114 | extern int _cups_snprintf(char *, size_t, const char *, ...) | |
115 | # ifdef __GNUC__ | |
116 | __attribute__ ((__format__ (__printf__, 3, 4))) | |
117 | # endif /* __GNUC__ */ | |
118 | ; | |
119 | # define snprintf _cups_snprintf | |
120 | # endif /* !HAVE_SNPRINTF */ | |
121 | ||
122 | # ifndef HAVE_VSNPRINTF | |
123 | extern int _cups_vsnprintf(char *, size_t, const char *, va_list); | |
124 | # define vsnprintf _cups_vsnprintf | |
125 | # endif /* !HAVE_VSNPRINTF */ | |
126 | ||
4400e98d | 127 | /* |
128 | * String pool functions... | |
129 | */ | |
130 | ||
757d2cad | 131 | extern char *_cupsStrAlloc(const char *s); |
d6ae789d | 132 | extern void _cupsStrFlush(void); |
757d2cad | 133 | extern void _cupsStrFree(const char *s); |
e07d4801 | 134 | extern char *_cupsStrRetain(const char *s); |
757d2cad | 135 | extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes); |
136 | ||
137 | ||
138 | /* | |
139 | * Floating point number functions... | |
140 | */ | |
141 | ||
142 | extern char *_cupsStrFormatd(char *buf, char *bufend, double number, | |
143 | struct lconv *loc); | |
144 | extern double _cupsStrScand(const char *buf, char **bufptr, | |
145 | struct lconv *loc); | |
4400e98d | 146 | |
ef416fc2 | 147 | |
148 | /* | |
149 | * C++ magic... | |
150 | */ | |
151 | ||
152 | # ifdef __cplusplus | |
153 | } | |
154 | # endif /* __cplusplus */ | |
155 | ||
156 | #endif /* !_CUPS_STRING_H_ */ | |
157 | ||
158 | /* | |
71e16022 | 159 | * End of "$Id$". |
ef416fc2 | 160 | */ |