Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

utypes.h

Go to the documentation of this file.
00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1996-2001, 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 00050 /*===========================================================================*/ 00051 /* char Character set family */ 00052 /*===========================================================================*/ 00053 00094 #define U_ASCII_FAMILY 0 00095 #define U_EBCDIC_FAMILY 1 00096 00097 #ifndef U_CHARSET_FAMILY 00098 # define U_CHARSET_FAMILY 0 00099 #endif 00100 00101 /*===========================================================================*/ 00102 /* ICUDATA naming scheme */ 00103 /*===========================================================================*/ 00104 00114 #if U_CHARSET_FAMILY 00115 # if U_IS_BIG_ENDIAN 00116 /* EBCDIC - should always be BE */ 00117 # define U_ICUDATA_TYPE_LETTER "e" 00118 # define U_ICUDATA_TYPE_LITLETTER e 00119 # else 00120 # error "Don't know what to do with little endian EBCDIC!" 00121 # define U_ICUDATA_TYPE_LETTER "x" 00122 # define U_ICUDATA_TYPE_LITLETTER x 00123 # endif 00124 #else 00125 # if U_IS_BIG_ENDIAN 00126 /* Big-endian ASCII */ 00127 # define U_ICUDATA_TYPE_LETTER "b" 00128 # define U_ICUDATA_TYPE_LITLETTER b 00129 # else 00130 /* Little-endian ASCII */ 00131 # define U_ICUDATA_TYPE_LETTER "l" 00132 # define U_ICUDATA_TYPE_LITLETTER l 00133 # endif 00134 #endif 00135 00138 #define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER 00139 00140 00141 /* 00142 * Define U_ICU_ENTRY_POINT to be the name of the DLL entry point. 00143 * Defined as a literal, not a string. 00144 * Tricky Preprocessor use - ## operator replaces macro paramters with the literal string 00145 * from the corresponding macro invocation, _before_ other macro substitutions. 00146 * Need a nested #defines to get the actual version numbers rather than 00147 * the literal text U_ICU_VERSION_MAJOR_NUM into the name. 00148 * The net result will be something of the form 00149 * #define U_ICU_ENTRY_POINT icudt19_dat 00150 */ 00151 #if U_HAVE_LIB_SUFFIX 00152 #define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM, U_LIB_SUFFIX_C_NAME) 00153 #define U_DEF2_ICUDATA_ENTRY_POINT(major, minor, suffix) U_DEF_ICUDATA_ENTRY_POINT(major, minor, suffix) 00154 #define U_DEF_ICUDATA_ENTRY_POINT(major, minor, suffix) icudt##major##minor##suffix##_dat 00155 #else 00156 #define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM) 00157 #define U_DEF2_ICUDATA_ENTRY_POINT(major, minor) U_DEF_ICUDATA_ENTRY_POINT(major, minor) 00158 #define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##major##minor##_dat 00159 #endif 00160 00171 #if defined(OS390) && defined(XP_CPLUSPLUS) 00172 # define U_CALLCONV __cdecl 00173 #else 00174 # define U_CALLCONV 00175 #endif 00176 00181 #ifndef NULL 00182 #ifdef XP_CPLUSPLUS 00183 #define NULL 0 00184 #else 00185 #define NULL ((void *)0) 00186 #endif 00187 #endif 00188 00189 /*===========================================================================*/ 00190 /* Calendar/TimeZone data types */ 00191 /*===========================================================================*/ 00192 00199 typedef double UDate; 00200 00201 /* Common time manipulation constants */ 00202 #define U_MILLIS_PER_SECOND (1000) 00203 #define U_MILLIS_PER_MINUTE (60000) 00204 #define U_MILLIS_PER_HOUR (3600000) 00205 #define U_MILLIS_PER_DAY (86400000) 00206 00207 00208 /*===========================================================================*/ 00209 /* UClassID-based RTTI */ 00210 /*===========================================================================*/ 00211 00254 typedef void* UClassID; 00255 00256 /*===========================================================================*/ 00257 /* Shared library/DLL import-export API control */ 00258 /*===========================================================================*/ 00259 00260 /* 00261 * Control of symbol import/export. 00262 * ICU is separated into three libraries. 00263 */ 00264 00292 #if defined(U_COMBINED_IMPLEMENTATION) 00293 #define U_COMMON_API U_EXPORT 00294 #define U_I18N_API U_EXPORT 00295 #define U_LAYOUT_API U_EXPORT 00296 #define U_USTDIO_API U_EXPORT 00297 #elif defined(U_STATIC_IMPLEMENTATION) 00298 #define U_COMMON_API 00299 #define U_I18N_API 00300 #define U_LAYOUT_API 00301 #define U_USTDIO_API 00302 #elif defined(U_COMMON_IMPLEMENTATION) 00303 #define U_COMMON_API U_EXPORT 00304 #define U_I18N_API U_IMPORT 00305 #define U_LAYOUT_API U_IMPORT 00306 #define U_USTDIO_API U_IMPORT 00307 #elif defined(U_I18N_IMPLEMENTATION) 00308 #define U_COMMON_API U_IMPORT 00309 #define U_I18N_API U_EXPORT 00310 #define U_LAYOUT_API U_IMPORT 00311 #define U_USTDIO_API U_IMPORT 00312 #elif defined(U_LAYOUT_IMPLEMENTATION) 00313 #define U_COMMON_API U_IMPORT 00314 #define U_I18N_API U_IMPORT 00315 #define U_LAYOUT_API U_EXPORT 00316 #define U_USTDIO_API U_IMPORT 00317 #elif defined(U_USTDIO_IMPLEMENTATION) 00318 #define U_COMMON_API U_IMPORT 00319 #define U_I18N_API U_IMPORT 00320 #define U_LAYOUT_API U_IMPORT 00321 #define U_USTDIO_API U_EXPORT 00322 #else 00323 #define U_COMMON_API U_IMPORT 00324 #define U_I18N_API U_IMPORT 00325 #define U_LAYOUT_API U_IMPORT 00326 #define U_USTDIO_API U_IMPORT 00327 #endif 00328 00333 #ifdef __cplusplus 00334 #define U_STANDARD_CPP_NAMESPACE :: 00335 #else 00336 #define U_STANDARD_CPP_NAMESPACE 00337 #endif 00338 00339 /*===========================================================================*/ 00340 /* UErrorCode */ 00341 /*===========================================================================*/ 00342 00356 enum UErrorCode { 00357 /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird 00358 * and is that way because VC++ debugger displays first encountered constant, 00359 * which is not the what the code is used for 00360 */ 00361 00362 U_USING_FALLBACK_WARNING = -128, 00364 U_USING_FALLBACK_ERROR = -128, 00366 U_ERROR_WARNING_START = -128, 00369 U_ERROR_INFO_START = U_ERROR_WARNING_START, 00371 U_USING_DEFAULT_WARNING = -127, 00373 U_USING_DEFAULT_ERROR = -127, 00375 U_SAFECLONE_ALLOCATED_WARNING = -126, 00377 U_SAFECLONE_ALLOCATED_ERROR = -126, 00379 U_STATE_OLD_WARNING = -125, 00381 U_STRING_NOT_TERMINATED_WARNING = -124, 00382 U_SORT_KEY_TOO_SHORT_WARNING = -123, 00383 00384 U_ERROR_WARNING_LIMIT, 00387 U_ERROR_INFO_LIMIT = U_ERROR_WARNING_LIMIT, 00389 U_ZERO_ERROR = 0, 00391 U_ILLEGAL_ARGUMENT_ERROR = 1, 00392 U_MISSING_RESOURCE_ERROR = 2, 00393 U_INVALID_FORMAT_ERROR = 3, 00394 U_FILE_ACCESS_ERROR = 4, 00395 U_INTERNAL_PROGRAM_ERROR = 5, 00396 U_MESSAGE_PARSE_ERROR = 6, 00397 U_MEMORY_ALLOCATION_ERROR = 7, 00398 U_INDEX_OUTOFBOUNDS_ERROR = 8, 00399 U_PARSE_ERROR = 9, 00400 U_INVALID_CHAR_FOUND = 10, 00401 U_TRUNCATED_CHAR_FOUND = 11, 00402 U_ILLEGAL_CHAR_FOUND = 12, 00403 U_INVALID_TABLE_FORMAT = 13, 00404 U_INVALID_TABLE_FILE = 14, 00405 U_BUFFER_OVERFLOW_ERROR = 15, 00406 U_UNSUPPORTED_ERROR = 16, 00407 U_RESOURCE_TYPE_MISMATCH = 17, 00408 U_ILLEGAL_ESCAPE_SEQUENCE = 18, 00409 U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, 00410 U_NO_SPACE_AVAILABLE = 20, 00411 U_CE_NOT_FOUND_ERROR = 21, 00412 U_PRIMARY_TOO_LONG_ERROR = 22, 00413 U_STATE_TOO_OLD_ERROR = 23, 00414 U_STANDARD_ERROR_LIMIT, 00415 /* 00416 * the error code range 0x10000 0x10100 are reserved for Transliterator 00417 */ 00418 U_BAD_VARIABLE_DEFINITION=0x10000, 00419 U_PARSE_ERROR_START = 0x10000, 00420 U_MALFORMED_RULE, 00421 U_MALFORMED_SET, 00422 U_MALFORMED_SYMBOL_REFERENCE, 00423 U_MALFORMED_UNICODE_ESCAPE, 00424 U_MALFORMED_VARIABLE_DEFINITION, 00425 U_MALFORMED_VARIABLE_REFERENCE, 00426 U_MISMATCHED_SEGMENT_DELIMITERS, 00427 U_MISPLACED_ANCHOR_START, 00428 U_MISPLACED_CURSOR_OFFSET, 00429 U_MISPLACED_QUANTIFIER, 00430 U_MISSING_OPERATOR, 00431 U_MISSING_SEGMENT_CLOSE, 00432 U_MULTIPLE_ANTE_CONTEXTS, 00433 U_MULTIPLE_CURSORS, 00434 U_MULTIPLE_POST_CONTEXTS, 00435 U_TRAILING_BACKSLASH, 00436 U_UNDEFINED_SEGMENT_REFERENCE, 00437 U_UNDEFINED_VARIABLE, 00438 U_UNQUOTED_SPECIAL, 00439 U_UNTERMINATED_QUOTE, 00440 U_RULE_MASK_ERROR, 00441 U_MISPLACED_COMPOUND_FILTER, 00442 U_MULTIPLE_COMPOUND_FILTERS, 00443 U_INVALID_RBT_SYNTAX, 00444 U_INVALID_PROPERTY_PATTERN, 00445 U_MALFORMED_PRAGMA, 00446 U_UNCLOSED_SEGMENT, 00447 U_ILLEGAL_CHAR_IN_SEGMENT, 00448 U_VARIABLE_RANGE_EXHAUSTED, 00449 U_VARIABLE_RANGE_OVERLAP, 00450 U_ILLEGAL_CHARACTER, 00451 U_INTERNAL_TRANSLITERATOR_ERROR, 00452 U_INVALID_ID, 00453 U_INVALID_FUNCTION, 00454 U_PARSE_ERROR_LIMIT, 00456 /* 00457 * the error code range 0x10100 0x10200 are reserved for formatting API parsing error 00458 */ 00459 U_UNEXPECTED_TOKEN=0x10100, 00460 U_FMT_PARSE_ERROR_START=0x10100, 00461 U_MULTIPLE_DECIMAL_SEPERATORS, 00462 U_MULTIPLE_EXPONENTIAL_SYMBOLS, 00463 U_MALFORMED_EXPONENTIAL_PATTERN, 00464 U_MULTIPLE_PERCENT_SYMBOLS, 00465 U_MULTIPLE_PERMILL_SYMBOLS, 00466 U_MULTIPLE_PAD_SPECIFIERS, 00467 U_PATTERN_SYNTAX_ERROR, 00468 U_ILLEGAL_PAD_POSITION, 00469 U_UNMATCHED_BRACES, 00470 U_UNSUPPORTED_PROPERTY, 00471 U_UNSUPPORTED_ATTRIBUTE, 00472 U_FMT_PARSE_ERROR_LIMIT, 00473 00474 U_ERROR_LIMIT=U_FMT_PARSE_ERROR_LIMIT 00475 }; 00476 00477 #ifndef XP_CPLUSPLUS 00478 typedef enum UErrorCode UErrorCode; 00479 #endif 00480 00481 /* Use the following to determine if an UErrorCode represents */ 00482 /* operational success or failure. */ 00483 00484 #ifdef XP_CPLUSPLUS 00485 00489 static 00490 inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); } 00495 static 00496 inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); } 00497 #else 00498 00502 # define U_SUCCESS(x) ((x)<=U_ZERO_ERROR) 00503 00507 # define U_FAILURE(x) ((x)>U_ZERO_ERROR) 00508 #endif 00509 00515 U_CAPI const char * U_EXPORT2 00516 u_errorName(UErrorCode code); 00517 00518 00519 00520 /*===========================================================================*/ 00521 /* Include header for platform utilies */ 00522 /*===========================================================================*/ 00523 00524 #include "unicode/putil.h" 00525 00526 #endif /* _UTYPES */

Generated on Wed Jul 28 05:45:13 2004 for ICU 2.1 by doxygen 1.3.7