json-gen-c
0.1.5
json-gen-c generate C code for json manipulation
|
38 JSON_TOKEN_COMMA =
',',
39 JSON_TOKEN_COLON =
':',
40 JSON_TOKEN_LEFT_BRACE =
'{',
41 JSON_TOKEN_RIGHT_BRACE =
'}',
42 JSON_TOKEN_LEFT_BRACKET =
'[',
43 JSON_TOKEN_RIGHT_BRACKET =
']',
48 #define FIELD_TYPE_INT 0
49 #define FIELD_TYPE_LONG 1
50 #define FIELD_TYPE_FLOAT 2
51 #define FIELD_TYPE_DOUBLE 3
52 #define FIELD_TYPE_SSTR 4
53 #define FIELD_TYPE_STRUCT 6
54 #define FIELD_TYPE_BOOL 7
76 static int json_unmarshal_array_internal_sstr_t(
sstr_t content,
80 static int json_unmarshal_array_internal_int(
sstr_t content,
83 static int json_unmarshal_array_internal_long(
sstr_t content,
86 static int json_unmarshal_array_internal_float(
sstr_t content,
88 float** ptr,
int* ptrlen,
90 static int json_unmarshal_array_internal_double(
sstr_t content,
92 double** ptr,
int* ptrlen,
95 int json_marshal_array_indent_int(
int* obj,
int len,
int indent,
int curindent,
101 for (i = 0; i < len; i++) {
115 int json_marshal_array_indent_long(
long* obj,
int len,
int indent,
116 int curindent,
sstr_t out) {
121 for (i = 0; i < len; i++) {
135 int json_marshal_array_indent_float(
float* obj,
int len,
int indent,
136 int curindent,
sstr_t out) {
141 for (i = 0; i < len; i++) {
155 int json_marshal_array_indent_double(
double* obj,
int len,
int indent,
156 int curindent,
sstr_t out) {
161 for (i = 0; i < len; i++) {
175 int json_marshal_array_indent_sstr_t(
sstr_t* obj,
int len,
int indent,
176 int curindent,
sstr_t out) {
181 for (i = 0; i < len; i++) {
184 sstr_json_escape_string_append(out, obj[i]);
void sstr_append_indent(sstr_t s, size_t indent)
append spaces at the end of the sstr_t.
Definition: sstr.c:822
void sstr_append_of_if(sstr_t s, const void *data, size_t length, int cond)
Append if cond is true, otherwise do nothing.
Definition: sstr.c:813
void * sstr_t
sstr_t are objects that represent sequences of characters.
Definition: sstr.h:73
void sstr_append_cstr(sstr_t dst, const char *src)
Extends the sstr_t by appending additional characters contained in src.
Definition: sstr.c:172
Definition: json_parse.h:56
void sstr_append_of(sstr_t s, const void *data, size_t length)
Extends the sstr_t by appending additional characters in data with length of length at the end of its...
Definition: sstr.c:161
position of string
Definition: struct_parse.h:75
Definition: json_parse.h:64
sstr_t sstr_printf_append(sstr_t buf, const char *fmt,...)
Same as sstr_printf(), but but print to buf instead of create a new one.
Definition: sstr.c:226