Loading...
Searching...
No Matches
utf_old.h File Reference

C API: Deprecated macros for Unicode string handling. More...

`#include "unicode/utf.h"`
`#include "unicode/utf8.h"`
`#include "unicode/utf16.h"`

Go to the source code of this file.

## Macros

#define | U_HIDE_OBSOLETE_UTF_OLD_H 0
| Hides the obsolete definitions in unicode/utf_old.h.
#define | UTF_SIZE 16
| Number of bits in a Unicode string code unit - ICU uses 16-bit Unicode.
#define | UTF_SAFE
| The default choice for general Unicode string macros is to use the ..._SAFE macro implementations with strict=false.
#define | UTF8_ERROR_VALUE_1 0x15
| UTF8_ERROR_VALUE_1 and UTF8_ERROR_VALUE_2 are special error values for UTF-8, which need 1 or 2 bytes in UTF-8:
#define | UTF8_ERROR_VALUE_2 0x9f
| See documentation on UTF8_ERROR_VALUE_1 for details.
#define | UTF_ERROR_VALUE 0xffff
| Error value for all UTFs.
#define | UTF_IS_ERROR(c)
| Is a given 32-bit code an error value as returned by one of the macros for any UTF?
#define | UTF_IS_VALID(c)
| This is a combined macro: Is c a valid Unicode value and not an error code?
#define | UTF_IS_SURROGATE(uchar)
| Is this code unit or code point a surrogate (U+d800..U+dfff)?
#define | UTF_IS_UNICODE_NONCHAR(c)
| Is a given 32-bit code point a Unicode noncharacter?
#define | UTF_IS_UNICODE_CHAR(c)
| Is a given 32-bit value a Unicode code point value (0..U+10ffff) that can be assigned a character?
#define | UTF8_COUNT_TRAIL_BYTES(leadByte)
| Count the trail bytes for a UTF-8 lead byte.
#define | UTF8_MASK_LEAD_BYTE(leadByte, countTrailBytes)
| Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
#define | UTF8_IS_SINGLE(uchar)
| Is this this code point a single code unit (byte)?
#define | UTF8_IS_LEAD(uchar)
| Is this this code unit the lead code unit (byte) of a code point?
#define | UTF8_IS_TRAIL(uchar)
| Is this this code unit a trailing code unit (byte) of a code point?
#define | UTF8_NEED_MULTIPLE_UCHAR(c)
| Does this scalar Unicode value need multiple code units for storage?
#define | UTF8_CHAR_LENGTH(c)
| Given the lead character, how many bytes are taken by this code point.
#define | UTF8_MAX_CHAR_LENGTH 4
| The maximum number of bytes per code point.
#define | UTF8_ARRAY_SIZE(size)
| Average number of code units compared to UTF-16.
#define | UTF8_GET_CHAR_UNSAFE(s, i, c)
#define | UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict)
#define | UTF8_NEXT_CHAR_UNSAFE(s, i, c)
#define | UTF8_APPEND_CHAR_UNSAFE(s, i, c)
#define | UTF8_FWD_1_UNSAFE(s, i)
#define | UTF8_FWD_N_UNSAFE(s, i, n)
#define | UTF8_SET_CHAR_START_UNSAFE(s, i)
#define | UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict)
#define | UTF8_APPEND_CHAR_SAFE(s, i, length, c)
#define | UTF8_FWD_1_SAFE(s, i, length)
#define | UTF8_FWD_N_SAFE(s, i, length, n)
#define | UTF8_SET_CHAR_START_SAFE(s, start, i)
#define | UTF8_PREV_CHAR_UNSAFE(s, i, c)
#define | UTF8_BACK_1_UNSAFE(s, i)
#define | UTF8_BACK_N_UNSAFE(s, i, n)
#define | UTF8_SET_CHAR_LIMIT_UNSAFE(s, i)
#define | UTF8_PREV_CHAR_SAFE(s, start, i, c, strict)
#define | UTF8_BACK_1_SAFE(s, start, i)
#define | UTF8_BACK_N_SAFE(s, start, i, n)
#define | UTF8_SET_CHAR_LIMIT_SAFE(s, start, i, length)
#define | UTF_IS_FIRST_SURROGATE(uchar)
| Is uchar a first/lead surrogate?
#define | UTF_IS_SECOND_SURROGATE(uchar)
| Is uchar a second/trail surrogate?
#define | UTF_IS_SURROGATE_FIRST(c)
| Assuming c is a surrogate, is it a first/lead surrogate?
#define | UTF_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
| Helper constant for UTF16_GET_PAIR_VALUE.
#define | UTF16_GET_PAIR_VALUE(first, second)
| Get the UTF-32 value from the surrogate code units.
#define | UTF_FIRST_SURROGATE(supplementary)
#define | UTF_SECOND_SURROGATE(supplementary)
#define | UTF16_LEAD(supplementary)
#define | UTF16_TRAIL(supplementary)
#define | UTF16_IS_SINGLE(uchar)
#define | UTF16_IS_LEAD(uchar)
#define | UTF16_IS_TRAIL(uchar)
#define | UTF16_NEED_MULTIPLE_UCHAR(c)
| Does this scalar Unicode value need multiple code units for storage?
#define | UTF16_CHAR_LENGTH(c)
#define | UTF16_MAX_CHAR_LENGTH 2
#define | UTF16_ARRAY_SIZE(size)
| Average number of code units compared to UTF-16.
#define | UTF16_GET_CHAR_UNSAFE(s, i, c)
| Get a single code point from an offset that points to any of the code units that belong to that code point.
#define | UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict)
#define | UTF16_NEXT_CHAR_UNSAFE(s, i, c)
#define | UTF16_APPEND_CHAR_UNSAFE(s, i, c)
#define | UTF16_FWD_1_UNSAFE(s, i)
#define | UTF16_FWD_N_UNSAFE(s, i, n)
#define | UTF16_SET_CHAR_START_UNSAFE(s, i)
#define | UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict)
#define | UTF16_APPEND_CHAR_SAFE(s, i, length, c)
#define | UTF16_FWD_1_SAFE(s, i, length)
#define | UTF16_FWD_N_SAFE(s, i, length, n)
#define | UTF16_SET_CHAR_START_SAFE(s, start, i)
#define | UTF16_PREV_CHAR_UNSAFE(s, i, c)
#define | UTF16_BACK_1_UNSAFE(s, i)
#define | UTF16_BACK_N_UNSAFE(s, i, n)
#define | UTF16_SET_CHAR_LIMIT_UNSAFE(s, i)
#define | UTF16_PREV_CHAR_SAFE(s, start, i, c, strict)
#define | UTF16_BACK_1_SAFE(s, start, i)
#define | UTF16_BACK_N_SAFE(s, start, i, n)
#define | UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length)
#define | UTF32_IS_SAFE(c, strict)
#define | UTF32_IS_SINGLE(uchar)
#define | UTF32_IS_LEAD(uchar)
#define | UTF32_IS_TRAIL(uchar)
#define | UTF32_NEED_MULTIPLE_UCHAR(c)
#define | UTF32_CHAR_LENGTH(c)
#define | UTF32_MAX_CHAR_LENGTH 1
#define | UTF32_ARRAY_SIZE(size)
#define | UTF32_GET_CHAR_UNSAFE(s, i, c)
#define | UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict)
#define | UTF32_NEXT_CHAR_UNSAFE(s, i, c)
#define | UTF32_APPEND_CHAR_UNSAFE(s, i, c)
#define | UTF32_FWD_1_UNSAFE(s, i)
#define | UTF32_FWD_N_UNSAFE(s, i, n)
#define | UTF32_SET_CHAR_START_UNSAFE(s, i)
#define | UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict)
#define | UTF32_APPEND_CHAR_SAFE(s, i, length, c)
#define | UTF32_FWD_1_SAFE(s, i, length)
#define | UTF32_FWD_N_SAFE(s, i, length, n)
#define | UTF32_SET_CHAR_START_SAFE(s, start, i)
#define | UTF32_PREV_CHAR_UNSAFE(s, i, c)
#define | UTF32_BACK_1_UNSAFE(s, i)
#define | UTF32_BACK_N_UNSAFE(s, i, n)
#define | UTF32_SET_CHAR_LIMIT_UNSAFE(s, i)
#define | UTF32_PREV_CHAR_SAFE(s, start, i, c, strict)
#define | UTF32_BACK_1_SAFE(s, start, i)
#define | UTF32_BACK_N_SAFE(s, start, i, n)
#define | UTF32_SET_CHAR_LIMIT_SAFE(s, i, length)
#define | UTF_ARRAY_SIZE(size)
| Estimate the number of code units for a string based on the number of UTF-16 code units.
#define | UTF_GET_CHAR_UNSAFE(s, i, c)
#define | UTF_GET_CHAR_SAFE(s, start, i, length, c, strict)
#define | UTF_NEXT_CHAR_UNSAFE(s, i, c)
#define | UTF_NEXT_CHAR_SAFE(s, i, length, c, strict)
#define | UTF_APPEND_CHAR_UNSAFE(s, i, c)
#define | UTF_APPEND_CHAR_SAFE(s, i, length, c)
#define | UTF_FWD_1_UNSAFE(s, i)
#define | UTF_FWD_1_SAFE(s, i, length)
#define | UTF_FWD_N_UNSAFE(s, i, n)
#define | UTF_FWD_N_SAFE(s, i, length, n)
#define | UTF_SET_CHAR_START_UNSAFE(s, i)
#define | UTF_SET_CHAR_START_SAFE(s, start, i)
#define | UTF_PREV_CHAR_UNSAFE(s, i, c)
#define | UTF_PREV_CHAR_SAFE(s, start, i, c, strict)
#define | UTF_BACK_1_UNSAFE(s, i)
#define | UTF_BACK_1_SAFE(s, start, i)
#define | UTF_BACK_N_UNSAFE(s, i, n)
#define | UTF_BACK_N_SAFE(s, start, i, n)
#define | UTF_SET_CHAR_LIMIT_UNSAFE(s, i)
#define | UTF_SET_CHAR_LIMIT_SAFE(s, start, i, length)
#define | UTF_IS_SINGLE(uchar)
| Does this code unit alone encode a code point (BMP, not a surrogate)?
#define | UTF_IS_LEAD(uchar)
| Is this code unit the first one of several (a lead surrogate)?
#define | UTF_IS_TRAIL(uchar)
| Is this code unit one of several but not the first one (a trail surrogate)?
#define | UTF_NEED_MULTIPLE_UCHAR(c)
| Does this code point require multiple code units (is it a supplementary code point)?
#define | UTF_CHAR_LENGTH(c)
| How many code units are used to encode this code point (1 or 2)?
#define | UTF_MAX_CHAR_LENGTH U16_MAX_LENGTH
| How many code units are used at most for any Unicode code point (2)?
#define | UTF_GET_CHAR(s, start, i, length, c)
| Set c to the code point that contains the code unit i.
#define | UTF_NEXT_CHAR(s, i, length, c)
| Set c to the code point that starts at code unit i and advance i to beyond the code units of this code point (post-increment).
#define | UTF_APPEND_CHAR(s, i, length, c)
| Append the code units of code point c to the string at index i and advance i to beyond the new code units (post-increment).
#define | UTF_FWD_1(s, i, length)
| Advance i to beyond the code units of the code point that begins at i.
#define | UTF_FWD_N(s, i, length, n)
| Advance i to beyond the code units of the n code points where the first one begins at i.
#define | UTF_SET_CHAR_START(s, start, i)
| Take the random-access index i and adjust it so that it points to the beginning of a code point.
#define | UTF_PREV_CHAR(s, start, i, c)
| Set c to the code point that has code units before i and move i backward (towards the beginning of the string) to the first code unit of this code point (pre-increment).
#define | UTF_BACK_1(s, start, i)
| Move i backward (towards the beginning of the string) to the first code unit of the code point that has code units before i.
#define | UTF_BACK_N(s, start, i, n)
| Move i backward (towards the beginning of the string) to the first code unit of the n code points that have code units before i.
#define | UTF_SET_CHAR_LIMIT(s, start, i, length)
| Take the random-access index i and adjust it so that it points beyond a code point.

