Namespace generated XSD and add missing attributes

This adds two things to the XSD (and the RNC file and options.md):
* attributes previously missing because of a bug in the conversion
  script
* a name space (https://cdds.io/config)

Adding the name spacing requires a different set of attributes at the
top of a configuration file, which in turn need to be ignored by the
configuration parser, and which should be reflected in the configuration
example in the README.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-11-01 14:48:37 +01:00 committed by eboasson
parent c5b22bf629
commit c642f5676a
6 changed files with 439 additions and 183 deletions

View file

@ -156,7 +156,8 @@ my %tables;
my @root = read_config ($input);
{
open my $fh, ">", "$output_rnc" or die "can't open $output_rnc";
open my $fh, ">:unix", "$output_rnc" or die "can't open $output_rnc";
print $fh "default namespace = \"https://cdds.io/config\"\n";
print $fh "namespace a = \"http://relaxng.org/ns/compatibility/annotations/1.0\"\n";
print $fh "grammar {\n";
print $fh " start =\n";
@ -170,7 +171,7 @@ my @root = read_config ($input);
}
{
open my $fh, ">", "$output_md" or die "can't open $output_md";
open my $fh, ">:unix", "$output_md" or die "can't open $output_md";
my $sep_blurb = "";
conv_table($fh, \&conv_to_md, \@root, "/", " ", "", \$sep_blurb);
close $fh;
@ -315,12 +316,14 @@ sub conv_to_rnc {
print_description_rnc ($fh, $fs->{description}, $indent);
printf $fh "${indent}%s %s {\n", ($fs->{kind} eq "ATTR" ? "attribute" : "element"), $name;
my $sub_isfirst = 1;
conv_table($fh, \&conv_to_rnc, $fs->{subtables}, $fqname, "${indent} ", $prefix, \$sub_isfirst);
my $sep = $sub_isfirst ? "" : "& ";
if ($fs->{kind} eq "GROUP" || $fs->{kind} eq "MGROUP") {
my $sub_isfirst = 1;
conv_table($fh, \&conv_to_rnc, $fs->{subtables}, $fqname, "${indent} ", $prefix, \$sub_isfirst);
printf $fh "${indent} empty\n" if $sub_isfirst;
printf $fh "${indent} ${sep}empty\n" if $sub_isfirst;
} elsif ($fs->{kstr} eq "Boolean") {
printf $fh "${indent} xsd:boolean\n";
printf $fh "${indent} ${sep}xsd:boolean\n";
} elsif ($fs->{kstr} eq "Comma") {
die unless exists $comma_values{$fs->{typehint}};
my $pat = "";
@ -337,13 +340,13 @@ sub conv_to_rnc {
}
}
$pat .= "|" if $allowempty;
printf $fh "${indent} xsd:token { pattern = \"%s\" }\n", $pat;
printf $fh "${indent} ${sep}xsd:token { pattern = \"%s\" }\n", $pat;
} elsif ($fs->{kstr} eq "Enum") {
die unless exists $enum_values{$fs->{typehint}};
my @vs = split /;/, $enum_values{$fs->{typehint}};
printf $fh "${indent} %s\n", (join '|', map { "\"$_\"" } @vs);
printf $fh "${indent} ${sep}%s\n", (join '|', map { "\"$_\"" } @vs);
} elsif ($fs->{kstr} eq "Int") {
printf $fh "${indent} xsd:integer\n";
printf $fh "${indent} ${sep}xsd:integer\n";
#if (exists $range{$lctn} || exists $range{$fs->{typehint}}) {
# # integer with range
# my $rr = exists $range{$lctn} ? $range{$lctn} : $range{$fs->{typehint}};
@ -351,9 +354,9 @@ sub conv_to_rnc {
#}
} elsif ($typehint2unit{$fs->{typehint}}) {
# number with unit
printf $fh "${indent} $typehint2unit{$fs->{typehint}}\n";
printf $fh "${indent} ${sep}$typehint2unit{$fs->{typehint}}\n";
} elsif ($typehint2xmltype{$fs->{typehint}} =~ /String$/) {
printf $fh "${indent} text\n";
printf $fh "${indent} ${sep}text\n";
} else {
die;
}
@ -393,7 +396,7 @@ sub conv_to_md {
# Describe type (boolean, integer, &c.); for a group list its attributes and children as
# links to their descriptions
if ($fs->{kind} eq "GROUP" || $fs->{kind} eq "MGROUP") {
{
my %children = ("attributes" => [], "elements" => []);
conv_table($fh, \&list_children_md, $fs->{subtables}, "", "${indent} ", $prefix, \%children);
if (@{$children{attributes}} > 0) {
@ -406,6 +409,10 @@ sub conv_to_md {
my @ys = map { my $lt = lc "$fqname\[\@$_]"; $lt =~ s/[^a-z0-9]//g; "[$_](#$lt)" } @xs;
printf $fh "Children: %s\n\n", (join ', ', @ys);
}
}
if ($fs->{kind} eq "GROUP" || $fs->{kind} eq "MGROUP") {
# nothing to see here
} elsif ($fs->{kstr} eq "Boolean") {
printf $fh "Boolean\n";
} elsif ($fs->{kstr} eq "Comma") {
@ -451,9 +458,7 @@ sub conv_to_md {
print_description_md ($fh, $fs->{description}, $indent);
# Generate attributes & children
if ($fs->{kind} eq "GROUP" || $fs->{kind} eq "MGROUP") {
conv_table($fh, \&conv_to_md, $fs->{subtables}, $fqname, "${indent} ", $prefix, $separator_blurb_ref);
}
conv_table($fh, \&conv_to_md, $fs->{subtables}, $fqname, "${indent} ", $prefix, $separator_blurb_ref);
}
sub conv_table {

View file

@ -672,6 +672,8 @@ The default value is: "false".
#### //CycloneDDS/Domain/Internal/HeartbeatInterval
Attributes: [max](#cycloneddsdomaininternalheartbeatintervalmax), [min](#cycloneddsdomaininternalheartbeatintervalmin), [minsched](#cycloneddsdomaininternalheartbeatintervalminsched)
Number-with-unit
This elemnents allows configuring the base interval for sending writer
@ -683,6 +685,42 @@ Valid values are finite durations with an explicit unit or the keyword
The default value is: "100 ms".
#### //CycloneDDS/Domain/Internal/HeartbeatInterval[@max]
Number-with-unit
This attribute sets the maximum interval for periodic heartbeats.
Valid values are finite durations with an explicit unit or the keyword
'inf' for infinity. Recognised units: ns, us, ms, s, min, hr, day.
The default value is: "8 s".
#### //CycloneDDS/Domain/Internal/HeartbeatInterval[@min]
Number-with-unit
This attribute sets the minimum interval that must have passed since the
most recent heartbeat from a writer, before another asynchronous (not
directly related to writing) will be sent.
Valid values are finite durations with an explicit unit or the keyword
'inf' for infinity. Recognised units: ns, us, ms, s, min, hr, day.
The default value is: "5 ms".
#### //CycloneDDS/Domain/Internal/HeartbeatInterval[@minsched]
Number-with-unit
This attribute sets the minimum interval for periodic heartbeats. Other
events may still cause heartbeats to go out.
Valid values are finite durations with an explicit unit or the keyword
'inf' for infinity. Recognised units: ns, us, ms, s, min, hr, day.
The default value is: "20 ms".
#### //CycloneDDS/Domain/Internal/LateAckMode
Boolean
@ -704,6 +742,8 @@ The default value is: "10 s".
#### //CycloneDDS/Domain/Internal/LivelinessMonitoring
Attributes: [Interval](#cycloneddsdomaininternallivelinessmonitoringinterval), [StackTraces](#cycloneddsdomaininternallivelinessmonitoringstacktraces)
Boolean
This element controls whether or not implementation should internally
@ -714,6 +754,28 @@ stopped making progress.
The default value is: "false".
#### //CycloneDDS/Domain/Internal/LivelinessMonitoring[@Interval]
Number-with-unit
This element controls the interval at which to check whether threads have
been making progress.
The unit must be specified explicitly. Recognised units: ns, us, ms, s,
min, hr, day.
The default value is: "1s".
#### //CycloneDDS/Domain/Internal/LivelinessMonitoring[@StackTraces]
Boolean
This element controls whether or not to write stack traces to the Cyclone
DDS trace when a thread fails to make progress (on select platforms
only).
The default value is: "true".
#### //CycloneDDS/Domain/Internal/MaxParticipants
Integer
@ -819,6 +881,8 @@ The default value is: "-1".
#### //CycloneDDS/Domain/Internal/MultipleReceiveThreads
Attributes: [maxretries](#cycloneddsdomaininternalmultiplereceivethreadsmaxretries)
Boolean
This element controls whether all traffic is handled by a single receive
@ -830,6 +894,18 @@ single (the default).
The default value is: "true".
#### //CycloneDDS/Domain/Internal/MultipleReceiveThreads[@maxretries]
Integer
Receive threads dedicated to a single socket can only be triggered for
termination by sending a packet. Reception of any packet will do, so
termination failure due to packet loss is exceedingly unlikely, but to
eliminate all risks, it will retry as many times as specified by this
attribute before aborting.
The default value is: "4294967295".
#### //CycloneDDS/Domain/Internal/NackDelay
Number-with-unit
@ -880,6 +956,8 @@ The default value is: "true".
#### //CycloneDDS/Domain/Internal/RediscoveryBlacklistDuration
Attributes: [enforce](#cycloneddsdomaininternalrediscoveryblacklistdurationenforce)
Number-with-unit
This element controls for how long a remote participant that was
@ -898,6 +976,18 @@ Valid values are finite durations with an explicit unit or the keyword
The default value is: "10s".
#### //CycloneDDS/Domain/Internal/RediscoveryBlacklistDuration[@enforce]
Boolean
This attribute controls whether the configured time during which recently
deleted participants will not be rediscovered (i.e., "black listed") is
enforced and following complete removal of the participant in Cyclone
DDS, or whether it can be rediscovered earlier provided all traces of
that participant have been removed already.
The default value is: "false".
#### //CycloneDDS/Domain/Internal/RetransmitMerging
One of: never, adaptive, always