--- libelwix/inc/elwix/ajson.h 2017/11/28 00:46:53 1.1.2.5 +++ libelwix/inc/elwix/ajson.h 2017/11/28 02:00:45 1.1.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: ajson.h,v 1.1.2.5 2017/11/28 00:46:53 misho Exp $ +* $Id: ajson.h,v 1.1.2.6 2017/11/28 02:00:45 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -72,6 +72,7 @@ typedef struct _tagHandler { void *h_alloc; int h_strict; } json_t; +#define json_toksnum(x) (x)->h_next typedef struct _tagToken { jtype_t tok_type; @@ -80,6 +81,12 @@ typedef struct _tagToken { long tok_size; long tok_parent; } jtok_t; +#define json_toktype(x) (x)->tok_type +#define json_toksize(x) (x)->tok_size +#define json_toklen(x) ((x)->tok_end - (x)->tok_start) +#define json_tokstr(j, x) ((j) + (x)->tok_start) +#define json_tokstrcpy(d, j, x) { strncpy((d), json_tokstr((j), (x)), json_toklen(x) - 1); \ + (d)[json_toklen(x)] = 0; } /*