## Variables

U_CFUNC U_IMPORT const uint8_t | utf8_countTrailBytes []
| Internal array with numbers of trail bytes for any given byte used in lead byte position.

## Detailed Description

C API: Deprecated macros for Unicode string handling.

The macros in utf_old.h are all deprecated and their use discouraged. Some of the design principles behind the set of UTF macros have changed or proved impractical. Almost all of the old "UTF macros" are at least renamed. If you are looking for a new equivalent to an old macro, please see the comment at the old one.

Brief summary of reasons for deprecation:

- Switch on UTF_SIZE (selection of UTF-8/16/32 default string processing) was impractical.
- Switch on UTF_SAFE etc. (selection of unsafe/safe/strict default string processing) was of little use and impractical.
- Whole classes of macros became obsolete outside of the UTF_SIZE/UTF_SAFE selection framework: UTF32_ macros (all trivial) and UTF_ default and intermediate macros (all aliases).
- The selection framework also caused many macro aliases.
- Change in Unicode standard: "irregular" sequences (3.0) became illegal (3.2).
- Change of language in Unicode standard: Growing distinction between internal x-bit Unicode strings and external UTF-x forms, with the former more lenient. Suggests renaming of UTF16_ macros to U16_.
- The prefix "UTF_" without a width number confused some users.
- "Safe" append macros needed the addition of an error indicator output.
- "Safe" UTF-8 macros used legitimate (if rarely used) code point values to indicate error conditions.
- The use of the "_CHAR" infix for code point operations confused some users.

More details:

Until ICU 2.2, utf.h theoretically allowed to choose among UTF-8/16/32 for string processing, and among unsafe/safe/strict default macros for that.

It proved nearly impossible to write non-trivial, high-performance code that is UTF-generic. Unsafe default macros would be dangerous for default string processing, and the main reason for the "strict" versions disappeared: Between Unicode 3.0 and 3.2 all "irregular" UTF-8 sequences became illegal. The only other conditions that "strict" checked for were non-characters, which are valid during processing. Only during text input/output should they be checked, and at that time other well-formedness checks may be necessary or useful as well. This can still be done by using U16_NEXT and U_IS_UNICODE_NONCHAR or U_IS_UNICODE_CHAR.

The old UTF8_..._SAFE macros also used some normal Unicode code points to indicate malformed sequences. The new UTF8_ macros without suffix use negative values instead.

The entire contents of utf32.h was moved here without replacement because all those macros were trivial and were meaningful only in the framework of choosing the UTF size.

See Jitterbug 2150 and its discussion on the ICU mailing list in September 2002.

Obsolete part of pre-ICU 2.4 utf.h file documentation:

The original concept for these files was for ICU to allow in principle to set which UTF (UTF-8/16/32) is used internally by defining UTF_SIZE to either 8, 16, or 32. utf.h would then define the UChar type accordingly. UTF-16 was the default.

This concept has been abandoned. A lot of the ICU source code assumes UChar strings are in UTF-16. This is especially true for low-level code like conversion, normalization, and collation. The utf.h header enforces the default of UTF-16. The UTF-8 and UTF-32 macros remain for now for completeness and backward compatibility.

Accordingly, utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then UChar is defined to be exactly wchar_t, otherwise uint16_t.

UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit Unicode code point (Unicode scalar value, 0..0x10ffff). Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as the definition of UChar. For details see the documentation for UChar32 itself.

utf.h also defines a number of C macros for handling single Unicode code points and for using UTF Unicode strings. It includes utf8.h, utf16.h, and utf32.h for the actual implementations of those macros and then aliases one set of them (for UTF-16) for general use. The UTF-specific macros have the UTF size in the macro name prefixes (UTF16_...), while the general alias macros always begin with UTF_...

Many string operations can be done with or without error checking. Where such a distinction is useful, there are two versions of the macros, "unsafe" and "safe" ones with ..._UNSAFE and ..._SAFE suffixes. The unsafe macros are fast but may cause program failures if the strings are not well-formed. The safe macros have an additional, boolean parameter "strict". If strict is false, then only illegal sequences are detected. Otherwise, irregular sequences and non-characters are detected as well (like single surrogates). Safe macros return special error code points for illegal/irregular sequences: Typically, U+ffff, or values that would result in a code unit sequence of the same length as the erroneous input sequence.
Note that _UNSAFE macros have fewer parameters: They do not have the strictness parameter, and they do not have start/length parameters for boundary checking.

Here, the macros are aliased in two steps: In the first step, the UTF-specific macros with UTF16_ prefix and UNSAFE and _SAFE suffixes are aliased according to the UTF_SIZE to macros with UTF prefix and the same suffixes and signatures. Then, in a second step, the default, general alias macros are set to use either the unsafe or the safe/not strict (default) or the safe/strict macro; these general macros do not have a strictness parameter.

It is possible to change the default choice for the general alias macros to be unsafe, safe/not strict or safe/strict. The default is safe/not strict. It is not recommended to select the unsafe macros as the basis for Unicode string handling in ICU! To select this, define UTF_SAFE, UTF_STRICT, or UTF_UNSAFE.

For general use, one should use the default, general macros with UTF_ prefix and no SAFE/_UNSAFE suffix. Only in some cases it may be necessary to control the choice of macro directly and use a less generic alias. For example, if it can be assumed that a string is well-formed and the index will stay within the bounds, then the _UNSAFE version may be used. If a UTF-8 string is to be processed, then the macros with UTF8 prefixes need to be used.

Deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead.

Definition in file utf_old.h.

## Macro Definition Documentation

## U_HIDE_OBSOLETE_UTF_OLD_H

#define U_HIDE_OBSOLETE_UTF_OLD_H 0

Hides the obsolete definitions in unicode/utf_old.h.

Recommended to be set to 1 at compile time to make sure the long-deprecated macros are no longer used.

For reasons for the deprecation see the utf_old.h file comments.

Internal
  Do not use. This API is for internal use only.

Definition at line 161 of file utf_old.h.

## UTF16_APPEND_CHAR_SAFE

#define UTF16_APPEND_CHAR_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else if((uint32_t)(c)<=0x10ffff) { \
if((i)+1<(length)) { \
(s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
(s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
} else /* not enough space */ { \
(s)[(i)++]=UTF_ERROR_VALUE; \
} \
} else /* c>0x10ffff, write error value */ { \
(s)[(i)++]=UTF_ERROR_VALUE; \
} \
} UPRV_BLOCK_MACRO_END
UPRV_BLOCK_MACRO_END
#define UPRV_BLOCK_MACRO_END
Defined as "while (false)" by default.
Definition umachine.h:178
UPRV_BLOCK_MACRO_BEGIN
#define UPRV_BLOCK_MACRO_BEGIN
Defined as the "do" keyword by default.
Definition umachine.h:169
UTF_ERROR_VALUE
#define UTF_ERROR_VALUE
Error value for all UTFs.
Definition utf_old.h:223

Deprecated
  ICU 2.4. Use U16_APPEND instead, see utf_old.h.

Definition at line 694 of file utf_old.h.

## UTF16_APPEND_CHAR_UNSAFE

