1 | // Copyright Benoit Blanchon 2014-2016
|
---|
2 | // MIT License
|
---|
3 | //
|
---|
4 | // Arduino JSON library
|
---|
5 | // https://github.com/bblanchon/ArduinoJson
|
---|
6 | // If you like this project, please add a star!
|
---|
7 |
|
---|
8 | #pragma once
|
---|
9 |
|
---|
10 | #ifdef ARDUINO // assume this is an embedded platform
|
---|
11 |
|
---|
12 | // store using float instead of double to reduce the memory usage (issue #134)
|
---|
13 | #ifndef ARDUINOJSON_USE_DOUBLE
|
---|
14 | #define ARDUINOJSON_USE_DOUBLE 0
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | // store using a long because it usually match the size of a float.
|
---|
18 | #ifndef ARDUINOJSON_USE_LONG_LONG
|
---|
19 | #define ARDUINOJSON_USE_LONG_LONG 0
|
---|
20 | #endif
|
---|
21 | #ifndef ARDUINOJSON_USE_INT64
|
---|
22 | #define ARDUINOJSON_USE_INT64 0
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | // arduino doesn't support STL stream
|
---|
26 | #ifndef ARDUINOJSON_ENABLE_STD_STREAM
|
---|
27 | #define ARDUINOJSON_ENABLE_STD_STREAM 0
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #ifndef ARDUINOJSON_ENABLE_ALIGNMENT
|
---|
31 | #ifdef ARDUINO_ARCH_AVR
|
---|
32 | // alignment isn't needed for 8-bit AVR
|
---|
33 | #define ARDUINOJSON_ENABLE_ALIGNMENT 0
|
---|
34 | #else
|
---|
35 | // but must processor needs pointer to be align on word size
|
---|
36 | #define ARDUINOJSON_ENABLE_ALIGNMENT 1
|
---|
37 | #endif
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | #else // assume this is a computer
|
---|
41 |
|
---|
42 | // on a computer we have plenty of memory so we can use doubles
|
---|
43 | #ifndef ARDUINOJSON_USE_DOUBLE
|
---|
44 | #define ARDUINOJSON_USE_DOUBLE 1
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | // use long long when available
|
---|
48 | #ifndef ARDUINOJSON_USE_LONG_LONG
|
---|
49 | #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
---|
50 | #define ARDUINOJSON_USE_LONG_LONG 1
|
---|
51 | #else
|
---|
52 | #define ARDUINOJSON_USE_LONG_LONG 0
|
---|
53 | #endif
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | // use _int64 on old versions of Visual Studio
|
---|
57 | #ifndef ARDUINOJSON_USE_INT64
|
---|
58 | #if defined(_MSC_VER) && _MSC_VER <= 1700
|
---|
59 | #define ARDUINOJSON_USE_INT64 1
|
---|
60 | #else
|
---|
61 | #define ARDUINOJSON_USE_INT64 0
|
---|
62 | #endif
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | // on a computer, we can assume that the STL is there
|
---|
66 | #ifndef ARDUINOJSON_ENABLE_STD_STREAM
|
---|
67 | #define ARDUINOJSON_ENABLE_STD_STREAM 1
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | #ifndef ARDUINOJSON_ENABLE_ALIGNMENT
|
---|
71 | // even if not required, most cpu's are faster with aligned pointers
|
---|
72 | #define ARDUINOJSON_ENABLE_ALIGNMENT 1
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | #if ARDUINOJSON_USE_LONG_LONG && ARDUINOJSON_USE_INT64
|
---|
78 | #error ARDUINOJSON_USE_LONG_LONG and ARDUINOJSON_USE_INT64 cannot be set together
|
---|
79 | #endif
|
---|