utypes.h

Go to the documentation of this file.
00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1996-2004, International Business Machines 00004 * Corporation and others. All Rights Reserved. 00005 ********************************************************************** 00006 * 00007 * FILE NAME : UTYPES.H (formerly ptypes.h) 00008 * 00009 * Date Name Description 00010 * 12/11/96 helena Creation. 00011 * 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32, 00012 * uint8, uint16, and uint32. 00013 * 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C as 00014 * well as C++. 00015 * Modified to use memcpy() for uprv_arrayCopy() fns. 00016 * 04/14/97 aliu Added TPlatformUtilities. 00017 * 05/07/97 aliu Added import/export specifiers (replacing the old 00018 * broken EXT_CLASS). Added version number for our 00019 * code. Cleaned up header. 00020 * 6/20/97 helena Java class name change. 00021 * 08/11/98 stephen UErrorCode changed from typedef to enum 00022 * 08/12/98 erm Changed T_ANALYTIC_PACKAGE_VERSION to 3 00023 * 08/14/98 stephen Added uprv_arrayCopy() for int8_t, int16_t, int32_t 00024 * 12/09/98 jfitz Added BUFFER_OVERFLOW_ERROR (bug 1100066) 00025 * 04/20/99 stephen Cleaned up & reworked for autoconf. 00026 * Renamed to utypes.h. 00027 * 05/05/99 stephen Changed to use <inttypes.h> 00028 * 12/07/99 helena Moved copyright notice string from ucnv_bld.h here. 00029 ******************************************************************************* 00030 */ 00031 00032 #ifndef UTYPES_H 00033 #define UTYPES_H 00034 00035 00036 #include "unicode/umachine.h" 00037 #include "unicode/utf.h" 00038 #include "unicode/uversion.h" 00039 #include "unicode/uconfig.h" 00040 00041 #ifdef U_HIDE_DRAFT_API 00042 #include "unicode/udraft.h" 00043 #endif 00044 00045 #ifdef U_HIDE_DEPRECATED_API 00046 #include "unicode/udeprctd.h" 00047 #endif 00048 00049 #ifdef U_HIDE_DEPRECATED_API 00050 #include "unicode/uobslete.h" 00051 #endif 00052 00053 00064 /*===========================================================================*/ 00065 /* char Character set family */ 00066 /*===========================================================================*/ 00067 00072 #define U_ASCII_FAMILY 0 00073 00078 #define U_EBCDIC_FAMILY 1 00079 00123 #ifndef U_CHARSET_FAMILY 00124 # define U_CHARSET_FAMILY 0 00125 #endif 00126 00127 /*===========================================================================*/ 00128 /* ICUDATA naming scheme */ 00129 /*===========================================================================*/ 00130 00147 #if U_CHARSET_FAMILY 00148 # if U_IS_BIG_ENDIAN 00149 /* EBCDIC - should always be BE */ 00150 # define U_ICUDATA_TYPE_LETTER "e" 00151 # define U_ICUDATA_TYPE_LITLETTER e 00152 # else 00153 # error "Don't know what to do with little endian EBCDIC!" 00154 # define U_ICUDATA_TYPE_LETTER "x" 00155 # define U_ICUDATA_TYPE_LITLETTER x 00156 # endif 00157 #else 00158 # if U_IS_BIG_ENDIAN 00159 /* Big-endian ASCII */ 00160 # define U_ICUDATA_TYPE_LETTER "b" 00161 # define U_ICUDATA_TYPE_LITLETTER b 00162 # else 00163 /* Little-endian ASCII */ 00164 # define U_ICUDATA_TYPE_LETTER "l" 00165 # define U_ICUDATA_TYPE_LITLETTER l 00166 # endif 00167 #endif 00168 00174 #define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER 00175 00176 00188 #define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM) 00189 00192 #define U_DEF2_ICUDATA_ENTRY_POINT(major, minor) U_DEF_ICUDATA_ENTRY_POINT(major, minor) 00193 00196 #define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##major##minor##_dat 00197 00209 #if defined(OS390) && (__COMPILER_VER__ < 0x41020000) && defined(XP_CPLUSPLUS) 00210 # define U_CALLCONV __cdecl 00211 #else 00212 # define U_CALLCONV U_EXPORT2 00213 #endif 00214 00220 #ifndef NULL 00221 #ifdef XP_CPLUSPLUS 00222 #define NULL 0 00223 #else 00224 #define NULL ((void *)0) 00225 #endif 00226 #endif 00227 00228 /*===========================================================================*/ 00229 /* Calendar/TimeZone data types */ 00230 /*===========================================================================*/ 00231 00239 typedef double UDate; 00240 00242 #define U_MILLIS_PER_SECOND (1000) 00243 00244 #define U_MILLIS_PER_MINUTE (60000) 00245 00246 #define U_MILLIS_PER_HOUR (3600000) 00247 00248 #define U_MILLIS_PER_DAY (86400000) 00249 00250 00251 /*===========================================================================*/ 00252 /* UClassID-based RTTI */ 00253 /*===========================================================================*/ 00254 00297 typedef void* UClassID; 00298 00299 /*===========================================================================*/ 00300 /* Shared library/DLL import-export API control */ 00301 /*===========================================================================*/ 00302 00303 /* 00304 * Control of symbol import/export. 00305 * ICU is separated into three libraries. 00306 */ 00307 00308 /* 00309 * \def U_COMBINED_IMPLEMENTATION 00310 * Set to export library symbols from inside the ICU library 00311 * when all of ICU is in a single library. 00312 * This can be set as a compiler option while building ICU, and it 00313 * needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc. 00314 * @stable ICU 2.0 00315 */ 00316 00359 #if defined(U_COMBINED_IMPLEMENTATION) 00360 #define U_DATA_API U_EXPORT 00361 #define U_COMMON_API U_EXPORT 00362 #define U_I18N_API U_EXPORT 00363 #define U_LAYOUT_API U_EXPORT 00364 #define U_LAYOUTEX_API U_EXPORT 00365 #define U_IO_API U_EXPORT 00366 #elif defined(U_STATIC_IMPLEMENTATION) 00367 #define U_DATA_API 00368 #define U_COMMON_API 00369 #define U_I18N_API 00370 #define U_LAYOUT_API 00371 #define U_LAYOUTEX_API 00372 #define U_IO_API 00373 #elif defined(U_COMMON_IMPLEMENTATION) 00374 #define U_DATA_API U_IMPORT 00375 #define U_COMMON_API U_EXPORT 00376 #define U_I18N_API U_IMPORT 00377 #define U_LAYOUT_API U_IMPORT 00378 #define U_LAYOUTEX_API U_IMPORT 00379 #define U_IO_API U_IMPORT 00380 #elif defined(U_I18N_IMPLEMENTATION) 00381 #define U_DATA_API U_IMPORT 00382 #define U_COMMON_API U_IMPORT 00383 #define U_I18N_API U_EXPORT 00384 #define U_LAYOUT_API U_IMPORT 00385 #define U_LAYOUTEX_API U_IMPORT 00386 #define U_IO_API U_IMPORT 00387 #elif defined(U_LAYOUT_IMPLEMENTATION) 00388 #define U_DATA_API U_IMPORT 00389 #define U_COMMON_API U_IMPORT 00390 #define U_I18N_API U_IMPORT 00391 #define U_LAYOUT_API U_EXPORT 00392 #define U_LAYOUTEX_API U_IMPORT 00393 #define U_IO_API U_IMPORT 00394 #elif defined(U_LAYOUTEX_IMPLEMENTATION) 00395 #define U_DATA_API U_IMPORT 00396 #define U_COMMON_API U_IMPORT 00397 #define U_I18N_API U_IMPORT 00398 #define U_LAYOUT_API U_IMPORT 00399 #define U_LAYOUTEX_API U_EXPORT 00400 #define U_IO_API U_IMPORT 00401 #elif defined(U_IO_IMPLEMENTATION) 00402 #define U_DATA_API U_IMPORT 00403 #define U_COMMON_API U_IMPORT 00404 #define U_I18N_API U_IMPORT 00405 #define U_LAYOUT_API U_IMPORT 00406 #define U_LAYOUTEX_API U_IMPORT 00407 #define U_IO_API U_EXPORT 00408 #else 00409 #define U_DATA_API U_IMPORT 00410 #define U_COMMON_API U_IMPORT 00411 #define U_I18N_API U_IMPORT 00412 #define U_LAYOUT_API U_IMPORT 00413 #define U_LAYOUTEX_API U_IMPORT 00414 #define U_IO_API U_IMPORT 00415 #endif 00416 00422 #ifdef __cplusplus 00423 #define U_STANDARD_CPP_NAMESPACE :: 00424 #else 00425 #define U_STANDARD_CPP_NAMESPACE 00426 #endif 00427 00428 00429 /*===========================================================================*/ 00430 /* Global delete operator */ 00431 /*===========================================================================*/ 00432 00433 /* 00434 * The ICU4C library must not use the global new and delete operators. 00435 * These operators here are defined to enable testing for this. 00436 * See Jitterbug 2581 for details of why this is necessary. 00437 * 00438 * Verification that ICU4C's memory usage is correct, i.e., 00439 * that global new/delete are not used: 00440 * 00441 * a) Check for imports of global new/delete (see uobject.cpp for details) 00442 * b) Verify that new is never imported. 00443 * c) Verify that delete is only imported from object code for interface/mixin classes. 00444 * d) Add global delete and delete[] only for the ICU4C library itself 00445 * and define them in a way that crashes or otherwise easily shows a problem. 00446 * 00447 * The following implements d). 00448 * The operator implementations crash; this is intentional and used for library debugging. 00449 * 00450 * Note: This is currently only done on Windows because 00451 * some Linux/Unix compilers have problems with defining global new/delete. 00452 * On Windows, WIN32 is defined, and it is _MSC_Ver>=1200 for MSVC 6.0 and higher. 00453 */ 00454 #if defined(XP_CPLUSPLUS) && defined(WIN32) && (_MSC_Ver>=1200) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_USTDIO_IMPLEMENTATION)) 00455 00461 inline void * 00462 operator new(size_t /*size*/) { 00463 char *q=NULL; 00464 *q=5; /* break it */ 00465 return q; 00466 } 00467 00473 inline void * 00474 operator new[](size_t /*size*/) { 00475 char *q=NULL; 00476 *q=5; /* break it */ 00477 return q; 00478 } 00479 00485 inline void 00486 operator delete(void * /*p*/) { 00487 char *q=NULL; 00488 *q=5; /* break it */ 00489 } 00490 00496 inline void 00497 operator delete[](void * /*p*/) { 00498 char *q=NULL; 00499 *q=5; /* break it */ 00500 } 00501 00502 #endif 00503 00504 /*===========================================================================*/ 00505 /* UErrorCode */ 00506 /*===========================================================================*/ 00507 00522 typedef enum UErrorCode { 00523 /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird 00524 * and is that way because VC++ debugger displays first encountered constant, 00525 * which is not the what the code is used for 00526 */ 00527 00528 U_USING_FALLBACK_WARNING = -128, 00530 U_ERROR_WARNING_START = -128, 00532 U_USING_DEFAULT_WARNING = -127, 00534 U_SAFECLONE_ALLOCATED_WARNING = -126, 00536 U_STATE_OLD_WARNING = -125, 00538 U_STRING_NOT_TERMINATED_WARNING = -124, 00540 U_SORT_KEY_TOO_SHORT_WARNING = -123, 00542 U_AMBIGUOUS_ALIAS_WARNING = -122, 00544 U_DIFFERENT_UCA_VERSION = -121, 00546 U_ERROR_WARNING_LIMIT, 00549 U_ZERO_ERROR = 0, 00551 U_ILLEGAL_ARGUMENT_ERROR = 1, 00552 U_MISSING_RESOURCE_ERROR = 2, 00553 U_INVALID_FORMAT_ERROR = 3, 00554 U_FILE_ACCESS_ERROR = 4, 00555 U_INTERNAL_PROGRAM_ERROR = 5, 00556 U_MESSAGE_PARSE_ERROR = 6, 00557 U_MEMORY_ALLOCATION_ERROR = 7, 00558 U_INDEX_OUTOFBOUNDS_ERROR = 8, 00559 U_PARSE_ERROR = 9, 00560 U_INVALID_CHAR_FOUND = 10, 00561 U_TRUNCATED_CHAR_FOUND = 11, 00562 U_ILLEGAL_CHAR_FOUND = 12, 00563 U_INVALID_TABLE_FORMAT = 13, 00564 U_INVALID_TABLE_FILE = 14, 00565 U_BUFFER_OVERFLOW_ERROR = 15, 00566 U_UNSUPPORTED_ERROR = 16, 00567 U_RESOURCE_TYPE_MISMATCH = 17, 00568 U_ILLEGAL_ESCAPE_SEQUENCE = 18, 00569 U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, 00570 U_NO_SPACE_AVAILABLE = 20, 00571 U_CE_NOT_FOUND_ERROR = 21, 00572 U_PRIMARY_TOO_LONG_ERROR = 22, 00573 U_STATE_TOO_OLD_ERROR = 23, 00574 U_TOO_MANY_ALIASES_ERROR = 24, 00576 U_ENUM_OUT_OF_SYNC_ERROR = 25, 00577 U_INVARIANT_CONVERSION_ERROR = 26, 00578 U_INVALID_STATE_ERROR = 27, 00580 U_STANDARD_ERROR_LIMIT, 00581 /* 00582 * the error code range 0x10000 0x10100 are reserved for Transliterator 00583 */ 00584 U_BAD_VARIABLE_DEFINITION=0x10000, 00585 U_PARSE_ERROR_START = 0x10000, 00586 U_MALFORMED_RULE, 00587 U_MALFORMED_SET, 00588 U_MALFORMED_SYMBOL_REFERENCE, 00589 U_MALFORMED_UNICODE_ESCAPE, 00590 U_MALFORMED_VARIABLE_DEFINITION, 00591 U_MALFORMED_VARIABLE_REFERENCE, 00592 U_MISMATCHED_SEGMENT_DELIMITERS, 00593 U_MISPLACED_ANCHOR_START, 00594 U_MISPLACED_CURSOR_OFFSET, 00595 U_MISPLACED_QUANTIFIER, 00596 U_MISSING_OPERATOR, 00597 U_MISSING_SEGMENT_CLOSE, 00598 U_MULTIPLE_ANTE_CONTEXTS, 00599 U_MULTIPLE_CURSORS, 00600 U_MULTIPLE_POST_CONTEXTS, 00601 U_TRAILING_BACKSLASH, 00602 U_UNDEFINED_SEGMENT_REFERENCE, 00603 U_UNDEFINED_VARIABLE, 00604 U_UNQUOTED_SPECIAL, 00605 U_UNTERMINATED_QUOTE, 00606 U_RULE_MASK_ERROR, 00607 U_MISPLACED_COMPOUND_FILTER, 00608 U_MULTIPLE_COMPOUND_FILTERS, 00609 U_INVALID_RBT_SYNTAX, 00610 U_INVALID_PROPERTY_PATTERN, 00611 U_MALFORMED_PRAGMA, 00612 U_UNCLOSED_SEGMENT, 00613 U_ILLEGAL_CHAR_IN_SEGMENT, 00614 U_VARIABLE_RANGE_EXHAUSTED, 00615 U_VARIABLE_RANGE_OVERLAP, 00616 U_ILLEGAL_CHARACTER, 00617 U_INTERNAL_TRANSLITERATOR_ERROR, 00618 U_INVALID_ID, 00619 U_INVALID_FUNCTION, 00620 U_PARSE_ERROR_LIMIT, 00622 /* 00623 * the error code range 0x10100 0x10200 are reserved for formatting API parsing error 00624 */ 00625 U_UNEXPECTED_TOKEN=0x10100, 00626 U_FMT_PARSE_ERROR_START=0x10100, 00627 U_MULTIPLE_DECIMAL_SEPARATORS, 00628 U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, 00629 U_MULTIPLE_EXPONENTIAL_SYMBOLS, 00630 U_MALFORMED_EXPONENTIAL_PATTERN, 00631 U_MULTIPLE_PERCENT_SYMBOLS, 00632 U_MULTIPLE_PERMILL_SYMBOLS, 00633 U_MULTIPLE_PAD_SPECIFIERS, 00634 U_PATTERN_SYNTAX_ERROR, 00635 U_ILLEGAL_PAD_POSITION, 00636 U_UNMATCHED_BRACES, 00637 U_UNSUPPORTED_PROPERTY, 00638 U_UNSUPPORTED_ATTRIBUTE, 00639 U_FMT_PARSE_ERROR_LIMIT, 00641 /* 00642 * the error code range 0x10200 0x102ff are reserved for Break Iterator related error 00643 */ 00644 U_BRK_ERROR_START=0x10200, 00645 U_BRK_INTERNAL_ERROR, 00646 U_BRK_HEX_DIGITS_EXPECTED, 00647 U_BRK_SEMICOLON_EXPECTED, 00648 U_BRK_RULE_SYNTAX, 00649 U_BRK_UNCLOSED_SET, 00650 U_BRK_ASSIGN_ERROR, 00651 U_BRK_VARIABLE_REDFINITION, 00652 U_BRK_MISMATCHED_PAREN, 00653 U_BRK_NEW_LINE_IN_QUOTED_STRING, 00654 U_BRK_UNDEFINED_VARIABLE, 00655 U_BRK_INIT_ERROR, 00656 U_BRK_RULE_EMPTY_SET, 00657 U_BRK_UNRECOGNIZED_OPTION, 00658 U_BRK_MALFORMED_RULE_TAG, 00659 U_BRK_ERROR_LIMIT, 00661 /* 00662 * The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs 00663 */ 00664 U_REGEX_ERROR_START=0x10300, 00665 U_REGEX_INTERNAL_ERROR, 00666 U_REGEX_RULE_SYNTAX, 00667 U_REGEX_INVALID_STATE, 00668 U_REGEX_BAD_ESCAPE_SEQUENCE, 00669 U_REGEX_PROPERTY_SYNTAX, 00670 U_REGEX_UNIMPLEMENTED, 00671 U_REGEX_MISMATCHED_PAREN, 00672 U_REGEX_NUMBER_TOO_BIG, 00673 U_REGEX_BAD_INTERVAL, 00674 U_REGEX_MAX_LT_MIN, 00675 U_REGEX_INVALID_BACK_REF, 00676 U_REGEX_INVALID_FLAG, 00677 U_REGEX_LOOK_BEHIND_LIMIT, 00678 U_REGEX_SET_CONTAINS_STRING, 00679 U_REGEX_ERROR_LIMIT, 00681 /* 00682 * The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes 00683 */ 00684 U_IDNA_ERROR_START=0x10400, 00685 U_IDNA_PROHIBITED_ERROR, 00686 U_IDNA_UNASSIGNED_ERROR, 00687 U_IDNA_CHECK_BIDI_ERROR, 00688 U_IDNA_STD3_ASCII_RULES_ERROR, 00689 U_IDNA_ACE_PREFIX_ERROR, 00690 U_IDNA_VERIFICATION_ERROR, 00691 U_IDNA_LABEL_TOO_LONG_ERROR, 00692 U_IDNA_ERROR_LIMIT, 00693 /* 00694 * Aliases for StringPrep 00695 */ 00696 U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR, 00697 U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR, 00698 U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, 00699 00700 00701 U_ERROR_LIMIT=U_IDNA_ERROR_LIMIT 00702 } UErrorCode; 00703 00704 /* Use the following to determine if an UErrorCode represents */ 00705 /* operational success or failure. */ 00706 00707 #ifdef XP_CPLUSPLUS 00708 00712 static 00713 inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); } 00718 static 00719 inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); } 00720 #else 00721 00725 # define U_SUCCESS(x) ((x)<=U_ZERO_ERROR) 00726 00730 # define U_FAILURE(x) ((x)>U_ZERO_ERROR) 00731 #endif 00732 00739 U_STABLE const char * U_EXPORT2 00740 u_errorName(UErrorCode code); 00741 00742 00743 00744 00745 00746 /*===========================================================================*/ 00747 /* Include header for platform utilies */ 00748 /*===========================================================================*/ 00749 00750 #include "unicode/putil.h" 00751 00752 #endif /* _UTYPES */

Generated on Fri Jun 18 12:36:03 2004 for ICU by doxygen 1.3.7