jsmn_h.h 977 B

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