|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CXML_TYPE_DEF_H |
|
20 #define CXML_TYPE_DEF_H |
|
21 |
|
22 #warning The CXML API will be removed wk25. Please see http://wikis.in.nokia.com/Browser/APIMigration for more information |
|
23 |
|
24 /* |
|
25 * ANSI/ISO C header files needed to define basic data types |
|
26 * (ie. NULL, etc) |
|
27 */ |
|
28 #include <stdlib.h> |
|
29 #include <assert.h> |
|
30 |
|
31 #ifdef __cplusplus |
|
32 extern "C" { |
|
33 #endif |
|
34 |
|
35 /* Data types in cXML */ |
|
36 //typedef unsigned char bool8; |
|
37 typedef unsigned char byte; |
|
38 typedef unsigned short int word; |
|
39 typedef unsigned long int dword; |
|
40 |
|
41 typedef unsigned char uint8; |
|
42 typedef unsigned short int uint16; |
|
43 typedef unsigned long int uint32; |
|
44 |
|
45 typedef signed char int8; |
|
46 typedef signed short int int16; |
|
47 typedef signed long int int32; |
|
48 |
|
49 typedef unsigned char CXML_Bool; /* NW_FALSE, NW_TRUE */ |
|
50 typedef byte CXML_Byte; /* 0 ... 0xFF */ |
|
51 typedef word CXML_Word; /* 0 ... 0xFFFF */ |
|
52 typedef dword CXML_Dword; /* 0 ... 0xFFFFFFFF */ |
|
53 |
|
54 typedef uint8 CXML_Uint8; /* 0 ... 255 */ |
|
55 typedef uint16 CXML_Uint16; /* 0 ... 65535 */ |
|
56 typedef uint32 CXML_Uint32; /* 0 ... 4294967295 */ |
|
57 |
|
58 typedef int8 CXML_Int8; /* -128 ... +127 */ |
|
59 typedef int16 CXML_Int16; /* -32768 ... +32767 */ |
|
60 typedef int32 CXML_Int32; /* -2147483648 ... +2147483647 */ |
|
61 |
|
62 typedef unsigned short CXML_Ucs2; /* 0 ... 65535 */ |
|
63 |
|
64 typedef CXML_Uint32 NW_TinyTree_Offset_t; |
|
65 |
|
66 #define CXML_ASSERT(expr) assert(((CXML_Uint32)(expr)) != 0) |
|
67 /* Use following to catch the ASSERT in Wins |
|
68 #if defined(__WINS__) && !defined(__WINSCW__) |
|
69 int kimono_assert (); |
|
70 #define CXML_ASSERT(expr) ((((CXML_Uint32)(expr)) != 0) || kimono_assert()) |
|
71 #else |
|
72 #define CXML_ASSERT(expr) assert(((CXML_Uint32)(expr)) != 0) |
|
73 #endif |
|
74 */ |
|
75 |
|
76 #define CXML_TRUE ((CXML_Bool) 0x01U) |
|
77 #define CXML_FALSE ((CXML_Bool) 0x00U) |
|
78 |
|
79 #define CXML_UINT16_MAX ((NW_Uint16) 0xFFFFU) |
|
80 #define CXML_UINT32_MAX ((NW_Uint32) 0xFFFFFFFFU) |
|
81 #define CXML_INT32_MIN ((NW_Int32) 0x80000000U) |
|
82 #define CXML_INT32_MAX ((NW_Int32) 0x7FFFFFFFU) |
|
83 |
|
84 #define CXML_UINT16_CAST(expr) \ |
|
85 ( (CXML_ASSERT((-(CXML_Int16)(expr)) <= 0 && \ |
|
86 ((CXML_Uint16)(expr)) <= CXML_UINT16_MAX)), \ |
|
87 ((CXML_Uint16)(expr)) ) |
|
88 |
|
89 #define CXML_UINT32_CAST(expr) \ |
|
90 ( (CXML_ASSERT((-(CXML_Int32)(expr)) <= 0 && \ |
|
91 ((CXML_Uint32)(expr)) <= CXML_UINT32_MAX)), \ |
|
92 ((CXML_Uint32)(expr)) ) |
|
93 |
|
94 #define CXML_INT32_CAST(expr) \ |
|
95 ( (CXML_ASSERT(((CXML_Int32)(expr)) >= CXML_INT32_MIN && \ |
|
96 ((CXML_Int32)(expr)) <= CXML_INT32_MAX)), \ |
|
97 ((CXML_Int32)(expr)) ) |
|
98 |
|
99 |
|
100 /* Vector types */ |
|
101 typedef CXML_Uint32 CXML_Vector_Metric_t; |
|
102 #define CXML_Vector_AtEnd ((CXML_Vector_Metric_t) ~0) |
|
103 #define CXML_Vector_AtFront ((CXML_Vector_Metric_t) 0) |
|
104 #define CXML_SEGMENT_LIST_INCREMENT 4 |
|
105 |
|
106 |
|
107 #define CXML_ASCII_NULL 0x00 |
|
108 #define CXML_ASCII_UPPER_A 0x41 |
|
109 #define CXML_ASCII_UPPER_F 0x46 |
|
110 #define CXML_ASCII_UPPER_Z 0x5A |
|
111 |
|
112 #define CXML_ASCII_LOWER_A 0x61 |
|
113 #define CXML_ASCII_0 0x30 |
|
114 #define CXML_ASCII_LOWER_F 0x66 |
|
115 #define CXML_ASCII_9 0x39 |
|
116 #define CXML_ASCII_LOWER_Z 0x7A |
|
117 |
|
118 #define CXML_ASCII_SPACE 0x20 |
|
119 #define CXML_ASCII_HT 0x09 |
|
120 #define CXML_ASCII_LF 0x0a |
|
121 #define CXML_ASCII_VT 0x0b |
|
122 #define CXML_ASCII_FF 0x0c |
|
123 #define CXML_ASCII_CR 0x0d |
|
124 |
|
125 /* |
|
126 * Used to supress compiler warnings about required, |
|
127 * but unused function parameters |
|
128 */ |
|
129 #define CXML_REQUIRED_PARAM(param) if (param) {}; |
|
130 |
|
131 /* |
|
132 ** Type Declarations |
|
133 */ |
|
134 typedef struct { |
|
135 CXML_Uint32 length; /* length of the used part of the buffer */ |
|
136 CXML_Uint32 allocatedLength; /* How much space was really allocated */ |
|
137 CXML_Byte *data; /* the real data */ |
|
138 } CXML_Buffer_t; |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 /* Forward declarations */ |
|
144 typedef struct CXML_Vector_s CXML_Vector_t; |
|
145 |
|
146 #ifdef __cplusplus |
|
147 } /* extern "C" */ |
|
148 #endif |
|
149 |
|
150 #endif /* CXML_TYPE_DEF_H */ |