24 #ifndef CS_FROZEN_FROZEN_H_ 25 #define CS_FROZEN_FROZEN_H_ 35 #if defined(_WIN32) && _MSC_VER < 1700 37 enum {
false = 0,
true = 1 };
43 enum json_token_type {
44 JSON_TYPE_INVALID = 0,
50 JSON_TYPE_OBJECT_START,
52 JSON_TYPE_ARRAY_START,
65 enum json_token_type type;
68 #define JSON_INVALID_TOKEN \ 69 { 0, 0, JSON_TYPE_INVALID } 72 #define JSON_STRING_INVALID -1 73 #define JSON_STRING_INCOMPLETE -2 101 typedef void (*json_walk_callback_t)(
void *callback_data,
const char *name,
102 size_t name_len,
const char *path,
110 int json_walk(
const char *json_string,
int json_string_length,
111 json_walk_callback_t callback,
void *callback_data);
118 int (*printer)(
struct json_out *,
const char *str,
size_t len);
130 extern int json_printer_buf(
struct json_out *,
const char *,
size_t);
131 extern int json_printer_file(
struct json_out *,
const char *,
size_t);
133 #define JSON_OUT_BUF(buf, len) \ 135 json_printer_buf, { \ 139 #define JSON_OUT_FILE(fp) \ 141 json_printer_file, { \ 142 { (char *) fp, 0, 0 } \ 146 typedef int (*json_printf_callback_t)(
struct json_out *, va_list *ap);
163 int json_printf(
struct json_out *,
const char *fmt, ...);
164 int json_vprintf(
struct json_out *,
const char *fmt, va_list ap);
170 int json_fprintf(
const char *file_name,
const char *fmt, ...);
171 int json_vfprintf(
const char *file_name,
const char *fmt, va_list ap);
184 char *json_asprintf(
const char *fmt, ...);
185 char *json_vasprintf(
const char *fmt, va_list ap);
192 int json_printf_array(
struct json_out *, va_list *ap);
221 int json_scanf(
const char *str,
int str_len,
const char *fmt, ...);
222 int json_vscanf(
const char *str,
int str_len,
const char *fmt, va_list ap);
225 typedef void (*json_scanner_t)(
const char *str,
int len,
void *user_data);
232 int json_scanf_array_elem(
const char *s,
int len,
const char *path,
int index,
242 int json_unescape(
const char *src,
int slen,
char *dst,
int dlen);
248 int json_escape(
struct json_out *out,
const char *str,
size_t str_len);
254 char *json_fread(
const char *file_name);
269 int json_setf(
const char *s,
int len,
struct json_out *out,
270 const char *json_path,
const char *json_fmt, ...);
272 int json_vsetf(
const char *s,
int len,
struct json_out *out,
273 const char *json_path,
const char *json_fmt, va_list ap);
279 int json_prettify(
const char *s,
int len,
struct json_out *out);
286 int json_prettify_file(
const char *file_name);
304 void *json_next_key(
const char *s,
int len,
void *handle,
const char *path,
311 void *json_next_elem(
const char *s,
int len,
void *handle,
const char *path,