mkiocccentry 1.1 2024-05-19 #868
lcn2
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Release 1.1 2024-05-19
Release version 1.1 of the mkiocccentry tool set.
Release 1.0.64 2024-05-18
Changed all submission_num to submit_slot (including json tags) and changed
all MAX_SUBMISSION_NUM to MAX_SUBMIT_SLOT_NUM and
all MAX_SUBMISSION_CHARS to MAX_SUBMIT_SLOT_CHARS and
changed relater comment and prompt text to be more consistent with the
pending submit server AND reduce the chance that someone revising their
submission incorrectly thinks they need to increment that value each time.
Remove formed_UTC JSON member from
.auth.json
and.info.json
.The formed_UTC JSON member was redundant in that it was simply
a different coding of the formed_timestamp in ASCII date string form.
It was a source of errors in editing formed_timestamp values.
Changed INFO_VERSION from "1.15 2024-03-02"
to "1.16 2024-05-18" as a result of the JSON member name above changes.
Changed AUTH_VERSION from "1.21 2024-03-04"
to "1.22 2024-05-18" s a result of the JSON member name above changes.
Fix
soup/reset_tstamp.sh
andsoup/Makefile
to look for thecorrect location of the
limit_ioccc.h
file and fixed the promptsresult messages.
Changed
soup/reset_tstamp.sh
RESET_TSTAMP_VERSION from "1.0.1 2024-03-02"to "1.0.2 2024-05-15" as a result of the above changes.
Changed MKIOCCCENTRY_VERSION from "1.0.5 2024-05-15"
to "1.0.6 2024-05-19" as a result of the above changes.
Changed TXZCHK_VERSION from "1.0.4 2024-05-16"
to "1.0.5 2024-05-19" as a result of the above changes.
Performed
make reset_min_timestamp
to change MIN_TIMESTAMP from 1675547786to 1716103155 due to the changes in both
.auth.json
and.info.json
.Release 1.0.63 2024-05-16
Changed more references of entry to submission and entries to
submissions and updated the man pages for
mkiocccentry(1)
andchkentry(1)
about this as there are places where it is NOT appropriate to update the terms.
It might be that there are no more places where entry or entries is used
incorrectly (except perhaps for iocccsize.c) but the other terms have not been
checked.
Make
txzchk(1)
not show output if-q
specified. Updated version to"1.0.4 2024-05-16"
.The
mkiocccentry(1)
tool prints both the location name and thecommon location name when prompting the user to validate author
location data.
Release 1.0.62 2024-05-15
Changed MKIOCCCENTRY_REPO_VERSION from "1.0.1 2023-02-14"
to "1.0.62 2024-05-15" to match the above release version.
Changed IOCCC_CONTEST from "IOCCCMOCK"
to "IOCCC28" for testing purposes. :-)
Changed IOCCC_YEAR from "2023"
to "2024" for testing purposes. :-)
Changed MKIOCCCENTRY_VERSION from "1.0.4 2024-03-04"
to "1.0.5 2024-05-15" because of the above constant changes.
The filename formed by mkiocccentry(1) was changed
to start with submit. instead of entry..
Changed FNAMCHK_VERSION from "1.0.1 2024-03-02"
to "1.0.2 2024-05-15" because of the above change.
Updated
mkiocccentry(1)
andchkentry(1)
man pages accordingly.Updated the test files according to the above changes.
Release 1.0.61 2024-03-07
Remove from comments the
winner_handle
. Fixed the regexp of an allowed handle(in comments and in strings). It is regrettable but due to the use of
posix_plus_safe()
additional characters are allowed that might be better leftout (these have been allowed for a long time but the comments and strings said
otherwise). The regexp that is allowed for
author_handle
s is:The difference is that it allows upper case characters too. In particular the
old regexp was
^[0-9a-z][0-9a-z._+-]*$
.Typo fix in txzchk.h: referred to
posix_safe_plus()
instead ofposix_plus_safe()
.Change words
entry
andentries
tosubmission
andsubmissions
(exception:in
iocccsize
).Added FAQ 12 "Why do these tools sometimes use the incorrect IOCCC terms?".
Release 1.0.59 2024-03-04
Added a distinction between a "common name" and "name" for locations.
Added
-c
to the location command line to change using "name"(the default) to ""common name".
Removed location_name JSON member from
.auth.json
.While
mkiocccentry
will ask the user to verify their location_codeby also showing them the location_name, it will no longer add
the JSON member with the JSON member name of "location_name" to
.auth.json
.Changed LOCATION_VERSION from "1.0.2 2023-08-04" to "1.0.3 2024-03-03".
Changed MKIOCCCENTRY_VERSION from "1.0.3 2024-03-02 to "1.0.4 2024-03-04".
Changed IOCCC_auth_version from "1.20 2024-03-02" to "1.21 2024-03-04".
Changed MKIOCCCENTRY_REPO_VERSION from "1.0.1 2023-02-14" to "1.1 2023-03-04".
Added a simple
make unstall
rule to uninstall all files installed by this repo.Release 1.0.58 2024-03-02
Address part (possibly all) of the issue of new IOCCC terms (only part because
some things need to be decided still especially with file names and related
specifics but possibly all if it's decided these should stay the same).
Changed version of
txzchk
to"1.0.3 2024-03-02"
.Changed version of
fnamchk
to"1.0.1 2024-03-02"
.Changed version of
mkiocccentry
to"1.0.3 2024-03-04"
.Changed
AUTH_VERSION
to"1.20 2024-03-02"
.Changed
INFO_VERSION
to"1.15 2024-03-02
".In many cases the word
entry
was changed tosubmission
. Forchkentry
andmkiocccentry
it has been decided to keep the names. However in text, variableand comments the word is now
submission
. It is not clear, however, if asubmission directory needs to have a different prefix (currently it's
entry.
).If this is necessary then more changes will have to be made. If it needs to be
renamed then changes in
fnamchk
andtxzchk
plus data files (at the veryleast - there might be other places that'd have to be updated) will have to be
made.
winner
/winners
changed towinning author
/winning authors
(a morethorough check has to be performed to make sure all are caught, see below). A
winning submission is an entry and at least in some cases this is now clear. In
the case of
winner_handle
(or even justwinner handle
) this was not changed.There already exists an
author_handle
and that's what is in the files but incomments
winner_handle
also exists. In other words this ambiguity should beaddressed.
The json
past_winner
was changed topast_winning_author
. Thisinvolved updating some patch files and all the auth json files as well.
Typo fix in
bug_report.sh
. No version update.In many cases (not all) the year 2023 was changed to 2024. The
IOCCC_YEAR
wasNOT updated to 2024 as this causes other problems that require a bit more time.
A fun problem to resolve is the text along the lines of 'submit your entry'
being changed to 'submit your submission'. In some cases the surrounding text
was reworded but not in all. If you like this can be submissions all the way
down!
Release 1.0.57 2024-01-21
Rename "print_test" to "pr_jparse_test". The name "print_test" was
too generic and might conflict with some test print application
if it was installed.
Release 1.0.56 2024-01-20
Changed
"iocccsize_version"
in JSON files (those that were"28.13 2023-02-04"
) to""28.14 2024-01-04"
. This fixed a problem withmake prep
failing due to the script
chkentry_test.sh
failing due to many errorsreported, some of which didn't seem to make any sense whatever.
Change
fd_is_ready()
to return true ifisatty(fd)
.Release 1.0.55 2023-11-07
Add another forbidden file name in submissions:
prog.alt
(prog.alt.c isallowed).
Modularise the checks for invalid filenames in entries. For instance in
check_extra_file()
there's no need to check each extra filename and then givethe same error message changing the macro of the filename that's disallowed when
we can just print the string being tested against. The only difference is that
there's one if (with multiple checks) and instead of duplicating the same error
message we just print it once with the string being tested against. Note that
there are two sets of checks: one for extra files being required filenames and
another for disallowed filenames.
Make sure to use the macros for the filenames, not the literal strings (e.g. use
PROG_FILENAME
not"prog"
).Check filenames in alphabetical order (I think :-) .. very tired so maybe missed
one or two).
Note that the function
check_extra_file()
CANNOT be used in every case so it'snot used except in chkentry!
Release 1.0.54 2023-11-06
The following filenames are no longer allowed in an entry's extra files list:
The mkiocccentry tool checks for this, giving an error early on (rather than
making the user retry after inputting more details). The function
test_extra_file()
now checks for these files too, giving an error if any arefound.
New mkiocccentry version: 1.0.2 2023-11-06.
txzchk
also checks for these files in the tarball. New version: 1.0.22023-11-06.
Release 1.0.53 2023-09-13
Minor fix in
jval
andjnamval
- new version"0.0.15 2023-09-13"
. Thene
operator for
-S
and-n
already was parsed (by foresight that it wouldbe needed, maybe) but it was not in the help. Also I decided to change the order
of the enum so that
JSON_CMP_OP_NE
comes right afterJSON_CMP_OP_EQ
ratherthan at the end.
Man pages updated - added
ne
to-S
and-n
options.Release 1.0.52 2023-08-09
New version of
jval
andjnamval
,"0.0.14 2023-08-09"
.Fixed the lists of
-S
and-n
option parsing. For now it should just be astring that's strdup()d. The operators are in the list in the order specified,
one list for strings and one list for numbers. This can be changed to a single
list later on if necessary (as I suspect it might need to be but the way it is
now is set up as two which is what I'm operating under).
The function that frees the
-S
and-n
lists injval
andjnamval
is nowin
json_util.c
as they are actually in a struct common to bothjval
andjnamval
. The functions that free them injval_util.c
andjnamval_util.c
simply check that
jval
orjnamval
is not NULL and then calls the newfree_json_util_cmp_list()
function.Made the json util operator macros an enum.
Rename the enum
output_format
toJSON_UTIL_OUTPUT_FMT
.Release 1.0.51 2023-08-07
Fix link in make rule
jparse.clone
to usehttps://github.com/xexyl/jparse.git
as the link used,https://github.com/lcn2/jparse.git
, is actually a clone of the repo I set up(empty for now) which will be populated with
jparse
later on when the parseris tested more fully.
Add
-F
to common options ofjson_util_README.md
.Change
jnamval -P
tojnamval -r
(restrict printing types). There might be areference to something non-programming in this change. New version
"0.0.13 2023-08-07"
.Slightly improve
dbg_example.c
by adding a call tonot_reached()
after theerrp()
call.Release 1.0.50 2023-08-06
New version of
jfmt
,jval
andjnamval
:"0.0.12 2023-08-06"
.jfmt
andjval
jumped from 0.0.10 to make them match. Later on after version 1.0.0 thiswill no longer happen.
Updated the
-F
option list. It now is:Updated man pages for the three tools for this change as well as a typo fix in
jnamval.1
for the-p
option (wrongly listed as-P
which is somethingelse).
Updated
tmp/TODO.md
: the options for the three tools should be in the sameorder, particularly the common options, both in usage string and man pages. But
since the specs are not finalised this needn't be done yet.
Release 1.0.49 2023-08-05
New version of
jnamval
:"0.0.11 2023-08-05"
. Add-I
option with samesemantics as
jfmt
. Updatedjnamval.1
to add this option and fix typos.Change available options for
jnamval -t
to be that ofjval -t
. Updated manpage.
Typo fixes in
jfmt.1
andjval.1
. Removed-I
fromjval.1
as it's not avalid option.
Fix typo in usage string in
jnamval
which referred to non-existent option (itis actually an option arg, not an option, that is correct and that is now what
it says).
Add option
-P
tojnamval
. This is just like what-t
forjnamval
used tobe but it will indicate what to print rather than what to match. Man page
updated for this option. As the code is common to both
jval
andjnamval
thejval
utility could be updated easily to support this option is desired butthis is TBD later.
Add some bad test JSON files in the
jparse/test_jparse/test_JSON/bad_loc
directory, updated Makefile rule Added appropriate
err
files.Updated Makefile rule
rebuild_jparse_err_files
to not show the command beingrun for each file to make the output clean (and to show what it looks like in
the README.md file - which has been updated due to slight changes).
Fix warning message of
mkiocccentry -y
and move it to happen before the optionto ignore all warnings as that one says no more warnings will be displayed so it
should come last.
Removed the "program" arg from
parse_verbosity()
. Theparse_verbosity()
no longer exits on errors or bad arguments. Instead
parse_verbosity()
returns
DBG_INVALID
, a value < 0.The return from
parse_verbosity()
is now checked for a < 0 returnvalue and an appropriate error is raised when that happens.
Release 1.0.48 2023-08-04
Bug fixes in
location
tool wrt the-a
and-s
options. New version"1.0.2 2023-08-04"
.Change
-N
to-n
.Always use re-entrant version of the lookup functions as this allows for proper
showing of both name and code whether or not one is using
-s
or-n
. If-a
we still show all (as before) but without
-n
we previously showed both nameand code like
code ==> name
when it should only show both if verbosity levelis > 0. Note that the chkentry tool SHOULD NOT and DOES NOT use the
re-entrant versions.
Use
parse_verbosity()
for parsing the-v
option.Updated man page with an example added and updating
-N
to-n
.Release 1.0.47 2023-08-03
New version of
location
tool:"1.0.1 2023-08-03"
.Improved tool to allow for
-a
(show all) and-s
(substring search). Uses newre-entrant versions of the functions
lookup_location_name()
andlookup_location_code()
. These new functions take asize_t *idx
which is setto the next element in the table (if != NULL) so that the next call can skip
continue after the previous element. They also take a
struct location **
which stores the found location. This is useful for
-v 1
as one can then seesomething like:
Without the
-v 1
it will only show:$ ./location -a -s -N 'united' AE GB PU TZ UK UM UN US
If one does not use the
-N
option the-a
is less useful as that functionchecks explicitly that the length is two characters so it has to be an exact
match. Nevertheless there is a re-entrant version of the function that works
much the same way as the other and the
-a
is processed without-N
. Use of-s
requires an arg much like-N
but it does NOT require-N
itself.The rationale behind these changes is they will make it easier for people to
find their country code, if they do not know what it is (or they want say
anonymous and don't know that it's
XX
). Search is done case-insensitively.Another example use:
I, that is Cody/@xexyl, observe that Germany is a country full of 'germ ridden
people' (this is not really true of course but it's a fun pun of mine :-) )
Add
tmp/TODO.md
file with todo items not specific to any open issue.Release 1.0.46 2023-08-02
Move
parse_verbosity(3)
to dbg/dbg.c as it is the dbg code that uses theverbosity_level
variable. Ranmake test
to verify that this works okay.Updated
dbg.3
man page to add this function to the man page. Also improved theman page in some clarification of other functions (call semantics for example).
New version of
dbg
facility and thejparse
and json parser: respectivelythey are
"2.11 2023-08-02"
and for bothjparse
and the json parser"1.1.4 2023-08-02"
.Remove
parse_verbosity(3)
fromdyn_array(3)
facility as it is in thedbg(3)
facility and thedyn_array(3)
facility uses thedbg(3)
facility.Update
jfmt.1
,jval.1
andjnamval.1
for-F
option. There might be acolourful update in the three files.
Typo fix in
print_test.c
and make a comment that exists in more than one placeconsistent in location.
Release 1.0.45 2023-08-01
New version of
jfmt
,jval
andjnamval
:"0.0.10 2023-08-01"
.Add two new format options to
-F
option ofjfmt
,jval
andjnamval
:1line
which prints output on one line with one space between the tokens andnows
for no extra whitespace. There might or might not be a joke somewhere inhere :-)
Fix formatting in
-h
usage string of the above mentioned tools as well.New version of
jparse_test.sh
:"1.0.3 2023-08-01"
. The script now runsprint_test
instead of the Makefile doing it and thus cluttering up the output.A thought was to have it run a new script
run_print_test.sh
but this was notnecessary and would only add more complexity as the script would just have to
run the tool and check for exit status.
Fix
jparse.3
man page for the change in theconverted
andparsed
booleanconvenience macros.
Release 1.0.44 2023-07-31
Add
-F format
option to tojfmt
,jval
andjnamval
. New version for tools"0.0.9 2023-07-31"
.color
is aliased tocolour
. Other options aredefault
andpedantic
. Debug output (withDBG_NONE
which has to change -later on) is added based on the optarg. This option has NOT been added to the
man pages. That will come later either later today or another day.
Add missing setting of variables in
alloc_jnamval()
.Release 1.0.43 2023-07-30
Improve, typo fix and bug fix
jparse/test_jparse/print_test.c
. Now checks thefile descriptor versions of the printf functions. Added
not_reached();
callafter an error function was called. New version
"1.0.1 2023-07-30"
.Release 1.0.42 2023-07-29
Add
jparse/test_jparse/print_test
test tool to test if variousprint function calls fail. Here "print function call" refers to:
We also test various print-like functions from
parse/util.c
such as:Added
chk_stdio_printf_err(stream, ret)
to determine of aprint function call had an error.
All "print function call"s are now followed by a call to
chk_stdio_printf_err()
to properly detect if there was afailure in the "print function call".
Add
print_test
execution tomake test
injparse/test_jparse/Makefile
.New versions of
jfmt
,jval
andjnamval
with some minor bug fixes andenhancements:
"0.0.8 2023-07-29"
,"0.0.8 2023-07-29"
and"0.0.8 2023-07-29"
. The version change synchronises the version number to keep trackof the versions since the date was the same. This does mean that the version for
both
jfmt
andjnamval
jumped from 0.0.6 to 0.0.8 but this seems like aworthy compromise to keep things together especially as the documented change
for the version update that technically took place on 28 July 2023 was or if it
was is no longer documented.
For
jval
andjnamval
the functionsparse_jval_args()
andparse_jnamval_args()
have been updated to take the proper struct, a pointer toargc
frommain()
and a pointer toargv
frommain()
. That is aint *
and a
char ***
. The functions incrementargc
/argv
past the file name sothat
main()
can check if there are any args without having to worry aboutargv[0]
. The function (notmain()
- the parsing ones) now show debuginformation about the args shown. Currently the debug level is 0 so that it's
always printed but this will change later on. As there is no implementation yet
(but see below) there is no list or array or searching of any kind with the
args.
Since the ability to check if any args is now easy and since
-i
flag with noargs specified means that there are no matches and that indicates exiting 8
jval
andjnamval
now have this check. That is the extent of anyimplementation details until we have discussed output, how
jfmt
should formatcode, search routines are added and numerous other things. This was just an
aside, one might say.
Added
XXX
comment to the print count function of each tool that points outthat currently the count is not correct. This will be removed in time.
Update
jval(1)
man page - add exit code 8 to list of exit codes.Release 1.0.41 2023-07-27
Update
json_util_README.md
document.Added missing exit code to
jval
tool. Updated version string to: "0.0.62023-07-27".
Sequenced exit codes.
Release 1.0.41 2023-07-26
New version of
jfmt
,jval
andjnamval
: "0.0.5 2023-07-26".Moved code in
jnamval
common to bothjval
andjnamval
tojson_util.c
like what was done yesterday for
jval
.Fixed bug where one could not do:
and the same thing with
jval
andjnamval
. This also fixes the bug where onecould not do:
./jfmt - "test" ^D
and the same thing with the other too tools. The above two fixes changes the use
of
parse_json_stream()
toparse_json()
. Note that theFILE *
is stillneeded.
Add to
struct json_util
the file path of the JSON file asjson_file_path
.Check that the path is not an empty file name and exit with error code 3 if it
is in all three tools.
New version of
jparse
and json parser: "1.1.3 2023-07-26".Improve how
parse_json_stream()
deals with NULL filename. This means that thecheck for NULL is moved higher up in the function so that if the path is NULL we
set it to
-
for stdin. This check was in the function already but the purposewas to make it so that if NULL it is stdin. If it's NULL though it's likely that
the stream is also NULL which means that the check would never get triggered.
The
stream
can still end up NULL but it shouldn't be a problem if stdin now.Improve check if file is ready (function
fd_is_ready()
) inparse_json_stream()
: don't check if stdin as it should be ready anyway and notdoing this seemed to prevent it from reading the file (in some cases).
Release 1.0.40 2023-07-25
New version for
jfmt
,jval
andjnamval
: "0.0.4 2023-07-25". Moved commonvariables from the structs for each tool (
struct jfmt
,struct jval
andstruct jnamval
) tojson_util.h
and prefix withjson_util
rather than the(jfmt|jval|jnamval)_
. More work needs to be done here asjval
andjnamval
share variables as well but this will be done in another commit.
The structs
(jfmt|jval|jnamval)_number
are nowjson_util_number
injson_util.h
and the associated code has been moved tojson_util.c
.The code for the common
-L
option to the three tools has also been moved tothe
json_util.c
file.Any other options common to the three tools that I have not mentioned here have
also been moved or so it is believed (it is possible some was missed but these
will be located in time if any are missing).
Move variables and functions common to
jval
andjnamval
tojson_util
except that only
jval
currently uses them.jnamval
has more options not usedby
jval
and so it'll take a bit more work to get it done. Some of the code isslightly different functionally so that code was not moved over. In particular
some options that are common to both tools have it where
jval
has feweroption args:
-t
for example. The macros that have been updated now are as thenew ones in
json_util.h
.Release 1.0.39 2023-07-24
Minor fixes to JSON convenience macros that check for a valid or parsed node.
Now they check that
item
!= NULL first. I kept the== true
checks that wereadded to them for the booleans even though it doesn't match my style simply
because as a macro it might not be clear immediately that it's a boolean so it
seems like it might be a good place to do that.
Fixed
warning: incompatible pointer to integer conversion passing 'struct json *' to parameter of type 'enum item_type'
injson_util.c
.Add
:
suffix to parsed/converted boolean in debug output ofJTYPE_STRING
andJTYPE_NUMBER
(viafprnumber()
) invjson_fprint()
. Forparsed
ifconverted is also false add a
:
else a,
. Print a:
after converted flag.This separates the parsed/converted status from the actual information of the
type. Here's an example log output for numbers:
Note for the first line it has
p,c:
as the number was both parsed andconverted but for the second line it has just
p:
as the number could notbe converted. The flags follow the
:
. Now one might argue that the bools arepart of the numbers but the other data is the number itself.
For strings it's likewise just the rest is string data, not number data:
Updated json parser and jparse version strings to "1.1.2 2023-07-24".
New definition of recently removed macro
CONVERTED_JSON_NODE
:Updated
jval
andjnamval
to parse the options-n
and-S
as a list aseach option can be specified more than once. A list seems the most natural
approach though a dynamic array might be considered later.
New version for both tools: "0.0.3 2023-07-24".
Release 1.0.38 2023-07-23
Fixed
jnum_chk
by correcting the output ofjnum_gen
.Fixed an incorrect prior use of
make rebuild_jnum_test
and hand verified the generated
jnum_test.c
file.Added large e-notation values to the jnum.testset.
Improved
json_alloc()
to explicitly initialize critical booleansand pointers when allocating a new JSON parse tree node.
Both
json_process_decimal()
andjson_process_floating()
nolonger set
parsed
andconverted
booleans. That taskif performed by the
json_conv_number()
function.The
json_conv_number()
now correctly attempts to converta given JSON number in floating point, e-notation and
integer depending on if the result of
is_floating_notation()
,or
is_e_notation()
oris_decimal()
, respectively.Those tests are used to set the
is_floating
,is_e_notatiion
,and
is_integer
booleans, also respectively.Improved JSON debug messages from
json_process_decimal()
andjson_process_floating()
.Simplified how the
is_valid
boolean arg is used injparse/jparse.l
.Refer to
tree
(instead of "node") when referring to the JSONtree in
jparse.l
.Updated convenience macros in
jparse/json_parse.h
. Now using:Use of
CONVERTED_JSON_NODE(item)
changed toCONVERTED_PARSED_JSON_NODE(item)
.Fixed "copy and paste" typo in
json_tree_print()
.Release 1.0.37 2023-07-22
Use of
-H
injnamval
implies-N
.Release 1.0.36 2023-07-21
Fix bug in
vjson_fprint()
where numbers that were converted and parsed werenot printed as the check accidentally was using the wrong macro that checks if
converted is true and parsed is false. It should be it checks for both are true
and then the next check in the else if checks if parsed is true and converted is
false.
Move
converted
bool instruct json_
structs below theparsed
bool.Make
jval
andjnamval
exit with 7 if a number cannot be represented by a Ctype. Updated man pages and usage messages. For
jnamval
this means what usedto be 7 is now 8: no matches found.
For number conversions in
jval
andjnamval
use the macros to check forconverted/parsed booleans.
Release 1.0.35 2023-07-19
Add initial version of man pages of
jfmt(1)
,jval(1)
andjnamval(1)
torepo.
Minor bug fixes in
jfmt
: set default spaces for-L
and-I
options to 4, not0, and add missing
-q
description to usage message. Updated version to "0.0.32023-07-19".
Add the three JSON tools
jfmt
,jval
andjnamval
tobug_report.sh
.Release 1.0.34 2023-07-18
New jval version "0.0.2 2023-07-18". Option parsing is complete. All that is
left for this is adding the test code for
-S
and-n
(see below for why theseoptions were not completely parsed).
Fix
jval
parsing of-S op=str
and-n op=num
so that the json conversionroutines are used in order to check that everything is okay according to the
JSON spec. What is NOT implemented is the routines to run the comparisons: that
will be a longer function and also has to happen after option parsing is done
for all three tools and then the man pages are written and followed by that
discussion.
Note that if the string starts with a '"' we pass in true for the quote
parameter to the conversion routine and otherwise we do not. It's the
responsibility of the user to ensure that the string is properly formed
otherwise. A possible problem, however, that might need to be addressed, is
whether or not it can compare strings with quotes in it. This can be decided
later.
If
jval -c
orjval -C
is used show a total count of matches. Currently willbe 0 and for
-C
the output will be incorrect but that's okay as that's all wehave available now and it lets us test the options.
Sequenced exit codes.
Remove
any
match type fromjval
. This was added by me as it seemed usefulbut since it's added to
jnamval
I presume that it should not be injval
.New version of
jnamval
"0.0.1 2023-07-18". All options should now be parsed(unless some were missed by accident). Options test code was updated to test the
new bits. Exit codes were changed from the original
json_util_README.md
(whichhas been updated) as 1 is already used for unable to write to output file which
is in all tools now (and since 1 was used for jfmt in that way it seems better
to keep them consistent).
Release 1.0.33 2023-07-17
Updated
jval
version to "0.0.1 2023-07-17".Add parsing for all options
jval
. Test code for-n
and-S
still needs tobe written but everything should be fine.
Removed unused
jval
code except that one function which might be usefullater is a placeholder - does nothing functionally.
Removed unused
jval
structs.Add check that out file is not stdout before flushing/closing when freeing jfmt
struct.
Release 1.0.32 2023-07-16
Add initial code for
jfmt
: completely parses options and will dump JSON tooutput file if it is not the same as the input file and the file does not
already exist. If not specified it will be stdout.
Add TEMPORARY PLACEHOLDER source and header files for
jval
andjnamval
tools. The key term that is important is TEMPORARY PLACEHOLDER. Thefiles are actually copies of what were once jprint related but for each tool
jprint / JPRINT were changed to their new tool counterparts. This is done this
way because some of the code is common and this way they are in the repo. A lot
of code will be removed but some will be kept. Much will also be changed. Option
parsing in particular is useful but this will also have some changes. As it will
take more work to get them in order I have kept the other things in too for now
but this GREATLY simplifies starting the tools which seems like a worthy
thing to do. A very nice way that this simplifies starting the tools is that
the parsing of the JSON file is already done. Along with this some of the
options being the same and some of the structs being the same (though they will
have to be modified and some will be removed) it will help get started.
Respective test scripts for each tool have also been added which are also
updated copies of the old script for jprint. These are not run yet because there
is no point in running them yet and it would only slow down make test.
With the exception of the scripts the required changes will be done soon -
hopefully sometime in the coming week (real weeks start on Monday) - but what
this means is that TEMPORARILY the tools function as the incomplete no
longer useful jprint. By required changes I mean that the unnecessary code will
be removed and option parsing / usage strings will be updated (whether the
option parsing is completed in the next week is indeterminate).
Updated
jparse/Makefile
and run make depend.Update .gitignore: fixed references of
jprint
and add the other tools.Release 1.0.31 2023-07-15
New JSON parser and jparse version "1.1.0 2023-07-15".
Completely resolve issue #752: 'Enhancement: add parsed boolean to the JSON
parser'. This involved the below changes.
Add more checks to JSON node
parsed
member so that if converted is false butparsed is true it's not an error (in the cases where parsed is allowed to be
different it is not an error: if they're not allowed to be different we warn
about it if they are different).
Improve printing of string variables and numbers in
vjson_fprint()
.Add helper macros
CONVERTED_PARSED_JSON_NODE
,CONVERTED_JSON_NODE
andPARSED_JSON_NODE
and updated jparse.3 man page. TheCONVERTED_PARSED_JSON_NODE
checks that both theconverted
andparsed
booleans are true. The
CONVERTED_JSON_NODE
checks that the booleanconverted
is true and that the
parsed
boolean is false and thePARSED_JSON_NODE
checksthat the
parsed
boolean is true and that theconverted
boolean is false.These macros have been used in in place of checks of
foo->converted
andfoo->parsed
.Rename function
sem_node_valid_converted()
to be justsem_node_valid()
andmake use of appropriate macro: for numbers it uses the
VALID_JSON_NODE
and orothers it uses
CONVERTED_PARSED_JSON_NODE
as bothconverted
andparsed
must be true for non-number nodes.
Fixes in
json_util_README.md
up through the beginning ofjnamval
. The restof the document and a more thorough check of that which has been checked will
come later.
Release 1.0.30 2023-07-14
New JSON parser and jparse version "1.0.11 2023-07-14".
Added placeholder functions
is_floating_notation()
,is_floating_notation_str()
,is_e_notation()
andis_e_notation_str()
forissue #752. These functions are NOT called yet except that the
_str()
versionscall the non-
_str()
versions. Both return true without any tests at this timewhich is why they cannot be called in the parse functions!
Added to each
struct json_foo
a booleanparsed
which means that the valuecan be parsed but if false it would indicate it cannot be converted. This is
important because a really big number say a googolplex would fail to be
converted in C but it doesn't mean it's not valid JSON. We don't want to tie the
parser to a big number library so other things will have to be done but we
cannot say that it's not valid JSON.
Add back good json file
googolplex.json
as it now is considered valid json: ifthe error is a range error then we know it's valid JSON so we can set parsed to
true. If it's something else we cannot. THIS IS TEMPORARY! It could be that
there is both a range error and it's an invalid string. There are XXX comments
about this as it needs to change!
Fix detection of '.' with e notation if a '.' found and also whether 'e' was
found in the jnum tests.
Add code to
is_floating_notation()
andis_e_notation()
functions. More needsto be checked and there are still some
XXX
comments to look at. Note that thecode here does the same checks as
json_process_floating()
and this might notbe strictly correct but that can determined later: as it's used only in JSON
parsing it should be okay for the time being.
Check for more than one dot in floating point number strings for JSON and
otherwise. For JSON this is not strictly necessary as the scanner will report an
invalid token but we do it for safety anyway.
Add to function
vjson_fprint()
code that prints out the string of a number ifconverted is false but parsed is true.
Add macro
VALID_JSON_NODE
that determines if astruct json_foo
is validwhich means that either
item->converted
oritem->parsed
is true. This macrois currently used prior to reporting an error in the conversion functions. This
macro is documented in both
jparse.1
andjparse.3
.Add function
sem_node_valid_parsed()
which is likesem_node_valid_converted()
but for the parsed boolean instead of the convertedboolean.
Update
jparse.1
man page noting the condition where if a value cannot beconverted but is valid JSON it will still report that it's valid JSON but will
warn that conversion failed.
Release 1.0.29 2023-07-13
New JSON parser and jparse version "1.0.10 2023-07-13".
Fix regexp for
JSON_NUMBER
in json parser. For exponents it only allowed afraction followed by an exponent rather than an integer followed by an exponent.
In other words
1.0e0
was valid but1e0
was not.Note that a googolplex is too big for C so the file
good/googolplex.json
wasremoved. For reference a googolplex is
1e10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
.We don't have a directory for the jparse test suite that is although valid JSON
is not possible to parse. We do incidentally have this functionality for
info.json and auth.json files though.
A googol (yes this is where the name 'Google' comes from :-) ) is
1e100
and isnot too big for C.
The file
test_ioccc/test_JSON/general.json/bad/info.timestamp-0.json
isactually valid JSON so it was moved to the good subdirectory. Now make test at
the top level directory works fine.
Release 1.0.28 2023-07-03
Fixes and improvements applied to the new
json-README.md document (which was not documented here
yesterday when it was added).
Release 1.0.27 2023-07-02
Bug fixes in
jparse_test.sh
(erroneously it referred to a variable that didnot exist in the function in question - to do with error location tests - and
also had a log message outside the check of the verbosity level).
Add several new good test JSON files under
jparse/test_jparse/test_JSON/good/
.Add another bad JSON test file for both location reporting and otherwise.
In an effort to write the specifications for command line utilities
that read JSON, and to assist others in understanding the JSON
related code, code comments, data structures and documentation found
in this GitHub repo, we add a first draft of
jparse/json-README.md
.The modified JSON string encoding rules as given in
jparse/json-README.md
have been implemented. The following characters are no longer encoded
and are represented as themselves:
Release 1.0.26 2023-06-29
New version of
jprint
"0.0.33 2023-06-29".Removed 'num' from description of 'simple' for options
-t
and-Y
and insteadsay what it translates to (int,float,exp).
Added four new good test json files under
test_jparse/test_JSON/good
:42.json
,foo.json
,just_array.json
andtop_level_array.json
.Sorted (by category) the member variables in
struct jprint
as well as in thefunction
alloc_jprint()
(injprint_util.c
).Added options
-o
and-r
but at this time nothing is done with them: booleansare set but nothing else. Why is
-o
before-r
? To spell out 'or' which iswhat the
-o
option does! Obviously :-)Make
bug_report.sh
check that bothjprint
andjprint_test.sh
areexecutable.
Add support of proper matching for JSON booleans and nulls. This does not apply
(just like for the others that are in) for inside arrays - just those by
themselves. Works for
-Y
to search by value and without-Y
to search byname, showing the name or value respectively, depending on if a match is found.
The
-p
or-j
options can override this of course. It should be rememberedthough that nulls and booleans have a string name so only string is checked
before adding a match.
Release 1.0.25 2023-06-28
Add new good JSON test file 42.json under
jparse/test_jparse/test_JSON/good/42.json
.New
jprint
version "0.0.32 2023-06-28".Fixed potential memory leak in
jprint
: although currently none exist thematches list in the struct jprint (instead of the matches list in each pattern)
was not freed.
Use of
jprint -s
andjprint -j
now possible.New jparse and json parser version "1.0.9 2023-06-28". Add new function
extern char const *json_get_type_str(struct json *node, bool encoded);
to jparselibrary to get the matched (in the parser/lexer) name that triggered parsing.
Updated man page.
Make use of
json_get_type_str()
injprint
for modularity. This only appliesto strings and number types.
Release 1.0.24 2023-06-27
New
jprint
version "0.0.30 2023-06-27".Fix possible NULL pointer dereference. It should never have happened but it was
theoretically possible. This fix involves a slight change in the way
is_jprint_match()
works in that it takes an additionalchar *
: a name thatis the name to match if
pattern
orpattern->pattern
is NULL. If both arename and either
pattern
orpattern->pattern
are NULL it is an error. Thissimplifies checking a bit and there is another use in mind that will have to
come with another commit (if it proves useful; as the concept of
name_arg
s iscurrently not correct it might be that this won't be useful at all and that the
struct is even removed).
jprint -Y str
partially works now. It's not perfect in that in some cases itcan end up matching other types but that depends on the JSON file and options.
The function
add_jprint_match()
can now have a NULL pattern and also NULLpattern->pattern
. Ifpattern == NULL
then the newjprint->matches
isiterated through and set up. This change is to facilitate adding matches without
patterns for when printing the entire file but this part has not been
implemented yet. More needs to be tested when calling this function but other
things have to be done before that can be done and once again it might be that
the pattern struct and patterns list is completely removed once certain pending
functions are added to the jparse library.
Add back call to run json check tool. Used after reading in the data block but
prior to parsing json. Fix use after free in the function that does this. It
dereferenced the jparse struct after calling
free_jparse()
. This was notdetected because it happens only when the tool failed and the test case used was
not invalid where I tested it but is in macOS.
Add
struct json *json_tree
tostruct jprint
as a convenience. Some functionsare directly passed this but this could be changed if desired.
Fixes in handling of
jprint -Q
. We have to check not only that it's a stringand printing syntax or quotes are requested but that the type of the match is a
string (
JTYPE_STRING
) as well. Get rid of string bool injprint_match
struct as it's not needed with the
type
.Improvements in printing some types wrt quotes. Now the function
add_jprint_match()
takes two types, a name and value type and thestruct jprint_match
has aenum item_type name_type
andenum item_type value_type
.The determination of which type to use still only has one node at a time so it's
not perfect but it does help somewhat and will be of value later on.
Further update version of
jprint
to "0.0.31 2023-06-27". The handling ofadding matches of strings and numbers with values and names being different (if
they are in the file) has been implemented. This required a lot of extra code
and more modularity needs to be added but that can come later.
Release 1.0.23 2023-06-26
New
jprint
version "0.0.29 2023-06-26".Fix handling of
-L
and-I
. Indenting and printing of levels was messed up.Doing this I was able to remove a lot of duplicate code too.
Add file
test_jparse/test_JSON/good/JSON_misfeature_number_7.json
from aGitHub comment.
Minor update to
h2g2.json
file - add a boolean to elements of the personarray.
Added stub code for JSON tree search functions.
Added pre-order (NLR) and post-order (LRN) search option to JSON
tree talking. Added post_order arg to
json_tree_walk()
andvjson_tree_walk()
.Added depth arg to
json_tree_walk()
.Release 1.0.22 2023-06-25
New
jprint
version "0.0.28 2023-06-25". Removed-G regex
option.Slight formatting in
jprint
usage string (to do with aliases).Rename
struct jprint
booleansubstrings_okay
touse_substrings
as it seemsa better description and it matches the pattern struct as well.
Modularise
vjprint_json_search()
by new functionis_jprint_match()
whichtakes the
struct jprint *
, the pattern, node and string and based on the typedoes the right checks. Will not return on NULL pointers. Returns true if it is a
match and false otherwise.
Add more safety when checking for matches by checking that
item != NULL
andthat
item->converted
is true and that the string is not NULL.Clarify that one can use
-p both
or-p b
but not-p n
/-p name
or-p v
/-p value
with-j
. This was changed yesterday as it's just as easy tocheck (and is slightly more user-friendly) that as it is for explicit use of
-p
full stop.Move most functions from
jprint.c
tojprint_util.c
and move structs tojprint_util.h
. This is because most functions are utility in nature. Thejprint_sanity_chks()
remains injprint.c
asusage()
is the same name asother tools usage function so it's a static function in
jprint.c
butjprint_sanity_chks()
uses that function. It could also be renamed tojprint_usage()
of course.Release 1.0.21 2023-06-24
New
jprint
version at "0.0.27 2023-06-24". If-j
is used don't make use of-p b
or-p both
an error. It's only an error if printing of just name orjust value is specified (after the
-j
as-j
will set both). Checking forthis is just as simple as for
-p
being used at all and it seems slightly moreuser-friendly to do it this way.
Modularise option checking of
jprint
by moving it to thejprint_sanity_chks()
function which now returns aFILE *
, the file to readthe JSON from. The function will never return a NULL
FILE *
. It will notreturn with a command line error. It will check all options and verify that the
right number of args have been specified.
main()
will add thename_arg
s tothe patterns list and go from there if
jprint_sanity_chks()
returns. As theargc
andargv
have to be shifted in main() they are aint *
andchar ***
respectively rather than their usual
int
andchar **
.Add function
parse_jprint_name_args()
to iterate through command line, lookingfor
name_arg
s. This function is called by thejprint_sanity_chks()
as someoptions have to be checked after looking on the command line for
name_arg
s.Make running JSON check tool more modular which fixes bug of printing output
more than once. The
struct jprint
has theFILE *json_file
,char *file_contents
as well as aFILE *
for the json check tool stream andchar *
s for the check tool path and args.Make
jprint.c
functions in same order as injprint.h
.Implement
jprint -Q
.Fix
jprint -L
for some types. Not all types have been tested but numbers,strings and possibly members are correct. When more is done other types will be
verified too.
Release 1.0.20 2023-06-23
New
jprint
version at "0.0.26 2023-06-23".Add booleans (including renaming one
uintmax_t
to be a boolean and adding anew
uintmax_t
in its place) instruct jprint
to indicate that specificoptions were used rather than relying on the
uintmax_t
s being not 0.Add inclusion of
string.h
and feature test macro_GNU_SOURCE
tojprint.h
for
strcasestr()
.Fix sign comparison warning in
util.h
.Fix use after free error in
util.c
(functionvcmdprintf()
).Fix error in
jprint_run_tests()
causing invalid test result and warning aboutunused computed value.
The
jprint_match
struct (which is still a work in progress) now has twostruct json *
s: the node name and node value. The name is what was matched,whether or not value was searched or not and the value is what will be printed,
either value or name depending on the options. As both might need to be printed
this can also be a misnomer but I believe having the nodes will be useful at
some point.
Improve (but not yet fixed) the value / name added to matches particularly with
substring matching. The value is still the same as the name in the match struct
but with substring matches the match is the pattern (
name_arg
) specified butthe value (what to be printed) is the actual member found.
Typo fix in debug message. The
jprint -o
option no longer exists but it wasreferenced.
New
jparse
version "1.0.8 2023-06-23". Fixed display bug invjson_fprint()
for some of the int types. In particular it cast the booleans to an int rather
than use the
as_type
members of the struct. This would mean that instead ofprinting the actual number it would print a boolean as an integer.
More modularity in
jprint
printing matches. Several new functions have beenadded. These will be useful later for the printing of not just a JSON file if no
pattern requested but also printing matches. More will be added.
Fix typo in usage string with
-Y
based on the original concept. It takes justone
name_arg
but is not an option arg but rather an arg to the program itself.Only the type is an option arg to the option.
Fix unmatched
.RE
in jsemtblgen.8 man page.Add initial man page for
jprint
. This is currently incomplete. TheBUGS
section just says that there are too many things to list at this time as the
tool is in progress and there are a number of things that are incorrect even
besides it. There are some examples but with the exception of one that prints
out the file it is not correct output (and it's not correct for the file in full
depending on options specified). The synopsis is complete and the description is
a good start but the options list is incomplete. There are a lot more to be
added but I want to have the file in and I'll continue working on it in the
coming days.
Release 1.0.19 2023-06-22
New
jprint
version at "0.0.25 2023-06-22".Modify behaviour of
jprint -c
to completely matchgrep -c
(which was myoriginal idea in the first place). If more than one pattern (as in
name_arg
)is specified and found it is a total of the matches found.
Implement
jprint -E
to such a degree as is currently possible.Minor improvements to
jprint
usage string including not hard coding in thestring the default maximum depth to parse, instead using the macro
JSON_DEFAULT_MAX_DEPTH
.Implement
jprint -P
. When this option is disabled the spaces specified stillseparate the tokens if printing both name and value. Default is 1 space, changed
from 0 (it was always supposed to be 1).
When printing both (without json syntax) print on the same line the name and
value.
Added boolean to indicate that
-b
was used. Currently this is unused but itwill allow not relying on the spaces being not 0 as the default is 1. This fact
is not yet needed but it might be and it's a clear way to indicate if the option
was used or not.
Make matching printing function a bit more modular by introducing a new
function,
jprint_print_match()
. Note that the concept of patterns is incorrectand has to be fixed. Discussion is pending.
New jparse and json parser version "1.0.7 2023-06-22". Make print tree function
a bit better in that for
null
type it prints notNULL
butnull
to indicateit's a JSON
null
to remove any ambiguity from C'sNULL
.Typo fixes in
jprint
usage string.Release 1.0.18 2023-06-21
New
jprint
version "0.0.24 2023-06-21".jprint
no longer accepts negative max values for options-l
and-N
. Only-n
allows a max < 0. For-N
it makes no sense and for-l
it's ofquestionable use. That can be decided later but let's just say that if it was a
square root it would be too imaginary :-) One of the
jprint -K
tests testsnegative max but no others do. In that code only
-l
was tested but the one fornegative max is now
-n
. A test case for parsing this error in command linecannot be done because that's a fatal error which would make the program exit.
It might be possible to do this in the test script at a later time.
Implement
-L
option for indenting after levels with-j
option. The text saidthat
-L
has no effect without-j
but I felt like it might be useful to haveit even without
-j
and the code is already there so for now I have kept it andremoved the text that stated it has no effect without
-j
. This can be undoneif necessary.
Implement
jprint -s
(substring match). This means that the only other kind ofmatching that has to be added is regexps. It should be noted, however, that
the matching is not entirely complete and some of it will have to change as
well. This holds for exact matches as well.
Implement
jprint -I
(indent json syntax based on the depth).Implement
jprint -b
.Release 1.0.17 2023-06-20
New
jprint
version "0.0.23 2023-06-20".Process write only pipe if -S tool specified. To see details check git log and
search for 'Process write only pipe if -S tool specified'.
Implement
-c
option to show only count of matches. Use of-o
(print entirefile) and
-c
(show only count) cannot be used together. Use of-c
withoutspecifying any patterns is also a command line error as there cannot be any
matches.
Change debug level 0 messages to debug level 1.
Implement case-insensitive option
-i
.New
jparse
and JSON parser version both at "1.0.6 2023-06-20". Added booleanto
struct json_number
a booleanis_integer
for integers to simplify checksin
jprint
. If integer the booleans for floating points are set to false but ifnumber string is parsed as floating point only the integer boolean is set to
false. This is because the function to parse floating points should take care of
it (there are a lot of paths in the integer conversions) and that function only
returns true or false without giving an indication if it's an exponent or not.
Don't increment the count of matches if the type is not the same. By type this
refers to the
JTYPE_*
enum found injson_parse.h
.Add more strict checks for number types based on options.
Disable explicit check for strings in match function as the check there is
problematic anyway and this helps in another way until the function itself can
be fixed. It's very much a work in progress.
Release 1.0.16 2023-06-19
New
jprint
version "0.0.22 2023-06-19".Fix level constraints and matching of value versus name constraints. These have
only been tested in very basic JSON files but both now work in principle. There
were a couple problems. See the commit log for details (search for the string,
without quotes,
"0.0.22 2023-06-19"
).Implement
-L
option.Implement
-C
and-B
options if-j
specified (-j
is required) and partlyimplement
-j
(for simple files). It is not an error if-j
is not specified:it simply has no effect. The
struct jprint_match
now has a booleanstring
:if true it means the match is a string.
Partly process
-Y
option. It is buggy for strings due to the way the functionis called. There is a workaround to let values be found but it also ends up
letting names be found. This has to be fixed at a later time. The number check
for
-Y
is incomplete as well and the simple and compound types are also notchecked yet.
Release 1.0.15 2023-06-18
New
jprint
version at "0.0.21 2023-06-18".jprint
now has a matches list perpattern. The tree traversal functions will search for matches and after that
function finally returns the printing of matches will be found. This will
require additional functions that figure out how to print based on the json type
and jprint options along with the jprint type but for now it prints just the
name and value.
Note that by 'everything is added to the list' mentioned above this means that
name and value will be added as a value. This is something that will be fixed
later but it's the way the tree is traversed that causes this. Be aware also
that for each pattern requested every member of currently supported types will
be added so you can see duplicates. This is because no matching is done yet.
New debug message added. The level is currently 0 so will always be printed but
just like the others this will be changed.
Stop extraneous newlines from being printed.
Add initial support for searching by value or name (value via
-Y
option). Thiswill only work for simple json files (or I have only tested simple json files at
this time). If value is being searched we print the name. I'm not sure now if
that's correct behaviour. If it is not then the check will have to be changed.
Checks for basic patterns are added! No regexp support yet. This does not mean
that the printing of name and/or value is yet correct. This needs to be worked
on. Right now a match can happen for either name or value even though it's
supposed to be one or the other.
Rename some functions to match what they do better (they do not print but search
for matches).
Added double blank lines before Release markdown headers in this file.
Rename
is_open_stream()
tois_open_file_stream()
injparse/util.c
.Added
fd_is_ready()
andflush_tty()
tojparse/util.c
.Added
flush_stdin
as new 2nd arg toshell_cmd()
injparse/util.c
.Changed
pipe_open()
injparse/util.c
to only flush stdin ifwrite_mode
.Changed JSON parser to use new
fd_is_ready()
function.Changed
jprint
andjparse/json_sem
to use newfd_is_ready()
function.Updated
mkiocccentry
to not flush stdin when calling shell functions.Updated
txzchk
to not flush stdin when calling shell functions.Release 1.0.14 2023-06-17
New
jprint
version at "0.0.20 2023-06-17".Fix special handling for -Y option wrt exactly one name arg. The idea behind the
check is that if
-G
is specified then one cannot specify aname_arg
. If itis not specified then you must specify one
name_arg
. If both-G
and aname_arg
are not specified it is also an error but there was a bug whichrequired that
-G
was used.Don't show that substrings are ignored for patterns that are regexps (in
jprint
).Sequenced exit codes in
jprint
.Add callback function and calling code to
jprint
. Currently it does not checkfor any constraints and will print only json nodes which has a string as the
name or value. The name is not ultimately desired without printing json as a
whole but for now the name is printed. This means that both name and value might
be printed. There are too many newlines printed as well. Much more needs to be
done with these functions.
jprint
now checks level (depth) constraints before printing a json member.This needs to be tested more carefully with bigger documents.
Release 1.0.13 2023-06-16
New
jprint
version "0.0.19 2023-06-16" - will print entire file if no patternspecified OR the new option
-o
is specified but only if valid JSON (for both).A note that if
read_all()
fails to read in the entire file then there could bea problem but we only print the file if the data read is not NULL. This change
is important as it means now all that needs to be done is add the handling of
the JSON checker/semantics tool and then the compiling of regexps (if requested)
and then printing for any matches found (the search routines have to be written
too as does the code to traverse the tree - or 'climb down the tree' :-) ). In
other words one of the features of the program is complete! Note that use of
-o
when a pattern is specified is a command line error.Changed
pipe_open()
to allow for write mode. Takes a new booleanwrite_mode
which says to open for write mode rather than read mode.
Fix handling of
jprint -S
andjprint -A
(specifically-S
: a segfault insome conditions namely if the path did not exist which was not checked for and
thus not triggered until this change). Verify path is a regular file and is
executable. Check args and if specified make sure not empty and make sure that
-S
is specified as well. Checks-S
path first.If
jprint -S path
is an executable file then attempt to run, first redirectingstdout and stderr to
/dev/null
, checking the exit code. If exit code is not 0exit as an error. If it is 0 open a write only pipe. The pipe is not used yet
but will be once it is clear how it should be used. At this time the
-A args
might be a misnomer or it might be a misunderstanding on my part or it might not
even matter. Currently it's used as options and the options list is terminated
by
--
. It might be that it's supposed to be args to the program, not options.Or it might be that it doesn't matter. This is TBD later.
Fix minor bug in
txzchk
that prevented a debug message from being shown evenif the debug level requested was high enough. New version "1.0.2 2023-11-06".
Release 1.0.12 2023-06-15
Change option letters of
jprint
a bit as described next.-s
now means search substrings. Conflicts with-g
.-s
was-M
.-S
sets the path to the tool to run, which although in concept should be asemantics tool checker, it can actually be something else like
grep
. This optionwas
-s
.-A
sets the args to the-S path
. This option was-S
. Empty args are notallowed and use of
-A
requires use of-S
. The difference besides letters isthat args now must not be empty though this might not be strictly necessary.
Allow for both regular expressions and normal patterns via the
-G regexp
option. Does not conflict with
-s
because the regexp is added as a regexp butthe
name_arg
s will allow substrings if-s
specified - but not for the-G
regexp.
-G
does not conflict with-Y
as long as only-G
is used only onceand no additional
name_arg
is specified at the command line afterfile.json
.Fix bug where the command line could be messed up and the file.json is thought
to be a different arg specified.
Updated
jprint
version to "0.0.18 2023-06-15".Release 1.0.11 2023-06-14
Minor fix in
jparse
error location reporting. When the erroneous token was atthe very first column the column reported was column 0 which is incorrect by the
standard (de facto or otherwise) and also editors like vim which could be
confusing. New JSON parser version "1.0.5 2023-06-14". Since this also changes
the
jparse
tool indirectly I also updated thejparse
version to be "1.0.52023-06-14" (skipping 1.0.4 in order to make it match as this seems like a good
time to make them match version and date).
Renamed
test_jparse/test_JSON/bad_loc/comma-eof.json
->test_jparse/test_JSON/bad_loc/braces-comma-eof.json
as it actually has anotherwise valid json file,
{}
. Added acomma-eof.json
and respective errorfile which has the first character being a comma.
Added several other test files (and their corresponding
.err
file) to havemore tests in JSON error location reporting.
Added another bad json file
test_ioccc/test_JSON/general.json/bad/third-line-backspace.json
.Added make rule in
jparse/test_jparse
to simplify adding thejparse/test_jparse/test_JSON/bad_loc
error files. To use run from thejparse/test_jparse
directorymake rebuild_jparse_err_files
. This ruledeletes the error files prior to regenerating them.
jprint
version updated to "0.0.17 2023-06-14".jprint -h
modified for the-m max_depth
option.jprint -Y
now acceptssimple
type as well.Rename
jprint -S
tojprint -M
, add new options-s
and-S
for a tool pathand tool args to be run on file.json. Right now all that is done is the old
processing of
-S
is now done for-M
and-s
sets a path and-S
sets args.It makes sure that if
-S
is specified then so is-s
. It does not check yetif the tool path exists, is a regular file and is executable and obviously it
does not execute anything yet either as this tool is to be written later and the
details are not specific yet either.
Make it so that use of both
jprint -j
andjprint -M
is an error.Change exit codes for
jprint
. Specifically 7 is no longer reserved for anallocation error as it's more of an internal error. 7 is now for the JSON check
tool failure which is related to the options
-s
and-S
. Sequenced exitcodes.
jprint -Y
requires exactly two args to the command - the file and onename_arg
. Anything else is an error.Release 1.0.10 2023-06-13
New
jparse
version at "1.0.3 2023-06-12" and json parser version at "1.0.42023-06-12". The json parser version was bumped by .2 rather than .1 since it
should have been updated the other day when
jparse
was updated and it might bethat
jparse
itself did not need to be updated: that's not necessarily trueeither way. The significant change here is that when encountering a
\t
weincrement the column by 8. This appears to be what a tab is but it might not be
perfect as there might be other cases where a
\t
is some other count. This hasto be tested further.
Update
jprint_test.sh
and add new files underjparse/test_jparse/test_JSON/bad_loc
. The new functionality, which is only runif the option
-L
is passed to the script, tests for the exact match of errors(in the
*.err
files) of the*.json
files in this subdirectory. These JSONfiles have syntax errors where the purpose is to test location reporting. If
there is not an exact match
make test
will fail. For now there is only onefile but more will be added in time. The purpose of this new feature is to test
the location reporting but we can add more files in time. An important thing to
note is the new README.md file in
jparse/test_jparse
which explains what oneMUST do after adding a new invalid JSON file under
jparse/test_jparse/test_JSON/bad_loc
. This information is also in the man pagejparse(8)
.New
jprint
version "0.0.16 2023-06-13" with new option. Using-Y type
onewill be able to search by value instead of name. Currently it does not check for
only one value but this will likely change in a future update. Code does not yet
check that the type matches either. In other words if one specifies
-Y int
itdoes not verify that the
name_arg
is actually an int. It might not benecessary either since the JSON parser has the values and names as original
strings. This is TBD later. But an important question has to be answered right
now.
Release 1.0.9 2023-06-12
New
jprint
version "0.0.15 2023-06-12".Make
jprint -h
exit codes formatting consistent withjparse
.Make
struct jprint options
in jprint.c astruct jprint *jprint
as it willhold other information besides options including additional structs. Added
free_jprint(struct jprint *jprint)
function to completely free everything init and then itself.
Fix bug in
jprint
checking of-
for stdin. It shouldn't be just checking thefirst char as being
-
but rather the entire arg. Without this it results instrange behaviour when say
-555
is the file arg.Added initial
jprint_test.sh
test script. For now it is very much likejparse_test.sh
except it doesn't test the strings file asjprint
doesn'thave an option to read args as a string. Whether it might be good to do this or
to change the script so that it can read from stdin are questions to be answered
at a later date. Something it additionally does is run
jprint -K
test mode.Fix incorrect exit codes in help string of
jparse_test.sh
.Add patterns / regexps to
patterns
linked list injprint
struct. For now itonly iterates through the list, showing that a pattern or regexp will be
searched for. Functions to add and free the list added. Patterns are appended to
the list so that the first pattern/regexp specified will be looked for first.
Change exit codes in
jprint
a bit, making 7 exclusive for memory allocationerrors and >= 15 for other internal errors.
Release 1.0.8 2023-06-11
Fix
jparse
column location calculations where error messages just showed theinvalid token at column 1 even when the bad token is not on column 1.
Bumped
jprint
version to "0.0.14 2023-06-11".When no
name_arg
is passed tojprint
it will print the entire file. It wasnever a condition that would cause anything but exit code 0 (assuming the json
file is valid) but it is now more explicit in the code as of 11 June 2023 that
the entire file will be printed once the printing code is implemented.
It is an error to use
jprint -p {n,v,b}
andjprint -j
together.Move the many options in
jprint
'smain()
tostruct jprint_options
toorganise them and to help with passing to necessary callbacks later on.
Release 1.0.7 2023-06-10
Release
jprint
version "0.0.13 2023-06-10".Make
jprint -S -g
a command line error.Use of
jprint -b [num]t
(or-b tab
) requires use of-p b
(or-p both
)and it is an error if this condition is true.
Add functions to parse
-I
,-b
and-L
options.Use of
jprint -j
implies-p b -b 1 -e -Q 4 -t any
.But fix check of number arguments after options in
jprint
. The comparison waswrong and could cause invalid number of arguments at command line even when they
are correct.
Clarify use of
jprint
-I
and-L
options in help string.Add more test cases of bits.
Fix potential NULL pointer dereference in parsing of number ranges.
Release 1.0.6 2023-06-09
New
jprint
version "0.0.10 2023-06-09". This version now correctly handles thenumber ranges in the form of e.g.
-l 5:-3
where if there are 10 matches itwill print the fifth match up through the third to last match.
Fixed
seqcexit
andpicky
rules for jprint and sequenced exit codes.Change semantics of
jprint -L
option. It now takes an option argument which isthe number of spaces or a tab which will be printed after the JSON level is
printed. Like
-b t
this has to be fixed in that we cannot assume thatt
ortab
is 8 spaces instead of\t
but this will change later.Further version update of
jprint
, now being "0.0.11 2023-06-09". Semantics of-L
and-b
changed further. Can be-[b|L] <num>[t|s]
wheres
is optional.If a number is specified without
t
it implies spaces. If as
is specified itimplies spaces and if nothing is specified it implies spaces. Anything else is a
syntax error.
Add initial testing of
-t type
option after fixing an issue with the bitwisetest functions. See
jprint_test.c
for details.Release
jprint
version "0.0.12 2023-06-09": change semantics of-I
option tomatch that of
-b
and-L
. Finished -t type test code.Release 1.0.5 2023-06-08
jprint
version "0.0.9 2023-06-08". At this time I (Cody) believe all knownchecks for
jprint
options have been added. Also test functions for the numberrange code and print mode have been added and run successfully! To run test code
pass in
-K
tojprint
.The next step is to write some test functions (likely printing debug
messages for different options and their option arguments). Currently (as of
version 0.0.8) the number range test functions are successful.
If all is OK the code to traverse the tree to look for simple matches (this does
not mean the
JPRINT_TYPE_SIMPLE
) can be added. At first the tool will notcheck for the constraints but rather just print the name and value (even though
the default is value (
JPRINT_PRINT_VALUE
) only I want to make sure that theability to to print both is there). This will help make sure that the
traversing works okay before constraints are added. Prior to the following step,
described below, the grep-like functionality, using
regex.h
, can be added (itmight be better to instead add the grep-like functionality after the below - the
constraints - are added but this will be determined at the time).
Once the above is okay the constraints can be added. The tests should be easier
to do than the traversing and following parts but my hope is that in the coming
days more than tests can be added.
Once this is all done a comprehensive test script can be added to the repo that
is called by the entire test suite (including
bug_report.sh
) so that we canverify that
jprint
works as expected. Then any issues can be fixed and thetests can be run again. This might take more than a few days but hopefully
things will move along nicely.
Release 1.0.5 2023-06-05
jprint
now accepts a-m max_depth
option to allow for one to specify maximumdepth to traverse the json tree, assuming it's valid JSON. Defaults to
JSON_DEFAULT_MAX_DEPTH == 256
. With debug levelDBG_NONE
(this will changeto a higher level once the tool is complete or closer to being complete) says
what the limit is, indicating that 0 is no limit and 256 is the default.
jprint
now parses the-t type
comma-separated option. Currently is abitvector but this might change as more is developed (bitvector was not the
first thought).
New
jprint
version "0.0.6 2023-06-07". It now parses all options and most testfunctions for options being set are added as well. This version is backdated to
7 June because this was done on the 7th of June but the version was not updated.
Release 1.0.4 2023-06-04
Split the location table into
soup/location_tbl.c
andthe location table related utilities into c
soup/location_util.c
.Updated location table
tbl[]
insoup/location_tbl.c
as of 2023 June 05.
Added
soup/location
utility to look up locations ISO 3166 code(s),location names, of print the entire location table.
Release initial
jprint
tool. Current version "0.0.3 2023-06-03". Currentfunctionality is limited to:
-h
.(same as
-h
but with error message about not enough args).stdin
) and if so ittries to parse it as a JSON file. Depending on status of whether it's valid or
json it will report an error or report valid json. Later it will only report
valid JSON as a debug message.
jprint
will make use of theregex(3)
library.Updated jparse/README.md to note the
jprint
tool.MUCH MORE has to be done but this is a great start for a very important tool. We
believe that after the tool is finished and tested (including added to the
overall test suite + the
bug_report.sh
script!) we (i.e. Cody/@xexyl) canimport the jparse parser and tools into the jparse
repo.
Release 1.0.3 2023-05-22
Added remarks.example.md which has instructions for
writing
remarks.md
files in the same vein as theMakefile.example.
Fix
bug_report.sh
andmake clobber
(injparse/
) to remove bogus filejparse/lex.jparse_.c
after completion of one of the steps.Release 1.0.2 2023-04-14
Fix mkiocccentry to write past winner and author handle to the answer file. It
already read from these from the file but did not write them and therefore using
a new answers file did not work at the point that these fields were added to the
tool.
Improved the algorithm for UTF-8 strings to ASCII POSIX safe characters.
The
utf8_posix_map hmap[]
was changed to no longer map UTF-8 toASCII characters '.' NOR '+' NOR '-'. The
default_handle()
functionwas changed to NOT produce more than one '_' (underscore) in a row.
Before these changes, the function produced handles of the form:
Now, handles conform to the following regexp:
Moreover, default handles will NOT contain 2 or more '_' (underscore)
characters in a row.
Release 1.0.1 2023-02-14
Fix minor shellcheck nits in
bug_report.sh
andjparse/test_jparse/jparse_test.sh
so that themake prep
phase25 shellcheck will pass as OK.
Test if ctags is available before attempting to run ctags in Makefile rules.
The
jparse/Makefile
make clobber
rule will call the same rule injparse/Makefile/test_jparse
as well.Make
hostchk.sh
grep usage POSIX compliant. This means it no longer uses theeither of the
-o
or-h
options.Corrected the comment about the Rule 2b value 2503. The previous
comment, as noted by Nicholas Carlini (GitHub user @carlini), was
an out of date comment related to the previous prime 2053 value.
Fix issue in jparse/Makefile where sometimes one would see:
Added
jparse_
prefix to json parser so that multiple parsers can exist inprograms that link in the library. New jparse version is 1.0.1 2023-03-10.
Fix jparse/Makefile to have a dependency line for jparse.c (jparse.o). Run make
depend at the root directory.
Change
malloc_path()
tocalloc_path()
as it usescalloc(3)
notmalloc(3)
.Rename macro
MAX_NUL_REPORTED
->MAX_NUL_BYTES_REPORTED
and allow overridingit (default is 5; uses
#if !defined (MAX_NUL_BYTES_REPORTED)
.Rename macro
MAX_LOW_REPORTED
MAX_LOW_BYTES_REPORTED
and allow overriding it(default is 5; uses
#if !defined (MAX_LOW_BYTES_REPORTED)
.Fix version of jparse; the prefix added was supposed to be
1.0.1 2023-03-10
and was changed initially but when trying to get a problem resolved it must have
been undone. Now it's instead
1.0.2 2023-03-11
.This discussion was created from the release mkiocccentry 1.1 2024-05-19.
Beta Was this translation helpful? Give feedback.
All reactions