Home » Eclipse Projects » Eclipse Titan » more strict 'ifpresent' handling in titan 6.6.x compared to previous versions
more strict 'ifpresent' handling in titan 6.6.x compared to previous versions [message #1826175] |
Mon, 20 April 2020 15:44 |
|
I just wanted to upgrade the Osmocom test suites from TITAN 6.5.0 to 6.6.1 yesterday, and it seems code that was compiled by 6.5.0 is no longer compiling with 6.6.1
specifically, there are code sequences like the following:
function tr_CBSP_WRITE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
template BSSMAP_FIELD_CellIdentificationList cell_list,
template uint8_t channel_ind)
return template CBSP_PDU {
var template CBSP_IEs ies := {
tr_CbspMsgId(msg_id),
tr_NewSerNo(new_ser_nr)
};
if (istemplatekind(cell_list, "*")) {
ies[lengthof(ies)] := tr_CbspCellList ifpresent;
} else if (istemplatekind(cell_list, "?")) {
ies[lengthof(ies)] := tr_CbspCellList(?);
} else if (not istemplatekind(cell_list, "omit")) {
ies[lengthof(ies)] := tr_CbspCellList(cell_list);
}
if (not istemplatekind(channel_ind, "omit")) {
ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
}
return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
}
where 6.6.1 now fails compilation with:
CBSP_Templates.ttcn:371.25-39: error: `ifpresent' is not allowed here
The full source file is at https://git.osmocom.org/osmo-ttcn3-hacks/tree/library/CBSP_Templates.ttcn
unfortunately it gives no explanation as to why it's not allowed. The same code compiles just fine under earlier versions. I think up to 6.5.0 are fine. Right now I only have a system with 6.3.0 for testing, and 6.3.0 definitely compiles the same code just fine.
Can somebody help me clarify
a) if the above is a valid TTCN-3 language construct. If not, why?
b) was it intentional to remove this functionality from TITAN?
Thanks!
|
|
| |
Re: more strict 'ifpresent' handling in titan 6.6.x compared to previous versions [message #1826228 is a reply to message #1826223] |
Tue, 21 April 2020 14:30 |
|
Thanks for the feedback.
So this means the new behavior is in-line with the language specification, and the previous behavior was a violation of the language spec?
I guess I have to find some time to understand how to express something functionally equivalent. It seems again like one of those situations where one would hope the power of TTCN3 can offer an easy solution, but in reality it's hard to find a way to solve it. But there obviously must be a way?
How do I construct a match/receive template for a set of / record of / array, were some elements can 'either be missing or present'?
Something like
ies[lengthof(ies)] := (omit, tr_CbspCellList);
also doesn't work, but renders:
> CBSP_Templates.ttcn:372.26-29: error: `omit' value is not allowed in this context
Regards,
Harald
|
|
|
Re: more strict 'ifpresent' handling in titan 6.6.x compared to previous versions [message #1826255 is a reply to message #1826228] |
Wed, 22 April 2020 08:50 |
Gyorgy Rethy Messages: 31 Registered: April 2015 |
Member |
|
|
Hi Harald,
I don't think the template list will work at a set element level, but at the set level, like this:
if (istemplatekind(cell_list, "*")) {
var template CBSP_IEs ies0 := ies;
ies[lengthof(ies)] := tr_CbspCellList;
ies := (ies0, ies);
}
However, it has a consequence that no further ie-s can be added later. Therefore, the check and addition of channel_ind should be moved before the checking of cell_list.
function tr_CBSP_WRITE_CBS_COMPL(template integer msg_id, template integer new_ser_nr,
template BSSMAP_FIELD_CellIdentificationList cell_list,
template integer channel_ind)
return template CBSP_PDU {
var template CBSP_IEs ies := {
tr_CbspMsgId(msg_id),
tr_NewSerNo(new_ser_nr)
};
//GyRethy: this check is moved forward, in front of the cell_list check
if (not istemplatekind(channel_ind, "omit")) {
ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
};
if (istemplatekind(cell_list, "*")) {
var template CBSP_IEs ies0 := ies;
ies[lengthof(ies)] := tr_CbspCellList;
ies := (ies0, ies);
} else if (istemplatekind(cell_list, "?")) {
ies[lengthof(ies)] := tr_CbspCellList(?);
} else if (not istemplatekind(cell_list, "omit")) {
ies[lengthof(ies)] := tr_CbspCellList(cell_list);
}
return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
}
[Updated on: Wed, 22 April 2020 09:01] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Oct 14 03:22:37 GMT 2024
Powered by FUDForum. Page generated in 0.03978 seconds
|