#define UTF16_APPEND_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else { \
(s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
(s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h.

Definition at line 642 of file utf_old.h.

## UTF16_ARRAY_SIZE

#define UTF16_ARRAY_SIZE | ( |  | size | ) |

Value:
(size)

Average number of code units compared to UTF-16.

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 582 of file utf_old.h.

## UTF16_BACK_1_SAFE

#define UTF16_BACK_1_SAFE | ( |  | s,
|  |  | start,
|  |  | i )

Value:
U16_BACK_1(s, start, i)
U16_BACK_1
#define U16_BACK_1(s, start, i)
Move the string offset from one code point boundary to the previous one.
Definition utf16.h:643

Deprecated
  ICU 2.4. Renamed to U16_BACK_1, see utf_old.h.

Definition at line 769 of file utf_old.h.

## UTF16_BACK_1_UNSAFE

#define UTF16_BACK_1_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_SECOND_SURROGATE((s)[--(i)])) { \
--(i); \
} \
} UPRV_BLOCK_MACRO_END
UTF_IS_SECOND_SURROGATE
#define UTF_IS_SECOND_SURROGATE(uchar)
Is uchar a second/trail surrogate?
Definition utf_old.h:539

Deprecated
  ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h.

Definition at line 727 of file utf_old.h.

## UTF16_BACK_N_SAFE

#define UTF16_BACK_N_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | n )

Value:
U16_BACK_N(s, start, i, n)
U16_BACK_N
#define U16_BACK_N(s, start, i, n)
Move the string offset from one code point boundary to the n-th one before it, i.e....
Definition utf16.h:684

Deprecated
  ICU 2.4. Renamed to U16_BACK_N, see utf_old.h.

Definition at line 772 of file utf_old.h.

## UTF16_BACK_N_UNSAFE

#define UTF16_BACK_N_UNSAFE | ( |  | s,
|  |  | i,
|  |  | n )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF16_BACK_1_UNSAFE(s, i); \
--__N; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h.

Definition at line 734 of file utf_old.h.

## UTF16_CHAR_LENGTH

#define UTF16_CHAR_LENGTH | ( |  | c | ) |

Value:
((uint32_t)(c)<=0xffff ? 1 : 2)

Deprecated
  ICU 2.4. Renamed to U16_LENGTH, see utf_old.h.

Definition at line 576 of file utf_old.h.

## UTF16_FWD_1_SAFE

#define UTF16_FWD_1_SAFE | ( |  | s,
|  |  | i,
|  |  | length )

Value:
U16_FWD_1(s, i, length)
U16_FWD_1
#define U16_FWD_1(s, i, length)
Advance the string offset from one code point boundary to the next.
Definition utf16.h:433

Deprecated
  ICU 2.4. Renamed to U16_FWD_1, see utf_old.h.

Definition at line 710 of file utf_old.h.

## UTF16_FWD_1_UNSAFE

#define UTF16_FWD_1_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_FIRST_SURROGATE((s)[(i)++])) { \
++(i); \
} \
} UPRV_BLOCK_MACRO_END
UTF_IS_FIRST_SURROGATE
#define UTF_IS_FIRST_SURROGATE(uchar)
Is uchar a first/lead surrogate?
Definition utf_old.h:536

Deprecated
  ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h.

Definition at line 652 of file utf_old.h.

## UTF16_FWD_N_SAFE

#define UTF16_FWD_N_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | n )

Value:
U16_FWD_N(s, i, length, n)
U16_FWD_N
#define U16_FWD_N(s, i, length, n)
Advance the string offset from one code point boundary to the n-th next one, i.e.,...
Definition utf16.h:474

Deprecated
  ICU 2.4. Renamed to U16_FWD_N, see utf_old.h.

Definition at line 713 of file utf_old.h.

## UTF16_FWD_N_UNSAFE

#define UTF16_FWD_N_UNSAFE | ( |  | s,
|  |  | i,
|  |  | n )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF16_FWD_1_UNSAFE(s, i); \
--__N; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h.

Definition at line 659 of file utf_old.h.

## UTF16_GET_CHAR_SAFE

#define UTF16_GET_CHAR_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(UTF_IS_SURROGATE(c)) { \
uint16_t __c2; \
if(UTF_IS_SURROGATE_FIRST(c)) { \
if((i)+1<(length) && UTF_IS_SECOND_SURROGATE(__c2=(s)[(i)+1])) { \
(c)=UTF16_GET_PAIR_VALUE((c), __c2); \
/* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \
} else if(strict) {\
/* unmatched first surrogate */ \
(c)=UTF_ERROR_VALUE; \
} \
} else { \
if((i)-1>=(start) && UTF_IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \
(c)=UTF16_GET_PAIR_VALUE(__c2, (c)); \
/* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \
} else if(strict) {\
/* unmatched second surrogate */ \
(c)=UTF_ERROR_VALUE; \
} \
} \
} else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \
(c)=UTF_ERROR_VALUE; \
} \
} UPRV_BLOCK_MACRO_END
UTF_IS_SURROGATE_FIRST
#define UTF_IS_SURROGATE_FIRST(c)
Assuming c is a surrogate, is it a first/lead surrogate?
Definition utf_old.h:542
UTF_IS_UNICODE_CHAR
#define UTF_IS_UNICODE_CHAR(c)
Is a given 32-bit value a Unicode code point value (0..U+10ffff) that can be assigned a character?
Definition utf_old.h:274
UTF_IS_SURROGATE
#define UTF_IS_SURROGATE(uchar)
Is this code unit or code point a surrogate (U+d800..U+dfff)?
Definition utf_old.h:247
UTF16_GET_PAIR_VALUE
#define UTF16_GET_PAIR_VALUE(first, second)
Get the UTF-32 value from the surrogate code units.
Definition utf_old.h:548

Deprecated
  ICU 2.4. Use U16_GET instead, see utf_old.h.

Definition at line 607 of file utf_old.h.

## UTF16_GET_CHAR_UNSAFE

#define UTF16_GET_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(UTF_IS_SURROGATE(c)) { \
if(UTF_IS_SURROGATE_FIRST(c)) { \
(c)=UTF16_GET_PAIR_VALUE((c), (s)[(i)+1]); \
} else { \
(c)=UTF16_GET_PAIR_VALUE((s)[(i)-1], (c)); \
} \
} \
} UPRV_BLOCK_MACRO_END

Get a single code point from an offset that points to any of the code units that belong to that code point.

Assume 0<=i<length.

This could be used for iteration together with UTF16_CHAR_LENGTH() and UTF_IS_ERROR(), but the use of UTF16_NEXT_CHAR[_UNSAFE]() and UTF16_PREV_CHAR[_UNSAFE]() is more efficient for that.

Deprecated
  ICU 2.4. Renamed to U16_GET_UNSAFE, see utf_old.h.

Definition at line 595 of file utf_old.h.

## UTF16_GET_PAIR_VALUE

#define UTF16_GET_PAIR_VALUE | ( |  | first,
|  |  | second )

Value:
(((first)<<10UL)+(second)-UTF_SURROGATE_OFFSET)
UTF_SURROGATE_OFFSET
#define UTF_SURROGATE_OFFSET
Helper constant for UTF16_GET_PAIR_VALUE.
Definition utf_old.h:545

Get the UTF-32 value from the surrogate code units.

Deprecated
  ICU 2.4. Renamed to U16_GET_SUPPLEMENTARY, see utf_old.h.

Definition at line 548 of file utf_old.h.

## UTF16_IS_LEAD

#define UTF16_IS_LEAD | ( |  | uchar | ) |

Value:
UTF_IS_FIRST_SURROGATE(uchar)

Deprecated
  ICU 2.4. Renamed to U16_IS_LEAD, see utf_old.h.

Definition at line 567 of file utf_old.h.

## UTF16_IS_SINGLE

#define UTF16_IS_SINGLE | ( |  | uchar | ) |

Value:
!UTF_IS_SURROGATE(uchar)

Deprecated
  ICU 2.4. Renamed to U16_IS_SINGLE, see utf_old.h.

Definition at line 564 of file utf_old.h.

## UTF16_IS_TRAIL

#define UTF16_IS_TRAIL | ( |  | uchar | ) |

Value:
UTF_IS_SECOND_SURROGATE(uchar)

Deprecated
  ICU 2.4. Renamed to U16_IS_TRAIL, see utf_old.h.

Definition at line 570 of file utf_old.h.

## UTF16_LEAD

#define UTF16_LEAD | ( |  | supplementary | ) |

Value:
UTF_FIRST_SURROGATE(supplementary)
UTF_FIRST_SURROGATE
#define UTF_FIRST_SURROGATE(supplementary)
Definition utf_old.h:552

Deprecated
  ICU 2.4. Renamed to U16_LEAD, see utf_old.h.

Definition at line 558 of file utf_old.h.

## UTF16_MAX_CHAR_LENGTH

#define UTF16_MAX_CHAR_LENGTH 2

Deprecated
  ICU 2.4. Renamed to U16_MAX_LENGTH, see utf_old.h.

Definition at line 579 of file utf_old.h.

## UTF16_NEED_MULTIPLE_UCHAR

#define UTF16_NEED_MULTIPLE_UCHAR | ( |  | c | ) |

Value:
((uint32_t)(c)>0xffff)

Does this scalar Unicode value need multiple code units for storage?

Deprecated
  ICU 2.4. Use U16_LENGTH or test ((uint32_t)(c)>0xffff) instead, see utf_old.h.

Definition at line 573 of file utf_old.h.

## UTF16_NEXT_CHAR_SAFE

#define UTF16_NEXT_CHAR_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(UTF_IS_FIRST_SURROGATE(c)) { \
uint16_t __c2; \
if((i)<(length) && UTF_IS_SECOND_SURROGATE(__c2=(s)[(i)])) { \
++(i); \
(c)=UTF16_GET_PAIR_VALUE((c), __c2); \
/* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \
} else if(strict) {\
/* unmatched first surrogate */ \
(c)=UTF_ERROR_VALUE; \
} \
} else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \
/* unmatched second surrogate or other non-character */ \
(c)=UTF_ERROR_VALUE; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Use U16_NEXT instead, see utf_old.h.

