1 /*
2  * libwbxml, the WBXML Library.
3  * Copyright (C) 2002-2008 Aymerick Jehanne <aymerick@jehanne.org>
4  * Copyright (C) 2011 Michael Bell <michael.bell@opensync.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * LGPL v2.1: http://www.gnu.org/copyleft/lesser.txt
21  *
22  * Contact: aymerick@jehanne.org
23  * Home: http://libwbxml.aymerick.com
24  */
25 
26 /**
27  * @file wbxml.h
28  * @ingroup wbxml
29  *
30  * @author Aymerick Jehanne <aymerick@jehanne.org>
31  * @date 02/11/11
32  *
33  * @brief WBXML Library Main Header
34  */
35 
36 #ifndef WBXML_DEFINES_H
37 #define WBXML_DEFINES_H
38 
39 #if defined( __SYMBIAN32__ )
40 /* For basic Symbian Types */
41 #include <e32def.h>
42 #endif /* __SYMBIAN32__ */
43 
44 /*
45  * This sytem includes are here instead of the *.c files because
46  * we want them to be included AFTER 'e32def.h' on Symbian. If not so,
47  * a lot of Warnings are displayed ('NULL' : macro redefinition)
48  */
49 #include <stdlib.h>
50 #include <string.h>
51 
52 
53 /** @addtogroup wbxml
54  *  @{
55  */
56 
57 /* WBXML Lib basic types redefinition */
58 #define WB_BOOL unsigned char
59 #define WB_UTINY unsigned char
60 #define WB_TINY char
61 #define WB_ULONG unsigned int
62 #define WB_LONG int
63 
64 #ifndef TRUE
65 #define TRUE 1
66 #endif
67 
68 #ifndef FALSE
69 #define FALSE 0
70 #endif
71 
72 #ifndef NULL
73 #define NULL 0
74 #endif
75 
76 /* Define NULL string */
77 #define WBXML_UTINY_NULL_STRING ((WB_UTINY *)"")
78 
79 /* WBXML Lib string functions */
80 #define WBXML_STRLEN(a) strlen((const WB_TINY*)a)
81 #define WBXML_STRCMP(a,b) strcmp((const WB_TINY*)a,(const WB_TINY*)b)
82 #define WBXML_STRNCMP(a,b,c) strncmp((const WB_TINY*)a,(const WB_TINY*)b,c)
83 #define WBXML_STRSTR(a,b) strstr((const WB_TINY*)a,(const WB_TINY*)b)
84 #if defined( WIN32 )
85 #define WBXML_STRCASECMP(a,b) _stricmp((const WB_TINY*)a,(const WB_TINY*)b)
86 #define WBXML_STRNCASECMP(a,b,c) _strnicmp((const WB_TINY*)a,(const WB_TINY*)b,c)
87 #else
88 #define WBXML_STRCASECMP(a,b) strcasecmp((const WB_TINY*)a,(const WB_TINY*)b)
89 #define WBXML_STRNCASECMP(a,b,c) strncasecmp((const WB_TINY*)a,(const WB_TINY*)b,c)
90 #endif /* WIN32 */
91 
92 #define WBXML_ISDIGIT(a) isdigit(a)
93 
94 /* For DLL exported functions */
95 #if defined( __SYMBIAN32__ )
96 #define WBXML_DECLARE(type) EXPORT_C type
97 #define WBXML_DECLARE_NONSTD(type) EXPORT_C type
98 #else  /* __SYMBIAN32__ */
99 #if defined( WIN32 )
100 #define WBXML_DECLARE(type) __declspec(dllexport) type __stdcall
101 #define WBXML_DECLARE_NONSTD(type) __declspec(dllexport) type
102 #else  /* WIN32 */
103 #define WBXML_DECLARE(type) type
104 #define WBXML_DECLARE_NONSTD(type) type
105 #endif /* WIN32 */
106 #endif /* __SYMBIAN32__ */
107 
108 #if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)
109   /* gcc >= 3.2 */
110 # define LIBWBXML_DEPRECATED __attribute__ ((deprecated))
111 #elif defined(_MSC_VER) && (_MSC_VER >= 1300) && (_MSC_VER < 1400)
112   /* msvc >= 7 */
113 # define LIBWBXML_DEPRECATED __declspec(deprecated)
114 #elif defined(_MSV_VER) && (_MSC_VER >= 1400)
115   /* MS Visual Studio 2005 */
116 # define LIBWBXML_DEPRECATED
117 #else
118 # define LIBWBXML_DEPRECATED
119 #endif
120 
121 /** Backward compatibility flag */
122 #define WBXML_BACKWARD_COMPAT
123 
124 #if defined( WBXML_BACKWARD_COMPAT )
125 
126 /* 0.9.2 */
127 #define WBXML_ENCODER_XML_GEN_COMPACT   WBXML_GEN_XML_COMPACT
128 #define WBXML_ENCODER_XML_GEN_INDENT    WBXML_GEN_XML_INDENT
129 #define WBXML_ENCODER_XML_GEN_CANONICAL WBXML_GEN_XML_CANONICAL
130 
131 #define WBXMLEncoderXMLGenType   WBXMLGenXMLType     LIBWBXML_DEPRECATED
132 #define WBXMLConvWBXML2XMLParams WBXMLGenXMLParams   LIBWBXML_DEPRECATED
133 #define WBXMLConvXML2WBXMLParams WBXMLGenWBXMLParams LIBWBXML_DEPRECATED
134 
135 // #define WBXMLTag      WBXMLTagName
136 // #define WBXMLTagEntry WBXMLTagNameEntry
137 
138 #endif /* WBXML_BACKWARD_COMPAT */
139 
140 /** @} */
141 
142 #endif /* WBXML_DEFINES_H */
143