web_plat/cxml_library_api/inc/cxml_type_def.h
changeset 0 dd21522fd290
child 48 79859ed3eea9
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 /*
       
    23  *  ANSI/ISO C header files needed to define basic data types
       
    24  * (ie. NULL, etc)
       
    25  */
       
    26 #include <stdlib.h>
       
    27 #include <assert.h>
       
    28 
       
    29 #ifdef __cplusplus
       
    30 extern "C" {
       
    31 #endif
       
    32 
       
    33 /* Data types in cXML */
       
    34 //typedef unsigned char           bool8;
       
    35 typedef unsigned char           byte;
       
    36 typedef unsigned short int      word;
       
    37 typedef unsigned long int       dword;
       
    38 
       
    39 typedef unsigned char           uint8;
       
    40 typedef unsigned short int      uint16;
       
    41 typedef unsigned long int       uint32;
       
    42 
       
    43 typedef signed   char           int8;
       
    44 typedef signed   short int      int16;
       
    45 typedef signed   long int       int32;
       
    46 
       
    47 typedef unsigned char         CXML_Bool;        /* NW_FALSE, NW_TRUE  */
       
    48 typedef byte          CXML_Byte;        /* 0 ... 0xFF         */
       
    49 typedef word          CXML_Word;        /* 0 ... 0xFFFF       */
       
    50 typedef dword         CXML_Dword;       /* 0 ... 0xFFFFFFFF   */
       
    51 
       
    52 typedef uint8         CXML_Uint8;       /* 0 ... 255          */
       
    53 typedef uint16        CXML_Uint16;      /* 0 ... 65535        */
       
    54 typedef uint32        CXML_Uint32;      /* 0 ... 4294967295   */
       
    55 
       
    56 typedef int8          CXML_Int8;        /* -128 ... +127      */
       
    57 typedef int16         CXML_Int16;       /* -32768 ... +32767  */
       
    58 typedef int32         CXML_Int32;       /* -2147483648 ... +2147483647 */
       
    59 
       
    60 typedef unsigned short CXML_Ucs2;       /* 0 ... 65535        */
       
    61 
       
    62 typedef CXML_Uint32 NW_TinyTree_Offset_t;
       
    63 
       
    64 #define CXML_ASSERT(expr) assert(((CXML_Uint32)(expr)) != 0)
       
    65 /* Use following to catch the ASSERT in Wins
       
    66 #if defined(__WINS__) && !defined(__WINSCW__)
       
    67 int kimono_assert ();
       
    68 #define CXML_ASSERT(expr) ((((CXML_Uint32)(expr)) != 0) || kimono_assert())
       
    69 #else
       
    70 #define CXML_ASSERT(expr) assert(((CXML_Uint32)(expr)) != 0)
       
    71 #endif
       
    72 */
       
    73 
       
    74 #define CXML_TRUE         ((CXML_Bool)  0x01U)
       
    75 #define CXML_FALSE        ((CXML_Bool)  0x00U)
       
    76 
       
    77 #define CXML_UINT16_MAX   ((NW_Uint16) 0xFFFFU)
       
    78 #define CXML_UINT32_MAX   ((NW_Uint32) 0xFFFFFFFFU)
       
    79 #define CXML_INT32_MIN    ((NW_Int32)  0x80000000U)
       
    80 #define CXML_INT32_MAX    ((NW_Int32)  0x7FFFFFFFU)
       
    81 
       
    82 #define CXML_UINT16_CAST(expr) \
       
    83         ( (CXML_ASSERT((-(CXML_Int16)(expr)) <= 0 && \
       
    84                      ((CXML_Uint16)(expr)) <= CXML_UINT16_MAX)), \
       
    85           ((CXML_Uint16)(expr)) )  
       
    86 
       
    87 #define CXML_UINT32_CAST(expr) \
       
    88         ( (CXML_ASSERT((-(CXML_Int32)(expr)) <= 0 && \
       
    89                      ((CXML_Uint32)(expr)) <= CXML_UINT32_MAX)), \
       
    90           ((CXML_Uint32)(expr)) )  
       
    91 
       
    92 #define CXML_INT32_CAST(expr) \
       
    93         ( (CXML_ASSERT(((CXML_Int32)(expr)) >= CXML_INT32_MIN && \
       
    94                      ((CXML_Int32)(expr)) <= CXML_INT32_MAX)), \
       
    95           ((CXML_Int32)(expr)) )
       
    96 
       
    97 
       
    98 /* Vector types */
       
    99 typedef CXML_Uint32 CXML_Vector_Metric_t;
       
   100 #define CXML_Vector_AtEnd   ((CXML_Vector_Metric_t) ~0)
       
   101 #define CXML_Vector_AtFront ((CXML_Vector_Metric_t) 0)
       
   102 #define CXML_SEGMENT_LIST_INCREMENT 4
       
   103 
       
   104 
       
   105 #define CXML_ASCII_NULL                0x00
       
   106 #define CXML_ASCII_UPPER_A             0x41
       
   107 #define CXML_ASCII_UPPER_F             0x46
       
   108 #define CXML_ASCII_UPPER_Z             0x5A
       
   109 
       
   110 #define CXML_ASCII_LOWER_A             0x61
       
   111 #define CXML_ASCII_0                   0x30
       
   112 #define CXML_ASCII_LOWER_F             0x66
       
   113 #define CXML_ASCII_9                   0x39
       
   114 #define CXML_ASCII_LOWER_Z             0x7A
       
   115 
       
   116 #define CXML_ASCII_SPACE               0x20
       
   117 #define CXML_ASCII_HT                  0x09
       
   118 #define CXML_ASCII_LF                  0x0a
       
   119 #define CXML_ASCII_VT                  0x0b
       
   120 #define CXML_ASCII_FF                  0x0c
       
   121 #define CXML_ASCII_CR                  0x0d
       
   122 
       
   123 /* 
       
   124  * Used to supress compiler warnings about required, 
       
   125  * but unused function parameters 
       
   126  */
       
   127 #define CXML_REQUIRED_PARAM(param) if (param) {};
       
   128 
       
   129 /*
       
   130 ** Type Declarations
       
   131 */
       
   132 typedef struct {
       
   133   CXML_Uint32  length;           /* length of the used part of the buffer */
       
   134   CXML_Uint32  allocatedLength;  /* How much space was really allocated */
       
   135   CXML_Byte    *data;            /* the real data */
       
   136 } CXML_Buffer_t;
       
   137 
       
   138 
       
   139 
       
   140 
       
   141 /* Forward declarations */
       
   142 typedef struct CXML_Vector_s CXML_Vector_t;
       
   143 
       
   144 #ifdef __cplusplus
       
   145 } /* extern "C" */
       
   146 #endif
       
   147 
       
   148 #endif /* CXML_TYPE_DEF_H */