Definition at line 675 of file utf_old.h.

## UTF16_NEXT_CHAR_UNSAFE

#define UTF16_NEXT_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(UTF_IS_FIRST_SURROGATE(c)) { \
(c)=UTF16_GET_PAIR_VALUE((c), (s)[(i)++]); \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h.

Definition at line 634 of file utf_old.h.

## UTF16_PREV_CHAR_SAFE

#define UTF16_PREV_CHAR_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF_IS_SECOND_SURROGATE(c)) { \
uint16_t __c2; \
if((i)>(start) && UTF_IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \
--(i); \
(c)=UTF16_GET_PAIR_VALUE(__c2, (c)); \
/* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \
} else if(strict) {\
/* unmatched second surrogate */ \
(c)=UTF_ERROR_VALUE; \
} \
} else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \
/* unmatched first surrogate or other non-character */ \
(c)=UTF_ERROR_VALUE; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Use U16_PREV instead, see utf_old.h.

Definition at line 750 of file utf_old.h.

## UTF16_PREV_CHAR_UNSAFE

#define UTF16_PREV_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF_IS_SECOND_SURROGATE(c)) { \
(c)=UTF16_GET_PAIR_VALUE((s)[--(i)], (c)); \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h.

Definition at line 719 of file utf_old.h.

## UTF16_SET_CHAR_LIMIT_SAFE

#define UTF16_SET_CHAR_LIMIT_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length )

Value:
U16_SET_CP_LIMIT(s, start, i, length)
U16_SET_CP_LIMIT
#define U16_SET_CP_LIMIT(s, start, i, length)
Adjust a random-access offset to a code point boundary after a code point.
Definition utf16.h:728

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h.

Definition at line 775 of file utf_old.h.

## UTF16_SET_CHAR_LIMIT_UNSAFE

#define UTF16_SET_CHAR_LIMIT_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_FIRST_SURROGATE((s)[(i)-1])) { \
++(i); \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h.

Definition at line 743 of file utf_old.h.

## UTF16_SET_CHAR_START_SAFE

#define UTF16_SET_CHAR_START_SAFE | ( |  | s,
|  |  | start,
|  |  | i )

Value:
U16_SET_CP_START(s, start, i)
U16_SET_CP_START
#define U16_SET_CP_START(s, start, i)
Adjust a random-access offset to a code point boundary at the start of a code point.
Definition utf16.h:515

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h.

Definition at line 716 of file utf_old.h.

## UTF16_SET_CHAR_START_UNSAFE

#define UTF16_SET_CHAR_START_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_SECOND_SURROGATE((s)[i])) { \
--(i); \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h.

Definition at line 668 of file utf_old.h.

## UTF16_TRAIL

#define UTF16_TRAIL | ( |  | supplementary | ) |

Value:
UTF_SECOND_SURROGATE(supplementary)
UTF_SECOND_SURROGATE
#define UTF_SECOND_SURROGATE(supplementary)
Definition utf_old.h:555

Deprecated
  ICU 2.4. Renamed to U16_TRAIL, see utf_old.h.

Definition at line 561 of file utf_old.h.

## UTF32_APPEND_CHAR_SAFE

#define UTF32_APPEND_CHAR_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x10ffff) { \
(s)[(i)++]=(c); \
} else /* c>0x10ffff, write 0xfffd */ { \
(s)[(i)++]=0xfffd; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 879 of file utf_old.h.

## UTF32_APPEND_CHAR_UNSAFE

#define UTF32_APPEND_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(s)[(i)++]=(c); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 852 of file utf_old.h.

## UTF32_ARRAY_SIZE

#define UTF32_ARRAY_SIZE | ( |  | size | ) |

Value:
(size)

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 829 of file utf_old.h.

## UTF32_BACK_1_SAFE

#define UTF32_BACK_1_SAFE | ( |  | s,
|  |  | start,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
--(i); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 933 of file utf_old.h.

## UTF32_BACK_1_UNSAFE

#define UTF32_BACK_1_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
--(i); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 911 of file utf_old.h.

## UTF32_BACK_N_SAFE

#define UTF32_BACK_N_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | n )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(i)-=(n); \
if((i)<(start)) { \
(i)=(start); \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 938 of file utf_old.h.

## UTF32_BACK_N_UNSAFE

#define UTF32_BACK_N_UNSAFE | ( |  | s,
|  |  | i,
|  |  | n )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(i)-=(n); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 916 of file utf_old.h.

## UTF32_CHAR_LENGTH

#define UTF32_CHAR_LENGTH | ( |  | c | ) |

Value:
1

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 822 of file utf_old.h.

## UTF32_FWD_1_SAFE

#define UTF32_FWD_1_SAFE | ( |  | s,
|  |  | i,
|  |  | length )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
++(i); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 888 of file utf_old.h.

## UTF32_FWD_1_UNSAFE

#define UTF32_FWD_1_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
++(i); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 857 of file utf_old.h.

## UTF32_FWD_N_SAFE

#define UTF32_FWD_N_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | n )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if(((i)+=(n))>(length)) { \
(i)=(length); \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 893 of file utf_old.h.

## UTF32_FWD_N_UNSAFE

#define UTF32_FWD_N_UNSAFE | ( |  | s,
|  |  | i,
|  |  | n )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(i)+=(n); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 862 of file utf_old.h.

## UTF32_GET_CHAR_SAFE

#define UTF32_GET_CHAR_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
} UPRV_BLOCK_MACRO_END
UTF32_IS_SAFE
#define UTF32_IS_SAFE(c, strict)
Definition utf_old.h:795

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 837 of file utf_old.h.

## UTF32_GET_CHAR_UNSAFE

#define UTF32_GET_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 832 of file utf_old.h.

## UTF32_IS_LEAD

#define UTF32_IS_LEAD | ( |  | uchar | ) |

Value:
0

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 813 of file utf_old.h.

## UTF32_IS_SAFE

#define UTF32_IS_SAFE | ( |  | c,
|  |  | strict )

Value:
(!(strict) ? \
(uint32_t)(c)<=0x10ffff : \
UTF_IS_UNICODE_CHAR(c))

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 795 of file utf_old.h.

## UTF32_IS_SINGLE

#define UTF32_IS_SINGLE | ( |  | uchar | ) |

Value:
1

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 811 of file utf_old.h.

## UTF32_IS_TRAIL

#define UTF32_IS_TRAIL | ( |  | uchar | ) |

Value:
0

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 815 of file utf_old.h.

## UTF32_MAX_CHAR_LENGTH

#define UTF32_MAX_CHAR_LENGTH 1

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 824 of file utf_old.h.

## UTF32_NEED_MULTIPLE_UCHAR

#define UTF32_NEED_MULTIPLE_UCHAR | ( |  | c | ) |

Value:
0

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 820 of file utf_old.h.

## UTF32_NEXT_CHAR_SAFE

#define UTF32_NEXT_CHAR_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 871 of file utf_old.h.

## UTF32_NEXT_CHAR_UNSAFE

#define UTF32_NEXT_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 847 of file utf_old.h.

## UTF32_PREV_CHAR_SAFE

#define UTF32_PREV_CHAR_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 925 of file utf_old.h.

## UTF32_PREV_CHAR_UNSAFE

#define UTF32_PREV_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 906 of file utf_old.h.

## UTF32_SET_CHAR_LIMIT_SAFE

#define UTF32_SET_CHAR_LIMIT_SAFE | ( |  | s,
|  |  | i,
|  |  | length )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 946 of file utf_old.h.

## UTF32_SET_CHAR_LIMIT_UNSAFE

#define UTF32_SET_CHAR_LIMIT_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 921 of file utf_old.h.

## UTF32_SET_CHAR_START_SAFE

#define UTF32_SET_CHAR_START_SAFE | ( |  | s,
|  |  | start,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 900 of file utf_old.h.

## UTF32_SET_CHAR_START_UNSAFE

#define UTF32_SET_CHAR_START_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 867 of file utf_old.h.

## UTF8_APPEND_CHAR_SAFE

#define UTF8_APPEND_CHAR_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x7f) { \
(s)[(i)++]=(uint8_t)(c); \
} else { \
(i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, NULL); \
} \
} UPRV_BLOCK_MACRO_END
utf8_appendCharSafeBody
U_CAPI int32_t utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError)
Function for handling "append code point" with error-checking.
NULL
#define NULL
Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
Definition utypes.h:203

Deprecated
  ICU 2.4. Use U8_APPEND instead, see utf_old.h.

Definition at line 452 of file utf_old.h.

## UTF8_APPEND_CHAR_UNSAFE

