|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ********************************************************************** 00005 * Copyright (C) 1996-2016, International Business Machines 00006 * Corporation and others. All Rights Reserved. 00007 ********************************************************************** 00008 * 00009 * FILE NAME : UTYPES.H (formerly ptypes.h) 00010 * 00011 * Date Name Description 00012 * 12/11/96 helena Creation. 00013 * 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32, 00014 * uint8, uint16, and uint32. 00015 * 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C as 00016 * well as C++. 00017 * Modified to use memcpy() for uprv_arrayCopy() fns. 00018 * 04/14/97 aliu Added TPlatformUtilities. 00019 * 05/07/97 aliu Added import/export specifiers (replacing the old 00020 * broken EXT_CLASS). Added version number for our 00021 * code. Cleaned up header. 00022 * 6/20/97 helena Java class name change. 00023 * 08/11/98 stephen UErrorCode changed from typedef to enum 00024 * 08/12/98 erm Changed T_ANALYTIC_PACKAGE_VERSION to 3 00025 * 08/14/98 stephen Added uprv_arrayCopy() for int8_t, int16_t, int32_t 00026 * 12/09/98 jfitz Added BUFFER_OVERFLOW_ERROR (bug 1100066) 00027 * 04/20/99 stephen Cleaned up & reworked for autoconf. 00028 * Renamed to utypes.h. 00029 * 05/05/99 stephen Changed to use <inttypes.h> 00030 * 12/07/99 helena Moved copyright notice string from ucnv_bld.h here. 00031 ******************************************************************************* 00032 */ 00033 00034 #ifndef UTYPES_H 00035 #define UTYPES_H 00036 00037 00038 #include "unicode/umachine.h" 00039 #include "unicode/uversion.h" 00040 #include "unicode/uconfig.h" 00041 #include <float.h> 00042 00043 #if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS 00044 # include "unicode/utf.h" 00045 #endif 00046 00062 #ifdef __cplusplus 00063 # ifndef U_SHOW_CPLUSPLUS_API 00064 # define U_SHOW_CPLUSPLUS_API 1 00065 # endif 00066 #else 00067 # undef U_SHOW_CPLUSPLUS_API 00068 # define U_SHOW_CPLUSPLUS_API 0 00069 #endif 00070 00083 #if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API) 00084 #define U_HIDE_DRAFT_API 1 00085 #endif 00086 #if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API) 00087 #define U_HIDE_INTERNAL_API 1 00088 #endif 00089 00092 /*===========================================================================*/ 00093 /* ICUDATA naming scheme */ 00094 /*===========================================================================*/ 00095 00112 #if U_CHARSET_FAMILY 00113 # if U_IS_BIG_ENDIAN 00114 /* EBCDIC - should always be BE */ 00115 # define U_ICUDATA_TYPE_LETTER "e" 00116 # define U_ICUDATA_TYPE_LITLETTER e 00117 # else 00118 # error "Don't know what to do with little endian EBCDIC!" 00119 # define U_ICUDATA_TYPE_LETTER "x" 00120 # define U_ICUDATA_TYPE_LITLETTER x 00121 # endif 00122 #else 00123 # if U_IS_BIG_ENDIAN 00124 /* Big-endian ASCII */ 00125 # define U_ICUDATA_TYPE_LETTER "b" 00126 # define U_ICUDATA_TYPE_LITLETTER b 00127 # else 00128 /* Little-endian ASCII */ 00129 # define U_ICUDATA_TYPE_LETTER "l" 00130 # define U_ICUDATA_TYPE_LITLETTER l 00131 # endif 00132 #endif 00133 00139 #define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER 00140 #ifndef U_HIDE_INTERNAL_API 00141 #define U_USRDATA_NAME "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER 00142 #define U_USE_USRDATA 0 00143 #endif /* U_HIDE_INTERNAL_API */ 00144 00156 #define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM,U_LIB_SUFFIX_C_NAME) 00157 00158 #ifndef U_HIDE_INTERNAL_API 00159 00163 #define U_DEF2_ICUDATA_ENTRY_POINT(major,suff) U_DEF_ICUDATA_ENTRY_POINT(major,suff) 00164 00169 #ifndef U_DEF_ICUDATA_ENTRY_POINT 00170 /* affected by symbol renaming. See platform.h */ 00171 #ifndef U_LIB_SUFFIX_C_NAME 00172 #define U_DEF_ICUDATA_ENTRY_POINT(major, suff) icudt##major##_dat 00173 #else 00174 #define U_DEF_ICUDATA_ENTRY_POINT(major, suff) icudt##suff ## major##_dat 00175 #endif 00176 #endif 00177 #endif /* U_HIDE_INTERNAL_API */ 00178 00184 #ifndef NULL 00185 #ifdef __cplusplus 00186 #define NULL nullptr 00187 #else 00188 #define NULL ((void *)0) 00189 #endif 00190 #endif 00191 00192 /*===========================================================================*/ 00193 /* Calendar/TimeZone data types */ 00194 /*===========================================================================*/ 00195 00203 typedef double UDate; 00204 00206 #define U_MILLIS_PER_SECOND (1000) 00207 00208 #define U_MILLIS_PER_MINUTE (60000) 00209 00210 #define U_MILLIS_PER_HOUR (3600000) 00211 00212 #define U_MILLIS_PER_DAY (86400000) 00213 00218 #define U_DATE_MAX DBL_MAX 00219 00224 #define U_DATE_MIN -U_DATE_MAX 00225 00226 /*===========================================================================*/ 00227 /* Shared library/DLL import-export API control */ 00228 /*===========================================================================*/ 00229 00230 /* 00231 * Control of symbol import/export. 00232 * ICU is separated into three libraries. 00233 */ 00234 00293 #ifdef U_IN_DOXYGEN 00294 // This definition is required when generating the API docs. 00295 #define U_COMBINED_IMPLEMENTATION 1 00296 #endif 00297 00298 #if defined(U_COMBINED_IMPLEMENTATION) 00299 #define U_DATA_API U_EXPORT 00300 #define U_COMMON_API U_EXPORT 00301 #define U_I18N_API U_EXPORT 00302 #define U_LAYOUT_API U_EXPORT 00303 #define U_LAYOUTEX_API U_EXPORT 00304 #define U_IO_API U_EXPORT 00305 #define U_TOOLUTIL_API U_EXPORT 00306 #elif defined(U_STATIC_IMPLEMENTATION) 00307 #define U_DATA_API 00308 #define U_COMMON_API 00309 #define U_I18N_API 00310 #define U_LAYOUT_API 00311 #define U_LAYOUTEX_API 00312 #define U_IO_API 00313 #define U_TOOLUTIL_API 00314 #elif defined(U_COMMON_IMPLEMENTATION) 00315 #define U_DATA_API U_IMPORT 00316 #define U_COMMON_API U_EXPORT 00317 #define U_I18N_API U_IMPORT 00318 #define U_LAYOUT_API U_IMPORT 00319 #define U_LAYOUTEX_API U_IMPORT 00320 #define U_IO_API U_IMPORT 00321 #define U_TOOLUTIL_API U_IMPORT 00322 #elif defined(U_I18N_IMPLEMENTATION) 00323 #define U_DATA_API U_IMPORT 00324 #define U_COMMON_API U_IMPORT 00325 #define U_I18N_API U_EXPORT 00326 #define U_LAYOUT_API U_IMPORT 00327 #define U_LAYOUTEX_API U_IMPORT 00328 #define U_IO_API U_IMPORT 00329 #define U_TOOLUTIL_API U_IMPORT 00330 #elif defined(U_LAYOUT_IMPLEMENTATION) 00331 #define U_DATA_API U_IMPORT 00332 #define U_COMMON_API U_IMPORT 00333 #define U_I18N_API U_IMPORT 00334 #define U_LAYOUT_API U_EXPORT 00335 #define U_LAYOUTEX_API U_IMPORT 00336 #define U_IO_API U_IMPORT 00337 #define U_TOOLUTIL_API U_IMPORT 00338 #elif defined(U_LAYOUTEX_IMPLEMENTATION) 00339 #define U_DATA_API U_IMPORT 00340 #define U_COMMON_API U_IMPORT 00341 #define U_I18N_API U_IMPORT 00342 #define U_LAYOUT_API U_IMPORT 00343 #define U_LAYOUTEX_API U_EXPORT 00344 #define U_IO_API U_IMPORT 00345 #define U_TOOLUTIL_API U_IMPORT 00346 #elif defined(U_IO_IMPLEMENTATION) 00347 #define U_DATA_API U_IMPORT 00348 #define U_COMMON_API U_IMPORT 00349 #define U_I18N_API U_IMPORT 00350 #define U_LAYOUT_API U_IMPORT 00351 #define U_LAYOUTEX_API U_IMPORT 00352 #define U_IO_API U_EXPORT 00353 #define U_TOOLUTIL_API U_IMPORT 00354 #elif defined(U_TOOLUTIL_IMPLEMENTATION) 00355 #define U_DATA_API U_IMPORT 00356 #define U_COMMON_API U_IMPORT 00357 #define U_I18N_API U_IMPORT 00358 #define U_LAYOUT_API U_IMPORT 00359 #define U_LAYOUTEX_API U_IMPORT 00360 #define U_IO_API U_IMPORT 00361 #define U_TOOLUTIL_API U_EXPORT 00362 #else 00363 #define U_DATA_API U_IMPORT 00364 #define U_COMMON_API U_IMPORT 00365 #define U_I18N_API U_IMPORT 00366 #define U_LAYOUT_API U_IMPORT 00367 #define U_LAYOUTEX_API U_IMPORT 00368 #define U_IO_API U_IMPORT 00369 #define U_TOOLUTIL_API U_IMPORT 00370 #endif 00371 00377 #ifdef __cplusplus 00378 #define U_STANDARD_CPP_NAMESPACE :: 00379 #else 00380 #define U_STANDARD_CPP_NAMESPACE 00381 #endif 00382 00383 /*===========================================================================*/ 00384 /* UErrorCode */ 00385 /*===========================================================================*/ 00386 00415 typedef enum UErrorCode { 00416 /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird 00417 * and is that way because VC++ debugger displays first encountered constant, 00418 * which is not the what the code is used for 00419 */ 00420 00421 U_USING_FALLBACK_WARNING = -128, 00423 U_ERROR_WARNING_START = -128, 00425 U_USING_DEFAULT_WARNING = -127, 00427 U_SAFECLONE_ALLOCATED_WARNING = -126, 00429 U_STATE_OLD_WARNING = -125, 00431 U_STRING_NOT_TERMINATED_WARNING = -124, 00433 U_SORT_KEY_TOO_SHORT_WARNING = -123, 00435 U_AMBIGUOUS_ALIAS_WARNING = -122, 00437 U_DIFFERENT_UCA_VERSION = -121, 00439 U_PLUGIN_CHANGED_LEVEL_WARNING = -120, 00441 #ifndef U_HIDE_DEPRECATED_API 00442 00446 U_ERROR_WARNING_LIMIT, 00447 #endif // U_HIDE_DEPRECATED_API 00448 00449 U_ZERO_ERROR = 0, 00451 U_ILLEGAL_ARGUMENT_ERROR = 1, 00452 U_MISSING_RESOURCE_ERROR = 2, 00453 U_INVALID_FORMAT_ERROR = 3, 00454 U_FILE_ACCESS_ERROR = 4, 00455 U_INTERNAL_PROGRAM_ERROR = 5, 00456 U_MESSAGE_PARSE_ERROR = 6, 00457 U_MEMORY_ALLOCATION_ERROR = 7, 00458 U_INDEX_OUTOFBOUNDS_ERROR = 8, 00459 U_PARSE_ERROR = 9, 00460 U_INVALID_CHAR_FOUND = 10, 00461 U_TRUNCATED_CHAR_FOUND = 11, 00462 U_ILLEGAL_CHAR_FOUND = 12, 00463 U_INVALID_TABLE_FORMAT = 13, 00464 U_INVALID_TABLE_FILE = 14, 00465 U_BUFFER_OVERFLOW_ERROR = 15, 00466 U_UNSUPPORTED_ERROR = 16, 00467 U_RESOURCE_TYPE_MISMATCH = 17, 00468 U_ILLEGAL_ESCAPE_SEQUENCE = 18, 00469 U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, 00470 U_NO_SPACE_AVAILABLE = 20, 00471 U_CE_NOT_FOUND_ERROR = 21, 00472 U_PRIMARY_TOO_LONG_ERROR = 22, 00473 U_STATE_TOO_OLD_ERROR = 23, 00474 U_TOO_MANY_ALIASES_ERROR = 24, 00476 U_ENUM_OUT_OF_SYNC_ERROR = 25, 00477 U_INVARIANT_CONVERSION_ERROR = 26, 00478 U_INVALID_STATE_ERROR = 27, 00479 U_COLLATOR_VERSION_MISMATCH = 28, 00480 U_USELESS_COLLATOR_ERROR = 29, 00481 U_NO_WRITE_PERMISSION = 30, 00489 U_INPUT_TOO_LONG_ERROR = 31, 00490 00491 #ifndef U_HIDE_DEPRECATED_API 00492 00496 U_STANDARD_ERROR_LIMIT = 32, 00497 #endif // U_HIDE_DEPRECATED_API 00498 00499 /* 00500 * Error codes in the range 0x10000 0x10100 are reserved for Transliterator. 00501 */ 00502 U_BAD_VARIABLE_DEFINITION=0x10000, 00503 U_PARSE_ERROR_START = 0x10000, 00504 U_MALFORMED_RULE, 00505 U_MALFORMED_SET, 00506 U_MALFORMED_SYMBOL_REFERENCE, 00507 U_MALFORMED_UNICODE_ESCAPE, 00508 U_MALFORMED_VARIABLE_DEFINITION, 00509 U_MALFORMED_VARIABLE_REFERENCE, 00510 U_MISMATCHED_SEGMENT_DELIMITERS, 00511 U_MISPLACED_ANCHOR_START, 00512 U_MISPLACED_CURSOR_OFFSET, 00513 U_MISPLACED_QUANTIFIER, 00514 U_MISSING_OPERATOR, 00515 U_MISSING_SEGMENT_CLOSE, 00516 U_MULTIPLE_ANTE_CONTEXTS, 00517 U_MULTIPLE_CURSORS, 00518 U_MULTIPLE_POST_CONTEXTS, 00519 U_TRAILING_BACKSLASH, 00520 U_UNDEFINED_SEGMENT_REFERENCE, 00521 U_UNDEFINED_VARIABLE, 00522 U_UNQUOTED_SPECIAL, 00523 U_UNTERMINATED_QUOTE, 00524 U_RULE_MASK_ERROR, 00525 U_MISPLACED_COMPOUND_FILTER, 00526 U_MULTIPLE_COMPOUND_FILTERS, 00527 U_INVALID_RBT_SYNTAX, 00528 U_INVALID_PROPERTY_PATTERN, 00529 U_MALFORMED_PRAGMA, 00530 U_UNCLOSED_SEGMENT, 00531 U_ILLEGAL_CHAR_IN_SEGMENT, 00532 U_VARIABLE_RANGE_EXHAUSTED, 00533 U_VARIABLE_RANGE_OVERLAP, 00534 U_ILLEGAL_CHARACTER, 00535 U_INTERNAL_TRANSLITERATOR_ERROR, 00536 U_INVALID_ID, 00537 U_INVALID_FUNCTION, 00538 #ifndef U_HIDE_DEPRECATED_API 00539 00543 U_PARSE_ERROR_LIMIT, 00544 #endif // U_HIDE_DEPRECATED_API 00545 00546 /* 00547 * Error codes in the range 0x10100 0x10200 are reserved for the formatting API. 00548 */ 00549 U_UNEXPECTED_TOKEN=0x10100, 00550 U_FMT_PARSE_ERROR_START=0x10100, 00551 U_MULTIPLE_DECIMAL_SEPARATORS, 00552 U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, 00553 U_MULTIPLE_EXPONENTIAL_SYMBOLS, 00554 U_MALFORMED_EXPONENTIAL_PATTERN, 00555 U_MULTIPLE_PERCENT_SYMBOLS, 00556 U_MULTIPLE_PERMILL_SYMBOLS, 00557 U_MULTIPLE_PAD_SPECIFIERS, 00558 U_PATTERN_SYNTAX_ERROR, 00559 U_ILLEGAL_PAD_POSITION, 00560 U_UNMATCHED_BRACES, 00561 U_UNSUPPORTED_PROPERTY, 00562 U_UNSUPPORTED_ATTRIBUTE, 00563 U_ARGUMENT_TYPE_MISMATCH, 00564 U_DUPLICATE_KEYWORD, 00565 U_UNDEFINED_KEYWORD, 00566 U_DEFAULT_KEYWORD_MISSING, 00567 U_DECIMAL_NUMBER_SYNTAX_ERROR, 00568 U_FORMAT_INEXACT_ERROR, 00569 U_NUMBER_ARG_OUTOFBOUNDS_ERROR, 00570 U_NUMBER_SKELETON_SYNTAX_ERROR, 00571 #ifndef U_HIDE_DEPRECATED_API 00572 00576 U_FMT_PARSE_ERROR_LIMIT = 0x10114, 00577 #endif // U_HIDE_DEPRECATED_API 00578 00579 /* 00580 * Error codes in the range 0x10200 0x102ff are reserved for BreakIterator. 00581 */ 00582 U_BRK_INTERNAL_ERROR=0x10200, 00583 U_BRK_ERROR_START=0x10200, 00584 U_BRK_HEX_DIGITS_EXPECTED, 00585 U_BRK_SEMICOLON_EXPECTED, 00586 U_BRK_RULE_SYNTAX, 00587 U_BRK_UNCLOSED_SET, 00588 U_BRK_ASSIGN_ERROR, 00589 U_BRK_VARIABLE_REDFINITION, 00590 U_BRK_MISMATCHED_PAREN, 00591 U_BRK_NEW_LINE_IN_QUOTED_STRING, 00592 U_BRK_UNDEFINED_VARIABLE, 00593 U_BRK_INIT_ERROR, 00594 U_BRK_RULE_EMPTY_SET, 00595 U_BRK_UNRECOGNIZED_OPTION, 00596 U_BRK_MALFORMED_RULE_TAG, 00597 #ifndef U_HIDE_DEPRECATED_API 00598 00602 U_BRK_ERROR_LIMIT, 00603 #endif // U_HIDE_DEPRECATED_API 00604 00605 /* 00606 * Error codes in the range 0x10300-0x103ff are reserved for regular expression related errors. 00607 */ 00608 U_REGEX_INTERNAL_ERROR=0x10300, 00609 U_REGEX_ERROR_START=0x10300, 00610 U_REGEX_RULE_SYNTAX, 00611 U_REGEX_INVALID_STATE, 00612 U_REGEX_BAD_ESCAPE_SEQUENCE, 00613 U_REGEX_PROPERTY_SYNTAX, 00614 U_REGEX_UNIMPLEMENTED, 00615 U_REGEX_MISMATCHED_PAREN, 00616 U_REGEX_NUMBER_TOO_BIG, 00617 U_REGEX_BAD_INTERVAL, 00618 U_REGEX_MAX_LT_MIN, 00619 U_REGEX_INVALID_BACK_REF, 00620 U_REGEX_INVALID_FLAG, 00621 U_REGEX_LOOK_BEHIND_LIMIT, 00622 U_REGEX_SET_CONTAINS_STRING, 00623 #ifndef U_HIDE_DEPRECATED_API 00624 U_REGEX_OCTAL_TOO_BIG, 00625 #endif /* U_HIDE_DEPRECATED_API */ 00626 U_REGEX_MISSING_CLOSE_BRACKET=U_REGEX_SET_CONTAINS_STRING+2, 00627 U_REGEX_INVALID_RANGE, 00628 U_REGEX_STACK_OVERFLOW, 00629 U_REGEX_TIME_OUT, 00630 U_REGEX_STOPPED_BY_CALLER, 00631 U_REGEX_PATTERN_TOO_BIG, 00632 U_REGEX_INVALID_CAPTURE_GROUP_NAME, 00633 #ifndef U_HIDE_DEPRECATED_API 00634 00638 U_REGEX_ERROR_LIMIT=U_REGEX_STOPPED_BY_CALLER+3, 00639 #endif // U_HIDE_DEPRECATED_API 00640 00641 /* 00642 * Error codes in the range 0x10400-0x104ff are reserved for IDNA related error codes. 00643 */ 00644 U_IDNA_PROHIBITED_ERROR=0x10400, 00645 U_IDNA_ERROR_START=0x10400, 00646 U_IDNA_UNASSIGNED_ERROR, 00647 U_IDNA_CHECK_BIDI_ERROR, 00648 U_IDNA_STD3_ASCII_RULES_ERROR, 00649 U_IDNA_ACE_PREFIX_ERROR, 00650 U_IDNA_VERIFICATION_ERROR, 00651 U_IDNA_LABEL_TOO_LONG_ERROR, 00652 U_IDNA_ZERO_LENGTH_LABEL_ERROR, 00653 U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR, 00654 #ifndef U_HIDE_DEPRECATED_API 00655 00659 U_IDNA_ERROR_LIMIT, 00660 #endif // U_HIDE_DEPRECATED_API 00661 /* 00662 * Aliases for StringPrep 00663 */ 00664 U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR, 00665 U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR, 00666 U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, 00667 00668 /* 00669 * Error codes in the range 0x10500-0x105ff are reserved for Plugin related error codes. 00670 */ 00671 U_PLUGIN_ERROR_START=0x10500, 00672 U_PLUGIN_TOO_HIGH=0x10500, 00673 U_PLUGIN_DIDNT_SET_LEVEL, 00674 #ifndef U_HIDE_DEPRECATED_API 00675 00679 U_PLUGIN_ERROR_LIMIT, 00680 #endif // U_HIDE_DEPRECATED_API 00681 00682 #ifndef U_HIDE_DEPRECATED_API 00683 00687 U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT 00688 #endif // U_HIDE_DEPRECATED_API 00689 } UErrorCode; 00690 00691 /* Use the following to determine if an UErrorCode represents */ 00692 /* operational success or failure. */ 00693 00694 #ifdef __cplusplus 00695 00699 static 00700 inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); } 00705 static 00706 inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); } 00707 #else 00708 00712 # define U_SUCCESS(x) ((x)<=U_ZERO_ERROR) 00713 00717 # define U_FAILURE(x) ((x)>U_ZERO_ERROR) 00718 #endif 00719 00726 U_CAPI const char * U_EXPORT2 00727 u_errorName(UErrorCode code); 00728 00729 00730 #endif /* _UTYPES */
1.7.6.1