Rizin
unix-like reverse engineering framework and cli tools
umachine.h File Reference

Basic types and constants for UTF. More...

#include "unicode/ptypes.h"
#include <stddef.h>
#include "unicode/urename.h"

Go to the source code of this file.

Macros

#define U_CFUNC   extern
 
#define U_CDECL_BEGIN
 
#define U_CDECL_END
 
#define U_ATTRIBUTE_DEPRECATED
 
#define U_CAPI   U_CFUNC U_EXPORT
 
#define U_STABLE   U_CAPI
 
#define U_DRAFT   U_CAPI
 
#define U_DEPRECATED   U_CAPI U_ATTRIBUTE_DEPRECATED
 
#define U_OBSOLETE   U_CAPI
 
#define U_INTERNAL   U_CAPI
 
#define U_OVERRIDE   override
 
#define U_FINAL   final
 
#define UPRV_BLOCK_MACRO_BEGIN   do
 
#define UPRV_BLOCK_MACRO_END   while (FALSE)
 
#define INT8_MIN   ((int8_t)(-128))
 
#define INT16_MIN   ((int16_t)(-32767-1))
 
#define INT32_MIN   ((int32_t)(-2147483647-1))
 
#define INT8_MAX   ((int8_t)(127))
 
#define INT16_MAX   ((int16_t)(32767))
 
#define INT32_MAX   ((int32_t)(2147483647))
 
#define UINT8_MAX   ((uint8_t)(255U))
 
#define UINT16_MAX   ((uint16_t)(65535U))
 
#define UINT32_MAX   ((uint32_t)(4294967295U))
 
#define INT64_C(c)   c ## LL
 
#define UINT64_C(c)   c ## ULL
 
#define U_INT64_MIN   ((int64_t)(INT64_C(-9223372036854775807)-1))
 
#define U_INT64_MAX   ((int64_t)(INT64_C(9223372036854775807)))
 
#define U_UINT64_MAX   ((uint64_t)(UINT64_C(18446744073709551615)))
 
#define TRUE   1
 
#define FALSE   0
 
#define U_SIZEOF_UCHAR   2
 
#define U_CHAR16_IS_TYPEDEF   0
 
#define U_SENTINEL   (-1)
 

Typedefs

typedef int8_t UBool
 
typedef uint16_t UChar
 
typedef uint16_t OldUChar
 
typedef int32_t UChar32
 

Detailed Description

Basic types and constants for UTF.

Basic types and constants for UTF

This file defines basic types and constants for utf.h to be platform-independent. umachine.h and utf.h are included into utypes.h to provide all the general definitions for ICU. All of these definitions used to be in utypes.h before the UTF-handling macros made this unmaintainable.

Definition in file umachine.h.

Macro Definition Documentation

◆ FALSE

#define FALSE   0

The FALSE value of a UBool @stable ICU 2.0

Definition at line 268 of file umachine.h.

◆ INT16_MAX

#define INT16_MAX   ((int16_t)(32767))

The largest value a 16 bit signed integer can hold @stable ICU 2.0

Definition at line 202 of file umachine.h.

◆ INT16_MIN

#define INT16_MIN   ((int16_t)(-32767-1))

The smallest value a 16 bit signed integer can hold @stable ICU 2.0

Definition at line 189 of file umachine.h.

◆ INT32_MAX

#define INT32_MAX   ((int32_t)(2147483647))

The largest value a 32 bit signed integer can hold @stable ICU 2.0

Definition at line 206 of file umachine.h.

◆ INT32_MIN

#define INT32_MIN   ((int32_t)(-2147483647-1))

The smallest value a 32 bit signed integer can hold @stable ICU 2.0

Definition at line 193 of file umachine.h.

◆ INT64_C

#define INT64_C (   c)    c ## LL

Provides a platform independent way to specify a signed 64-bit integer constant. note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C @stable ICU 2.8

Definition at line 231 of file umachine.h.