#define UTF8_APPEND_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x7f) { \
(s)[(i)++]=(uint8_t)(c); \
} else { \
if((uint32_t)(c)<=0x7ff) { \
(s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
} else { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
} else { \
(s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \
(s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \
} \
(s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
} \
(s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U8_APPEND_UNSAFE, see utf_old.h.

Definition at line 401 of file utf_old.h.

## UTF8_ARRAY_SIZE

#define UTF8_ARRAY_SIZE | ( |  | size | ) |

Value:
((5*(size))/2)

Average number of code units compared to UTF-16.

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 362 of file utf_old.h.

## UTF8_BACK_1_SAFE

#define UTF8_BACK_1_SAFE | ( |  | s,
|  |  | start,
|  |  | i )

Value:
U8_BACK_1(s, start, i)
U8_BACK_1
#define U8_BACK_1(s, start, i)
Move the string offset from one code point boundary to the previous one.
Definition utf8.h:817

Deprecated
  ICU 2.4. Renamed to U8_BACK_1, see utf_old.h.

Definition at line 525 of file utf_old.h.

## UTF8_BACK_1_UNSAFE

#define UTF8_BACK_1_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
while(UTF8_IS_TRAIL((s)[--(i)])) {} \
} UPRV_BLOCK_MACRO_END
UTF8_IS_TRAIL
#define UTF8_IS_TRAIL(uchar)
Is this this code unit a trailing code unit (byte) of a code point?
Definition utf_old.h:318

Deprecated
  ICU 2.4. Renamed to U8_BACK_1_UNSAFE, see utf_old.h.

Definition at line 493 of file utf_old.h.

## UTF8_BACK_N_SAFE

#define UTF8_BACK_N_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | n )

Value:
U8_BACK_N(s, start, i, n)
U8_BACK_N
#define U8_BACK_N(s, start, i, n)
Move the string offset from one code point boundary to the n-th one before it, i.e....
Definition utf8.h:858

Deprecated
  ICU 2.4. Renamed to U8_BACK_N, see utf_old.h.

Definition at line 528 of file utf_old.h.

## UTF8_BACK_N_UNSAFE

#define UTF8_BACK_N_UNSAFE | ( |  | s,
|  |  | i,
|  |  | n )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF8_BACK_1_UNSAFE(s, i); \
--__N; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U8_BACK_N_UNSAFE, see utf_old.h.

Definition at line 498 of file utf_old.h.

## UTF8_CHAR_LENGTH

#define UTF8_CHAR_LENGTH | ( |  | c | ) |

Value:
((uint32_t)(c)<=0x7f ? 1 : \
((uint32_t)(c)<=0x7ff ? 2 : \
((uint32_t)((c)-0x10000)>0xfffff ? 3 : 4) \
) \
)

Given the lead character, how many bytes are taken by this code point.

ICU does not deal with code points >0x10ffff unless necessary for advancing in the byte stream.

These length macros take into account that for values >0x10ffff the UTF8_APPEND_CHAR_SAFE macros would write the error code point 0xffff with 3 bytes. Code point comparisons need to be in uint32_t because UChar32 may be a signed type, and negative values must be recognized.

Deprecated
  ICU 2.4. Use U8_LENGTH instead, see utf.h.

Definition at line 337 of file utf_old.h.

## UTF8_COUNT_TRAIL_BYTES

#define UTF8_COUNT_TRAIL_BYTES | ( |  | leadByte | ) |

Value:
(utf8_countTrailBytes[(uint8_t)leadByte])
utf8_countTrailBytes
U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]
Internal array with numbers of trail bytes for any given byte used in lead byte position.
Definition utf_old.h:298

Count the trail bytes for a UTF-8 lead byte.

Deprecated
  ICU 2.4. Renamed to U8_COUNT_TRAIL_BYTES, see utf_old.h.

Definition at line 305 of file utf_old.h.

## UTF8_ERROR_VALUE_1

#define UTF8_ERROR_VALUE_1 0x15

UTF8_ERROR_VALUE_1 and UTF8_ERROR_VALUE_2 are special error values for UTF-8, which need 1 or 2 bytes in UTF-8:

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

U+0015 = NAK = Negative Acknowledge, C0 control character
U+009f = highest C1 control character

These are used by UTF8_..._SAFE macros so that they can return an error value that needs the same number of code units (bytes) as were seen by a macro. They should be tested with UTF_IS_ERROR() or UTF_IS_VALID().

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 208 of file utf_old.h.

## UTF8_ERROR_VALUE_2

#define UTF8_ERROR_VALUE_2 0x9f

See documentation on UTF8_ERROR_VALUE_1 for details.

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 215 of file utf_old.h.

## UTF8_FWD_1_SAFE

#define UTF8_FWD_1_SAFE | ( |  | s,
|  |  | i,
|  |  | length )

Value:
U8_FWD_1(s, i, length)
U8_FWD_1
#define U8_FWD_1(s, i, length)
Advance the string offset from one code point boundary to the next.
Definition utf8.h:533

Deprecated
  ICU 2.4. Renamed to U8_FWD_1, see utf_old.h.

Definition at line 461 of file utf_old.h.

## UTF8_FWD_1_UNSAFE

#define UTF8_FWD_1_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(i)+=1+UTF8_COUNT_TRAIL_BYTES((s)[i]); \
} UPRV_BLOCK_MACRO_END
UTF8_COUNT_TRAIL_BYTES
#define UTF8_COUNT_TRAIL_BYTES(leadByte)
Count the trail bytes for a UTF-8 lead byte.
Definition utf_old.h:305

Deprecated
  ICU 2.4. Renamed to U8_FWD_1_UNSAFE, see utf_old.h.

Definition at line 421 of file utf_old.h.

## UTF8_FWD_N_SAFE

#define UTF8_FWD_N_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | n )

Value:
U8_FWD_N(s, i, length, n)
U8_FWD_N
#define U8_FWD_N(s, i, length, n)
Advance the string offset from one code point boundary to the n-th next one, i.e.,...
Definition utf8.h:591

Deprecated
  ICU 2.4. Renamed to U8_FWD_N, see utf_old.h.

Definition at line 464 of file utf_old.h.

## UTF8_FWD_N_UNSAFE

#define UTF8_FWD_N_UNSAFE | ( |  | s,
|  |  | i,
|  |  | n )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF8_FWD_1_UNSAFE(s, i); \
--__N; \
} \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U8_FWD_N_UNSAFE, see utf_old.h.

Definition at line 426 of file utf_old.h.

## UTF8_GET_CHAR_SAFE

#define UTF8_GET_CHAR_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
int32_t _utf8_get_char_safe_index=(int32_t)(i); \
UTF8_SET_CHAR_START_SAFE(s, start, _utf8_get_char_safe_index); \
UTF8_NEXT_CHAR_SAFE(s, _utf8_get_char_safe_index, length, c, strict); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Use U8_GET instead, see utf_old.h.

Definition at line 372 of file utf_old.h.

## UTF8_GET_CHAR_UNSAFE

#define UTF8_GET_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
int32_t _utf8_get_char_unsafe_index=(int32_t)(i); \
UTF8_SET_CHAR_START_UNSAFE(s, _utf8_get_char_unsafe_index); \
UTF8_NEXT_CHAR_UNSAFE(s, _utf8_get_char_unsafe_index, c); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U8_GET_UNSAFE, see utf_old.h.

Definition at line 365 of file utf_old.h.

## UTF8_IS_LEAD

#define UTF8_IS_LEAD | ( |  | uchar | ) |

Value:
((uint8_t)((uchar)-0xc0)<0x3e)

Is this this code unit the lead code unit (byte) of a code point?

Deprecated
  ICU 2.4. Renamed to U8_IS_LEAD, see utf_old.h.

Definition at line 316 of file utf_old.h.

## UTF8_IS_SINGLE

#define UTF8_IS_SINGLE | ( |  | uchar | ) |

Value:
(((uchar)&0x80)==0)

Is this this code point a single code unit (byte)?

Deprecated
  ICU 2.4. Renamed to U8_IS_SINGLE, see utf_old.h.

Definition at line 314 of file utf_old.h.

## UTF8_IS_TRAIL

#define UTF8_IS_TRAIL | ( |  | uchar | ) |

Value:
(((uchar)&0xc0)==0x80)

Is this this code unit a trailing code unit (byte) of a code point?

Deprecated
  ICU 2.4. Renamed to U8_IS_TRAIL, see utf_old.h.

Definition at line 318 of file utf_old.h.

## UTF8_MASK_LEAD_BYTE

#define UTF8_MASK_LEAD_BYTE | ( |  | leadByte,
|  |  | countTrailBytes )

Value:
((leadByte)&=(1<<(6-(countTrailBytes)))-1)

Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.

Deprecated
  ICU 2.4. Renamed to U8_MASK_LEAD_BYTE, see utf_old.h.

Definition at line 311 of file utf_old.h.

## UTF8_MAX_CHAR_LENGTH

#define UTF8_MAX_CHAR_LENGTH 4

The maximum number of bytes per code point.

Deprecated
  ICU 2.4. Renamed to U8_MAX_LENGTH, see utf_old.h.

Definition at line 359 of file utf_old.h.

## UTF8_NEED_MULTIPLE_UCHAR

#define UTF8_NEED_MULTIPLE_UCHAR | ( |  | c | ) |

Value:
((uint32_t)(c)>0x7f)

Does this scalar Unicode value need multiple code units for storage?

Deprecated
  ICU 2.4. Use U8_LENGTH or test ((uint32_t)(c)>0x7f) instead, see utf_old.h.

Definition at line 321 of file utf_old.h.

## UTF8_NEXT_CHAR_SAFE

#define UTF8_NEXT_CHAR_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if((c)>=0x80) { \
if(UTF8_IS_LEAD(c)) { \
(c)=utf8_nextCharSafeBody(s, &(i), (int32_t)(length), c, strict); \
} else { \
(c)=UTF8_ERROR_VALUE_1; \
} \
} \
} UPRV_BLOCK_MACRO_END
utf8_nextCharSafeBody
U_CAPI UChar32 utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, int8_t strict)
Function for handling "next code point" with error-checking.
UTF8_IS_LEAD
#define UTF8_IS_LEAD(uchar)
Is this this code unit the lead code unit (byte) of a code point?
Definition utf_old.h:316
UTF8_ERROR_VALUE_1
#define UTF8_ERROR_VALUE_1
UTF8_ERROR_VALUE_1 and UTF8_ERROR_VALUE_2 are special error values for UTF-8, which need 1 or 2 bytes...
Definition utf_old.h:208

Deprecated
  ICU 2.4. Use U8_NEXT instead, see utf_old.h.

Definition at line 440 of file utf_old.h.

## UTF8_NEXT_CHAR_UNSAFE

