[xsd2ttcn] uses file-based counter for consts variables (what doesn't work for some cases)
Summary
ETSI may use the same module name in different XSD files, and Titan puts all definitions in the single TTCN file (what is correct), so we need to use static counter for some generated variables to avoid duplicated declarations.
Example of such ETSI files: TS24607-OIP-OIR.xsd
and TS24608-TIP-TIR-R2.xsd
.
The current behavior: Titan puts generation for both XSD files in the single TTCN module (this is correct), however, some const variables, such as
const XSD.Boolean c_defaultForEmpty_1 := true;
are generated for each XSD file separately (not for the resulting TTCN module). As result, there are duplicated variables in the code.
There is 'xsd2ttcn' option -o
, but it looks not applicable for our needs as it generates all XSD definitions (not only for the same namespace) into one module.
Need some fix for that to make 'xsd2ttcn' aware about such behavior. Or as alternative it would be nice to have capability to specify some option to 'makefilegen' utility and TPD to use always static counter.
Possible fixes
This is not a real fix. It is just a hack to demonstrate, what we have done on our side to get everything working.
diff --git a/xsdconvert/TTCN3Module.hh b/xsdconvert/TTCN3Module.hh
index e6f56ffbd..60a60a346 100644
--- a/xsdconvert/TTCN3Module.hh
+++ b/xsdconvert/TTCN3Module.hh
@@ -274,10 +274,12 @@ public:
friend bool compareModules(TTCN3Module * lhs, TTCN3Module * rhs);
unsigned int getConstCounter() {
- return o_flag_used ? static_const_counter : const_counter;
+ // return o_flag_used ? static_const_counter : const_counter;
+ return static_const_counter; // HACK
}
void increaseConstCounter() {
+ ++static_const_counter; return; // HACK
if (o_flag_used) {
++static_const_counter;
}
Titan version
The current Titan version we use is 10.1.2