pd_json_private.h 961 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef PDJSON_PRIVATE_H
  2. #define PDJSON_PRIVATE_H
  3. #if defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901L)
  4. #include <stdbool.h>
  5. #endif // __STDC_VERSION__
  6. #include <stdio.h>
  7. struct json_source {
  8. int (*get) (struct json_source *);
  9. int (*peek) (struct json_source *);
  10. size_t position;
  11. union {
  12. struct {
  13. FILE *stream;
  14. } stream;
  15. struct {
  16. const char *buffer;
  17. size_t length;
  18. } buffer;
  19. } source;
  20. };
  21. struct json_stack {
  22. enum json_type type;
  23. long count;
  24. };
  25. struct json_stream {
  26. size_t lineno;
  27. struct json_stack *stack;
  28. size_t stack_top;
  29. size_t stack_size;
  30. enum json_type next;
  31. int error : 31;
  32. bool streaming : 1;
  33. struct {
  34. char *string;
  35. size_t string_fill;
  36. size_t string_size;
  37. } data;
  38. size_t ntokens;
  39. struct json_source source;
  40. struct json_allocator alloc;
  41. char errmsg[128];
  42. };
  43. #endif