reverted previous 2 commits for support json format in xli.
instead, i'm writing a different json format reader
This commit is contained in:
@ -134,6 +134,12 @@ QSE_EXPORT int qse_xli_readinistd (
|
||||
qse_xli_iostd_t* in
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_xli_readjsonstd (
|
||||
qse_xli_t* xli,
|
||||
qse_xli_iostd_t* in
|
||||
);
|
||||
|
||||
|
||||
QSE_EXPORT int qse_xli_writestd (
|
||||
qse_xli_t* xli,
|
||||
qse_xli_list_t* root_list,
|
||||
@ -146,6 +152,12 @@ QSE_EXPORT int qse_xli_writeinistd (
|
||||
qse_xli_iostd_t* out
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_xli_writejsonstd (
|
||||
qse_xli_t* xli,
|
||||
qse_xli_list_t* root_list,
|
||||
qse_xli_iostd_t* out
|
||||
);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -65,10 +65,12 @@ enum qse_xli_errnum_t
|
||||
QSE_XLI_EIOUSR, /**< i/o handler error */
|
||||
|
||||
QSE_XLI_ESYNTAX, /**< syntax error */
|
||||
QSE_XLI_ECOLON, /**< colon expected in place of '${0}' */
|
||||
QSE_XLI_ESCOLON, /**< semicolon expected in place of '${0}' */
|
||||
QSE_XLI_EASSIGN, /**< = expected in place of '${0}' */
|
||||
QSE_XLI_EEQ, /**< = expected in place of '${0}' */
|
||||
QSE_XLI_ELBREQ, /**< { or = expected in place of '${0}' */
|
||||
QSE_XLI_ERBRCE, /**< } expected in place of '${0}' */
|
||||
QSE_XLI_ERBRACE, /**< } expected in place of '${0}' */
|
||||
QSE_XLI_ERBRACK, /**< ] expected in place of '${0}' */
|
||||
QSE_XLI_EPAVAL, /**< pair value expected in place of '${0}' */
|
||||
QSE_XLI_ESTRNC, /**< string not closed */
|
||||
QSE_XLI_ETAGNC, /**< tag not closed */
|
||||
@ -115,18 +117,7 @@ enum qse_xli_opt_t
|
||||
*/
|
||||
QSE_XLI_ROOTXTNSIZE,
|
||||
|
||||
/**
|
||||
* It is a character to put between a parent key and a nested key.
|
||||
* By default, it's a period and used like 'a.b.c' that means c under b under a.
|
||||
*/
|
||||
QSE_XLI_KEYSPLITTER,
|
||||
|
||||
/**
|
||||
* The first character is in the tag marker speicifies the tag opener
|
||||
* and the second chracter specifies the tag closer. The are used when
|
||||
* key tags and/or string tags are enabled. By default, it is "[]".
|
||||
*/
|
||||
QSE_XLI_TAGMARKER
|
||||
QSE_XLI_KEYSPLITTER
|
||||
};
|
||||
typedef enum qse_xli_opt_t qse_xli_opt_t;
|
||||
|
||||
@ -156,19 +147,14 @@ enum qse_xli_trait_t
|
||||
* "tg" is stored into the tag field of qse_xli_str_t. */
|
||||
QSE_XLI_STRTAG = (1 << 10),
|
||||
|
||||
/** support the json format */
|
||||
QSE_XLI_JSON = (1 << 11),
|
||||
|
||||
/** enable pair validation against pair definitions while reading */
|
||||
QSE_XLI_VALIDATE = (1 << 12)
|
||||
QSE_XLI_VALIDATE = (1 << 11)
|
||||
};
|
||||
typedef enum qse_xli_trait_t qse_xli_trait_t;
|
||||
|
||||
typedef struct qse_xli_val_t qse_xli_val_t;
|
||||
typedef struct qse_xli_nil_t qse_xli_nil_t;
|
||||
typedef struct qse_xli_str_t qse_xli_str_t;
|
||||
typedef struct qse_xli_int_t qse_xli_int_t;
|
||||
typedef struct qse_xli_array_t qse_xli_array_t;
|
||||
typedef struct qse_xli_list_t qse_xli_list_t;
|
||||
|
||||
typedef struct qse_xli_atom_t qse_xli_atom_t;
|
||||
@ -223,26 +209,6 @@ struct qse_xli_str_t
|
||||
qse_xli_str_t* next;
|
||||
};
|
||||
|
||||
struct qse_xli_int_t
|
||||
{
|
||||
QSE_XLI_VAL_HDR;
|
||||
const qse_char_t* tag;
|
||||
const qse_char_t* ptr;
|
||||
qse_size_t len;
|
||||
/* TODO: include a numeric value here???
|
||||
qse_intmax_t val;
|
||||
*/
|
||||
/* NEED TO SUPPORT MULTI NUBMER? */
|
||||
};
|
||||
|
||||
struct qse_xli_array_t
|
||||
{
|
||||
QSE_XLI_VAL_HDR;
|
||||
const qse_char_t* tag;
|
||||
qse_xli_val_t* ptr;
|
||||
qse_size_t count;
|
||||
};
|
||||
|
||||
#define QSE_XLI_ATOM_HDR \
|
||||
qse_xli_atom_type_t type; \
|
||||
qse_xli_atom_t* prev; \
|
||||
@ -261,8 +227,6 @@ struct qse_xli_pair_t
|
||||
const qse_char_t* key;
|
||||
const qse_char_t* alias;
|
||||
const qse_char_t* tag;
|
||||
unsigned int _key_quoted: 2; /* used internally for output */
|
||||
unsigned int _alias_quoted: 2; /* used internally for output - in fact, an alias is always quoted */
|
||||
qse_xli_val_t* val;
|
||||
};
|
||||
|
||||
@ -404,10 +368,9 @@ enum qse_xli_scm_flag_t
|
||||
QSE_XLI_SCM_VALNIL = (1 << 1),
|
||||
QSE_XLI_SCM_VALSTR = (1 << 2),
|
||||
QSE_XLI_SCM_VALLIST = (1 << 3),
|
||||
QSE_XLI_SCM_VALARRAY = (1 << 4),
|
||||
|
||||
QSE_XLI_SCM_KEYNODUP = (1 << 5),
|
||||
QSE_XLI_SCM_KEYALIAS = (1 << 6),
|
||||
QSE_XLI_SCM_KEYNODUP = (1 << 4),
|
||||
QSE_XLI_SCM_KEYALIAS = (1 << 5),
|
||||
|
||||
/** Indicates that the value is a list with uncertain definitions with
|
||||
* the following constraints:
|
||||
@ -418,7 +381,7 @@ enum qse_xli_scm_flag_t
|
||||
* is specified.
|
||||
*
|
||||
* Applies only if #QSE_XLI_SCM_VALLIST is set. */
|
||||
QSE_XLI_SCM_VALIFFY = (1 << 7)
|
||||
QSE_XLI_SCM_VALIFFY = (1 << 6)
|
||||
};
|
||||
typedef enum qse_xli_scm_flag_t qse_xli_scm_flag_t;
|
||||
|
||||
@ -786,6 +749,11 @@ QSE_EXPORT int qse_xli_readini (
|
||||
qse_xli_io_impl_t io
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_xli_readjson (
|
||||
qse_xli_t* xli,
|
||||
qse_xli_io_impl_t io
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_xli_write (
|
||||
qse_xli_t* xli,
|
||||
qse_xli_list_t* root_list,
|
||||
@ -798,6 +766,12 @@ QSE_EXPORT int qse_xli_writeini (
|
||||
qse_xli_io_impl_t io
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_xli_writejson (
|
||||
qse_xli_t* xli,
|
||||
qse_xli_list_t* root_list,
|
||||
qse_xli_io_impl_t io
|
||||
);
|
||||
|
||||
QSE_EXPORT void* qse_getxlipairxtn (
|
||||
qse_xli_pair_t* pair
|
||||
);
|
||||
|
Reference in New Issue
Block a user