]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/string.h
Merge fixes from CUPS 1.4.0 (r8739).
[thirdparty/cups.git] / cups / string.h
CommitLineData
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__)
536bc2c6
MS
51# define strcasecmp _stricmp
52# define strncasecmp _strnicmp
ef416fc2 53# endif /* WIN32 || __EMX__ */
54
55
56/*
57 * C++ magic...
58 */
59
60# ifdef __cplusplus
61extern "C" {
62# endif /* __cplusplus */
63
64
4400e98d 65/*
66 * String pool structures...
67 */
68
745129be
MS
69# define _CUPS_STR_GUARD 0x12344321
70
4400e98d 71typedef 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
85extern void _cups_strcpy(char *dst, const char *src);
86
87# ifndef HAVE_STRDUP
88extern char *_cups_strdup(const char *);
89# define strdup _cups_strdup
90# endif /* !HAVE_STRDUP */
91
92# ifndef HAVE_STRCASECMP
93extern int _cups_strcasecmp(const char *, const char *);
94# define strcasecmp _cups_strcasecmp
95# endif /* !HAVE_STRCASECMP */
96
97# ifndef HAVE_STRNCASECMP
98extern int _cups_strncasecmp(const char *, const char *, size_t n);
99# define strncasecmp _cups_strncasecmp
100# endif /* !HAVE_STRNCASECMP */
101
102# ifndef HAVE_STRLCAT
103extern size_t _cups_strlcat(char *, const char *, size_t);
104# define strlcat _cups_strlcat
105# endif /* !HAVE_STRLCAT */
106
107# ifndef HAVE_STRLCPY
108extern size_t _cups_strlcpy(char *, const char *, size_t);
109# define strlcpy _cups_strlcpy
110# endif /* !HAVE_STRLCPY */
111
112# ifndef HAVE_SNPRINTF
113extern 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
122extern 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 130extern char *_cupsStrAlloc(const char *s);
d6ae789d 131extern void _cupsStrFlush(void);
757d2cad 132extern void _cupsStrFree(const char *s);
e07d4801 133extern char *_cupsStrRetain(const char *s);
757d2cad 134extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes);
135
136
137/*
138 * Floating point number functions...
139 */
140
141extern char *_cupsStrFormatd(char *buf, char *bufend, double number,
142 struct lconv *loc);
143extern 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 */