libfreehand_utils.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is part of the libfreehand project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef __LIBFREEHAND_UTILS_H__
11 #define __LIBFREEHAND_UTILS_H__
12 
13 #include <stdio.h>
14 #include <string>
15 #include <math.h>
16 #include <libwpd/libwpd.h>
17 #include <libwpd-stream/libwpd-stream.h>
18 
19 #ifndef M_PI
20 #define M_PI 3.14159265358979323846
21 #endif
22 
23 #define FH_EPSILON 1E-6
24 #define FH_ALMOST_ZERO(m) (fabs(m) <= FH_EPSILON)
25 
26 #ifdef _MSC_VER
27 
28 typedef unsigned char uint8_t;
29 typedef unsigned short uint16_t;
30 typedef unsigned uint32_t;
31 typedef unsigned __int64 uint64_t;
32 typedef signed char int8_t;
33 typedef short int16_t;
34 typedef int int32_t;
35 typedef __int64 int64_t;
36 
37 #else
38 
39 #ifdef HAVE_CONFIG_H
40 
41 #include <config.h>
42 
43 #ifdef HAVE_STDINT_H
44 #include <stdint.h>
45 #endif
46 
47 #ifdef HAVE_INTTYPES_H
48 #include <inttypes.h>
49 #endif
50 
51 #else
52 
53 // assume that the headers are there inside LibreOffice build when no HAVE_CONFIG_H is defined
54 #include <stdint.h>
55 #include <inttypes.h>
56 
57 #endif
58 
59 #endif
60 
61 // debug message includes source file and line number
62 //#define VERBOSE_DEBUG 1
63 
64 // do nothing with debug messages in a release compile
65 #ifdef DEBUG
66 #ifdef VERBOSE_DEBUG
67 #define FH_DEBUG_MSG(M) printf("%15s:%5d: ", __FILE__, __LINE__); printf M
68 #define FH_DEBUG(M) M
69 #else
70 #define FH_DEBUG_MSG(M) printf M
71 #define FH_DEBUG(M) M
72 #endif
73 #else
74 #define FH_DEBUG_MSG(M)
75 #define FH_DEBUG(M)
76 #endif
77 
78 namespace libfreehand
79 {
80 
81 uint8_t readU8(WPXInputStream *input);
82 uint16_t readU16(WPXInputStream *input);
83 uint32_t readU32(WPXInputStream *input);
84 int8_t readS8(WPXInputStream *input);
85 int16_t readS16(WPXInputStream *input);
86 int32_t readS32(WPXInputStream *input);
87 
89 {
90 };
91 
93 {
94 };
95 
96 } // namespace libfreehand
97 
98 #endif // __LIBFREEHAND_UTILS_H__
99 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
int32_t readS32(WPXInputStream *input)
Definition: libfreehand_utils.cpp:72
int16_t readS16(WPXInputStream *input)
Definition: libfreehand_utils.cpp:50
uint32_t readU32(WPXInputStream *input)
Definition: libfreehand_utils.cpp:55
uint16_t readU16(WPXInputStream *input)
Definition: libfreehand_utils.cpp:33
Definition: libfreehand_utils.h:88
uint8_t readU8(WPXInputStream *input)
Definition: libfreehand_utils.cpp:12
int8_t readS8(WPXInputStream *input)
Definition: libfreehand_utils.cpp:28
Definition: libfreehand_utils.h:92

Generated for libfreehand by doxygen 1.8.5