#define UTF8_NEXT_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if((uint8_t)((c)-0xc0)<0x35) { \
uint8_t __count=UTF8_COUNT_TRAIL_BYTES(c); \
UTF8_MASK_LEAD_BYTE(c, __count); \
switch(__count) { \
/* each following branch falls through to the next one */ \
case 3: \
(c)=((c)<<6)|((s)[(i)++]&0x3f); \
U_FALLTHROUGH; \
case 2: \
(c)=((c)<<6)|((s)[(i)++]&0x3f); \
U_FALLTHROUGH; \
case 1: \
(c)=((c)<<6)|((s)[(i)++]&0x3f); \
/* no other branches to optimize switch() */ \
break; \
} \
} \
} UPRV_BLOCK_MACRO_END
U_FALLTHROUGH
#define U_FALLTHROUGH
Annotate intentional fall-through between switch labels.
Definition platform.h:507

Deprecated
  ICU 2.4. Renamed to U8_NEXT_UNSAFE, see utf_old.h.

Definition at line 379 of file utf_old.h.

## UTF8_PREV_CHAR_SAFE

#define UTF8_PREV_CHAR_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | c,
|  |  | strict )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if((c)>=0x80) { \
if((c)<=0xbf) { \
(c)=utf8_prevCharSafeBody(s, start, &(i), c, strict); \
} else { \
(c)=UTF8_ERROR_VALUE_1; \
} \
} \
} UPRV_BLOCK_MACRO_END
utf8_prevCharSafeBody
U_CAPI UChar32 utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, int8_t strict)
Function for handling "previous code point" with error-checking.

Deprecated
  ICU 2.4. Use U8_PREV instead, see utf_old.h.

Definition at line 513 of file utf_old.h.

## UTF8_PREV_CHAR_UNSAFE

#define UTF8_PREV_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF8_IS_TRAIL(c)) { \
uint8_t __b, __count=1, __shift=6; \
\
/* c is a trail byte */ \
(c)&=0x3f; \
for(;;) { \
__b=(s)[--(i)]; \
if(__b>=0xc0) { \
UTF8_MASK_LEAD_BYTE(__b, __count); \
(c)|=(UChar32)__b<<__shift; \
break; \
} else { \
(c)|=(UChar32)(__b&0x3f)<<__shift; \
++__count; \
__shift+=6; \
} \
} \
} \
} UPRV_BLOCK_MACRO_END
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition umachine.h:449

Deprecated
  ICU 2.4. Renamed to U8_PREV_UNSAFE, see utf_old.h.

Definition at line 470 of file utf_old.h.

## UTF8_SET_CHAR_LIMIT_SAFE

#define UTF8_SET_CHAR_LIMIT_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length )

Value:
U8_SET_CP_LIMIT(s, start, i, length)
U8_SET_CP_LIMIT
#define U8_SET_CP_LIMIT(s, start, i, length)
Adjust a random-access offset to a code point boundary after a code point.
Definition utf8.h:901

Deprecated
  ICU 2.4. Renamed to U8_SET_CP_LIMIT, see utf_old.h.

Definition at line 531 of file utf_old.h.

## UTF8_SET_CHAR_LIMIT_UNSAFE

#define UTF8_SET_CHAR_LIMIT_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
UTF8_BACK_1_UNSAFE(s, i); \
UTF8_FWD_1_UNSAFE(s, i); \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U8_SET_CP_LIMIT_UNSAFE, see utf_old.h.

Definition at line 507 of file utf_old.h.

## UTF8_SET_CHAR_START_SAFE

#define UTF8_SET_CHAR_START_SAFE | ( |  | s,
|  |  | start,
|  |  | i )

Value:
U8_SET_CP_START(s, start, i)
U8_SET_CP_START
#define U8_SET_CP_START(s, start, i)
Adjust a random-access offset to a code point boundary at the start of a code point.
Definition utf8.h:633

Deprecated
  ICU 2.4. Renamed to U8_SET_CP_START, see utf_old.h.

Definition at line 467 of file utf_old.h.

## UTF8_SET_CHAR_START_UNSAFE

#define UTF8_SET_CHAR_START_UNSAFE | ( |  | s,
|  |  | i )

Value:
UPRV_BLOCK_MACRO_BEGIN { \
while(UTF8_IS_TRAIL((s)[i])) { --(i); } \
} UPRV_BLOCK_MACRO_END

Deprecated
  ICU 2.4. Renamed to U8_SET_CP_START_UNSAFE, see utf_old.h.

Definition at line 435 of file utf_old.h.

## UTF_APPEND_CHAR

#define UTF_APPEND_CHAR | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c )

Value:
UTF16_APPEND_CHAR_SAFE(s, i, length, c)
UTF16_APPEND_CHAR_SAFE
#define UTF16_APPEND_CHAR_SAFE(s, i, length, c)
Definition utf_old.h:694

Append the code units of code point c to the string at index i and advance i to beyond the new code units (post-increment).

The code units beginning at index i will be overwritten. Same as UTF16_APPEND_CHAR.

Precondition
  0<=c<=0x10ffff
  0<=i<length

Postcondition
  0<i<=length

Deprecated
  ICU 2.4. Use U16_APPEND instead, see utf_old.h.

Definition at line 1106 of file utf_old.h.

## UTF_APPEND_CHAR_SAFE

#define UTF_APPEND_CHAR_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c )

Value:
UTF16_APPEND_CHAR_SAFE(s, i, length, c)

Deprecated
  ICU 2.4. Use U16_APPEND instead, see utf_old.h.

Definition at line 976 of file utf_old.h.

## UTF_APPEND_CHAR_UNSAFE

#define UTF_APPEND_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UTF16_APPEND_CHAR_UNSAFE(s, i, c)
UTF16_APPEND_CHAR_UNSAFE
#define UTF16_APPEND_CHAR_UNSAFE(s, i, c)
Definition utf_old.h:642

Deprecated
  ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h.

Definition at line 973 of file utf_old.h.

## UTF_ARRAY_SIZE

#define UTF_ARRAY_SIZE | ( |  | size | ) |

Value:
UTF16_ARRAY_SIZE(size)
UTF16_ARRAY_SIZE
#define UTF16_ARRAY_SIZE(size)
Average number of code units compared to UTF-16.
Definition utf_old.h:582

Estimate the number of code units for a string based on the number of UTF-16 code units.

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 956 of file utf_old.h.

## UTF_BACK_1

#define UTF_BACK_1 | ( |  | s,
|  |  | start,
|  |  | i )

Value:
U16_BACK_1(s, start, i)

Move i backward (towards the beginning of the string) to the first code unit of the code point that has code units before i.

I.e., move i backward by one code point. i must point to the first code unit after the last unit of a code point (i==length is allowed). Same as UTF16_BACK_1.

Precondition
  start<i<=length

Postcondition
  start<=i<length

Deprecated
  ICU 2.4. Renamed to U16_BACK_1, see utf_old.h.

Definition at line 1170 of file utf_old.h.

## UTF_BACK_1_SAFE

#define UTF_BACK_1_SAFE | ( |  | s,
|  |  | start,
|  |  | i )

Value:
UTF16_BACK_1_SAFE(s, start, i)
UTF16_BACK_1_SAFE
#define UTF16_BACK_1_SAFE(s, start, i)
Definition utf_old.h:769

Deprecated
  ICU 2.4. Renamed to U16_BACK_1, see utf_old.h.

Definition at line 1011 of file utf_old.h.

## UTF_BACK_1_UNSAFE

#define UTF_BACK_1_UNSAFE | ( |  | s,
|  |  | i )

Value:
UTF16_BACK_1_UNSAFE(s, i)
UTF16_BACK_1_UNSAFE
#define UTF16_BACK_1_UNSAFE(s, i)
Definition utf_old.h:727

Deprecated
  ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h.

Definition at line 1008 of file utf_old.h.

## UTF_BACK_N

#define UTF_BACK_N | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | n )

Value:
U16_BACK_N(s, start, i, n)

Move i backward (towards the beginning of the string) to the first code unit of the n code points that have code units before i.

I.e., move i backward by n code points. i must point to the first code unit after the last unit of a code point (i==length is allowed). Same as UTF16_BACK_N.

Precondition
  start<i<=length

Postcondition
  start<=i<length

Deprecated
  ICU 2.4. Renamed to U16_BACK_N, see utf_old.h.

Definition at line 1183 of file utf_old.h.

## UTF_BACK_N_SAFE

#define UTF_BACK_N_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | n )

Value:
UTF16_BACK_N_SAFE(s, start, i, n)
UTF16_BACK_N_SAFE
#define UTF16_BACK_N_SAFE(s, start, i, n)
Definition utf_old.h:772

Deprecated
  ICU 2.4. Renamed to U16_BACK_N, see utf_old.h.

Definition at line 1018 of file utf_old.h.

## UTF_BACK_N_UNSAFE

#define UTF_BACK_N_UNSAFE | ( |  | s,
|  |  | i,
|  |  | n )

Value:
UTF16_BACK_N_UNSAFE(s, i, n)
UTF16_BACK_N_UNSAFE
#define UTF16_BACK_N_UNSAFE(s, i, n)
Definition utf_old.h:734

Deprecated
  ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h.

Definition at line 1015 of file utf_old.h.

## UTF_CHAR_LENGTH

#define UTF_CHAR_LENGTH | ( |  | c | ) |

Value:
U16_LENGTH(c)
U16_LENGTH
#define U16_LENGTH(c)
How many 16-bit code units are used to encode this Unicode code point?
Definition utf16.h:141

How many code units are used to encode this code point (1 or 2)?

Same as UTF16_CHAR_LENGTH.

Deprecated
  ICU 2.4. Renamed to U16_LENGTH, see utf_old.h.

Definition at line 1062 of file utf_old.h.

## UTF_ERROR_VALUE

#define UTF_ERROR_VALUE 0xffff

Error value for all UTFs.

