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 <librevenge/librevenge.h>
17 
18 #ifndef M_PI
19 #define M_PI 3.14159265358979323846
20 #endif
21 
22 #define FH_EPSILON 1E-6
23 #define FH_ALMOST_ZERO(m) (fabs(m) <= FH_EPSILON)
24 
25 #ifdef _MSC_VER
26 
27 typedef unsigned char uint8_t;
28 typedef unsigned short uint16_t;
29 typedef unsigned uint32_t;
30 typedef unsigned __int64 uint64_t;
31 typedef signed char int8_t;
32 typedef short int16_t;
33 typedef int int32_t;
34 typedef __int64 int64_t;
35 
36 #else
37 
38 #ifdef HAVE_CONFIG_H
39 
40 #include <config.h>
41 
42 #ifdef HAVE_STDINT_H
43 #include <stdint.h>
44 #endif
45 
46 #ifdef HAVE_INTTYPES_H
47 #include <inttypes.h>
48 #endif
49 
50 #else
51 
52 // assume that the headers are there inside LibreOffice build when no HAVE_CONFIG_H is defined
53 #include <stdint.h>
54 #include <inttypes.h>
55 
56 #endif
57 
58 #endif
59 
60 // debug message includes source file and line number
61 //#define VERBOSE_DEBUG 1
62 
63 // do nothing with debug messages in a release compile
64 #ifdef DEBUG
65 #ifdef VERBOSE_DEBUG
66 #define FH_DEBUG_MSG(M) printf("%15s:%5d: ", __FILE__, __LINE__); printf M
67 #define FH_DEBUG(M) M
68 #else
69 #define FH_DEBUG_MSG(M) printf M
70 #define FH_DEBUG(M) M
71 #endif
72 #else
73 #define FH_DEBUG_MSG(M)
74 #define FH_DEBUG(M)
75 #endif
76 
77 namespace libfreehand
78 {
79 
80 uint8_t readU8(librevenge::RVNGInputStream *input);
81 uint16_t readU16(librevenge::RVNGInputStream *input);
82 uint32_t readU32(librevenge::RVNGInputStream *input);
83 int8_t readS8(librevenge::RVNGInputStream *input);
84 int16_t readS16(librevenge::RVNGInputStream *input);
85 int32_t readS32(librevenge::RVNGInputStream *input);
86 
88 {
89 };
90 
92 {
93 };
94 
95 } // namespace libfreehand
96 
97 #endif // __LIBFREEHAND_UTILS_H__
98 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libfreehand_utils.cpp:33
uint32_t readU32(librevenge::RVNGInputStream *input)
Definition: libfreehand_utils.cpp:55
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libfreehand_utils.cpp:12
int32_t readS32(librevenge::RVNGInputStream *input)
Definition: libfreehand_utils.cpp:72
Definition: libfreehand_utils.h:87
int16_t readS16(librevenge::RVNGInputStream *input)
Definition: libfreehand_utils.cpp:50
int8_t readS8(librevenge::RVNGInputStream *input)
Definition: libfreehand_utils.cpp:28
Definition: libfreehand_utils.h:91

Generated for libfreehand by doxygen 1.8.5