19#ifndef CS_FROZEN_FROZEN_H_
20#define CS_FROZEN_FROZEN_H_
30#if defined(_WIN32) && _MSC_VER < 1700
32enum {
false = 0,
true = 1 };
39 JSON_TYPE_INVALID = 0,
45 JSON_TYPE_OBJECT_START,
47 JSON_TYPE_ARRAY_START,
60 enum json_token_type type;
63#define JSON_INVALID_TOKEN \
64 { 0, 0, JSON_TYPE_INVALID }
67#define JSON_STRING_INVALID -1
68#define JSON_STRING_INCOMPLETE -2
96typedef void (*json_walk_callback_t)(
109 const char* json_string,
110 int json_string_length,
111 json_walk_callback_t callback,
112 void* callback_data);
119 int (*printer)(
struct json_out*,
const char* str,
size_t len);
131extern int json_printer_buf(
struct json_out*,
const char*,
size_t);
132extern int json_printer_file(
struct json_out*,
const char*,
size_t);
134#define JSON_OUT_BUF(buf, len) \
136 json_printer_buf, { \
140#define JSON_OUT_FILE(fp) \
142 json_printer_file, { \
143 { (char*)fp, 0, 0 } \
147typedef int (*json_printf_callback_t)(
struct json_out*, va_list* ap);
164int json_printf(
struct json_out*,
const char* fmt, ...);
165int json_vprintf(
struct json_out*,
const char* fmt, va_list ap);
171int json_fprintf(
const char* file_name,
const char* fmt, ...);
172int json_vfprintf(
const char* file_name,
const char* fmt, va_list ap);
185char* json_asprintf(
const char* fmt, ...);
186char* json_vasprintf(
const char* fmt, va_list ap);
193int json_printf_array(
struct json_out*, va_list* ap);
222int json_scanf(
const char* str,
int str_len,
const char* fmt, ...);
223int json_vscanf(
const char* str,
int str_len,
const char* fmt, va_list ap);
226typedef void (*json_scanner_t)(
const char* str,
int len,
void* user_data);
233int json_scanf_array_elem(
247int json_unescape(
const char* src,
int slen,
char* dst,
int dlen);
253int json_escape(
struct json_out* out,
const char* str,
size_t str_len);
259char* json_fread(
const char* file_name);
278 const char* json_path,
279 const char* json_fmt,
286 const char* json_path,
287 const char* json_fmt,
294int json_prettify(
const char* s,
int len,
struct json_out* out);
301int json_prettify_file(
const char* file_name);
339#ifndef JSON_MAX_PATH_LEN
340#define JSON_MAX_PATH_LEN 256
344#define JSON_MINIMAL 0
347#ifndef JSON_ENABLE_BASE64
348#define JSON_ENABLE_BASE64 !JSON_MINIMAL
351#ifndef JSON_ENABLE_HEX
352#define JSON_ENABLE_HEX !JSON_MINIMAL