This code point value will be set by macros with error checking if an error is detected.

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 223 of file utf_old.h.

## UTF_FIRST_SURROGATE

#define UTF_FIRST_SURROGATE | ( |  | supplementary | ) |

Value:
(UChar)(((supplementary)>>10)+0xd7c0)
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:400

Deprecated
  ICU 2.4. Renamed to U16_LEAD, see utf_old.h.

Definition at line 552 of file utf_old.h.

## UTF_FWD_1

#define UTF_FWD_1 | ( |  | s,
|  |  | i,
|  |  | length )

Value:
U16_FWD_1(s, i, length)

Advance i to beyond the code units of the code point that begins at i.

I.e., advance i by one code point. Same as UTF16_FWD_1.

Precondition
  0<=i<length

Postcondition
  0<i<=length

Deprecated
  ICU 2.4. Renamed to U16_FWD_1, see utf_old.h.

Definition at line 1117 of file utf_old.h.

## UTF_FWD_1_SAFE

#define UTF_FWD_1_SAFE | ( |  | s,
|  |  | i,
|  |  | length )

Value:
UTF16_FWD_1_SAFE(s, i, length)
UTF16_FWD_1_SAFE
#define UTF16_FWD_1_SAFE(s, i, length)
Definition utf_old.h:710

Deprecated
  ICU 2.4. Renamed to U16_FWD_1, see utf_old.h.

Definition at line 983 of file utf_old.h.

## UTF_FWD_1_UNSAFE

#define UTF_FWD_1_UNSAFE | ( |  | s,
|  |  | i )

Value:
UTF16_FWD_1_UNSAFE(s, i)
UTF16_FWD_1_UNSAFE
#define UTF16_FWD_1_UNSAFE(s, i)
Definition utf_old.h:652

Deprecated
  ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h.

Definition at line 980 of file utf_old.h.

## UTF_FWD_N

#define UTF_FWD_N | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | n )

Value:
U16_FWD_N(s, i, length, n)

Advance i to beyond the code units of the n code points where the first one begins at i.

I.e., advance i by n code points. Same as UT16_FWD_N.

Precondition
  0<=i<length

Postcondition
  0<i<=length

Deprecated
  ICU 2.4. Renamed to U16_FWD_N, see utf_old.h.

Definition at line 1128 of file utf_old.h.

## UTF_FWD_N_SAFE

#define UTF_FWD_N_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | n )

Value:
UTF16_FWD_N_SAFE(s, i, length, n)
UTF16_FWD_N_SAFE
#define UTF16_FWD_N_SAFE(s, i, length, n)
Definition utf_old.h:713

Deprecated
  ICU 2.4. Renamed to U16_FWD_N, see utf_old.h.

Definition at line 990 of file utf_old.h.

## UTF_FWD_N_UNSAFE

#define UTF_FWD_N_UNSAFE | ( |  | s,
|  |  | i,
|  |  | n )

Value:
UTF16_FWD_N_UNSAFE(s, i, n)
UTF16_FWD_N_UNSAFE
#define UTF16_FWD_N_UNSAFE(s, i, n)
Definition utf_old.h:659

Deprecated
  ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h.

Definition at line 987 of file utf_old.h.

## UTF_GET_CHAR

#define UTF_GET_CHAR | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length,
|  |  | c )

Value:
U16_GET(s, start, i, length, c)
U16_GET
#define U16_GET(s, start, i, length, c)
Get a code point from a string at a random-access offset, without changing the offset.
Definition utf16.h:201

Set c to the code point that contains the code unit i.

i could point to the lead or the trail surrogate for the code point. i is not modified. Same as UTF16_GET_CHAR.

Precondition
  0<=i<length

Deprecated
  ICU 2.4. Renamed to U16_GET, see utf_old.h.

Definition at line 1080 of file utf_old.h.

## UTF_GET_CHAR_SAFE

#define UTF_GET_CHAR_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length,
|  |  | c,
|  |  | strict )

Value:
UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict)
UTF16_GET_CHAR_SAFE
#define UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict)
Definition utf_old.h:607

Deprecated
  ICU 2.4. Use U16_GET instead, see utf_old.h.

Definition at line 962 of file utf_old.h.

## UTF_GET_CHAR_UNSAFE

#define UTF_GET_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UTF16_GET_CHAR_UNSAFE(s, i, c)
UTF16_GET_CHAR_UNSAFE
#define UTF16_GET_CHAR_UNSAFE(s, i, c)
Get a single code point from an offset that points to any of the code units that belong to that code ...
Definition utf_old.h:595

Deprecated
  ICU 2.4. Renamed to U16_GET_UNSAFE, see utf_old.h.

Definition at line 959 of file utf_old.h.

## UTF_IS_ERROR

#define UTF_IS_ERROR | ( |  | c | ) |

Value:
(((c)&0xfffe)==0xfffe || (c)==UTF8_ERROR_VALUE_1 || (c)==UTF8_ERROR_VALUE_2)
UTF8_ERROR_VALUE_2
#define UTF8_ERROR_VALUE_2
See documentation on UTF8_ERROR_VALUE_1 for details.
Definition utf_old.h:215

Is a given 32-bit code an error value as returned by one of the macros for any UTF?

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 231 of file utf_old.h.

## UTF_IS_FIRST_SURROGATE

#define UTF_IS_FIRST_SURROGATE | ( |  | uchar | ) |

Value:
(((uchar)&0xfffffc00)==0xd800)

Is uchar a first/lead surrogate?

Deprecated
  ICU 2.4. Renamed to U_IS_LEAD and U16_IS_LEAD, see utf_old.h.

Definition at line 536 of file utf_old.h.

## UTF_IS_LEAD

#define UTF_IS_LEAD | ( |  | uchar | ) |

Value:
U16_IS_LEAD(uchar)
U16_IS_LEAD
#define U16_IS_LEAD(c)
Is this code unit a lead surrogate (U+d800..U+dbff)?
Definition utf16.h:59

Is this code unit the first one of several (a lead surrogate)?

Same as UTF16_IS_LEAD.

Deprecated
  ICU 2.4. Renamed to U_IS_LEAD and U16_IS_LEAD, see utf_old.h.

Definition at line 1041 of file utf_old.h.

## UTF_IS_SECOND_SURROGATE

#define UTF_IS_SECOND_SURROGATE | ( |  | uchar | ) |

Value:
(((uchar)&0xfffffc00)==0xdc00)

Is uchar a second/trail surrogate?

Deprecated
  ICU 2.4. Renamed to U_IS_TRAIL and U16_IS_TRAIL, see utf_old.h.

Definition at line 539 of file utf_old.h.

## UTF_IS_SINGLE

#define UTF_IS_SINGLE | ( |  | uchar | ) |

Value:
U16_IS_SINGLE(uchar)
U16_IS_SINGLE
#define U16_IS_SINGLE(c)
Does this code unit alone encode a code point (BMP, not a surrogate)?
Definition utf16.h:51

Does this code unit alone encode a code point (BMP, not a surrogate)?

Same as UTF16_IS_SINGLE.

Deprecated
  ICU 2.4. Renamed to U_IS_SINGLE and U16_IS_SINGLE, see utf_old.h.

Definition at line 1034 of file utf_old.h.

## UTF_IS_SURROGATE

#define UTF_IS_SURROGATE | ( |  | uchar | ) |

Value:
(((uchar)&0xfffff800)==0xd800)

Is this code unit or code point a surrogate (U+d800..U+dfff)?

Deprecated
  ICU 2.4. Renamed to U_IS_SURROGATE and U16_IS_SURROGATE, see utf_old.h.

Definition at line 247 of file utf_old.h.

## UTF_IS_SURROGATE_FIRST

#define UTF_IS_SURROGATE_FIRST | ( |  | c | ) |

Value:
(((c)&0x400)==0)

Assuming c is a surrogate, is it a first/lead surrogate?

Deprecated
  ICU 2.4. Renamed to U_IS_SURROGATE_LEAD and U16_IS_SURROGATE_LEAD, see utf_old.h.

Definition at line 542 of file utf_old.h.

## UTF_IS_TRAIL

#define UTF_IS_TRAIL | ( |  | uchar | ) |

Value:
U16_IS_TRAIL(uchar)
U16_IS_TRAIL
#define U16_IS_TRAIL(c)
Is this code unit a trail surrogate (U+dc00..U+dfff)?
Definition utf16.h:67

Is this code unit one of several but not the first one (a trail surrogate)?

Same as UTF16_IS_TRAIL.

Deprecated
  ICU 2.4. Renamed to U_IS_TRAIL and U16_IS_TRAIL, see utf_old.h.

Definition at line 1048 of file utf_old.h.

## UTF_IS_UNICODE_CHAR

#define UTF_IS_UNICODE_CHAR | ( |  | c | ) |

Value:
((uint32_t)(c)<0xd800 || \
((uint32_t)(c)>0xdfff && \
(uint32_t)(c)<=0x10ffff && \
!UTF_IS_UNICODE_NONCHAR(c)))
UTF_IS_UNICODE_NONCHAR
#define UTF_IS_UNICODE_NONCHAR(c)
Is a given 32-bit code point a Unicode noncharacter?
Definition utf_old.h:254

Is a given 32-bit value a Unicode code point value (0..U+10ffff) that can be assigned a character?

Code points that are not characters include:

- single surrogate code points (U+d800..U+dfff, 2048 code points)
- the last two code points on each plane (U+__fffe and U+__ffff, 34 code points)
- U+fdd0..U+fdef (new with Unicode 3.1, 32 code points)
- the highest Unicode code point value is U+10ffff

This means that all code points below U+d800 are character code points, and that boundary is tested first for performance.

Deprecated
  ICU 2.4. Renamed to U_IS_UNICODE_CHAR, see utf_old.h.

