summaryrefslogtreecommitdiff
path: root/include/lib/ArduinoJson/Polyfills
diff options
context:
space:
mode:
Diffstat (limited to 'include/lib/ArduinoJson/Polyfills')
-rw-r--r--include/lib/ArduinoJson/Polyfills/attributes.hpp29
-rw-r--r--include/lib/ArduinoJson/Polyfills/ctype.hpp18
-rw-r--r--include/lib/ArduinoJson/Polyfills/isFloat.hpp38
-rw-r--r--include/lib/ArduinoJson/Polyfills/isInteger.hpp19
-rw-r--r--include/lib/ArduinoJson/Polyfills/math.hpp19
-rw-r--r--include/lib/ArduinoJson/Polyfills/parseFloat.hpp90
-rw-r--r--include/lib/ArduinoJson/Polyfills/parseInteger.hpp41
7 files changed, 0 insertions, 254 deletions
diff --git a/include/lib/ArduinoJson/Polyfills/attributes.hpp b/include/lib/ArduinoJson/Polyfills/attributes.hpp
deleted file mode 100644
index b49091d..0000000
--- a/include/lib/ArduinoJson/Polyfills/attributes.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#ifdef _MSC_VER // Visual Studio
-
-#define FORCE_INLINE // __forceinline causes C4714 when returning std::string
-#define NO_INLINE __declspec(noinline)
-#define DEPRECATED(msg) __declspec(deprecated(msg))
-
-#elif defined(__GNUC__) // GCC or Clang
-
-#define FORCE_INLINE __attribute__((always_inline))
-#define NO_INLINE __attribute__((noinline))
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
-#define DEPRECATED(msg) __attribute__((deprecated(msg)))
-#else
-#define DEPRECATED(msg) __attribute__((deprecated))
-#endif
-
-#else // Other compilers
-
-#define FORCE_INLINE
-#define NO_INLINE
-#define DEPRECATED(msg)
-
-#endif
diff --git a/include/lib/ArduinoJson/Polyfills/ctype.hpp b/include/lib/ArduinoJson/Polyfills/ctype.hpp
deleted file mode 100644
index 2d52703..0000000
--- a/include/lib/ArduinoJson/Polyfills/ctype.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-
-inline bool isdigit(char c) {
- return '0' <= c && c <= '9';
-}
-
-inline bool issign(char c) {
- return '-' == c || c == '+';
-}
-}
-}
diff --git a/include/lib/ArduinoJson/Polyfills/isFloat.hpp b/include/lib/ArduinoJson/Polyfills/isFloat.hpp
deleted file mode 100644
index 973b89f..0000000
--- a/include/lib/ArduinoJson/Polyfills/isFloat.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include <string.h> // for strcmp
-#include "./ctype.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-inline bool isFloat(const char* s) {
- if (!s) return false;
-
- if (!strcmp(s, "NaN")) return true;
- if (issign(*s)) s++;
- if (!strcmp(s, "Infinity")) return true;
- if (*s == '\0') return false;
-
- while (isdigit(*s)) s++;
-
- if (*s == '.') {
- s++;
- while (isdigit(*s)) s++;
- }
-
- if (*s == 'e' || *s == 'E') {
- s++;
- if (issign(*s)) s++;
- if (!isdigit(*s)) return false;
- while (isdigit(*s)) s++;
- }
-
- return *s == '\0';
-}
-}
-}
diff --git a/include/lib/ArduinoJson/Polyfills/isInteger.hpp b/include/lib/ArduinoJson/Polyfills/isInteger.hpp
deleted file mode 100644
index 8049079..0000000
--- a/include/lib/ArduinoJson/Polyfills/isInteger.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include "./ctype.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-inline bool isInteger(const char* s) {
- if (!s || !*s) return false;
- if (issign(*s)) s++;
- while (isdigit(*s)) s++;
- return *s == '\0';
-}
-} // namespace Internals
-} // namespace ArduinoJson
diff --git a/include/lib/ArduinoJson/Polyfills/math.hpp b/include/lib/ArduinoJson/Polyfills/math.hpp
deleted file mode 100644
index 48773ed..0000000
--- a/include/lib/ArduinoJson/Polyfills/math.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-template <typename T>
-bool isNaN(T x) {
- return x != x;
-}
-
-template <typename T>
-bool isInfinity(T x) {
- return x != 0.0 && x * 2 == x;
-}
-}
-}
diff --git a/include/lib/ArduinoJson/Polyfills/parseFloat.hpp b/include/lib/ArduinoJson/Polyfills/parseFloat.hpp
deleted file mode 100644
index 49b0f6f..0000000
--- a/include/lib/ArduinoJson/Polyfills/parseFloat.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include "../TypeTraits/FloatTraits.hpp"
-#include "./ctype.hpp"
-#include "./math.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-template <typename T>
-inline T parseFloat(const char* s) {
- typedef FloatTraits<T> traits;
- typedef typename traits::mantissa_type mantissa_t;
- typedef typename traits::exponent_type exponent_t;
-
- if (!s) return 0; // NULL
-
- bool negative_result = false;
- switch (*s) {
- case '-':
- negative_result = true;
- s++;
- break;
- case '+':
- s++;
- break;
- }
-
- if (*s == 't') return 1; // true
- if (*s == 'n' || *s == 'N') return traits::nan();
- if (*s == 'i' || *s == 'I')
- return negative_result ? -traits::inf() : traits::inf();
-
- mantissa_t mantissa = 0;
- exponent_t exponent_offset = 0;
-
- while (isdigit(*s)) {
- if (mantissa < traits::mantissa_max / 10)
- mantissa = mantissa * 10 + (*s - '0');
- else
- exponent_offset++;
- s++;
- }
-
- if (*s == '.') {
- s++;
- while (isdigit(*s)) {
- if (mantissa < traits::mantissa_max / 10) {
- mantissa = mantissa * 10 + (*s - '0');
- exponent_offset--;
- }
- s++;
- }
- }
-
- int exponent = 0;
- if (*s == 'e' || *s == 'E') {
- s++;
- bool negative_exponent = false;
- if (*s == '-') {
- negative_exponent = true;
- s++;
- } else if (*s == '+') {
- s++;
- }
-
- while (isdigit(*s)) {
- exponent = exponent * 10 + (*s - '0');
- if (exponent + exponent_offset > traits::exponent_max) {
- if (negative_exponent)
- return negative_result ? -0.0f : 0.0f;
- else
- return negative_result ? -traits::inf() : traits::inf();
- }
- s++;
- }
- if (negative_exponent) exponent = -exponent;
- }
- exponent += exponent_offset;
-
- T result = traits::make_float(static_cast<T>(mantissa), exponent);
-
- return negative_result ? -result : result;
-}
-}
-}
diff --git a/include/lib/ArduinoJson/Polyfills/parseInteger.hpp b/include/lib/ArduinoJson/Polyfills/parseInteger.hpp
deleted file mode 100644
index e8f1974..0000000
--- a/include/lib/ArduinoJson/Polyfills/parseInteger.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include <stdlib.h>
-
-#include "../Configuration.hpp"
-#include "./ctype.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-template <typename T>
-T parseInteger(const char *s) {
- if (!s) return 0; // NULL
-
- if (*s == 't') return 1; // "true"
-
- T result = 0;
- bool negative_result = false;
-
- switch (*s) {
- case '-':
- negative_result = true;
- s++;
- break;
- case '+':
- s++;
- break;
- }
-
- while (isdigit(*s)) {
- result = T(result * 10 + T(*s - '0'));
- s++;
- }
-
- return negative_result ? T(~result + 1) : result;
-}
-}
-}