#ifndef LLVM_SUPPORT_CONVERTUTF_H
#define LLVM_SUPPORT_CONVERTUTF_H
+#include <string>
+#include <cstddef>
+
+// Wrap everything in namespace llvm so that programs can link with llvm and
+// their own version of the unicode libraries.
+
+namespace llvm {
+
/* ---------------------------------------------------------------------
The following 4 definitions are compiler-specific.
The C standard does not guarantee that wchar_t has at least
lenientConversion
} ConversionFlags;
-/* This is for C++ and does no harm in C */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
ConversionResult ConvertUTF8toUTF16 (
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
unsigned getNumBytesForUTF8(UTF8 firstByte);
-#ifdef __cplusplus
-}
-
/*************************************************************************/
/* Below are LLVM-specific wrappers of the functions above. */
-#include <string>
-#include <cstddef>
-
-namespace llvm {
template <typename T> class ArrayRef;
template <typename T> class SmallVectorImpl;
class StringRef;
} /* end namespace llvm */
#endif
-
-/* --------------------------------------------------------------------- */
-
-#endif
#endif
#include <assert.h>
+namespace llvm {
+
static const int halfShift = 10; /* used for shifting by 10 bits */
static const UTF32 halfBase = 0x0010000UL;
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
#define UNI_SUR_LOW_START (UTF32)0xDC00
#define UNI_SUR_LOW_END (UTF32)0xDFFF
-#define false 0
-#define true 1
/* --------------------------------------------------------------------- */
similarly unrolled loops.
--------------------------------------------------------------------- */
+
+} // namespace llvm