Final changes to YAJL for use in Base

* Bump the YAJL version number
* Define a HAS_JSON5 macro
* Set yajl_allow_json5 by default, fixing yajl_test and API comments
This commit is contained in:
Andrew Johnson
2020-07-12 23:50:01 -05:00
parent c00f638f7e
commit b0d78921fd
4 changed files with 23 additions and 5 deletions

View File

@@ -74,7 +74,7 @@ yajl_alloc(const yajl_callbacks * callbacks,
hand->lexer = NULL;
hand->bytesConsumed = 0;
hand->decodeBuf = yajl_buf_alloc(&(hand->alloc));
hand->flags = 0;
hand->flags = yajl_allow_json5 | yajl_allow_comments;
yajl_bs_init(hand->stateStack, &(hand->alloc));
yajl_bs_push(hand->stateStack, yajl_state_start);

View File

@@ -37,13 +37,27 @@ extern "C" {
* YAJL 1.0.12 version that was
* bundled with EPICS Base 3.15.0.1
*
* YAJL 2.1.0
* ***YAJL 2.1.0***
* \li Changes argument type for yajl_integer() from \c int to \c long \c long
* \li Changes argument type for yajl_string() and yajl_map_key() from \c unsigned to \c size_t
* \li Changes argument type for yajl_string() and yajl_map_key() from
* \c unsigned to \c size_t
* \li Replacement of struct yajl_parser_config with yajl_config()
* \li Replacement of yajl_parse_complete() with yajl_complete_parse()
*
* ***YAJL 2.2.0***
* This version adds support for JSON5 parsing and generation.
* The upstream YAJL repository is no longer being maintained and the
* original author no longer responds to messsages, so while this code
* has been offered for merging into the upstream it is unlikely that
* will ever happen. The version number here is thus an EPICS-specific
* construct.
*/
#define EPICS_YAJL_VERSION VERSION_INT(2,1,0,0)
#define EPICS_YAJL_VERSION VERSION_INT(2,2,0,0)
/** A macro to make it easy to conditionally compile code that supports
* older releases.
*/
#define HAS_JSON5
/** A limit used by the generator API, YAJL_MAX_DEPTH is the maximum
* depth to which arrays and maps may be nested.

View File

@@ -183,7 +183,8 @@ extern "C" {
* and object keys which are not permitted by the JSON standard.
* Setting this flag tells yajl to accept JSON5 standard input.
* This flag also enables \c yajl_allow_comments since comments are
* part of the JSON5 standard.
* part of the JSON5 standard. In the EPICS build this option is
* enabled by default, it must be turned off to disable JSON5.
*
* yajl_config() argument type: int (boolean)
*

View File

@@ -205,6 +205,9 @@ main(int argc, char ** argv)
/* allocate the parser */
hand = yajl_alloc(&callbacks, &allocFuncs, NULL);
/* turn off JSON5 (the EPICS default) */
yajl_config(hand, yajl_allow_json5, 0);
/* check arguments. We expect exactly one! */
for (i=1;i<argc;i++) {
if (!strcmp("-5", argv[i])) {