◆ INT8_MAX

#define INT8_MAX   ((int8_t)(127))

The largest value an 8 bit signed integer can hold @stable ICU 2.0

Definition at line 198 of file umachine.h.

◆ INT8_MIN

#define INT8_MIN   ((int8_t)(-128))

The smallest value an 8 bit signed integer can hold @stable ICU 2.0

Definition at line 185 of file umachine.h.

◆ TRUE

#define TRUE   1

The TRUE value of a UBool @stable ICU 2.0

Definition at line 264 of file umachine.h.

◆ U_ATTRIBUTE_DEPRECATED

#define U_ATTRIBUTE_DEPRECATED

This is used for GCC specific attributes

Definition at line 104 of file umachine.h.

◆ U_CAPI

#define U_CAPI   U_CFUNC U_EXPORT

This is used to declare a function as a public ICU C API @stable ICU 2.0

Definition at line 109 of file umachine.h.

◆ U_CDECL_BEGIN

#define U_CDECL_BEGIN

This is used to begin a declaration of a library private ICU C API. @stable ICU 2.4

Definition at line 84 of file umachine.h.

◆ U_CDECL_END

#define U_CDECL_END

This is used to end a declaration of a library private ICU C API @stable ICU 2.4

Definition at line 85 of file umachine.h.

◆ U_CFUNC

#define U_CFUNC   extern

This is used in a declaration of a library private ICU C function. @stable ICU 2.4

Definition at line 83 of file umachine.h.

◆ U_CHAR16_IS_TYPEDEF

#define U_CHAR16_IS_TYPEDEF   0

If 1, then char16_t is a typedef and not a real type (yet)

Definition at line 331 of file umachine.h.

◆ U_DEPRECATED

#define U_DEPRECATED   U_CAPI U_ATTRIBUTE_DEPRECATED

This is used to declare a function as a deprecated public ICU C API

Definition at line 115 of file umachine.h.

◆ U_DRAFT

#define U_DRAFT   U_CAPI

This is used to declare a function as a draft public ICU C API

Definition at line 113 of file umachine.h.

◆ U_FINAL

#define U_FINAL   final

Defined to the C++11 "final" keyword if available. Denotes a class or member which may not be overridden in subclasses. May result in an error if subclasses attempt to override.

Definition at line 140 of file umachine.h.

◆ U_INT64_MAX

#define U_INT64_MAX   ((int64_t)(INT64_C(9223372036854775807)))

The largest value a 64 bit signed integer can hold @stable ICU 2.8

Definition at line 247 of file umachine.h.

◆ U_INT64_MIN

#define U_INT64_MIN   ((int64_t)(INT64_C(-9223372036854775807)-1))

The smallest value a 64 bit signed integer can hold @stable ICU 2.8

Definition at line 243 of file umachine.h.

◆ U_INTERNAL

#define U_INTERNAL   U_CAPI

This is used to declare a function as an internal ICU C API

Definition at line 119 of file umachine.h.

◆ U_OBSOLETE

#define U_OBSOLETE   U_CAPI

This is used to declare a function as an obsolete public ICU C API

Definition at line 117 of file umachine.h.

◆ U_OVERRIDE

#define U_OVERRIDE   override

Defined to the C++11 "override" keyword if available. Denotes a class or member which is an override of the base class. May result in an error if it applied to something not an override.

Definition at line 129 of file umachine.h.

◆ U_SENTINEL

#define U_SENTINEL   (-1)

This value is intended for sentinel values for APIs that (take or) return single code points (UChar32). It is outside of the Unicode code point range 0..0x10ffff.

For example, a "done" or "error" value in a new API could be indicated with U_SENTINEL.

ICU APIs designed before ICU 2.4 usually define service-specific "done" values, mostly 0xffff. Those may need to be distinguished from actual U+ffff text contents by calling functions like CharacterIterator::hasNext() or UnicodeString::length().

Returns
-1
See also
UChar32 @stable ICU 2.4

