Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

utypes.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1996-2002, 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 #define U_ICUDATA_ENTRY_POINT  U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM) 
00152 #define U_DEF2_ICUDATA_ENTRY_POINT(major, minor) U_DEF_ICUDATA_ENTRY_POINT(major, minor)
00153 #define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##major##minor##_dat
00154 
00165 #if defined(OS390) && (__COMPILER_VER__ < 0x41020000) && defined(XP_CPLUSPLUS)
00166 #    define U_CALLCONV __cdecl
00167 #else
00168 #    define U_CALLCONV U_EXPORT2
00169 #endif
00170 
00175 #ifndef NULL
00176 #ifdef XP_CPLUSPLUS
00177 #define NULL    0
00178 #else
00179 #define NULL    ((void *)0)
00180 #endif
00181 #endif
00182 
00183 /*===========================================================================*/
00184 /* Calendar/TimeZone data types                                              */
00185 /*===========================================================================*/
00186 
00193 typedef double UDate;
00194 
00195 /* Common time manipulation constants */
00196 #define U_MILLIS_PER_SECOND        (1000)
00197 #define U_MILLIS_PER_MINUTE       (60000)
00198 #define U_MILLIS_PER_HOUR       (3600000)
00199 #define U_MILLIS_PER_DAY       (86400000)
00200 
00201 
00202 /*===========================================================================*/
00203 /* UClassID-based RTTI */
00204 /*===========================================================================*/
00205 
00248 typedef void* UClassID;
00249 
00250 /*===========================================================================*/
00251 /* Shared library/DLL import-export API control                              */
00252 /*===========================================================================*/
00253 
00254 /*
00255  * Control of symbol import/export.
00256  * ICU is separated into three libraries.
00257  */
00258 
00286 #if defined(U_COMBINED_IMPLEMENTATION)
00287 #define U_COMMON_API  U_EXPORT
00288 #define U_I18N_API    U_EXPORT
00289 #define U_LAYOUT_API  U_EXPORT
00290 #define U_USTDIO_API  U_EXPORT
00291 #elif defined(U_STATIC_IMPLEMENTATION)
00292 #define U_COMMON_API
00293 #define U_I18N_API
00294 #define U_LAYOUT_API
00295 #define U_USTDIO_API
00296 #elif defined(U_COMMON_IMPLEMENTATION)
00297 #define U_COMMON_API  U_EXPORT
00298 #define U_I18N_API    U_IMPORT
00299 #define U_LAYOUT_API  U_IMPORT
00300 #define U_USTDIO_API  U_IMPORT
00301 #elif defined(U_I18N_IMPLEMENTATION)
00302 #define U_COMMON_API  U_IMPORT
00303 #define U_I18N_API    U_EXPORT
00304 #define U_LAYOUT_API  U_IMPORT
00305 #define U_USTDIO_API  U_IMPORT
00306 #elif defined(U_LAYOUT_IMPLEMENTATION)
00307 #define U_COMMON_API  U_IMPORT
00308 #define U_I18N_API    U_IMPORT
00309 #define U_LAYOUT_API  U_EXPORT
00310 #define U_USTDIO_API  U_IMPORT
00311 #elif defined(U_USTDIO_IMPLEMENTATION)
00312 #define U_COMMON_API  U_IMPORT
00313 #define U_I18N_API    U_IMPORT
00314 #define U_LAYOUT_API  U_IMPORT
00315 #define U_USTDIO_API  U_EXPORT
00316 #else
00317 #define U_COMMON_API  U_IMPORT
00318 #define U_I18N_API    U_IMPORT
00319 #define U_LAYOUT_API  U_IMPORT
00320 #define U_USTDIO_API  U_IMPORT
00321 #endif
00322 
00327 #ifdef __cplusplus
00328 #define U_STANDARD_CPP_NAMESPACE        ::
00329 #else
00330 #define U_STANDARD_CPP_NAMESPACE
00331 #endif
00332 
00333 /*===========================================================================*/
00334 /* UErrorCode */
00335 /*===========================================================================*/
00336 
00350 typedef enum UErrorCode {
00351     /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird
00352      * and is that way because VC++ debugger displays first encountered constant, 
00353      * which is not the what the code is used for
00354      */
00355 
00356     U_USING_FALLBACK_WARNING  = -128,   
00358     U_USING_FALLBACK_ERROR    = -128,   
00360     U_ERROR_WARNING_START     = -128,   
00363     U_ERROR_INFO_START        = U_ERROR_WARNING_START,   
00365     U_USING_DEFAULT_WARNING   = -127,   
00367     U_USING_DEFAULT_ERROR     = -127,   
00369     U_SAFECLONE_ALLOCATED_WARNING = -126, 
00371     U_SAFECLONE_ALLOCATED_ERROR = -126, 
00373     U_STATE_OLD_WARNING       = -125,   
00375     U_STRING_NOT_TERMINATED_WARNING = -124,
00377     U_SORT_KEY_TOO_SHORT_WARNING = -123, 
00379     U_AMBIGUOUS_ALIAS_WARNING = -122,   
00381     U_ERROR_WARNING_LIMIT,                 
00384     U_ERROR_INFO_LIMIT        = U_ERROR_WARNING_LIMIT,  
00386     U_ZERO_ERROR              =  0,     
00388     U_ILLEGAL_ARGUMENT_ERROR  =  1,     
00389     U_MISSING_RESOURCE_ERROR  =  2,
00390     U_INVALID_FORMAT_ERROR    =  3,
00391     U_FILE_ACCESS_ERROR       =  4,
00392     U_INTERNAL_PROGRAM_ERROR  =  5,     
00393     U_MESSAGE_PARSE_ERROR     =  6,
00394     U_MEMORY_ALLOCATION_ERROR =  7,     
00395     U_INDEX_OUTOFBOUNDS_ERROR =  8,
00396     U_PARSE_ERROR             =  9,     
00397     U_INVALID_CHAR_FOUND      = 10,     
00398     U_TRUNCATED_CHAR_FOUND    = 11,     
00399     U_ILLEGAL_CHAR_FOUND      = 12,     
00400     U_INVALID_TABLE_FORMAT    = 13,     
00401     U_INVALID_TABLE_FILE      = 14,     
00402     U_BUFFER_OVERFLOW_ERROR   = 15,     
00403     U_UNSUPPORTED_ERROR       = 16,     
00404     U_RESOURCE_TYPE_MISMATCH  = 17,     
00405     U_ILLEGAL_ESCAPE_SEQUENCE = 18,     
00406     U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, 
00407     U_NO_SPACE_AVAILABLE      = 20,     
00408     U_CE_NOT_FOUND_ERROR      = 21,     
00409     U_PRIMARY_TOO_LONG_ERROR  = 22,     
00410     U_STATE_TOO_OLD_ERROR     = 23,     
00411     U_TOO_MANY_ALIASES_ERROR  = 24,     
00413     U_ENUM_OUT_OF_SYNC_ERROR  = 25,     
00414     U_INVARIANT_CONVERSION_ERROR = 26,  
00416     U_STANDARD_ERROR_LIMIT,             
00417     /* 
00418      * the error code range 0x10000 0x10100 are reserved for Transliterator
00419      */
00420     U_BAD_VARIABLE_DEFINITION=0x10000,
00421     U_PARSE_ERROR_START = 0x10000,      
00422     U_MALFORMED_RULE,
00423     U_MALFORMED_SET,
00424     U_MALFORMED_SYMBOL_REFERENCE,
00425     U_MALFORMED_UNICODE_ESCAPE,
00426     U_MALFORMED_VARIABLE_DEFINITION,
00427     U_MALFORMED_VARIABLE_REFERENCE,
00428     U_MISMATCHED_SEGMENT_DELIMITERS,
00429     U_MISPLACED_ANCHOR_START,
00430     U_MISPLACED_CURSOR_OFFSET,
00431     U_MISPLACED_QUANTIFIER,
00432     U_MISSING_OPERATOR,
00433     U_MISSING_SEGMENT_CLOSE,
00434     U_MULTIPLE_ANTE_CONTEXTS,
00435     U_MULTIPLE_CURSORS,
00436     U_MULTIPLE_POST_CONTEXTS,
00437     U_TRAILING_BACKSLASH,
00438     U_UNDEFINED_SEGMENT_REFERENCE,
00439     U_UNDEFINED_VARIABLE,
00440     U_UNQUOTED_SPECIAL,
00441     U_UNTERMINATED_QUOTE,
00442     U_RULE_MASK_ERROR,
00443     U_MISPLACED_COMPOUND_FILTER,
00444     U_MULTIPLE_COMPOUND_FILTERS,
00445     U_INVALID_RBT_SYNTAX,
00446     U_INVALID_PROPERTY_PATTERN,
00447     U_MALFORMED_PRAGMA,
00448     U_UNCLOSED_SEGMENT,
00449     U_ILLEGAL_CHAR_IN_SEGMENT,
00450     U_VARIABLE_RANGE_EXHAUSTED,         
00451     U_VARIABLE_RANGE_OVERLAP,           
00452     U_ILLEGAL_CHARACTER,
00453     U_INTERNAL_TRANSLITERATOR_ERROR,
00454     U_INVALID_ID,
00455     U_INVALID_FUNCTION,
00456     U_PARSE_ERROR_LIMIT,                
00458     /* 
00459      * the error code range 0x10100 0x10200 are reserved for formatting API parsing error
00460      */
00461     U_UNEXPECTED_TOKEN=0x10100,
00462     U_FMT_PARSE_ERROR_START=0x10100,
00463     U_MULTIPLE_DECIMAL_SEPERATORS,
00464     U_MULTIPLE_EXPONENTIAL_SYMBOLS,
00465     U_MALFORMED_EXPONENTIAL_PATTERN,
00466     U_MULTIPLE_PERCENT_SYMBOLS,
00467     U_MULTIPLE_PERMILL_SYMBOLS,
00468     U_MULTIPLE_PAD_SPECIFIERS,
00469     U_PATTERN_SYNTAX_ERROR,
00470     U_ILLEGAL_PAD_POSITION,
00471     U_UNMATCHED_BRACES,
00472     U_UNSUPPORTED_PROPERTY,
00473     U_UNSUPPORTED_ATTRIBUTE,
00474     U_FMT_PARSE_ERROR_LIMIT,
00475    
00476     /* 
00477      * the error code range 0x10200 0x10300 are reserved for Break Iterator related error
00478      */
00479     U_BRK_ERROR_START=0x10200,
00480     U_BRK_INTERNAL_ERROR,
00481     U_BRK_HEX_DIGITS_EXPECTED,
00482     U_BRK_SEMICOLON_EXPECTED,
00483     U_BRK_RULE_SYNTAX,
00484     U_BRK_UNCLOSED_SET,
00485     U_BRK_ASSIGN_ERROR,
00486     U_BRK_VARIABLE_REDFINITION,
00487     U_BRK_MISMATCHED_PAREN,
00488     U_BRK_NEW_LINE_IN_QUOTED_STRING,
00489     U_BRK_UNDEFINED_VARIABLE,
00490     U_BRK_ERROR_LIMIT,
00491 
00492     U_ERROR_LIMIT=U_BRK_ERROR_LIMIT 
00493 } UErrorCode;
00494 
00495 /* Use the following to determine if an UErrorCode represents */
00496 /* operational success or failure. */
00497 
00498 #ifdef XP_CPLUSPLUS
00499 
00503     static
00504     inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); }
00509     static
00510     inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); }
00511 #else
00512 
00516 #   define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
00517 
00521 #   define U_FAILURE(x) ((x)>U_ZERO_ERROR)
00522 #endif
00523 
00529 U_CAPI const char * U_EXPORT2
00530 u_errorName(UErrorCode code);
00531 
00532 
00533 
00534 /*===========================================================================*/
00535 /* Include header for platform utilies */
00536 /*===========================================================================*/
00537 
00538 #include "unicode/putil.h"
00539 
00540 #endif /* _UTYPES */

Generated on Thu Aug 15 14:13:35 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001