#include "config.h"
#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
#include "cpplib.h"
#include "cpphash.h"
#include "cppucnid.h"
#endif
/* This structure is used for a resizable string buffer throughout. */
-struct strbuf
+/* Don't call it strbuf, as that conflicts with unistd.h on systems
+ such as DYNIX/ptx where unistd.h includes stropts.h. */
+struct _cpp_strbuf
{
uchar *text;
size_t asize;
/* Helper routine for the next few functions. The 'const' on
one_conversion means that we promise not to modify what function is
- pointed to, which lets the inliner see through it. */
+ pointed to, which lets the inliner see through it. */
static inline bool
conversion_loop (int (*const one_conversion)(iconv_t, const uchar **, size_t *,
uchar **, size_t *),
- iconv_t cd, const uchar *from, size_t flen, struct strbuf *to)
+ iconv_t cd, const uchar *from, size_t flen, struct _cpp_strbuf *to)
{
const uchar *inbuf;
uchar *outbuf;
/* These functions convert entire strings between character sets.
They all have the signature
- bool (*)(iconv_t cd, const uchar *from, size_t flen, struct strbuf *to);
+ bool (*)(iconv_t cd, const uchar *from, size_t flen, struct _cpp_strbuf *to);
The input string FROM is converted as specified by the function
name plus the iconv descriptor CD (which may be fake), and the
/* These four use the custom conversion code above. */
static bool
convert_utf8_utf16 (iconv_t cd, const uchar *from, size_t flen,
- struct strbuf *to)
+ struct _cpp_strbuf *to)
{
return conversion_loop (one_utf8_to_utf16, cd, from, flen, to);
}
static bool
convert_utf8_utf32 (iconv_t cd, const uchar *from, size_t flen,
- struct strbuf *to)
+ struct _cpp_strbuf *to)
{
return conversion_loop (one_utf8_to_utf32, cd, from, flen, to);
}
static bool
convert_utf16_utf8 (iconv_t cd, const uchar *from, size_t flen,
- struct strbuf *to)
+ struct _cpp_strbuf *to)
{
return conversion_loop (one_utf16_to_utf8, cd, from, flen, to);
}
static bool
convert_utf32_utf8 (iconv_t cd, const uchar *from, size_t flen,
- struct strbuf *to)
+ struct _cpp_strbuf *to)
{
return conversion_loop (one_utf32_to_utf8, cd, from, flen, to);
}
/* Identity conversion, used when we have no alternative. */
static bool
convert_no_conversion (iconv_t cd ATTRIBUTE_UNUSED,
- const uchar *from, size_t flen, struct strbuf *to)
+ const uchar *from, size_t flen, struct _cpp_strbuf *to)
{
if (to->len + flen > to->asize)
{
#if HAVE_ICONV
static bool
convert_using_iconv (iconv_t cd, const uchar *from, size_t flen,
- struct strbuf *to)
+ struct _cpp_strbuf *to)
{
ICONV_CONST char *inbuf;
char *outbuf;
static const uchar *
convert_ucn (cpp_reader *pfile, const uchar *from, const uchar *limit,
- struct strbuf *tbuf, bool wide)
+ struct _cpp_strbuf *tbuf, bool wide)
{
cppchar_t ucn;
uchar buf[6];
static void
emit_numeric_escape (cpp_reader *pfile, cppchar_t n,
- struct strbuf *tbuf, bool wide)
+ struct _cpp_strbuf *tbuf, bool wide)
{
if (wide)
{
number. You can, e.g. generate surrogate pairs this way. */
static const uchar *
convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit,
- struct strbuf *tbuf, bool wide)
+ struct _cpp_strbuf *tbuf, bool wide)
{
cppchar_t c, n = 0, overflow = 0;
int digits_found = 0;
number. */
static const uchar *
convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit,
- struct strbuf *tbuf, bool wide)
+ struct _cpp_strbuf *tbuf, bool wide)
{
size_t count = 0;
cppchar_t c, n = 0;
pointer. Handles all relevant diagnostics. */
static const uchar *
convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
- struct strbuf *tbuf, bool wide)
+ struct _cpp_strbuf *tbuf, bool wide)
{
/* Values of \a \b \e \f \n \r \t \v respectively. */
#if HOST_CHARSET == HOST_CHARSET_ASCII
cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
cpp_string *to, bool wide)
{
- struct strbuf tbuf;
+ struct _cpp_strbuf tbuf;
const uchar *p, *base, *limit;
size_t i;
struct cset_converter cvt