Definition at line 274 of file utf_old.h.

## UTF_IS_UNICODE_NONCHAR

#define UTF_IS_UNICODE_NONCHAR | ( |  | c | ) |

Value:
((c)>=0xfdd0 && \
((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \
(uint32_t)(c)<=0x10ffff)

Is a given 32-bit code point a Unicode noncharacter?

Deprecated
  ICU 2.4. Renamed to U_IS_UNICODE_NONCHAR, see utf_old.h.

Definition at line 254 of file utf_old.h.

## UTF_IS_VALID

#define UTF_IS_VALID | ( |  | c | ) |

Value:
(UTF_IS_UNICODE_CHAR(c) && \
(c)!=UTF8_ERROR_VALUE_1 && (c)!=UTF8_ERROR_VALUE_2)

This is a combined macro: Is c a valid Unicode value and not an error code?

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 239 of file utf_old.h.

## UTF_MAX_CHAR_LENGTH

#define UTF_MAX_CHAR_LENGTH U16_MAX_LENGTH

How many code units are used at most for any Unicode code point (2)?

Same as UTF16_MAX_CHAR_LENGTH.

Deprecated
  ICU 2.4. Renamed to U16_MAX_LENGTH, see utf_old.h.

Definition at line 1069 of file utf_old.h.

## UTF_NEED_MULTIPLE_UCHAR

#define UTF_NEED_MULTIPLE_UCHAR | ( |  | c | ) |

Value:
UTF16_NEED_MULTIPLE_UCHAR(c)
UTF16_NEED_MULTIPLE_UCHAR
#define UTF16_NEED_MULTIPLE_UCHAR(c)
Does this scalar Unicode value need multiple code units for storage?
Definition utf_old.h:573

Does this code point require multiple code units (is it a supplementary code point)?

Same as UTF16_NEED_MULTIPLE_UCHAR.

Deprecated
  ICU 2.4. Use U16_LENGTH or test ((uint32_t)(c)>0xffff) instead.

Definition at line 1055 of file utf_old.h.

## UTF_NEXT_CHAR

#define UTF_NEXT_CHAR | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c )

Value:
U16_NEXT(s, i, length, c)
U16_NEXT
#define U16_NEXT(s, i, length, c)
Get a code point from a string at a code point boundary offset, and advance the offset to the next co...
Definition utf16.h:309

Set c to the code point that starts at code unit i and advance i to beyond the code units of this code point (post-increment).

i must point to the first code unit of a code point. Otherwise c is set to the trail unit (surrogate) itself. Same as UTF16_NEXT_CHAR.

Precondition
  0<=i<length

Postcondition
  0<i<=length

Deprecated
  ICU 2.4. Renamed to U16_NEXT, see utf_old.h.

Definition at line 1093 of file utf_old.h.

## UTF_NEXT_CHAR_SAFE

#define UTF_NEXT_CHAR_SAFE | ( |  | s,
|  |  | i,
|  |  | length,
|  |  | c,
|  |  | strict )

Value:
UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict)
UTF16_NEXT_CHAR_SAFE
#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict)
Definition utf_old.h:675

Deprecated
  ICU 2.4. Use U16_NEXT instead, see utf_old.h.

Definition at line 969 of file utf_old.h.

## UTF_NEXT_CHAR_UNSAFE

#define UTF_NEXT_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UTF16_NEXT_CHAR_UNSAFE(s, i, c)
UTF16_NEXT_CHAR_UNSAFE
#define UTF16_NEXT_CHAR_UNSAFE(s, i, c)
Definition utf_old.h:634

Deprecated
  ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h.

Definition at line 966 of file utf_old.h.

## UTF_PREV_CHAR

#define UTF_PREV_CHAR | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | c )

Value:
U16_PREV(s, start, i, c)
U16_PREV
#define U16_PREV(s, start, i, c)
Move the string offset from one code point boundary to the previous one and get the code point betwee...
Definition utf16.h:570

Set c to the code point that has code units before i and move i backward (towards the beginning of the string) to the first code unit of this code point (pre-increment).

i must point to the first code unit after the last unit of a code point (i==length is allowed). Same as UTF16_PREV_CHAR.

Precondition
  start<i<=length

Postcondition
  start<=i<length

Deprecated
  ICU 2.4. Renamed to U16_PREV, see utf_old.h.

Definition at line 1157 of file utf_old.h.

## UTF_PREV_CHAR_SAFE

#define UTF_PREV_CHAR_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | c,
|  |  | strict )

Value:
UTF16_PREV_CHAR_SAFE(s, start, i, c, strict)
UTF16_PREV_CHAR_SAFE
#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict)
Definition utf_old.h:750

Deprecated
  ICU 2.4. Use U16_PREV instead, see utf_old.h.

Definition at line 1004 of file utf_old.h.

## UTF_PREV_CHAR_UNSAFE

#define UTF_PREV_CHAR_UNSAFE | ( |  | s,
|  |  | i,
|  |  | c )

Value:
UTF16_PREV_CHAR_UNSAFE(s, i, c)
UTF16_PREV_CHAR_UNSAFE
#define UTF16_PREV_CHAR_UNSAFE(s, i, c)
Definition utf_old.h:719

Deprecated
  ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h.

Definition at line 1001 of file utf_old.h.

## UTF_SAFE

#define UTF_SAFE

The default choice for general Unicode string macros is to use the ..._SAFE macro implementations with strict=false.

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 188 of file utf_old.h.

## UTF_SECOND_SURROGATE

#define UTF_SECOND_SURROGATE | ( |  | supplementary | ) |

Value:
(UChar)(((supplementary)&0x3ff)|0xdc00)

Deprecated
  ICU 2.4. Renamed to U16_TRAIL, see utf_old.h.

Definition at line 555 of file utf_old.h.

## UTF_SET_CHAR_LIMIT

#define UTF_SET_CHAR_LIMIT | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length )

Value:
U16_SET_CP_LIMIT(s, start, i, length)

Take the random-access index i and adjust it so that it points beyond a code point.

The input index points beyond any code unit of a code point and is moved to point beyond the last code unit of the same code point. i is never decremented. In other words, if i points to a trail surrogate that is preceded by a matching lead surrogate, then i is incremented. Otherwise it is not modified. This can be used to start an iteration with UTF_PREV_CHAR() from a random index. Same as UTF16_SET_CHAR_LIMIT.

Precondition
  start<i<=length

Postcondition
  start<i<=length

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h.

Definition at line 1199 of file utf_old.h.

## UTF_SET_CHAR_LIMIT_SAFE

#define UTF_SET_CHAR_LIMIT_SAFE | ( |  | s,
|  |  | start,
|  |  | i,
|  |  | length )

Value:
UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length)
UTF16_SET_CHAR_LIMIT_SAFE
#define UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length)
Definition utf_old.h:775

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h.

Definition at line 1025 of file utf_old.h.

## UTF_SET_CHAR_LIMIT_UNSAFE

#define UTF_SET_CHAR_LIMIT_UNSAFE | ( |  | s,
|  |  | i )

Value:
UTF16_SET_CHAR_LIMIT_UNSAFE(s, i)
UTF16_SET_CHAR_LIMIT_UNSAFE
#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i)
Definition utf_old.h:743

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h.

Definition at line 1022 of file utf_old.h.

## UTF_SET_CHAR_START

#define UTF_SET_CHAR_START | ( |  | s,
|  |  | start,
|  |  | i )

Value:
U16_SET_CP_START(s, start, i)

Take the random-access index i and adjust it so that it points to the beginning of a code point.

The input index points to any code unit of a code point and is moved to point to the first code unit of the same code point. i is never incremented. In other words, if i points to a trail surrogate that is preceded by a matching lead surrogate, then i is decremented. Otherwise it is not modified. This can be used to start an iteration with UTF_NEXT_CHAR() from a random index. Same as UTF16_SET_CHAR_START.

Precondition
  start<=i<length

Postcondition
  start<=i<length

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h.

Definition at line 1144 of file utf_old.h.

## UTF_SET_CHAR_START_SAFE

#define UTF_SET_CHAR_START_SAFE | ( |  | s,
|  |  | start,
|  |  | i )

Value:
UTF16_SET_CHAR_START_SAFE(s, start, i)
UTF16_SET_CHAR_START_SAFE
#define UTF16_SET_CHAR_START_SAFE(s, start, i)
Definition utf_old.h:716

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h.

Definition at line 997 of file utf_old.h.

## UTF_SET_CHAR_START_UNSAFE

#define UTF_SET_CHAR_START_UNSAFE | ( |  | s,
|  |  | i )

Value:
UTF16_SET_CHAR_START_UNSAFE(s, i)
UTF16_SET_CHAR_START_UNSAFE
#define UTF16_SET_CHAR_START_UNSAFE(s, i)
Definition utf_old.h:668

Deprecated
  ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h.

Definition at line 994 of file utf_old.h.

## UTF_SIZE

#define UTF_SIZE 16

Number of bits in a Unicode string code unit - ICU uses 16-bit Unicode.

Deprecated
  ICU 2.4. Obsolete, see utf_old.h.

Definition at line 180 of file utf_old.h.

## UTF_SURROGATE_OFFSET

#define UTF_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)

Helper constant for UTF16_GET_PAIR_VALUE.

Deprecated
  ICU 2.4. Renamed to U16_SURROGATE_OFFSET, see utf_old.h.

Definition at line 545 of file utf_old.h.

## Variable Documentation

## utf8_countTrailBytes

U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]

Internal array with numbers of trail bytes for any given byte used in lead byte position.

This is internal since it is not meant to be called directly by external clients; however it is called by public macros in this file and thus must remain stable, and should not be hidden when other internal functions are hidden (otherwise public macros would fail to compile).

Internal
  Do not use. This API is for internal use only.

Definition at line 298 of file utf_old.h.