]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/string-private.h
Merge changes from CUPS 1.5svn-r9049 (private header support)
[thirdparty/cups.git] / cups / string-private.h
1 /*
2 * "$Id$"
3 *
4 * Private string definitions for CUPS.
5 *
6 * Copyright 2007-2010 by Apple Inc.
7 * Copyright 1997-2006 by Easy Software Products.
8 *
9 * These coded instructions, statements, and computer programs are the
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/".
14 *
15 * This file is subject to the Apple OS-Developed Software exception.
16 */
17
18 #ifndef _CUPS_STRING_PRIVATE_H_
19 # define _CUPS_STRING_PRIVATE_H_
20
21 /*
22 * Include necessary headers...
23 */
24
25 # include <stdio.h>
26 # include <stdlib.h>
27 # include <stdarg.h>
28 # include <ctype.h>
29 # include <errno.h>
30 # include <locale.h>
31
32 # include "config.h"
33
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__)
52 # define strcasecmp _stricmp
53 # define strncasecmp _strnicmp
54 # endif /* WIN32 || __EMX__ */
55
56
57 /*
58 * C++ magic...
59 */
60
61 # ifdef __cplusplus
62 extern "C" {
63 # endif /* __cplusplus */
64
65
66 /*
67 * String pool structures...
68 */
69
70 # define _CUPS_STR_GUARD 0x12344321
71
72 typedef struct _cups_sp_item_s /**** String Pool Item ****/
73 {
74 # ifdef DEBUG_GUARDS
75 unsigned int guard; /* Guard word */
76 # endif /* DEBUG_GUARDS */
77 unsigned int ref_count; /* Reference count */
78 char str[1]; /* String */
79 } _cups_sp_item_t;
80
81
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
127 /*
128 * String pool functions...
129 */
130
131 extern char *_cupsStrAlloc(const char *s);
132 extern void _cupsStrFlush(void);
133 extern void _cupsStrFree(const char *s);
134 extern char *_cupsStrRetain(const char *s);
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);
146
147
148 /*
149 * C++ magic...
150 */
151
152 # ifdef __cplusplus
153 }
154 # endif /* __cplusplus */
155
156 #endif /* !_CUPS_STRING_H_ */
157
158 /*
159 * End of "$Id$".
160 */