libopc
config.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010, Florian Reuter
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions
7  are met:
8 
9  * Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  * Redistributions in binary form must reproduce the above copyright
12  notice, this list of conditions and the following disclaimer in
13  the documentation and/or other materials provided with the
14  distribution.
15  * Neither the name of Florian Reuter nor the names of its contributors
16  may be used to endorse or promote products derived from this
17  software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30  OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
34 #ifndef OPC_CONFIG_H
35 #define OPC_CONFIG_H
36 
37 #include <libxml/xmlstring.h>
38 #include <plib/plib.h>
39 #include <assert.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 
50 #define OPC_ASSERT(e) assert(e)
51 
56 #ifdef NDEBUG
57 #define OPC_ENSURE(e) (void)(e)
58 #else
59 #define OPC_ENSURE(e) assert(e)
60 #endif
61 
62 
67 #define OPC_TRUE (0==0)
68 
73 #define OPC_FALSE (0==1)
74 
79  typedef pbool_t opc_bool_t;
80 
85  typedef pofs_t opc_ofs_t;
86 
91  typedef puint8_t opc_uint8_t;
92 
97  typedef puint16_t opc_uint16_t;
98 
103  typedef puint32_t opc_uint32_t;
104 
109  typedef puint64_t opc_uint64_t;
110 
115  typedef pint8_t opc_int8_t;
116 
121  typedef pint16_t opc_int16_t;
122 
127  typedef pint32_t opc_int32_t;
128 
133  typedef pint64_t opc_int64_t;
134 
138 #define OPC_DEFLATE_BUFFER_SIZE 4096
139 
143 #define OPC_MAX_PATH 512
144 
148  typedef enum OPC_ERROR_ENUM {
149  OPC_ERROR_NONE,
150  OPC_ERROR_STREAM,
151  OPC_ERROR_SEEK, // can't seek
152  OPC_ERROR_UNSUPPORTED_DATA_DESCRIPTOR,
153  OPC_ERROR_UNSUPPORTED_COMPRESSION,
154  OPC_ERROR_DEFLATE,
155  OPC_ERROR_HEADER,
156  OPC_ERROR_MEMORY,
157  OPC_ERROR_XML,
158  OPC_ERROR_USER // user triggered an abort
159  } opc_error_t;
160 
165  OPC_COMPRESSIONOPTION_NONE,
166  OPC_COMPRESSIONOPTION_NORMAL,
167  OPC_COMPRESSIONOPTION_MAXIMUM,
168  OPC_COMPRESSIONOPTION_FAST,
169  OPC_COMPRESSIONOPTION_SUPERFAST
171 
172 
177 #define opc_logf printf
178 
183 #define opc_bzero_mem(m,s) memset(m, 0, s)
184 
185 #ifdef __cplusplus
186 } /* extern "C" */
187 #endif
188 
189 #endif /* OPC_CONFIG_H */
puint64_t opc_uint64_t
Definition: config.h:109
puint16_t opc_uint16_t
Definition: config.h:97
pint32_t opc_int32_t
Definition: config.h:127
puint8_t opc_uint8_t
Definition: config.h:91
pint8_t opc_int8_t
Definition: config.h:115
pbool_t opc_bool_t
Definition: config.h:79
OPC_ERROR_ENUM
Definition: config.h:148
puint32_t opc_uint32_t
Definition: config.h:103
enum OPC_COMPRESSIONOPTION_ENUM opcCompressionOption_t
enum OPC_ERROR_ENUM opc_error_t
pofs_t opc_ofs_t
Definition: config.h:85
pint16_t opc_int16_t
Definition: config.h:121
pint64_t opc_int64_t
Definition: config.h:133
OPC_COMPRESSIONOPTION_ENUM
Definition: config.h:164