added the pair_writable callback to xli
This commit is contained in:
parent
d61c292659
commit
b3a288affb
@ -454,9 +454,15 @@ typedef void (*qse_xli_pair_read_cb_t) (
|
|||||||
qse_xli_loc_t* loc
|
qse_xli_loc_t* loc
|
||||||
);
|
);
|
||||||
|
|
||||||
|
typedef int (*qse_xli_pair_writable_cb_t) (
|
||||||
|
qse_xli_t* xli,
|
||||||
|
qse_xli_pair_t* pair
|
||||||
|
);
|
||||||
|
|
||||||
struct qse_xli_cbs_t
|
struct qse_xli_cbs_t
|
||||||
{
|
{
|
||||||
qse_xli_pair_read_cb_t pair_read;
|
qse_xli_pair_read_cb_t pair_read;
|
||||||
|
qse_xli_pair_writable_cb_t pair_writable;
|
||||||
};
|
};
|
||||||
typedef struct qse_xli_cbs_t qse_xli_cbs_t;
|
typedef struct qse_xli_cbs_t qse_xli_cbs_t;
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ static int write_list (qse_xli_t* xli, qse_xli_list_t* list, int depth)
|
|||||||
{
|
{
|
||||||
qse_xli_pair_t* pair = (qse_xli_pair_t*)curatom;
|
qse_xli_pair_t* pair = (qse_xli_pair_t*)curatom;
|
||||||
|
|
||||||
|
if (xli->opt.cbs.pair_writable && !xli->opt.cbs.pair_writable(xli, pair)) continue;
|
||||||
|
|
||||||
if (pair->tag)
|
if (pair->tag)
|
||||||
{
|
{
|
||||||
/* the tag can't be written. so ignore it */
|
/* the tag can't be written. so ignore it */
|
||||||
|
@ -106,6 +106,8 @@ static int write_list (qse_xli_t* xli, qse_xli_list_t* list, int depth)
|
|||||||
{
|
{
|
||||||
qse_xli_pair_t* pair = (qse_xli_pair_t*)curatom;
|
qse_xli_pair_t* pair = (qse_xli_pair_t*)curatom;
|
||||||
|
|
||||||
|
if (xli->opt.cbs.pair_writable && !xli->opt.cbs.pair_writable(xli, pair)) continue;
|
||||||
|
|
||||||
if (write_indentation(xli, depth) <= -1) return -1;
|
if (write_indentation(xli, depth) <= -1) return -1;
|
||||||
|
|
||||||
if (!(list->flags & QSE_XLI_LIST_ARRAYED))
|
if (!(list->flags & QSE_XLI_LIST_ARRAYED))
|
||||||
@ -130,15 +132,15 @@ static int write_list (qse_xli_t* xli, qse_xli_list_t* list, int depth)
|
|||||||
switch (pair->val->type)
|
switch (pair->val->type)
|
||||||
{
|
{
|
||||||
case QSE_XLI_NIL:
|
case QSE_XLI_NIL:
|
||||||
if (write_to_current_stream(xli, QSE_T("nil"), 5, 0) <= -1) return -1;
|
if (write_to_current_stream(xli, QSE_T("nil"), 3, 0) <= -1) return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QSE_XLI_TRUE:
|
case QSE_XLI_TRUE:
|
||||||
if (write_to_current_stream(xli, QSE_T("true"), 6, 0) <= -1) return -1;
|
if (write_to_current_stream(xli, QSE_T("true"), 4, 0) <= -1) return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QSE_XLI_FALSE:
|
case QSE_XLI_FALSE:
|
||||||
if (write_to_current_stream(xli, QSE_T("false"), 7, 0) <= -1) return -1;
|
if (write_to_current_stream(xli, QSE_T("false"), 5, 0) <= -1) return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QSE_XLI_STR:
|
case QSE_XLI_STR:
|
||||||
|
@ -268,6 +268,8 @@ static int write_list (qse_xli_t* xli, qse_xli_list_t* list, int depth)
|
|||||||
{
|
{
|
||||||
qse_xli_pair_t* pair = (qse_xli_pair_t*)curatom;
|
qse_xli_pair_t* pair = (qse_xli_pair_t*)curatom;
|
||||||
|
|
||||||
|
if (xli->opt.cbs.pair_writable && !xli->opt.cbs.pair_writable(xli, pair)) continue;
|
||||||
|
|
||||||
if (write_indentation (xli, depth) <= -1) return -1;
|
if (write_indentation (xli, depth) <= -1) return -1;
|
||||||
|
|
||||||
if (pair->tag)
|
if (pair->tag)
|
||||||
|
Loading…
Reference in New Issue
Block a user