Skip to content

Commit

Permalink
New release of all tools
Browse files Browse the repository at this point in the history
Remove has_nul in struct json_string as UTF-8 should, it is my
understanding, not have a NUL byte.

Fix path in jsemcgen.sh. The repo we know that uses this might have a
problem here that has to be fixed but the path was broken for this repo
so it has to be done, and as the script has an option to change the tool
path, it should not be a problem as this is just the default path.

Update all tools and the release to be the same version after issue #13 was
resolved: "1.2.0 2024-10-09". "1.2.0" was chosen because it was the first one >
some of the versions and the others could be bumped up to it without any harm.
  • Loading branch information
xexyl committed Oct 9, 2024
1 parent 400d311 commit 6b6a0f3
Show file tree
Hide file tree
Showing 26 changed files with 66 additions and 63 deletions.
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Significant changes in the JSON parser repo

## Release 1.2.0 2024-10-09

Remove `has_nul` in `struct json_string` as UTF-8 should, it is my
understanding, not have a NUL byte.

Fix path in `jsemcgen.sh`.

Update all tools and the release to be the same version after issue #13 was
resolved: `1.2.0 2024-10-09`. `1.2.0` was chosen because it was the first one >
some of the versions and the others could be bumped up to it without any harm.


## Release 1.0.23 2024-10-08

Fix surrogate pair decoding in `json_decode()` / `decode_json_string()`. Now one
Expand Down
2 changes: 1 addition & 1 deletion jparse_bug_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if [[ -z "$MAKE" ]]; then
MAKE="$(type -P make)"
fi
export MAKE
export BUG_REPORT_VERSION="1.0.4 2024-06-26"
export BUG_REPORT_VERSION="1.2.0 2024-10-09"
export FAILURE_SUMMARY=
export NOTICE_SUMMARY=
export DBG_LEVEL="0"
Expand Down
4 changes: 2 additions & 2 deletions jsemcgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export MEMBER_FUNC=
export OBJECT_FUNC=
export ARRAY_FUNC=
export UNKNOWN_FUNC=
export JSEMTBLGEN="../jparse/jsemtblgen"
export JSEMTBLGEN="./jsemtblgen"
export JSEMTBLGEN_ARGS=
export PATCH_TOOL=
export JSEMCGEN_VERSION="1.3 2023-02-04"
export JSEMCGEN_VERSION="1.2.0 2024-10-09"

# attempt to fetch system specific paths to tools we need
#
Expand Down
2 changes: 1 addition & 1 deletion jsemtblgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
/*
* official jsemtblgen version
*/
#define JSEMTBLGEN_VERSION "1.0.1 2024-03-02" /* format: major.minor YYYY-MM-DD */
#define JSEMTBLGEN_VERSION "1.2.0 2024-10-09" /* format: major.minor YYYY-MM-DD */

