1#ifndef PDJSON_PRIVATE_H
2#define PDJSON_PRIVATE_H
3
4#include <stdbool.h>
5#include <stdio.h>
6
7struct 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
22struct json_stack {
23 enum json_type type;
24 long count;
25};
26
27struct json_stream {
28 size_t lineno;
29
30 struct json_stack *stack;
31 size_t stack_top;
32 size_t stack_size;
33 enum json_type next;
34 int error : 31;
35 bool streaming : 1;
36
37 struct {
38 char *string;
39 size_t string_fill;
40 size_t string_size;
41 } data;
42
43 size_t ntokens;
44
45 struct json_source source;
46 struct json_allocator alloc;
47 char errmsg[128];
48};
49
50#endif
51