Skip to content

Commit

Permalink
Merge pull request #826 from xexyl/gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
lcn2 authored Aug 5, 2023
2 parents 026b759 + 8e09cff commit 96818dd
Show file tree
Hide file tree
Showing 22 changed files with 848 additions and 653 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jparse.xml
jparse/jfmt
jparse/jnamval
jparse/jparse
*jprint*
jparse/jval
jparse/lex.yy.c
jparse/test_jparse/print_test
Expand Down
28 changes: 28 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Major changes to the IOCCC entry toolkit

## Release 1.0.49 2023-08-05

New version of `jnamval`: `"0.0.11 2023-08-05"`. Add `-I` option with same
semantics as `jfmt`. Updated `jnamval.1` to add this option and fix typos.

Change available options for `jnamval -t` to be that of `jval -t`. Updated man
page.

Typo fixes in `jfmt.1` and `jval.1`. Removed `-I` from `jval.1` as it's not a
valid option.

Fix typo in usage string in `jnamval` which referred to non-existent option (it
is actually an option arg, not an option, that is correct and that is now what
it says).

Add option `-P` to `jnamval`. This is just like what `-t` for `jnamval` used to
be 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` and `jnamval` the
`jval` utility could be updated easily to support this option is desired but
this 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 being
run 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).


## Release 1.0.48 2023-08-04

Bug fixes in `location` tool wrt the `-a` and `-s` options. New version `"1.0.2
Expand Down
50 changes: 38 additions & 12 deletions jparse/jnamval.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ static bool quiet = false; /* true ==> quiet mode */
* Use the usage() function to print the usage_msg([0-9]?)+ strings.
*/
static const char * const usage_msg0 =
"usage:\t%s [-h] [-V] [-v level] [-J level] [-q] [-L <num>{[t|s]}] [-t type] [-l lvl]\n"
"\t[-Q] [-D] [-d] [-i] [-s] [-f] [-c] [-C] [-g] [-e] [-n op=num] [-S op=str] [-o ofile]\n"
"\t[-p parts] [-N] [-H] [-m max_depth] [-K] [-F fmt] file.json [arg ...]\n"
"usage:\t%s [-h] [-V] [-v level] [-J level] [-q] [-L <num>{[t|s]}] [-I <num>{[t|s]}]\n"
"\t[-t types] [-P types] [-l lvl] [-Q] [-D] [-d] [-i] [-s] [-f] [-c] [-C] [-g] [-e] [-n op=num]\n"
"\t[-S op=str] [-o ofile] [-p parts] [-N] [-H] [-m max_depth] [-K] [-F fmt] file.json [arg ...]\n"
"\n"
"\t-h\t\tPrint help and exit\n"
"\t-V\t\tPrint version and exit\n"
Expand All @@ -53,10 +53,27 @@ static const char * const usage_msg0 =
"\t-L <num>[{t|s}]\tPrint JSON level (root is 0) followed by a number of tabs or spaces (def: don't print levels)\n"
"\t-L tab\t\tAlias for: '-L 1t'\n"
"\n"
"\t\t\tTrailing 't' implies indent with number of tabs whereas trailing 's' implies spaces.\n"
"\t\t\tNot specifying 's' or 't' implies spaces.\n"
"\n"
"\t-I <num>{[t|s]}\tWhen printing JSON syntax, indent levels (def: indent with 4 spaces)\n"
"\t-I tab\t\tAlias for '-I 1t'\n"
"\n"
"\t\t\tTrailing 't' implies <num> tabs whereas trailing 's' implies <num> spaces.\n"
"\t\t\tNot specifying 's' or 't' implies spaces.\n"
"\n"
"\t-t type\t\tMatch only the comma-separated types (def: simple):\n"
"\t-t types\t\tMatch only the comma-separated types (def: simple):\n"
"\n"
"\t\t\t\tint\t\tinteger values\n"
"\t\t\t\tfloat\t\tfloating point values\n"
"\t\t\t\texp\t\texponential notation values\n"
"\t\t\t\tnum\t\talias for 'int,float,exp'\n"
"\t\t\t\tbool\t\tboolean values\n"
"\t\t\t\tstr\t\tstring values\n"
"\t\t\t\tnull\t\tnull values\n"
"\t\t\t\tsimple\t\talias for 'int,float,exp,bool,str,null' (the default)\n"
"\n"
"\t-P types\t\tPrint only the comma-separated types (def: any):\n"
"\n"
"\t\t\t\tint\t\tinteger values\n"
"\t\t\t\tfloat\t\tfloating point values\n"
Expand All @@ -68,16 +85,17 @@ static const char * const usage_msg0 =
"\t\t\t\tmember\t\tmembers\n"
"\t\t\t\tobject\t\tobjects\n"
"\t\t\t\tarray\t\tarrays\n"
"\t\t\t\tcompound\tcompound values\n"
"\t\t\t\tsimple\t\talias for 'int,float,exp,bool,str,null' (the default)\n"
"\t\t\t\tcompound\talias for 'member,object,array'\n"
"\t\t\t\tsimple\t\talias for 'int,float,exp,bool,str,null'\n"
"\t\t\t\tany\t\talias for 'int,float,exp,bool,str,null,member,object,array' (default)\n"
"\n"
"\t-p {n,v,b,j}\tPrint JSON key, value, both or JSON members (def: print JSON values)\n"
"\t-p name\t\tAlias for '-p n'\n"
"\t-p value\tAlias for '-p v'\n"
"\t-p both\t\tAlias for '-p n,v'\n"
"\t-p json\t\tAlias for '-p j'\n"
"\n"
"\t\t\tIt is an error to use -p n or -p v with -j.\n"
"\t\t\tIt is an error to use -p n or -p v with -p j.\n"
"\n"
"\n"
"\t-l lvl\t\tPrint values at specific JSON levels (def: print any level)\n"
Expand Down Expand Up @@ -188,7 +206,7 @@ main(int argc, char **argv)
* parse args
*/
program = argv[0];
while ((i = getopt(argc, argv, ":hVv:J:qL:t:l:QDdisfcCgen:S:o:m:Kp:NHF:")) != -1) {
while ((i = getopt(argc, argv, ":hVv:J:qL:I:t:P:l:QDdisfcCgen:S:o:m:Kp:NHF:")) != -1) {
switch (i) {
case 'h': /* -h - print help to stderr and exit 0 */
free_jnamval(&jnamval);
Expand Down Expand Up @@ -221,9 +239,17 @@ main(int argc, char **argv)
jnamval->common.print_json_levels = true; /* print JSON levels */
json_util_parse_st_level_option(optarg, &jnamval->common.num_level_spaces, &jnamval->common.print_level_tab);
break;
case 'I':
jnamval->common.indent_levels = true;
json_util_parse_st_indent_option(optarg, &jnamval->common.indent_spaces, &jnamval->common.indent_tab);
break;
case 't':
jnamval->json_name_val.json_types_specified = true;
jnamval->json_name_val.json_types = jnamval_parse_types_option(optarg);
jnamval->json_name_val.match_json_types_specified = true;
jnamval->json_name_val.match_json_types = json_util_parse_match_types(optarg);
break;
case 'P':
jnamval->json_name_val.print_json_types_specified = true;
jnamval->json_name_val.print_json_types = jnamval_parse_print_types(optarg);
break;
case 'l':
jnamval->common.levels_constrained = true;
Expand Down Expand Up @@ -305,8 +331,8 @@ main(int argc, char **argv)
}
break;
case 'p':
jnamval->print_json_types_option = true;
jnamval->print_json_types = jnamval_parse_print_option(optarg);
jnamval->match_json_types_option = true;
jnamval->match_json_types = jnamval_parse_print_option(optarg);
break;
case 'N':
jnamval->match_json_member_names = true;
Expand Down
2 changes: 1 addition & 1 deletion jparse/jnamval.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
#include "jparse.h"

/* jnamval version string */
#define JNAMVAL_VERSION "0.0.10 2023-08-01" /* format: major.minor YYYY-MM-DD */
#define JNAMVAL_VERSION "0.0.11 2023-08-05" /* format: major.minor YYYY-MM-DD */

/* jnamval functions - see jnamval_util.h for most */

Expand Down
Loading

0 comments on commit 96818dd

Please sign in to comment.