]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/cpp/DataBoardTest/libantlr3c-3.2/include/antlr3convertutf.h
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / libantlr3c-3.2 / include / antlr3convertutf.h
index 1339373a56f97bbc90a08e16110f0d814f280aa4..ffe44b0c00a3e716f836c5bff0bd422d1332042c 100644 (file)
-/*\r
- * Copyright 2001-2004 Unicode, Inc.\r
- * \r
- * Disclaimer\r
- * \r
- * This source code is provided as is by Unicode, Inc. No claims are\r
- * made as to fitness for any particular purpose. No warranties of any\r
- * kind are expressed or implied. The recipient agrees to determine\r
- * applicability of information provided. If this file has been\r
- * purchased on magnetic or optical media from Unicode, Inc., the\r
- * sole remedy for any claim will be exchange of defective media\r
- * within 90 days of receipt.\r
- * \r
- * Limitations on Rights to Redistribute This Code\r
- * \r
- * Unicode, Inc. hereby grants the right to freely use the information\r
- * supplied in this file in the creation of products supporting the\r
- * Unicode Standard, and to make copies of this file in any form\r
- * for internal or external distribution as long as this notice\r
- * remains attached.\r
- */\r
-\r
-/* ---------------------------------------------------------------------\r
-\r
-    Conversions between UTF32, UTF-16, and UTF-8.  Header file.\r
-\r
-    Several functions are included here, forming a complete set of\r
-    conversions between the three formats.  UTF-7 is not included\r
-    here, but is handled in a separate source file.\r
-\r
-    Each of these routines takes pointers to input buffers and output\r
-    buffers.  The input buffers are const.\r
-\r
-    Each routine converts the text between *sourceStart and sourceEnd,\r
-    putting the result into the buffer between *targetStart and\r
-    targetEnd. Note: the end pointers are *after* the last item: e.g. \r
-    *(sourceEnd - 1) is the last item.\r
-\r
-    The return result indicates whether the conversion was successful,\r
-    and if not, whether the problem was in the source or target buffers.\r
-    (Only the first encountered problem is indicated.)\r
-\r
-    After the conversion, *sourceStart and *targetStart are both\r
-    updated to point to the end of last text successfully converted in\r
-    the respective buffers.\r
-\r
-    Input parameters:\r
-       sourceStart - pointer to a pointer to the source buffer.\r
-               The contents of this are modified on return so that\r
-               it points at the next thing to be converted.\r
-       targetStart - similarly, pointer to pointer to the target buffer.\r
-       sourceEnd, targetEnd - respectively pointers to the ends of the\r
-               two buffers, for overflow checking only.\r
-\r
-    These conversion functions take a ConversionFlags argument. When this\r
-    flag is set to strict, both irregular sequences and isolated surrogates\r
-    will cause an error.  When the flag is set to lenient, both irregular\r
-    sequences and isolated surrogates are converted.\r
-\r
-    Whether the flag is strict or lenient, all illegal sequences will cause\r
-    an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,\r
-    or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code\r
-    must check for illegal sequences.\r
-\r
-    When the flag is set to lenient, characters over 0x10FFFF are converted\r
-    to the replacement character; otherwise (when the flag is set to strict)\r
-    they constitute an error.\r
-\r
-    Output parameters:\r
-       The value "sourceIllegal" is returned from some routines if the input\r
-       sequence is malformed.  When "sourceIllegal" is returned, the source\r
-       value will point to the illegal value that caused the problem. E.g.,\r
-       in UTF-8 when a sequence is malformed, it points to the start of the\r
-       malformed sequence.  \r
-\r
-    Author: Mark E. Davis, 1994.\r
-    Rev History: Rick McGowan, fixes & updates May 2001.\r
-                Fixes & updates, Sept 2001.\r
-\r
------------------------------------------------------------------------- */\r
-\r
-/* ---------------------------------------------------------------------\r
-    The following 4 definitions are compiler-specific.\r
-    The C standard does not guarantee that wchar_t has at least\r
-    16 bits, so wchar_t is no less portable than unsigned short!\r
-    All should be unsigned values to avoid sign extension during\r
-    bit mask & shift operations.\r
------------------------------------------------------------------------- */\r
-\r
-\r
-// Changes for ANTLR3 - Jim Idle, January 2008.\r
-// builtin types defined for Unicode types changed to\r
-// aliases for the types that are system determined by\r
-// ANTLR at compile time.\r
-//\r
-// typedef unsigned long       UTF32;  /* at least 32 bits */\r
-// typedef unsigned short      UTF16;  /* at least 16 bits */\r
-// typedef unsigned char       UTF8;   /* typically 8 bits */\r
-// typedef unsigned char       Boolean; /* 0 or 1 */\r
-\r
-#ifndef        _ANTLR3_CONVERTUTF_H\r
-#define        _ANTLR3_CONVERTUTF_H\r
-\r
-#include       <antlr3defs.h>\r
-\r
-typedef ANTLR3_UINT32  UTF32;  /* at least 32 bits */\r
-typedef ANTLR3_UINT16  UTF16;  /* at least 16 bits */\r
-typedef ANTLR3_UINT8   UTF8;   /* typically 8 bits */\r
-\r
-/* Some fundamental constants */\r
-#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD\r
-#define UNI_MAX_BMP (UTF32)0x0000FFFF\r
-#define UNI_MAX_UTF16 (UTF32)0x0010FFFF\r
-#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF\r
-#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF\r
-\r
-typedef enum {\r
-       conversionOK,           /* conversion successful */\r
-       sourceExhausted,        /* partial character in source, but hit end */\r
-       targetExhausted,        /* insuff. room in target for conversion */\r
-       sourceIllegal           /* source sequence is illegal/malformed */\r
-} ConversionResult;\r
-\r
-typedef enum {\r
-       strictConversion = 0,\r
-       lenientConversion\r
-} ConversionFlags;\r
-\r
-/* This is for C++ and does no harm in C */\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-ConversionResult ConvertUTF8toUTF16 (\r
-               const UTF8** sourceStart, const UTF8* sourceEnd, \r
-               UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);\r
-\r
-ConversionResult ConvertUTF16toUTF8 (\r
-               const UTF16** sourceStart, const UTF16* sourceEnd, \r
-               UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);\r
-               \r
-ConversionResult ConvertUTF8toUTF32 (\r
-               const UTF8** sourceStart, const UTF8* sourceEnd, \r
-               UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);\r
-\r
-ConversionResult ConvertUTF32toUTF8 (\r
-               const UTF32** sourceStart, const UTF32* sourceEnd, \r
-               UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);\r
-               \r
-ConversionResult ConvertUTF16toUTF32 (\r
-               const UTF16** sourceStart, const UTF16* sourceEnd, \r
-               UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);\r
-\r
-ConversionResult ConvertUTF32toUTF16 (\r
-               const UTF32** sourceStart, const UTF32* sourceEnd, \r
-               UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);\r
-\r
-ANTLR3_BOOLEAN isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
-\r
-/* --------------------------------------------------------------------- */\r
+/*
+ * Copyright 2001-2004 Unicode, Inc.
+ * 
+ * Disclaimer
+ * 
+ * This source code is provided as is by Unicode, Inc. No claims are
+ * made as to fitness for any particular purpose. No warranties of any
+ * kind are expressed or implied. The recipient agrees to determine
+ * applicability of information provided. If this file has been
+ * purchased on magnetic or optical media from Unicode, Inc., the
+ * sole remedy for any claim will be exchange of defective media
+ * within 90 days of receipt.
+ * 
+ * Limitations on Rights to Redistribute This Code
+ * 
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form
+ * for internal or external distribution as long as this notice
+ * remains attached.
+ */
+
+/* ---------------------------------------------------------------------
+
+    Conversions between UTF32, UTF-16, and UTF-8.  Header file.
+
+    Several functions are included here, forming a complete set of
+    conversions between the three formats.  UTF-7 is not included
+    here, but is handled in a separate source file.
+
+    Each of these routines takes pointers to input buffers and output
+    buffers.  The input buffers are const.
+
+    Each routine converts the text between *sourceStart and sourceEnd,
+    putting the result into the buffer between *targetStart and
+    targetEnd. Note: the end pointers are *after* the last item: e.g. 
+    *(sourceEnd - 1) is the last item.
+
+    The return result indicates whether the conversion was successful,
+    and if not, whether the problem was in the source or target buffers.
+    (Only the first encountered problem is indicated.)
+
+    After the conversion, *sourceStart and *targetStart are both
+    updated to point to the end of last text successfully converted in
+    the respective buffers.
+
+    Input parameters:
+       sourceStart - pointer to a pointer to the source buffer.
+               The contents of this are modified on return so that
+               it points at the next thing to be converted.
+       targetStart - similarly, pointer to pointer to the target buffer.
+       sourceEnd, targetEnd - respectively pointers to the ends of the
+               two buffers, for overflow checking only.
+
+    These conversion functions take a ConversionFlags argument. When this
+    flag is set to strict, both irregular sequences and isolated surrogates
+    will cause an error.  When the flag is set to lenient, both irregular
+    sequences and isolated surrogates are converted.
+
+    Whether the flag is strict or lenient, all illegal sequences will cause
+    an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
+    or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
+    must check for illegal sequences.
+
+    When the flag is set to lenient, characters over 0x10FFFF are converted
+    to the replacement character; otherwise (when the flag is set to strict)
+    they constitute an error.
+
+    Output parameters:
+       The value "sourceIllegal" is returned from some routines if the input
+       sequence is malformed.  When "sourceIllegal" is returned, the source
+       value will point to the illegal value that caused the problem. E.g.,
+       in UTF-8 when a sequence is malformed, it points to the start of the
+       malformed sequence.  
+
+    Author: Mark E. Davis, 1994.
+    Rev History: Rick McGowan, fixes & updates May 2001.
+                Fixes & updates, Sept 2001.
+
+------------------------------------------------------------------------ */
+
+/* ---------------------------------------------------------------------
+    The following 4 definitions are compiler-specific.
+    The C standard does not guarantee that wchar_t has at least
+    16 bits, so wchar_t is no less portable than unsigned short!
+    All should be unsigned values to avoid sign extension during
+    bit mask & shift operations.
+------------------------------------------------------------------------ */
+
+
+// Changes for ANTLR3 - Jim Idle, January 2008.
+// builtin types defined for Unicode types changed to
+// aliases for the types that are system determined by
+// ANTLR at compile time.
+//
+// typedef unsigned long       UTF32;  /* at least 32 bits */
+// typedef unsigned short      UTF16;  /* at least 16 bits */
+// typedef unsigned char       UTF8;   /* typically 8 bits */
+// typedef unsigned char       Boolean; /* 0 or 1 */
+
+#ifndef        _ANTLR3_CONVERTUTF_H
+#define        _ANTLR3_CONVERTUTF_H
+
+#include       <antlr3defs.h>
+
+typedef ANTLR3_UINT32  UTF32;  /* at least 32 bits */
+typedef ANTLR3_UINT16  UTF16;  /* at least 16 bits */
+typedef ANTLR3_UINT8   UTF8;   /* typically 8 bits */
+
+/* Some fundamental constants */
+#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
+#define UNI_MAX_BMP (UTF32)0x0000FFFF
+#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
+#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
+#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
+
+typedef enum {
+       conversionOK,           /* conversion successful */
+       sourceExhausted,        /* partial character in source, but hit end */
+       targetExhausted,        /* insuff. room in target for conversion */
+       sourceIllegal           /* source sequence is illegal/malformed */
+} ConversionResult;
+
+typedef enum {
+       strictConversion = 0,
+       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);
+
+ConversionResult ConvertUTF16toUTF8 (
+               const UTF16** sourceStart, const UTF16* sourceEnd, 
+               UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
+               
+ConversionResult ConvertUTF8toUTF32 (
+               const UTF8** sourceStart, const UTF8* sourceEnd, 
+               UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF8 (
+               const UTF32** sourceStart, const UTF32* sourceEnd, 
+               UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
+               
+ConversionResult ConvertUTF16toUTF32 (
+               const UTF16** sourceStart, const UTF16* sourceEnd, 
+               UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF16 (
+               const UTF32** sourceStart, const UTF32* sourceEnd, 
+               UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+
+ANTLR3_BOOLEAN isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* --------------------------------------------------------------------- */