Skip to content

Commit f26f4ee

Browse files
committed
Change behaviour of s1kd-aspp -c option
Now enables searching for ACTs/CCTs rather than disabling it, and user-defined ACTs (-A) and CCTs (-C) can be used in addition to the referenced ACT/CCT.
1 parent 467b0ea commit f26f4ee

File tree

4 files changed

+27
-36
lines changed

4 files changed

+27
-36
lines changed

tools/s1kd-aspp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The ID to use for the inline applicability annotation representing the whole dat
3535
Add a CCT to use when generating display text for conditions. Multiple CCT data modules can be used by specifying this option multiple times.
3636

3737
-c
38-
Normally, if neither the -A nor -C options are specified, the tool will search for the ACT/CCT in the current directory using the ACT reference in each input data module. But if this option is specified, it will not search for ACT(s)/CCT(s) referenced by the data module(s). Only the applicability property attributes in the data module(s) will be used to generate the display text.
38+
Search for the ACT and CCT referenced by each data module, and add them to the list of ACTs/CCTs to use when generating display text for that data module.
3939

4040
-d
4141
Dump the built-in XSLT used to generate display text for applicability statements.

tools/s1kd-aspp/doc/DMC-S1000DTOOLS-A-00-0Q-00-00A-040A-D_EN-CA.XML

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
<dmIdent>
77
<dmCode modelIdentCode="S1000DTOOLS" systemDiffCode="A" systemCode="00" subSystemCode="0" subSubSystemCode="Q" assyCode="00" disassyCode="00" disassyCodeVariant="A" infoCode="040" infoCodeVariant="A" itemLocationCode="D"/>
88
<language languageIsoCode="en" countryIsoCode="CA"/>
9-
<issueInfo issueNumber="007" inWork="00"/>
9+
<issueInfo issueNumber="008" inWork="00"/>
1010
</dmIdent>
1111
<dmAddressItems>
12-
<issueDate year="2018" month="08" day="01"/>
12+
<issueDate year="2018" month="08" day="02"/>
1313
<dmTitle>
1414
<techName>s1kd-aspp(1) | s1kd-tools</techName>
1515
</dmTitle>
@@ -39,7 +39,7 @@
3939
<unverified/>
4040
</qualityAssurance>
4141
<reasonForUpdate id="rfu-0001" updateReasonType="urt02" updateHighlight="1">
42-
<simplePara>Try finding ACT/CCT using data module ACT reference if none are specified.</simplePara>
42+
<simplePara>Change behaviour of -c option.</simplePara>
4343
</reasonForUpdate>
4444
</dmStatus>
4545
</identAndStatusSection>
@@ -94,10 +94,10 @@
9494
<para>Add a CCT to use when generating display text for conditions. Multiple CCT data modules can be used by specifying this option multiple times.</para>
9595
</listItemDefinition>
9696
</definitionListItem>
97-
<definitionListItem changeType="add" reasonForUpdateRefIds="rfu-0001" changeMark="1">
97+
<definitionListItem>
9898
<listItemTerm>-c</listItemTerm>
9999
<listItemDefinition>
100-
<para>Normally, if neither the -A nor -C options are specified, the tool will search for the ACT/CCT in the current directory using the ACT reference in each input data module. But if this option is specified, it will not search for ACT(s)/CCT(s) referenced by the data module(s). Only the applicability property attributes in the data module(s) will be used to generate the display text.</para>
100+
<para changeType="modify" reasonForUpdateRefIds="rfu-0001" changeMark="1">Search for the ACT and CCT referenced by each data module, and add them to the list of ACTs/CCTs to use when generating display text for that data module.</para>
101101
</listItemDefinition>
102102
</definitionListItem>
103103
<definitionListItem>

tools/s1kd-aspp/doc/s1kd-aspp.1

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 1.19.2.1
22
.\"
3-
.TH "s1kd\-aspp" "1" "2018\-08\-01" "" "s1kd\-tools"
3+
.TH "s1kd\-aspp" "1" "2018\-08\-02" "" "s1kd\-tools"
44
.hy
55
.SH NAME
66
.PP
@@ -59,13 +59,9 @@ times.
5959
.RE
6060
.TP
6161
.B \-c
62-
Normally, if neither the \-A nor \-C options are specified, the tool
63-
will search for the ACT/CCT in the current directory using the ACT
64-
reference in each input data module.
65-
But if this option is specified, it will not search for ACT(s)/CCT(s)
66-
referenced by the data module(s).
67-
Only the applicability property attributes in the data module(s) will be
68-
used to generate the display text.
62+
Search for the ACT and CCT referenced by each data module, and add them
63+
to the list of ACTs/CCTs to use when generating display text for that
64+
data module.
6965
.RS
7066
.RE
7167
.TP

