… | |
… | |
19 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
19 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
20 | # |
20 | # |
21 | |
21 | |
22 | use 5.016; # numerous features need 5.14, __SUB__ needs 5.16 |
22 | use 5.016; # numerous features need 5.14, __SUB__ needs 5.16 |
23 | |
23 | |
24 | our $VERSION = '1.2'; |
24 | our $VERSION = '1.3'; |
25 | our $JSON_VERSION = 2; # the version of the json objects generated by this program |
25 | our $JSON_VERSION = 3; # the version of the json objects generated by this program |
26 | |
26 | |
27 | our $CHANGELOG = <<EOF; |
27 | our $CHANGELOG = <<EOF; |
|
|
28 | |
|
|
29 | 1.3 |
|
|
30 | - output of pbcdedit elements --json has changed, as it didn't |
|
|
31 | take the reorganisation by classes fully into account. |
|
|
32 | - json schema bumped to 3. |
|
|
33 | |
28 | 1.2 Fri Aug 16 00:20:41 CEST 2019 |
34 | 1.2 Fri Aug 16 00:20:41 CEST 2019 |
29 | - bcde element names now depend on the bcd object type they are in, |
35 | - bcde element names now depend on the bcd object type they are in, |
30 | also affects "elements" output. |
36 | also affects "elements" output. |
31 | - json schema bumped to 2. |
37 | - json schema bumped to 2. |
32 | - new version command. |
38 | - new version command. |
… | |
… | |
2465 | BCDE_FORMAT_INTEGER , "integer", |
2471 | BCDE_FORMAT_INTEGER , "integer", |
2466 | BCDE_FORMAT_BOOLEAN , "boolean", |
2472 | BCDE_FORMAT_BOOLEAN , "boolean", |
2467 | BCDE_FORMAT_INTEGER_LIST, "integer list", |
2473 | BCDE_FORMAT_INTEGER_LIST, "integer list", |
2468 | ); |
2474 | ); |
2469 | |
2475 | |
2470 | my %element; |
2476 | my @element; |
2471 | |
2477 | |
2472 | for my $class (sort keys %rbcde_byclass) { |
2478 | for my $class (sort keys %rbcde_byclass) { |
2473 | my $rbcde = $rbcde_byclass{$class}; |
2479 | my $rbcde = $rbcde_byclass{$class}; |
2474 | |
2480 | |
2475 | unless ($json) { |
2481 | unless ($json) { |
… | |
… | |
2478 | printf "%-9s %-12s %s\n", "Element", "Format", "Name Alias"; |
2484 | printf "%-9s %-12s %s\n", "Element", "Format", "Name Alias"; |
2479 | } |
2485 | } |
2480 | for my $name (sort keys %$rbcde) { |
2486 | for my $name (sort keys %$rbcde) { |
2481 | my $id = $rbcde->{$name}; |
2487 | my $id = $rbcde->{$name}; |
2482 | my $format = $format_name{$id & BCDE_FORMAT}; |
2488 | my $format = $format_name{$id & BCDE_FORMAT}; |
2483 | $id = sprintf "%08x", $id; |
|
|
2484 | |
2489 | |
2485 | if ($json) { |
2490 | if ($json) { |
2486 | $element{$id} = [$class, $format, $name]; |
2491 | push @element, [$class, $id * 1, $format, $name]; |
2487 | } else { |
2492 | } else { |
|
|
2493 | $id = sprintf "%08x", $id; |
2488 | printf "%-9s %-12s %s\n", $id, $format, $name; |
2494 | printf "%-9s %-12s %s\n", $id, $format, $name; |
2489 | } |
2495 | } |
2490 | } |
2496 | } |
2491 | } |
2497 | } |
2492 | print "\n" unless $json; |
2498 | print "\n" unless $json; |
2493 | |
2499 | |
2494 | prjson { |
2500 | prjson { |
2495 | version => $JSON_VERSION, |
2501 | version => $JSON_VERSION, |
2496 | element => \%element, |
2502 | element => \@element, |
2497 | class => \@bcde_typeclass, |
2503 | class => \@bcde_typeclass, |
2498 | } if $json; |
2504 | } if $json; |
2499 | |
2505 | |
2500 | }, |
2506 | }, |
2501 | |
2507 | |