blob: 92cd4bed6173902084bc9256fde073595618735a [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Portions Copyright 2000-2003 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26/*
27 * (C) Copyright Taligent, Inc., 1996, 1997 *
28 * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
29 *
30 * The original version of this source code and documentation is
31 * copyrighted and owned by IBM. These materials are provided
32 * under terms of a License Agreement between IBM and Sun.
33 * This technology is protected by multiple US and International
34 * patents. This notice and attribution to IBM may not be removed.
35 */
36
37/*
38*
39* FILE NAME : UTYPES.H (formerly ptypes.h)
40*
41* Date Name Description
42* 12/11/96 helena Creation.
43* 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32,
44* uint8, uint16, and uint32.
45* 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C as
46* well as C++.
47* Modified to use memcpy() for icu_arrayCopy() fns.
48* 04/14/97 aliu Added TPlatformUtilities.
49* 05/07/97 aliu Added import/export specifiers (replacing the old
50* broken EXT_CLASS). Added version number for our
51* code. Cleaned up header.
52* 6/20/97 helena Java class name change.
53* 08/11/98 stephen UErrorCode changed from typedef to enum
54* 08/12/98 erm Changed T_ANALYTIC_PACKAGE_VERSION to 3
55* 08/14/98 stephen Added icu_arrayCopy() for int8_t, int16_t, int32_t
56* 12/09/98 jfitz Added BUFFER_OVERFLOW_ERROR (bug 1100066)
57* 04/20/99 stephen Cleaned up & reworked for autoconf.
58* Renamed to utypes.h.
59* 05/05/99 stephen Changed to use <inttypes.h>
60* 10/12/00 dfelt Adapted to use javavm types (plus juint from j2d)
61*******************************************************************************
62*/
63
64#ifndef UTYPES_H
65#define UTYPES_H
66
67// doesn't seem to be a way of getting around this
68
69//#if defined(WIN32) || defined(_WIN32)
70// not needed since we don't export to another dll
71
72#if 0
73
74#define U_EXPORT __declspec(dllexport)
75#define U_EXPORT2
76#define U_IMPORT __declspec(dllimport)
77
78#else
79
80#define U_EXPORT
81#define U_EXPORT2
82#define U_IMPORT
83
84#endif
85
86#ifdef XP_CPLUSPLUS
87# define U_CFUNC extern "C"
88# define U_CDECL_BEGIN extern "C" {
89# define U_CDECL_END }
90#else
91# define U_CFUNC
92# define U_CDECL_BEGIN
93# define U_CDECL_END
94#endif
95#define U_CAPI U_CFUNC U_EXPORT
96
97// defines jboolean, jchar, jshort, and jint via jni_md.h
98#include "jni.h"
99// defines jubyte, jushort, juint
100#include "j2d_md.h"
101
102typedef jboolean bool_t;
103
104/*
105 * win32 does not have standard definitions for the following:
106 */
107#ifdef WIN32
108
109#ifndef __int8_t_defined
110typedef jbyte int8_t;
111typedef jshort int16_t;
112typedef jint int32_t;
113#endif
114
115typedef jubyte uint8_t;
116typedef jushort uint16_t;
117typedef juint uint32_t;
118
119#endif /* WIN32 */
120
121/*===========================================================================*/
122/* Unicode character */
123/*===========================================================================*/
124typedef uint16_t UChar;
125
126
127/** Error code to replace exception handling */
128enum UErrorCode {
129 U_ERROR_INFO_START = -128, /* Start of information results (semantically successful) */
130 U_USING_FALLBACK_ERROR = -128,
131 U_USING_DEFAULT_ERROR = -127,
132 U_ERROR_INFO_LIMIT,
133
134 U_ZERO_ERROR = 0, /* success */
135
136 U_ILLEGAL_ARGUMENT_ERROR = 1, /* Start of codes indicating failure */
137 U_MISSING_RESOURCE_ERROR = 2,
138 U_INVALID_FORMAT_ERROR = 3,
139 U_FILE_ACCESS_ERROR = 4,
140 U_INTERNAL_PROGRAM_ERROR = 5, /* Indicates a bug in the library code */
141 U_MESSAGE_PARSE_ERROR = 6,
142 U_MEMORY_ALLOCATION_ERROR = 7, /* Memory allocation error */
143 U_INDEX_OUTOFBOUNDS_ERROR = 8,
144 U_PARSE_ERROR = 9, /* Equivalent to Java ParseException */
145 U_INVALID_CHAR_FOUND = 10, /* In the Character conversion routines: Invalid character or sequence was encountered*/
146 U_TRUNCATED_CHAR_FOUND = 11, /* In the Character conversion routines: More bytes are required to complete the conversion successfully*/
147 U_ILLEGAL_CHAR_FOUND = 12, /* In codeset conversion: a sequence that does NOT belong in the codepage has been encountered*/
148 U_INVALID_TABLE_FORMAT = 13, /* Conversion table file found, but corrupted*/
149 U_INVALID_TABLE_FILE = 14, /* Conversion table file not found*/
150 U_BUFFER_OVERFLOW_ERROR = 15, /* A result would not fit in the supplied buffer */
151 U_UNSUPPORTED_ERROR = 16, /* Requested operation not supported in current context */
152 U_ERROR_LIMIT
153};
154
155#ifndef XP_CPLUSPLUS
156typedef enum UErrorCode UErrorCode;
157#endif
158
159/* Use the following to determine if an UErrorCode represents */
160/* operational success or failure. */
161#ifdef XP_CPLUSPLUS
162inline bool_t U_SUCCESS(UErrorCode code) { return (bool_t)(code<=U_ZERO_ERROR); }
163inline bool_t U_FAILURE(UErrorCode code) { return (bool_t)(code>U_ZERO_ERROR); }
164#else
165#define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
166#define U_FAILURE(x) ((x)>U_ZERO_ERROR)
167#endif
168
169#ifndef TRUE
170# define TRUE 1
171#endif
172#ifndef FALSE
173# define FALSE 0
174#endif
175
176// UTYPES_H
177#endif