Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Compiler error on in-line template as parameter of a function(TTCN-3 Compiler In-line template)
Compiler error on in-line template as parameter of a function [message #1859307] Tue, 30 May 2023 10:39 Go to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Dear Support,

I got a compiler error (see below) when passing an inline template declaration as an argument of TTCN-3 function:
f_Iot_Diameter_receive(
                    {
                        DIAMETER_MSG:{uDR_MSG := mw_UDR_userData_publicIdentity("tel:"&v_userInfoA.publicId)}
                    },
                    {},
                    {0, omit},
                    "TP_SH_HSS_UDA_01 - UDR",
                    p_forward_to_mtc,
                    p_checkMessage 
                )


The inline template declaration is:
DIAMETER_MSG:{uDR_MSG := mw_UDR_userData_publicIdentity("tel:"&v_userInfoA.publicId)}


The compiler error is:
./ttcn/AtsImsIot/AtsImsIot_TP_behavior_SH.ttcn:90:37: error: at or before token `:': syntax error, unexpected ':', expecting ',' or '}'
Notify: Parsing TTCN-3 module `./ttcn/AtsImsIot/AtsImsIot_TD_DRG.ttcn'...

My understanding of ETSI ES 201 873-1 clause 15.4 In-line Templates is that inline template usage is not limited to port operation such a send or receive.
Is it correct?

Many thanks in advance for your help,

BR\Yann Garia
Re: Compiler error on in-line template as parameter of a function [message #1859313 is a reply to message #1859307] Tue, 30 May 2023 15:56 Go to previous messageGo to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello,

Just an additional note: DIAMETER_MSG an union of all DIAMETER messages (see https://forge.etsi.org/rep/LIBS/LibDiameter/-/blob/TTF006/ttcn/LibDiameter_TypesAndValues.ttcn]).
So this is a huge union and it won't be easy to create a template for each variant of this union. This is why we are using inline template.

Thanks,

BR\Yann Garcia
Re: Compiler error on in-line template as parameter of a function [message #1859337 is a reply to message #1859313] Wed, 31 May 2023 16:05 Go to previous messageGo to next message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 55
Registered: February 2016
Member
Hi Yann,

there is pair of curly brackets around the mentioned in-line template, meaning it is supposed to be a field of a record or an element in an array.

In-line templates work for function parameters in TITAN, but only if the entire actual parameter is an in-line template (i.e. the type indicator is in front of the whole actual parameter, not in front of a field or element).

You could write this instead (without the curly brackets), or replace DIAMETER_MSG with the parent structure, if it really is a field or element:
f_Iot_Diameter_receive(
                    DIAMETER_MSG:{uDR_MSG := mw_UDR_userData_publicIdentity("tel:"&v_userInfoA.publicId)},
                    {},
                    {0, omit},
                    "TP_SH_HSS_UDA_01 - UDR",
                    p_forward_to_mtc,
                    p_checkMessage 
                )


Best regards,
Botond Baranyi



Re: Compiler error on in-line template as parameter of a function [message #1859338 is a reply to message #1859337] Wed, 31 May 2023 16:12 Go to previous messageGo to next message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 55
Registered: February 2016
Member
Also, the type of a function parameter is unambiguous. I'm not sure what the point of using a type identifier before the template would be, the compiler already knows what type to expect for that parameter.
Re: Compiler error on in-line template as parameter of a function [message #1859344 is a reply to message #1859338] Thu, 01 June 2023 10:32 Go to previous messageGo to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello Botond,

Thanks a lot for your feedback.
One clarification: the code below cannot compile if I properly understood what you explained:
var template DIAMETER_MSG mw_diameter_msg := DIAMETER_MSG:{mAR_MSG := mw_MAR(mw_publicIdentity(v_publicIdentity))};


Am I right?

Many thanks,

BR\Yann Garcia
Re: Compiler error on in-line template as parameter of a function [message #1859347 is a reply to message #1859344] Thu, 01 June 2023 14:48 Go to previous messageGo to next message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 55
Registered: February 2016
Member
Hello Yann,

yes, it doesn't compile.

Best regards,
Botond Baranyi
Re: Compiler error on in-line template as parameter of a function [message #1859350 is a reply to message #1859347] Thu, 01 June 2023 15:22 Go to previous messageGo to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Yes,
this is what I thought.

We are evaluating who to move all ETSI INT Test Suites (conformance and Interoperability tests for IMS, DIAMETER, SIP...) to TITAN.
Do you think it can be implemented in TITAN for the future?

Many thanks,

BR\Yann





Re: Compiler error on in-line template as parameter of a function [message #1859369 is a reply to message #1859350] Fri, 02 June 2023 15:23 Go to previous messageGo to next message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 55
Registered: February 2016
Member
Hello Yann,

I don't think it'll be implemented anytime soon.

As a workaround you can simply omit the type indicator before these templates (that is, use regular templates instead of in-line templates).

Such as:
var template DIAMETER_MSG mw_diameter_msg := {mAR_MSG := mw_MAR(mw_publicIdentity(v_publicIdentity))};


Or:
f_Iot_Diameter_receive(
                    {
                        {uDR_MSG := mw_UDR_userData_publicIdentity("tel:"&v_userInfoA.publicId)}
                    },
                    {},
                    {0, omit},
                    "TP_SH_HSS_UDA_01 - UDR",
                    p_forward_to_mtc,
                    p_checkMessage 
                )


The type of a variable or a function parameter is not ambiguous, so there's no reason to specify its type again on the right-hand-side, or in the actual parameter value.

Best regards,
Botond Baranyi
Re: Compiler error on in-line template as parameter of a function [message #1859386 is a reply to message #1859369] Sun, 04 June 2023 12:39 Go to previous message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello Botond,

Oh it's fine for me.
Many thanks for it.

BR\Yann
Previous Topic:TITAN g++ compiler error
Next Topic:JSON key name with dash (-)
Goto Forum:
  


Current Time: Mon Oct 14 21:03:46 GMT 2024

Powered by FUDForum. Page generated in 0.05949 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top