string parsing utility functions described by the [JSON] schema
More...
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "mh5debug.h"
#include "mh5json.h"
#include "mh5memory.h"
Go to the source code of this file.
|
#define | SPECIAL_CHARS "{}[]:,\" \n\r\t" |
|
#define | OPEN_CURLY '{' |
|
#define | CLSE_CURLY '}' |
|
#define | OPEN_SQUARE '[' |
|
#define | CLSE_SQUARE ']' |
|
#define | COMMA ',' |
|
#define | DBLE_QUOTE '\"' |
|
#define | MIN_AFTER_TOKEN 6 |
|
#define | NEXT_CHAR(p, l) p++; l--; |
|
#define | SKIP_TO_CHAR(p, l, c) do { NEXT_CHAR(p, l) } while (*p != c && l != 0) |
|
#define | SKIP_DATA(pc, lt) while (lt != 0 && strchr(special_chars, *pc) == NULL) { NEXT_CHAR(pc, lt) } |
|
#define | SKIP_SPACES(pc, lt) while (lt != 0 && (*pc == ' ' || *pc == '\n' || *pc == '\r' || *pc == '\t')) { NEXT_CHAR(pc, lt) } |
|
#define | TPARSE TSTATE |
|
string parsing utility functions described by the [JSON] schema
- Date
- 15/07/2010
- Author
- Adam Sturtridge
Definition in file mh5json.c.
void JSON_FreeAstring |
( |
S_STRING * |
p_str | ) |
|
- Parameters
-
p_str | pointer to allocated string (JST_CBF_ASTRING) |
- Returns
- n/a
Definition at line 90 of file mh5json.c.
void JSON_FreeStrArray |
( |
S_STRING ** |
pp_str | ) |
|
- Parameters
-
array | pointer to allocated array |
type | type of array (JST_CBF_ARRAY_INT or JST_CBF_ARRAY_STR) or allocated string (JST_CBF_ASTRING) |
- Returns
- n/a
Definition at line 110 of file mh5json.c.
void JSON_FreeUintArray |
( |
U32BIT * |
p_uint | ) |
|
- Parameters
-
p_uint | pointer to allocated int array (JST_CBF_ARRAY_INT) |
- Returns
- n/a
Definition at line 100 of file mh5json.c.
E_JSON_STATE JSON_Parse |
( |
U8BIT * |
data, |
|
|
U32BIT |
size, |
|
|
const S_JSON_MEMBERS * |
members, |
|
|
void * |
usr |
|
) |
| |
- Parameters
-
data | pointer to JSON formated data |
size | number of bytes of JSON data |
members | array of [token, type, callback func] |
- Returns
- JSON_ERROR, - encountered wrong data JSON_OKAY - success JSON_MAIN,JSON_NEXT - data ended while still processing
Definition at line 78 of file mh5json.c.