/*
* jsemtblgen tool basename
Expand Down
21 changes: 9 additions & 12 deletions json_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ struct byte2asciistr byte2asciistr[JSON_BYTE_VALUES] = {


/* for json string decoding */
static char *decode_json_string(char const *ptr, size_t len, size_t mlen, size_t *retlen, bool *has_nul);
static char *decode_json_string(char const *ptr, size_t len, size_t mlen, size_t *retlen);
/* for json number strings */
static bool json_process_decimal(struct json_number *item, char const *str, size_t len);
static bool json_process_floating(struct json_number *item, char const *str, size_t len);
Expand Down Expand Up @@ -808,7 +808,6 @@ chkbyte2asciistr(void)
* len length of block
* mlen length of decoded bytes to allocate
* retlen address of where to store allocated length, if retlen != NULL
* has_nul if != NULL and we find an encoded NUL byte we will do *has_nul = true
*
* returns:
* allocated JSON decoding of a block, or NULL ==> error
Expand All @@ -817,7 +816,7 @@ chkbyte2asciistr(void)
* NOTE: this function is used by json_decode().
*/
char *
decode_json_string(char const *ptr, size_t len, size_t mlen, size_t *retlen, bool *has_nul)
decode_json_string(char const *ptr, size_t len, size_t mlen, size_t *retlen)
{
char *ret = NULL; /* allocated encoding string or NULL */
char *beyond = NULL; /* beyond the end of the allocated encoding string */
Expand Down Expand Up @@ -1099,7 +1098,7 @@ decode_json_string(char const *ptr, size_t len, size_t mlen, size_t *retlen, boo
*/

dbg(DBG_VVVHIGH, "returning from decode_json_string(ptr, %ju, %ju, *%ju, %s)",
(uintmax_t)len, (uintmax_t)mlen, retlen != NULL ? *retlen : 0, has_nul != NULL ? booltostr(*has_nul) : "false");
(uintmax_t)len, (uintmax_t)mlen, retlen != NULL ? *retlen : 0);
if (retlen != NULL) {
*retlen = mlen;
}
Expand All @@ -1114,14 +1113,13 @@ decode_json_string(char const *ptr, size_t len, size_t mlen, size_t *retlen, boo
* ptr start of memory block to decode
* len length of block to decode in bytes
* retlen address of where to store allocated length, if retlen != NULL
* has_nul if != NULL and we find an encoded NUL byte we will do *has_nul = true
*
* returns:
* allocated JSON decoding of a block, or NULL ==> error
* NOTE: retlen, if non-NULL, is set to 0 on error
*/
char *
json_decode(char const *ptr, size_t len, size_t *retlen, bool *has_nul)
json_decode(char const *ptr, size_t len, size_t *retlen)
{
char *ret = NULL; /* allocated encoding string or NULL */
size_t mlen = 0; /* length of allocated encoded string */
Expand Down Expand Up @@ -1339,17 +1337,17 @@ json_decode(char const *ptr, size_t len, size_t *retlen, bool *has_nul)
/*
* decode JSON string
*/
ret = decode_json_string(ptr, (uintmax_t)len, (uintmax_t)mlen, retlen, has_nul);
ret = decode_json_string(ptr, (uintmax_t)len, (uintmax_t)mlen, retlen);

/*
* return result, if not NULL
*/
if (ret != NULL) {
dbg(DBG_VVVHIGH, "returning from json_decode(ptr, %ju, *%ju, %s)",
(uintmax_t)len, (uintmax_t)mlen, has_nul != NULL ? booltostr(*has_nul) : "false");
(uintmax_t)len, (uintmax_t)mlen);
} else {
dbg(DBG_VVVHIGH, "in json_decode(): decode_json_string(ptr, %ju, *%ju, %s) returned NULL",
(uintmax_t)len, (uintmax_t)mlen, has_nul != NULL ? booltostr(*has_nul) : "false");
(uintmax_t)len, (uintmax_t)mlen);
if (retlen != NULL) {
*retlen = 0;
}
Expand Down Expand Up @@ -1410,7 +1408,7 @@ json_decode_str(char const *str, size_t *retlen)
/*
* convert to json_decode() call
*/
ret = json_decode(str, len, retlen, NULL);
ret = json_decode(str, len, retlen);
if (ret == NULL) {
dbg(DBG_VVHIGH, "returning NULL for decoding of: <%s>", str);
} else {
Expand Down Expand Up @@ -2946,7 +2944,6 @@ json_conv_string(char const *ptr, size_t len, bool quote)
item->parsed = false;
item->quote = false;
item->same = false;
item->has_nul = false;
item->slash = false;
item->posix_safe = false;
item->first_alphanum = false;
Expand Down Expand Up @@ -3007,7 +3004,7 @@ json_conv_string(char const *ptr, size_t len, bool quote)
* decode the JSON encoded string
*/
/* decode the entire string */
item->str = json_decode(item->as_str, len, &(item->str_len), &(item->has_nul));
item->str = json_decode(item->as_str, len, &(item->str_len));
if (item->str == NULL) {
warn(__func__, "quote === %s: JSON string decode failed for: <%s>",
booltostr(quote), item->as_str);
Expand Down
3 changes: 1 addition & 2 deletions json_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ struct json_string
bool quote; /* The original JSON string included surrounding '"'s */

bool same; /* true => as_str same as str, JSON decoding not required */
bool has_nul; /* true ==> decoded JSON string has a NUL byte inside it */

bool slash; /* true ==> / was found after decoding */
bool posix_safe; /* true ==> all chars are POSIX portable safe plus + and maybe / after decoding */
Expand Down Expand Up @@ -491,7 +490,7 @@ extern struct byte2asciistr byte2asciistr[];
extern char *json_encode(char const *ptr, size_t len, size_t *retlen, bool skip_quote);
extern char *json_encode_str(char const *str, size_t *retlen, bool skip_quote);
extern void chkbyte2asciistr(void);
extern char *json_decode(char const *ptr, size_t len, size_t *retlen, bool *has_nul);
extern char *json_decode(char const *ptr, size_t len, size_t *retlen);
extern char *json_decode_str(char const *str, size_t *retlen);
extern struct json *parse_json_string(char const *string, size_t len);
extern struct json *parse_json_bool(char const *string);
Expand Down
1 change: 0 additions & 1 deletion json_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,6 @@ vjson_fprint(struct json *node, unsigned int depth, va_list ap)
CONVERTED_PARSED_JSON_NODE(item)?"c:":"",
item->quote ? "q" : "",
item->same ? "=" : "",
item->has_nul ? "0" : "",
item->slash ? "/" : "",
item->posix_safe ? "P" : "",
item->first_alphanum ? "a" : "",
Expand Down
7 changes: 1 addition & 6 deletions jstrdecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
*/
#define REQUIRED_ARGS (0) /* number of required arguments on the command line */

/*
* official jstrdecode version
*/
#define JSTRDECODE_VERSION "1.0.6 2024-10-08" /* format: major.minor YYYY-MM-DD */

/*
* usage message
*
Expand Down Expand Up @@ -221,7 +216,7 @@ jstrdecode_stream(FILE *in_stream)
/*
* decode data read from input stream
*/
buf = json_decode(input, inputlen, &bufsiz, NULL);
buf = json_decode(input, inputlen, &bufsiz);
if (buf == NULL) {
/* free input */
if (input != NULL) {
Expand Down
5 changes: 5 additions & 0 deletions jstrdecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
*/
#include "version.h"

/*
* official jstrdecode version
*/
#define JSTRDECODE_VERSION "1.2.0 2024-10-09" /* format: major.minor YYYY-MM-DD */


/*
* jstrdecode tool basename
Expand Down
5 changes: 0 additions & 5 deletions jstrencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
*/
#define REQUIRED_ARGS (0) /* number of required arguments on the command line */

/*
* official jstrencode version
*/
#define JSTRENCODE_VERSION "1.1.3 2024-10-08" /* format: major.minor YYYY-MM-DD */

/*
* usage message
*
Expand Down
5 changes: 5 additions & 0 deletions jstrencode.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
*/
#include "version.h"

/*
* official jstrencode version
*/
#define JSTRENCODE_VERSION "1.2.0 2024-10-09" /* format: major.minor YYYY-MM-DD */


/*
* jstrencode tool basename
Expand Down
2 changes: 1 addition & 1 deletion run_bison.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# setup
#
export RUN_BISON_VERSION="1.0.1 2024-03-02"
export RUN_BISON_VERSION="1.2.0 2024-10-09"
export BISON_BASENAME="bison"
export PREFIX="jparse"
export SORRY_H="sorry.tm.ca.h"
Expand Down
2 changes: 1 addition & 1 deletion run_flex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# setup
#
export RUN_FLEX_VERSION="1.0.1 2024-03-02"
export RUN_FLEX_VERSION="1.2.0 2024-10-09"
export FLEX_BASENAME="flex"
export PREFIX="jparse"
export SORRY_H="sorry.tm.ca.h"
Expand Down
2 changes: 1 addition & 1 deletion test_jparse/is_available.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# Share and enjoy! :-)

export VERSION="1.1.1 2024-10-01"
export VERSION="1.2.0 2024-10-09"
NAME=$(basename "$0")
export NAME
export PRINT_WHERE=""
Expand Down
5 changes: 0 additions & 5 deletions test_jparse/jnum_chk.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
*/
#define REQUIRED_ARGS (0) /* number of required arguments on the command line */

/*
* official jnum_chk version
*/
#define JNUM_CHK_VERSION "1.0.1 2024-03-02" /* format: major.minor YYYY-MM-DD */

/*
* usage message
*
Expand Down
5 changes: 4 additions & 1 deletion test_jparse/jnum_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
*/
#include "../version.h"


/*
* official jnum_chk version
*/
#define JNUM_CHK_VERSION "1.0.1 2024-03-02" /* format: major.minor YYYY-MM-DD */


/*
Expand Down
5 changes: 0 additions & 5 deletions test_jparse/jnum_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@
#define REQUIRED_ARGS (1) /* number of required arguments on the command readline_buf */
#define CHUNK (16) /* allocate CHUNK elements at a time */

/*
* official jnum_gen version
*/
#define JNUM_GEN_VERSION "1.0.1 2024-03-02" /* format: major.minor YYYY-MM-DD */

/*
* usage message
*
Expand Down
4 changes: 4 additions & 0 deletions test_jparse/jnum_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
*/
#include "../version.h"

/*
* official jnum_gen version
*/
#define JNUM_GEN_VERSION "1.0.1 2024-03-02" /* format: major.minor YYYY-MM-DD */

/*
* jnum_gen tool basename
Expand Down
2 changes: 1 addition & 1 deletion test_jparse/jparse_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

# setup
#
export JPARSE_TEST_VERSION="1.0.8 2024-10-08" # version format: major.minor YYYY-MM-DD */
export JPARSE_TEST_VERSION="1.2.0 2024-10-09" # version format: major.minor YYYY-MM-DD */
export CHK_TEST_FILE="./test_jparse/json_teststr.txt"
export CHK_INVALID_TEST_FILE="./test_jparse/json_teststr_fail.txt"
export JPARSE_JSON="./jparse.json"
Expand Down
2 changes: 1 addition & 1 deletion test_jparse/jstr_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export JSTRDECODE="./jstrdecode"
export TEST_FILE="./test_jparse/jstr_test.out"
export TEST_FILE2="./test_jparse/jstr_test2.out"
export JSTR_TEST_TXT="./test_jparse/jstr_test.txt"
export JSTR_TEST_VERSION="1.0.4 2024-10-08" # version format: major.minor YYYY-MM-DD
export JSTR_TEST_VERSION="1.2.0 2024-10-09" # version format: major.minor YYYY-MM-DD
export TOPDIR=

export USAGE="usage: $0 [-h] [-V] [-v level] [-e jstrencode] [-d jstrdecode] [-Z topdir]
Expand Down
7 changes: 0 additions & 7 deletions test_jparse/pr_jparse_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
*/
#include "pr_jparse_test.h"



/*
* official pr_jparse_test version
*/
#define PR_JPARSE_TEST_VERSION "1.0.3 2024-09-12" /* format: major.minor YYYY-MM-DD */

/*
* definitions
*/
Expand Down
6 changes: 6 additions & 0 deletions test_jparse/pr_jparse_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
*/
#include "../version.h"

/*
* official pr_jparse_test version
*/
#define PR_JPARSE_TEST_VERSION "1.2.0 2024-10-09" /* format: major.minor YYYY-MM-DD */


/*
* pr_jparse_test tool basename
*/
Expand Down
2 changes: 1 addition & 1 deletion test_jparse/prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
export FAILURE_SUMMARY=
export SKIPPED_SUMMARY=
export LOGFILE=
export PREP_VERSION="1.0.3 2024-09-30"
export PREP_VERSION="1.2.0 2024-10-09"
export NOTICE_COUNT="0"
export USAGE="usage: $0 [-h] [-v level] [-V] [-e] [-o] [-m make] [-M Makefile] [-l logfile]
Expand Down
5 changes: 0 additions & 5 deletions verge.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
*/
#define REQUIRED_ARGS (2) /* number of required arguments on the command line */

/*
* official verge tool version
*/
#define VERGE_VERSION "1.0.1 2024-03-02" /* format: major.minor YYYY-MM-DD */

/*
* usage message
*
Expand Down
5 changes: 5 additions & 0 deletions verge.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
*/
#include "version.h"

/*
* official verge tool version
*/
#define VERGE_VERSION "1.2.0 2024-10-09" /* format: major.minor YYYY-MM-DD */


/*
* verge tool basename
Expand Down
Loading

0 comments on commit 6b6a0f3

Please sign in to comment.