]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * "$Id: string.h 6649 2007-07-11 21:46:42Z mike $" | |
3 | * | |
4 | * String definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
6 | * Copyright 2007 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_H_ | |
19 | # define _CUPS_STRING_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 <locale.h> | |
30 | ||
31 | # include <config.h> | |
32 | ||
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 | ||
65 | /* | |
66 | * String pool structures... | |
67 | */ | |
68 | ||
69 | typedef struct _cups_sp_item_s /**** String Pool Item ****/ | |
70 | { | |
71 | char *str; /* String */ | |
72 | unsigned int ref_count; /* Reference count */ | |
73 | } _cups_sp_item_t; | |
74 | ||
75 | ||
76 | /* | |
77 | * Prototypes... | |
78 | */ | |
79 | ||
80 | extern void _cups_strcpy(char *dst, const char *src); | |
81 | ||
82 | # ifndef HAVE_STRDUP | |
83 | extern char *_cups_strdup(const char *); | |
84 | # define strdup _cups_strdup | |
85 | # endif /* !HAVE_STRDUP */ | |
86 | ||
87 | # ifndef HAVE_STRCASECMP | |
88 | extern int _cups_strcasecmp(const char *, const char *); | |
89 | # define strcasecmp _cups_strcasecmp | |
90 | # endif /* !HAVE_STRCASECMP */ | |
91 | ||
92 | # ifndef HAVE_STRNCASECMP | |
93 | extern int _cups_strncasecmp(const char *, const char *, size_t n); | |
94 | # define strncasecmp _cups_strncasecmp | |
95 | # endif /* !HAVE_STRNCASECMP */ | |
96 | ||
97 | # ifndef HAVE_STRLCAT | |
98 | extern size_t _cups_strlcat(char *, const char *, size_t); | |
99 | # define strlcat _cups_strlcat | |
100 | # endif /* !HAVE_STRLCAT */ | |
101 | ||
102 | # ifndef HAVE_STRLCPY | |
103 | extern size_t _cups_strlcpy(char *, const char *, size_t); | |
104 | # define strlcpy _cups_strlcpy | |
105 | # endif /* !HAVE_STRLCPY */ | |
106 | ||
107 | # ifndef HAVE_SNPRINTF | |
108 | extern int _cups_snprintf(char *, size_t, const char *, ...) | |
109 | # ifdef __GNUC__ | |
110 | __attribute__ ((__format__ (__printf__, 3, 4))) | |
111 | # endif /* __GNUC__ */ | |
112 | ; | |
113 | # define snprintf _cups_snprintf | |
114 | # endif /* !HAVE_SNPRINTF */ | |
115 | ||
116 | # ifndef HAVE_VSNPRINTF | |
117 | extern int _cups_vsnprintf(char *, size_t, const char *, va_list); | |
118 | # define vsnprintf _cups_vsnprintf | |
119 | # endif /* !HAVE_VSNPRINTF */ | |
120 | ||
121 | /* | |
122 | * String pool functions... | |
123 | */ | |
124 | ||
125 | extern char *_cupsStrAlloc(const char *s); | |
126 | extern void _cupsStrFlush(void); | |
127 | extern void _cupsStrFree(const char *s); | |
128 | extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes); | |
129 | ||
130 | ||
131 | /* | |
132 | * Floating point number functions... | |
133 | */ | |
134 | ||
135 | extern char *_cupsStrFormatd(char *buf, char *bufend, double number, | |
136 | struct lconv *loc); | |
137 | extern double _cupsStrScand(const char *buf, char **bufptr, | |
138 | struct lconv *loc); | |
139 | ||
140 | ||
141 | /* | |
142 | * C++ magic... | |
143 | */ | |
144 | ||
145 | # ifdef __cplusplus | |
146 | } | |
147 | # endif /* __cplusplus */ | |
148 | ||
149 | #endif /* !_CUPS_STRING_H_ */ | |
150 | ||
151 | /* | |
152 | * End of "$Id: string.h 6649 2007-07-11 21:46:42Z mike $". | |
153 | */ |