Main Page   Class Hierarchy   Compound List   File List   Header Files   Sources   Compound Members   File Members  

utypes.h

00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1996-1999, 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 #include "unicode/umachine.h"
00036 #include "unicode/utf.h"
00037 
00038 #ifndef __OS400__
00039 #include <memory.h>
00040 #endif
00041 #include <stdlib.h>
00042 
00043 /*===========================================================================*/
00044 /* char Character set family                                                 */
00045 /*===========================================================================*/
00046 
00047 /*
00048  * These definitions allow to specify the encoding of text
00049  * in the char data type as defined by the platform and the compiler.
00050  * It is enough to determine the code point values of "invariant characters",
00051  * which are the ones shared by all encodings that are in use
00052  * on a given platform.
00053  *
00054  * Those "invariant characters" should be all the uppercase and lowercase
00055  * latin letters, the digits, the space, and "basic punctuation".
00056  * Also, '\n', '\r', '\t' should be available.
00057  *
00058  * The list of "invariant characters" is:
00059  *    A-Z  a-z  0-9  SPACE  "  %  &  '  (  )  *  +  ,  -  .  /  :  ;  <  =  >  ?  _
00060  * (52 letters + 10 numbers + 20 punc/sym = 82 total)
00061  *
00062  * In other words, all the graphic characters in 7-bit ASCII should
00063  * be safely accessible except the following:
00064  * 
00065  *    '\' <backslash>
00066  *    '[' <left bracket>
00067  *    ']' <right bracket>
00068  *    '{' <left brace>
00069  *    '}' <right brace>
00070  *    '^' <circumflex>
00071  *    '~' <tilde>
00072  *    '!' <exclamation mark>
00073  *    '#' <number sign>
00074  *    '|' <vertical line>
00075  *    '$' <dollar sign>
00076  *    '@' <commercial at>
00077  *    '`' <grave accent>
00078  */
00079 
00080 #define U_ASCII_FAMILY 0
00081 #define U_EBCDIC_FAMILY 1
00082 
00083 #ifndef U_CHARSET_FAMILY
00084 #   define U_CHARSET_FAMILY 0
00085 #endif
00086 
00087 /*===========================================================================*/
00088 /* Related version information                                               */
00089 /*===========================================================================*/
00090 #define U_ICU_VERSION "1.5"
00091 
00092 #define U_MAX_VERSION_LENGTH 4
00093 #define U_VERSION_DELIMITER '.'
00094 #define U_MAX_VERSION_STRING_LENGTH 20
00095 
00096 typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
00097 
00098 /* Work around the OS390 compiler issue, to be removed when the compiler 
00099 updates come out.  */
00100 #if defined(OS390) && defined(XP_CPLUSPLUS)
00101 #    define U_CALLCONV __cdecl
00102 #else
00103 #    define U_CALLCONV 
00104 #endif
00105 
00106 /* Define NULL (the wrong way, cast to void *) if it does not exist. */
00107 #ifndef NULL
00108 #ifdef XP_CPLUSPLUS
00109 #define NULL    0
00110 #else
00111 #define NULL    ((void *)0)
00112 #endif
00113 #endif
00114 
00115 /* Maximum value of a (void*) - use to indicate the limit of
00116    an 'infinite' buffer.  */
00117 #ifndef U_MAX_PTR
00118 #define U_MAX_PTR ((void*)-1)
00119 #endif
00120 
00121 /*===========================================================================*/
00122 /* Calendar/TimeZone data types                                              */
00123 /*===========================================================================*/
00124 
00131 typedef double UDate;
00132 
00133 /* Common time manipulation constants */
00134 #define U_MILLIS_PER_SECOND        (1000)
00135 #define U_MILLIS_PER_MINUTE       (60000)
00136 #define U_MILLIS_PER_HOUR       (3600000)
00137 #define U_MILLIS_PER_DAY       (86400000)
00138 
00139 
00140 /*===========================================================================*/
00141 /* UClassID-based RTTI */
00142 /*===========================================================================*/
00143 
00181 typedef void* UClassID;
00182 
00183 /*===========================================================================*/
00184 /* Shared library/DLL import-export API control                              */
00185 /*===========================================================================*/
00186 
00193 #ifdef U_COMMON_IMPLEMENTATION
00194 #define U_COMMON_API  U_EXPORT
00195 #define U_I18N_API    U_IMPORT
00196 #elif defined(U_I18N_IMPLEMENTATION)
00197 #define U_COMMON_API  U_IMPORT
00198 #define U_I18N_API    U_EXPORT
00199 #else
00200 #define U_COMMON_API  U_IMPORT
00201 #define U_I18N_API    U_IMPORT
00202 #endif
00203 /*===========================================================================*/
00204 /* UErrorCode */
00205 /*===========================================================================*/
00206 
00210 enum UErrorCode {
00211     U_ERROR_INFO_START        = -128,     /* Start of information results (semantically successful) */
00212     U_USING_FALLBACK_ERROR    = -128,
00213     U_USING_DEFAULT_ERROR     = -127,
00214     U_ERROR_INFO_LIMIT,
00215 
00217     U_ZERO_ERROR              =  0,             
00218 
00219     U_ILLEGAL_ARGUMENT_ERROR  =  1,       /* Start of codes indicating failure */
00220     U_MISSING_RESOURCE_ERROR  =  2,
00221     U_INVALID_FORMAT_ERROR    =  3,
00222     U_FILE_ACCESS_ERROR       =  4,
00223     U_INTERNAL_PROGRAM_ERROR  =  5,       /* Indicates a bug in the library code */
00224     U_MESSAGE_PARSE_ERROR     =  6,
00225     U_MEMORY_ALLOCATION_ERROR =  7,       /* Memory allocation error */
00226     U_INDEX_OUTOFBOUNDS_ERROR =  8,
00227     U_PARSE_ERROR             =  9,       /* Equivalent to Java ParseException */
00228     U_INVALID_CHAR_FOUND      = 10,       /* In the Character conversion routines: Invalid character or sequence was encountered*/
00229     U_TRUNCATED_CHAR_FOUND    = 11,       /* In the Character conversion routines: More bytes are required to complete the conversion successfully*/
00230     U_ILLEGAL_CHAR_FOUND      = 12,       /* In codeset conversion: a sequence that does NOT belong in the codepage has been encountered*/
00231     U_INVALID_TABLE_FORMAT    = 13,       /* Conversion table file found, but corrupted*/
00232     U_INVALID_TABLE_FILE      = 14,       /* Conversion table file not found*/
00233     U_BUFFER_OVERFLOW_ERROR   = 15,       /* A result would not fit in the supplied buffer */
00234     U_UNSUPPORTED_ERROR       = 16,       /* Requested operation not supported in current context */
00235     U_RESOURCE_TYPE_MISMATCH  = 17,       /* an operation is requested over a resource that does not support it*/
00236     U_ERROR_LIMIT
00237 };
00238 
00239 #ifndef XP_CPLUSPLUS
00240 typedef enum UErrorCode UErrorCode;
00241 #endif
00242 
00243 /* Use the following to determine if an UErrorCode represents */
00244 /* operational success or failure. */
00245 #ifdef XP_CPLUSPLUS
00247 inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); }
00249 inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); }
00250 #else
00252 #define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
00254 #define U_FAILURE(x) ((x)>U_ZERO_ERROR)
00255 #endif
00256 
00262 U_CAPI const char * U_EXPORT2
00263 u_errorName(UErrorCode code);
00264 
00265 /* Casting function for int32_t (backward compatibility version, here until
00266    T_INT32 is replaced) */
00267 #define T_INT32(i) ((int32_t)i)
00268 
00269 #define U_COPYRIGHT_STRING \
00270   " Copyright (C) 2000, International Business Machines Corporation and others.  All Rights Reserved. "
00271 
00272 #define U_COPYRIGHT_STRING_LENGTH  160
00273 
00274 /*===========================================================================*/
00275 /* Include header for platform utilies */
00276 /*===========================================================================*/
00277 
00278 
00279 
00280 /* Mutex data type.  INTERNAL.*/
00281 typedef void *UMTX;
00282 
00283 
00284 #include "unicode/putil.h"
00285 
00286 #endif /* _UTYPES */

Generated at Mon Jun 5 12:53:09 2000 for ICU1.5 by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999