jsmn_h.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #include <furi.h>
  3. #include <stddef.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. // added by Derek Jamison to lower memory usage
  8. #undef FURI_LOG_E
  9. #define FURI_LOG_E(tag, msg, ...)
  10. #undef FURI_LOG_I
  11. #define FURI_LOG_I(tag, msg, ...)
  12. // //
  13. typedef enum
  14. {
  15. JSMN_UNDEFINED = 0,
  16. JSMN_OBJECT = 1 << 0,
  17. JSMN_ARRAY = 1 << 1,
  18. JSMN_STRING = 1 << 2,
  19. JSMN_PRIMITIVE = 1 << 3
  20. } jsmntype_t;
  21. enum jsmnerr
  22. {
  23. JSMN_ERROR_NOMEM = -1,
  24. JSMN_ERROR_INVAL = -2,
  25. JSMN_ERROR_PART = -3
  26. };
  27. typedef struct
  28. {
  29. jsmntype_t type;
  30. int start;
  31. int end;
  32. int size;
  33. #ifdef JSMN_PARENT_LINKS
  34. int parent;
  35. #endif
  36. } jsmntok_t;
  37. typedef struct
  38. {
  39. unsigned int pos; /* offset in the JSON string */
  40. unsigned int toknext; /* next token to allocate */
  41. int toksuper; /* superior token node, e.g. parent object or array */
  42. } jsmn_parser;
  43. typedef struct
  44. {
  45. char *key;
  46. char *value;
  47. } JSON;
  48. typedef struct
  49. {
  50. FuriString *key;
  51. FuriString *value;
  52. } FuriJSON;
  53. FuriString *char_to_furi_string(const char *str);
  54. // check memory
  55. bool jsmn_memory_check(size_t heap_size);