Definition at line 444 of file umachine.h.

◆ U_SIZEOF_UCHAR

#define U_SIZEOF_UCHAR   2

Number of bytes in a UChar. @stable ICU 2.0

Definition at line 315 of file umachine.h.

◆ U_STABLE

#define U_STABLE   U_CAPI

This is used to declare a function as a stable public ICU C API

Definition at line 111 of file umachine.h.

◆ U_UINT64_MAX

#define U_UINT64_MAX   ((uint64_t)(UINT64_C(18446744073709551615)))

The largest value a 64 bit unsigned integer can hold @stable ICU 2.8

Definition at line 251 of file umachine.h.

◆ UINT16_MAX

#define UINT16_MAX   ((uint16_t)(65535U))

The largest value a 16 bit unsigned integer can hold @stable ICU 2.0

Definition at line 215 of file umachine.h.

◆ UINT32_MAX

#define UINT32_MAX   ((uint32_t)(4294967295U))

The largest value a 32 bit unsigned integer can hold @stable ICU 2.0

Definition at line 219 of file umachine.h.

◆ UINT64_C

#define UINT64_C (   c)    c ## ULL

Provides a platform independent way to specify an unsigned 64-bit integer constant. note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C @stable ICU 2.8

Definition at line 239 of file umachine.h.

◆ UINT8_MAX

#define UINT8_MAX   ((uint8_t)(255U))

The largest value an 8 bit unsigned integer can hold @stable ICU 2.0

Definition at line 211 of file umachine.h.

◆ UPRV_BLOCK_MACRO_BEGIN

#define UPRV_BLOCK_MACRO_BEGIN   do

Defined as the "do" keyword by default.

Definition at line 167 of file umachine.h.

◆ UPRV_BLOCK_MACRO_END

#define UPRV_BLOCK_MACRO_END   while (FALSE)

Defined as "while (FALSE)" by default.

Definition at line 176 of file umachine.h.

Typedef Documentation

◆ OldUChar

Default ICU 58 definition of UChar. A base type for UTF-16 code units and pointers. Unsigned 16-bit integer.

Define OldUChar to be wchar_t if that is 16 bits wide. If wchar_t is not 16 bits wide, then define UChar to be uint16_t.

This makes the definition of OldUChar platform-dependent but allows direct string type compatibility with platforms with 16-bit wchar_t types.

This is how UChar was defined in ICU 58, for transition convenience. Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined. The current UChar responds to UCHAR_TYPE but OldUChar does not.

@stable ICU 59

Definition at line 404 of file umachine.h.

◆ UBool

typedef int8_t UBool

The ICU boolean type @stable ICU 2.0

Definition at line 260 of file umachine.h.

◆ UChar

The base type for UTF-16 code units and pointers. Unsigned 16-bit integer. Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar.

UChar is configurable by defining the macro UCHAR_TYPE on the preprocessor or compiler command line: -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc. (The UCHAR_TYPE can also be #defined earlier in this file, for outside the ICU library code.) This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16.

The default is UChar=char16_t.

C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type.

In C, char16_t is a simple typedef of uint_least16_t. ICU requires uint_least16_t=uint16_t for data memory mapping. On macOS, char16_t is not available because the uchar.h standard header is missing.

@stable ICU 4.4

Definition at line 377 of file umachine.h.

◆ UChar32

typedef int32_t UChar32

Define UChar32 as a type for single Unicode code points. UChar32 is a signed 32-bit integer (same as int32_t).

The Unicode code point range is 0..0x10ffff. All other values (negative or >=0x110000) are illegal as Unicode code points. They may be used as sentinel values to indicate "done", "error" or similar non-code point conditions.

Before ICU 2.4 (Jitterbug 2146), UChar32 was defined to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned) or else to be uint32_t. That is, the definition of UChar32 was platform-dependent.

See also
U_SENTINEL @stable ICU 2.4

Definition at line 424 of file umachine.h.