forked from bblanchon/ArduinoJson
Remove ARDUINOJSON_EMBEDDED_MODE
This commit is contained in:
@ -26,130 +26,86 @@
|
||||
# define ARDUINOJSON_HAS_INT64 0
|
||||
#endif
|
||||
|
||||
// Small or big machine?
|
||||
#ifndef ARDUINOJSON_EMBEDDED_MODE
|
||||
# if defined(ARDUINO) /* Arduino*/ \
|
||||
|| defined(__IAR_SYSTEMS_ICC__) /* IAR Embedded Workbench */ \
|
||||
|| defined(__XC) /* MPLAB XC compiler */ \
|
||||
|| defined(__ARMCC_VERSION) /* Keil ARM Compiler */ \
|
||||
|| defined(__NIOS2__) /* Altera Nios II EDS */ \
|
||||
|| defined(__AVR) /* Atmel AVR8/GNU C Compiler */
|
||||
# define ARDUINOJSON_EMBEDDED_MODE 1
|
||||
# else
|
||||
# define ARDUINOJSON_EMBEDDED_MODE 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Auto enable std::stream if the right headers are here and no conflicting
|
||||
// macro is defined
|
||||
#if !defined(ARDUINOJSON_ENABLE_STD_STREAM) && defined(__has_include)
|
||||
# if __has_include(<istream>) && \
|
||||
// Support std::istream and std::ostream
|
||||
#ifndef ARDUINOJSON_ENABLE_STD_STREAM
|
||||
# ifdef __has_include
|
||||
# if __has_include(<istream>) && \
|
||||
__has_include(<ostream>) && \
|
||||
!defined(min) && \
|
||||
!defined(max)
|
||||
# define ARDUINOJSON_ENABLE_STD_STREAM 1
|
||||
# define ARDUINOJSON_ENABLE_STD_STREAM 1
|
||||
# else
|
||||
# define ARDUINOJSON_ENABLE_STD_STREAM 0
|
||||
# endif
|
||||
# else
|
||||
# define ARDUINOJSON_ENABLE_STD_STREAM 0
|
||||
# ifdef ARDUINO
|
||||
# define ARDUINOJSON_ENABLE_STD_STREAM 0
|
||||
# else
|
||||
# define ARDUINOJSON_ENABLE_STD_STREAM 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Auto enable std::string if the right header is here and no conflicting
|
||||
// macro is defined
|
||||
#if !defined(ARDUINOJSON_ENABLE_STD_STRING) && defined(__has_include)
|
||||
# if __has_include(<string>) && !defined(min) && !defined(max)
|
||||
# define ARDUINOJSON_ENABLE_STD_STRING 1
|
||||
// Support std::string
|
||||
#ifndef ARDUINOJSON_ENABLE_STD_STRING
|
||||
# ifdef __has_include
|
||||
# if __has_include(<string>) && !defined(min) && !defined(max)
|
||||
# define ARDUINOJSON_ENABLE_STD_STRING 1
|
||||
# else
|
||||
# define ARDUINOJSON_ENABLE_STD_STRING 0
|
||||
# endif
|
||||
# else
|
||||
# define ARDUINOJSON_ENABLE_STD_STRING 0
|
||||
# ifdef ARDUINO
|
||||
# define ARDUINOJSON_ENABLE_STD_STRING 0
|
||||
# else
|
||||
# define ARDUINOJSON_ENABLE_STD_STRING 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Support for std::string_view
|
||||
#ifndef ARDUINOJSON_ENABLE_STRING_VIEW
|
||||
# ifdef __has_include
|
||||
# if __has_include(<string_view>) && __cplusplus >= 201703L
|
||||
# define ARDUINOJSON_ENABLE_STRING_VIEW 1
|
||||
# else
|
||||
# define ARDUINOJSON_ENABLE_STRING_VIEW 0
|
||||
# endif
|
||||
# else
|
||||
# define ARDUINOJSON_ENABLE_STRING_VIEW 0
|
||||
# endif
|
||||
#endif
|
||||
#ifndef ARDUINOJSON_ENABLE_STRING_VIEW
|
||||
# define ARDUINOJSON_ENABLE_STRING_VIEW 0
|
||||
|
||||
// Store floating-point values with float (0) or double (1)
|
||||
#ifndef ARDUINOJSON_USE_DOUBLE
|
||||
# define ARDUINOJSON_USE_DOUBLE 0
|
||||
#endif
|
||||
|
||||
#if ARDUINOJSON_EMBEDDED_MODE
|
||||
|
||||
// Store floats by default to reduce the memory usage (issue #134)
|
||||
# ifndef ARDUINOJSON_USE_DOUBLE
|
||||
# define ARDUINOJSON_USE_DOUBLE 0
|
||||
# endif
|
||||
|
||||
// Store longs by default, because they usually match the size of a float.
|
||||
# ifndef ARDUINOJSON_USE_LONG_LONG
|
||||
# define ARDUINOJSON_USE_LONG_LONG 0
|
||||
# endif
|
||||
|
||||
// Embedded systems usually don't have std::string
|
||||
# ifndef ARDUINOJSON_ENABLE_STD_STRING
|
||||
# define ARDUINOJSON_ENABLE_STD_STRING 0
|
||||
# endif
|
||||
|
||||
// Embedded systems usually don't have std::stream
|
||||
# ifndef ARDUINOJSON_ENABLE_STD_STREAM
|
||||
# define ARDUINOJSON_ENABLE_STD_STREAM 0
|
||||
# endif
|
||||
// Store integral values with long (0) or long long (1)
|
||||
#ifndef ARDUINOJSON_USE_LONG_LONG
|
||||
# define ARDUINOJSON_USE_LONG_LONG 0
|
||||
#endif
|
||||
|
||||
// Limit nesting as the stack is likely to be small
|
||||
# ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
|
||||
# define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
|
||||
# endif
|
||||
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
|
||||
# define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
|
||||
#endif
|
||||
|
||||
// Number of bits to store the pointer to next node
|
||||
// (saves RAM but limits the number of values in a document)
|
||||
# ifndef ARDUINOJSON_SLOT_OFFSET_SIZE
|
||||
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 2
|
||||
#ifndef ARDUINOJSON_SLOT_OFFSET_SIZE
|
||||
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ <= 2
|
||||
// Address space == 16-bit => max 127 values
|
||||
# define ARDUINOJSON_SLOT_OFFSET_SIZE 1
|
||||
# else
|
||||
// Address space > 16-bit => max 32767 values
|
||||
# define ARDUINOJSON_SLOT_OFFSET_SIZE 2
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#else // ARDUINOJSON_EMBEDDED_MODE
|
||||
|
||||
// On a computer we have plenty of memory so we can use doubles
|
||||
# ifndef ARDUINOJSON_USE_DOUBLE
|
||||
# define ARDUINOJSON_USE_DOUBLE 1
|
||||
# endif
|
||||
|
||||
// Use long long when available
|
||||
# ifndef ARDUINOJSON_USE_LONG_LONG
|
||||
# if ARDUINOJSON_HAS_LONG_LONG || ARDUINOJSON_HAS_INT64
|
||||
# define ARDUINOJSON_USE_LONG_LONG 1
|
||||
# else
|
||||
# define ARDUINOJSON_USE_LONG_LONG 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
// On a computer, we can use std::string
|
||||
# ifndef ARDUINOJSON_ENABLE_STD_STRING
|
||||
# define ARDUINOJSON_ENABLE_STD_STRING 1
|
||||
# endif
|
||||
|
||||
// On a computer, we can assume std::stream
|
||||
# ifndef ARDUINOJSON_ENABLE_STD_STREAM
|
||||
# define ARDUINOJSON_ENABLE_STD_STREAM 1
|
||||
# endif
|
||||
|
||||
// On a computer, the stack is large so we can increase nesting limit
|
||||
# ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
|
||||
# define ARDUINOJSON_DEFAULT_NESTING_LIMIT 50
|
||||
# endif
|
||||
|
||||
// Number of bits to store the pointer to next node
|
||||
# ifndef ARDUINOJSON_SLOT_OFFSET_SIZE
|
||||
# define ARDUINOJSON_SLOT_OFFSET_SIZE 1
|
||||
# elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ >= 8 || \
|
||||
defined(_WIN64) && _WIN64
|
||||
// Address space == 64-bit => max 2147483647 values
|
||||
# define ARDUINOJSON_SLOT_OFFSET_SIZE 4
|
||||
# else
|
||||
// Address space == 32-bit => max 32767 values
|
||||
# define ARDUINOJSON_SLOT_OFFSET_SIZE 2
|
||||
# endif
|
||||
|
||||
#endif // ARDUINOJSON_EMBEDDED_MODE
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO
|
||||
|
||||
|
Reference in New Issue
Block a user