JST: JSON tools
1.0.0
JSON tools dynamic library for reading, manipulating and writing JSON tree
|
#include "JST_private.h"
#include "JST_list.h"
#include "JST_string.h"
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "jstools.h"
Go to the source code of this file.
Enumerations | |
enum | TokenType { TOKEN_NONE, TOKEN_OPEN_OBJECT, TOKEN_COLON, TOKEN_CLOSE_OBJECT, TOKEN_COMMA, TOKEN_OPEN_ARRAY, TOKEN_CLOSE_ARRAY, TOKEN_TRUE, TOKEN_FALSE, TOKEN_INTEGER, TOKEN_DOUBLE, TOKEN_STRING, TOKEN_NULL } |
Functions | |
JST_Error | JST_load_from_stream (FILE *stream, JST_Element *root, JST_SyntaxError *syntax_error) |
Reads the input stream, allocates the node of the corresponding tree, than frees the input buffer. More... | |
JST_Error | JST_load_from_file (const char *path, JST_Element *root, JST_SyntaxError *syntax_error) |
Reads the input file, allocates the node of the corresponding tree, than frees the input buffer. More... | |
Variables | |
bool | JST_DEBUG_SHOW_TOKENS = false |
const JST_Array | JST_Array_Zero = { .items = NULL, .count = 0U, .parent = NULL } |
Constant defined to initialize safely a variable of type JST_Array. More... | |
const JST_Object | JST_Object_Zero = { .items = NULL, .count = 0U, .parent = NULL, .first = NULL } |
Constant defined to initialize safely a variable of type JST_Object. More... | |
const JST_Value | JST_Value_Zero = { .object = JST_Object_Zero } |
Constant defined to initialize safely a variable of type JST_Value. More... | |
const JST_Element | JST_Element_Zero = { .type = JST_NULL, .value = JST_Value_Zero } |
Constant defined to initialize safely a variable of type JST_Element. More... | |
const JST_ArrayItem | JST_ArrayItem_Zero = { .parent = NULL, .element = JST_Element_Zero } |
const JST_Pair | JST_Pair_Zero = { .parent = NULL, .element = JST_Element_Zero, .name = NULL, .next = NULL } |
Constant defined to initialize safely a variable of type JST_Pair. More... | |
const JST_SyntaxError | JST_SyntaxError_Zero = { .line = 0U, .pos = 0U } |
Constant defined to initialize safely a variable of type JST_SyntaxError. More... | |
enum TokenType |
Enumerator | |
---|---|
TOKEN_NONE | |
TOKEN_OPEN_OBJECT | |
TOKEN_COLON | |
TOKEN_CLOSE_OBJECT | |
TOKEN_COMMA | |
TOKEN_OPEN_ARRAY | |
TOKEN_CLOSE_ARRAY | |
TOKEN_TRUE | |
TOKEN_FALSE | |
TOKEN_INTEGER | |
TOKEN_DOUBLE | |
TOKEN_STRING | |
TOKEN_NULL |
Definition at line 24 of file JST_load.c.
JST_Error JST_load_from_file | ( | const char * | filepath, |
JST_Element * | root, | ||
JST_SyntaxError * | error | ||
) |
Reads the input file, allocates the node of the corresponding tree, than frees the input buffer.
filepath | the file path |
root | the root of the JSON tree |
line | the last line number read, available in case of error |
context | few characters before the error, available in case of error |
ditsance | the offset of the error, in context |
Definition at line 573 of file JST_load.c.
JST_Error JST_load_from_stream | ( | FILE * | stream, |
JST_Element * | root, | ||
JST_SyntaxError * | error | ||
) |
Reads the input stream, allocates the node of the corresponding tree, than frees the input buffer.
stream | the character stream to read |
root | the root of the JSON tree |
line | the last line number read, available in case of error |
context | few characters before the error, available in case of error |
ditsance | the offset of the error, in context |
Definition at line 533 of file JST_load.c.
const JST_Array JST_Array_Zero = { .items = NULL, .count = 0U, .parent = NULL } |
Constant defined to initialize safely a variable of type JST_Array.
Definition at line 16 of file JST_load.c.
const JST_ArrayItem JST_ArrayItem_Zero = { .parent = NULL, .element = JST_Element_Zero } |
Definition at line 20 of file JST_load.c.
bool JST_DEBUG_SHOW_TOKENS = false |
Definition at line 14 of file JST_load.c.
const JST_Element JST_Element_Zero = { .type = JST_NULL, .value = JST_Value_Zero } |
Constant defined to initialize safely a variable of type JST_Element.
Definition at line 19 of file JST_load.c.
const JST_Object JST_Object_Zero = { .items = NULL, .count = 0U, .parent = NULL, .first = NULL } |
Constant defined to initialize safely a variable of type JST_Object.
Definition at line 17 of file JST_load.c.
const JST_Pair JST_Pair_Zero = { .parent = NULL, .element = JST_Element_Zero, .name = NULL, .next = NULL } |
Constant defined to initialize safely a variable of type JST_Pair.
Definition at line 21 of file JST_load.c.
const JST_SyntaxError JST_SyntaxError_Zero = { .line = 0U, .pos = 0U } |
Constant defined to initialize safely a variable of type JST_SyntaxError.
Definition at line 22 of file JST_load.c.
const JST_Value JST_Value_Zero = { .object = JST_Object_Zero } |
Constant defined to initialize safely a variable of type JST_Value.
Definition at line 18 of file JST_load.c.