tools/s1kd-aspp/s1kd-aspp.c

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "identity.h"
2222

2323
#define PROG_NAME "s1kd-aspp"
24-
#define VERSION "1.1.0"
24+
#define VERSION "1.1.1"
2525

2626
/* ID for the inline <applic> element representing the whole data module's
2727
* applicability. */
@@ -476,26 +476,13 @@ void find_cross_ref_tables(xmlDocPtr doc, xmlNodePtr acts, xmlNodePtr ccts)
476476
}
477477
}
478478

479-
/* Remove all ACTs/CCTs from the cross-reference table list. */
480-
void clear_ct(xmlNodePtr ct)
481-
{
482-
xmlNodePtr cur;
483-
cur = ct->children;
484-
while (cur) {
485-
xmlNodePtr next;
486-
next = cur->next;
487-
xmlUnlinkNode(cur);
488-
xmlFreeNode(cur);
489-
cur = next;
490-
}
491-
}
492-
493479
void processFile(const char *in, const char *out, bool xincl, bool process,
494480
bool genDispText, xmlNodePtr acts, xmlNodePtr ccts, bool findcts)
495481
{
496482
xmlDocPtr doc;
497483
xmlXPathContextPtr ctx;
498484
xmlXPathObjectPtr obj;
485+
xmlNodePtr all_acts, all_ccts;
499486

500487
doc = xmlReadFile(in, NULL, PARSE_OPTS);
501488

@@ -504,7 +491,15 @@ void processFile(const char *in, const char *out, bool xincl, bool process,
504491
}
505492

506493
if (findcts) {
507-
find_cross_ref_tables(doc, acts, ccts);
494+
/* Copy the user-defined ACTs/CCTs. */
495+
all_acts = xmlCopyNode(acts, 1);
496+
all_ccts = xmlCopyNode(ccts, 1);
497+
/* Find the ACT/CCT referenced by the current DM. */
498+
find_cross_ref_tables(doc, all_acts, all_ccts);
499+
} else {
500+
/* Only use the user-defined ACTs/CCTs. */
501+
all_acts = acts;
502+
all_ccts = ccts;
508503
}
509504

510505
if (process) {
@@ -518,16 +513,16 @@ void processFile(const char *in, const char *out, bool xincl, bool process,
518513
}
519514

520515
if (genDispText) {
521-
generateDisplayText(doc, acts, ccts);
516+
generateDisplayText(doc, all_acts, all_ccts);
522517
}
523518

524519
xmlSaveFile(out, doc);
525520

526521
/* The next data module could reference a different ACT/CCT, so
527522
* the list must be cleared. */
528523
if (findcts) {
529-
clear_ct(acts);
530-
clear_ct(ccts);
524+
xmlFreeNode(all_acts);
525+
xmlFreeNode(all_ccts);
531526
}
532527

533528
xmlFreeDoc(doc);
@@ -541,7 +536,7 @@ void showHelp(void)
541536
puts(" -A <ACT> Use <ACT> when generating display text.");
542537
puts(" -a <ID> Use <ID> for DM-level applic.");
543538
puts(" -C <CCT> Use <CCT> when generating display text.");
544-
puts(" -c Ignore ACT/CCT refs.");
539+
puts(" -c Search for ACT/CCT data modules.");
545540
puts(" -d Dump built-in XSLT for generating display text.");
546541
puts(" -f Overwrite input file(s).");
547542
puts(" -G <XSL> Use custom XSLT script to generate display text.");
@@ -563,7 +558,7 @@ int main(int argc, char **argv)
563558
bool xincl = false;
564559
bool genDispText = false;
565560
bool process = false;
566-
bool findcts = true;
561+
bool findcts = false;
567562

568563
xmlNodePtr acts, ccts;
569564

@@ -604,7 +599,7 @@ int main(int argc, char **argv)
604599
findcts = false;
605600
break;
606601
case 'c':
607-
findcts = false;
602+
findcts = true;
608603
break;
609604
case 'd':
610605
dumpGenDispTextXsl();

0 commit comments

Comments
 (0)