Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Size of templates

Size of templates 25 May 2007 14:49 #7107

Hello together,

TTCN-3 allows to use the sizeof function to compute the size of a
template. Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will it be 0, 1, or
runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 26 May 2007 08:14 #7108

Hi Thomas!

Since the size is undefined or "any"-size the nicest theoritical value
to be displayed would be "*". From an implementation and usage
standpoint that would be a bit hard to use I guess... ;-) so I would go
for the runtime error. Can't find it in the std so I guess it is up for
discussion.

BR

/Stefan

________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: den 25 maj 2007 16:49
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Size of templates



Hello together,

TTCN-3 allows to use the sizeof function to compute the size of a
template. Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will it be 0, 1, or
runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 26 May 2007 08:49 #7109

Hi Thomas,





Some suggestions:



1) At compilation time a WARNING or ERROR message should be displayed
since the value "*" can be zero up to infinity.

2) At runtime, use the currently received message matched against the
constraint to determine the value to be returned by

Sizeof. If the received message contains 20 integer, then return value 20,
if none, then 0, etc.

3) return a TTCN-3 error verdict with the offending line number in the
TTCN-3 code where the error occurs.



Look a C.29 and C30 of ES20187301.



C.30 indicates that an error occurs in the case where a record of integer
xxx is used with the sizeoftype since there is no length constraint.



Since the type you use is unconstrained from a length/number of elements
point of view, it would make sense to cause

A runtime error for a template of this type. Of course, specifying any
other value than "*", would likely work.



Consider the following:



template R a_r2 := { 1, 2, * , 3, *, 9 };



What should sizeof return here? It is impossible to determine the value
here since "*" means 0 to infinity.

I would say applying a sizeof operation on any template containing a "*"
must cause either a static compilation error, or at a minimum a runtime
error (which is less desirable).





Now to put some more "salt into the wound", what happens with this:





template R a_r3 := { ? } // what is returned here? // 1 or something
else.





Cheers,



Claude.













_____

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
Sent: 26 May 2007 10:14
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas!



Since the size is undefined or "any"-size the nicest theoritical value to be
displayed would be "*". From an implementation and usage standpoint that
would be a bit hard to use I guess... ;-) so I would go for the runtime
error. Can't find it in the std so I guess it is up for discussion.



BR



/Stefan



_____

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: den 25 maj 2007 16:49
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Size of templates

Hello together,

TTCN-3 allows to use the sizeof function to compute the size of a template.
Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will it be 0, 1, or
runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 29 May 2007 09:44 #7110

Hello Claude and Stefan,

Thanks for your answers. I take them as indications that the sizeof
function is not defined for all of its parameters and that applying it
so some templates could lead to either runtime errors or errors at
compile time. Actually, that's what I feared: Another partial builtin
function and no possibility to check whether the argument is within the
domain of the function.

I'll have a closer look at the situation and prepare a CR if needed.

Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.

Best regards

Thomas



________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members
only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Saturday, 26. May 2007 10:50
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates





Hi Thomas,





Some suggestions:



1) At compilation time a WARNING or ERROR message should
be displayed since the value "*" can be zero up to infinity.

2) At runtime, use the currently received message matched
against the constraint to determine the value to be returned by

Sizeof. If the received message contains 20 integer, then
return value 20, if none, then 0, etc.

3) return a TTCN-3 error verdict with the offending line
number in the TTCN-3 code where the error occurs.



Look a C.29 and C30 of ES20187301.



C.30 indicates that an error occurs in the case where a record
of integer xxx is used with the sizeoftype since there is no length
constraint.



Since the type you use is unconstrained from a length/number of
elements point of view, it would make sense to cause

A runtime error for a template of this type. Of course,
specifying any other value than "*", would likely work.



Consider the following:



template R a_r2 := { 1, 2, * , 3, *, 9 };



What should sizeof return here? It is impossible to determine
the value here since "*" means 0 to infinity.

I would say applying a sizeof operation on any template
containing a "*" must cause either a static compilation error, or at a
minimum a runtime error (which is less desirable).





Now to put some more "salt into the wound", what happens with
this:





template R a_r3 := { ? } // what is returned here? // 1 or
something else.





Cheers,



Claude.














________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active members
only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
Sent: 26 May 2007 10:14
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas!



Since the size is undefined or "any"-size the nicest theoritical
value to be displayed would be "*". From an implementation and usage
standpoint that would be a bit hard to use I guess... ;-) so I would go
for the runtime error. Can't find it in the std so I guess it is up for
discussion.



BR



/Stefan




________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active members
only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: den 25 maj 2007 16:49
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Size of templates

Hello together,

TTCN-3 allows to use the sizeof function to compute the size of
a template. Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will it be 0,
1, or runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 29 May 2007 10:48 #7111

Dear Thomas,

I support your view to complete the definitions of builin functions in
TTCN-3. I was once defining the error cases for the builtin functions of
TTCN-3 - identifying the legal and illegal arguments. That did not make
it into the standard. But I still think that the error cases should be
added, such that there is a complete definition for the functions. The
sizeof function is only one case where it is not clear for which
arguments the functions are defined.

With best regards,

Ina.

>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
> Sent: Tuesday, May 29, 2007 11:45 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
> Hello Claude and Stefan,
>
> Thanks for your answers. I take them as indications that the
> sizeof function is not defined for all of its parameters and
> that applying it so some templates could lead to either
> runtime errors or errors at compile time. Actually, that's
> what I feared: Another partial builtin function and no
> possibility to check whether the argument is within the
> domain of the function.
>
> I'll have a closer look at the situation and prepare a CR if needed.
>
> Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.
>
> Best regards
>
> Thomas
>
>
>
> ________________________________
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext
> Claude Desroches
> Sent: Saturday, 26. May 2007 10:50
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
>
>
> Hi Thomas,
>
>
>
>
>
> Some suggestions:
>
>
>
> 1) At compilation time a WARNING or ERROR message
> should be displayed since the value "*" can be zero up to infinity.
>
> 2) At runtime, use the currently received message
> matched against the constraint to determine the value to be
> returned by
>
> Sizeof. If the received message contains 20 integer,
> then return value 20, if none, then 0, etc.
>
> 3) return a TTCN-3 error verdict with the
> offending line number in the TTCN-3 code where the error occurs.
>
>
>
> Look a C.29 and C30 of ES20187301.
>
>
>
> C.30 indicates that an error occurs in the case where a
> record of integer xxx is used with the sizeoftype since there
> is no length constraint.
>
>
>
> Since the type you use is unconstrained from a
> length/number of elements point of view, it would make sense to cause
>
> A runtime error for a template of this type. Of
> course, specifying any other value than "*", would likely work.
>
>
>
> Consider the following:
>
>
>
> template R a_r2 := { 1, 2, * , 3, *, 9 };
>
>
>
> What should sizeof return here? It is impossible to
> determine the value here since "*" means 0 to infinity.
>
> I would say applying a sizeof operation on any template
> containing a "*" must cause either a static compilation
> error, or at a minimum a runtime error (which is less desirable).
>
>
>
>
>
> Now to put some more "salt into the wound", what
> happens with this:
>
>
>
>
>
> template R a_r3 := { ? } // what is returned here?
> // 1 or something else.
>
>
>
>
>
> Cheers,
>
>
>
> Claude.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
> Sent: 26 May 2007 10:14
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hi Thomas!
>
>
>
> Since the size is undefined or "any"-size the nicest
> theoritical value to be displayed would be "*". From an
> implementation and usage standpoint that would be a bit hard
> to use I guess... ;-) so I would go for the runtime error.
> Can't find it in the std so I guess it is up for discussion.
>
>
>
> BR
>
>
>
> /Stefan
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
> Sent: den 25 maj 2007 16:49
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Size of templates
>
> Hello together,
>
> TTCN-3 allows to use the sizeof function to compute the
> size of a template. Assume the following definitions
>
> type record of integer R;
> template R a_r := {*};
>
> What will be the result of evalating sizeof(a_r), will
> it be 0, 1, or runtime error? Any ideas?
>
> Best regards
>
> Thomas
>
>
The administrator has disabled public write access.

Size of templates 29 May 2007 18:39 #7114

Hi,

I think that the problem does not exist as it originally was raised. The proforma of the sizeof predef. function is:

sizeof(any_type value) return integer

Note that it allows value parameter only, not a template parameter. If we re-write the original example to have a value parameter,
template R a_r := {*};

sizeof(valueof(a_r));

, it will give a run-time error.

If sizeof is allowed for templates, the only reasonable solution would be:
- if ALL values that would match the actual template parameter of sizeof have the same size, this value is returned by sizeof.
- all other cases shall result dynamic error

//e.g.
template R t_R := { 1,2,?,4 };
sizeof (t_R); //returns 4

//but
sizeof (R:{*})//returns error

Pls. note that the second example could not return anything else than error, as e.g. 0 would be returned by R:{}, 1 would be returned e.g. by R:{0}, R:{1}, R:{?} etc.

BR, Gyorgy

>
Original Message
>From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of
>Schieferdecker, Ina
>Sent: Tuesday, 2007 May 29. 12:49 PM
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: Size of templates
>
>Dear Thomas,
>
>I support your view to complete the definitions of builin functions in
>TTCN-3. I was once defining the error cases for the builtin
>functions of
>TTCN-3 - identifying the legal and illegal arguments. That did not make
>it into the standard. But I still think that the error cases should be
>added, such that there is a complete definition for the functions. The
>sizeof function is only one case where it is not clear for which
>arguments the functions are defined.
>
>With best regards,
>
>Ina.
>
>>
Original Message
>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>> Sent: Tuesday, May 29, 2007 11:45 AM
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: Re: Size of templates
>>
>> Hello Claude and Stefan,
>>
>> Thanks for your answers. I take them as indications that the
>> sizeof function is not defined for all of its parameters and
>> that applying it so some templates could lead to either
>> runtime errors or errors at compile time. Actually, that's
>> what I feared: Another partial builtin function and no
>> possibility to check whether the argument is within the
>> domain of the function.
>>
>> I'll have a closer look at the situation and prepare a CR if needed.
>>
>> Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.
>>
>> Best regards
>>
>> Thomas
>>
>>
>>
>> ________________________________
>>
>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext
>> Claude Desroches
>> Sent: Saturday, 26. May 2007 10:50
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: Re: Size of templates
>>
>>
>>
>>
>>
>> Hi Thomas,
>>
>>
>>
>>
>>
>> Some suggestions:
>>
>>
>>
>> 1) At compilation time a WARNING or ERROR message
>> should be displayed since the value "*" can be zero up to infinity.
>>
>> 2) At runtime, use the currently received message
>> matched against the constraint to determine the value to be
>> returned by
>>
>> Sizeof. If the received message contains 20 integer,
>> then return value 20, if none, then 0, etc.
>>
>> 3) return a TTCN-3 error verdict with the
>> offending line number in the TTCN-3 code where the error occurs.
>>
>>
>>
>> Look a C.29 and C30 of ES20187301.
>>
>>
>>
>> C.30 indicates that an error occurs in the case where a
>> record of integer xxx is used with the sizeoftype since there
>> is no length constraint.
>>
>>
>>
>> Since the type you use is unconstrained from a
>> length/number of elements point of view, it would make sense to cause
>>
>> A runtime error for a template of this type. Of
>> course, specifying any other value than "*", would likely work.
>>
>>
>>
>> Consider the following:
>>
>>
>>
>> template R a_r2 := { 1, 2, * , 3, *, 9 };
>>
>>
>>
>> What should sizeof return here? It is impossible to
>> determine the value here since "*" means 0 to infinity.
>>
>> I would say applying a sizeof operation on any template
>> containing a "*" must cause either a static compilation
>> error, or at a minimum a runtime error (which is less desirable).
>>
>>
>>
>>
>>
>> Now to put some more "salt into the wound", what
>> happens with this:
>>
>>
>>
>>
>>
>> template R a_r3 := { ? } // what is returned here?
>> // 1 or something else.
>>
>>
>>
>>
>>
>> Cheers,
>>
>>
>>
>> Claude.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ________________________________
>>
>>
>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of
>Qelthin, Stefan
>> Sent: 26 May 2007 10:14
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: Re: Size of templates
>>
>>
>>
>> Hi Thomas!
>>
>>
>>
>> Since the size is undefined or "any"-size the nicest
>> theoritical value to be displayed would be "*". From an
>> implementation and usage standpoint that would be a bit hard
>> to use I guess... ;-) so I would go for the runtime error.
>> Can't find it in the std so I guess it is up for discussion.
>>
>>
>>
>> BR
>>
>>
>>
>> /Stefan
>>
>>
>>
>>
>> ________________________________
>>
>>
>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>> Sent: den 25 maj 2007 16:49
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: Size of templates
>>
>> Hello together,
>>
>> TTCN-3 allows to use the sizeof function to compute the
>> size of a template. Assume the following definitions
>>
>> type record of integer R;
>> template R a_r := {*};
>>
>> What will be the result of evalating sizeof(a_r), will
>> it be 0, 1, or runtime error? Any ideas?
>>
>> Best regards
>>
>> Thomas
>>
>>
>
The administrator has disabled public write access.

Size of templates 30 May 2007 06:39 #7115

Hello Gyorgy,

Sorry, but I disagree on what you stated.

Annex C.29 explicitly states that a template can be used as parameter of the sizeof predefined function:

This function returns the actual number of elements of a module parameter, constant, variable or template of a ...

From what do you conclude that the sizeof predefined function allows values only? I cannot find this restriction. What am I missing?

Btw.: the usage of 'value' in the proforma of sizeof does not qualify as such a restriction, in my opinion. I see this just as an informal hint to the reader that a value shall be used here. But this is in contradiction to the textual explanation as mentioned above.

Best regards

Thomas


>
Original Message
>From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext
>György Réthy (IJ/ETH)
>Sent: Tuesday, 29. May 2007 20:40
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: Size of templates
>
>Hi,
>
>I think that the problem does not exist as it originally was
>raised. The proforma of the sizeof predef. function is:
>
> sizeof(any_type value) return integer
>
>Note that it allows value parameter only, not a template
>parameter. If we re-write the original example to have a value
>parameter,
> template R a_r := {*};
>
> sizeof(valueof(a_r));
>
>, it will give a run-time error.
>
>If sizeof is allowed for templates, the only reasonable
>solution would be:
>- if ALL values that would match the actual template parameter
>of sizeof have the same size, this value is returned by sizeof.
>- all other cases shall result dynamic error
>
>//e.g.
>template R t_R := { 1,2,?,4 };
>sizeof (t_R); //returns 4
>
>//but
>sizeof (R:{*})//returns error
>
>Pls. note that the second example could not return anything
>else than error, as e.g. 0 would be returned by R:{}, 1 would
>be returned e.g. by R:{0}, R:{1}, R:{?} etc.
>
>BR, Gyorgy
>
>>
Original Message
>>From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
>>[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Schieferdecker, Ina
>>Sent: Tuesday, 2007 May 29. 12:49 PM
>>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>Subject: Re: Size of templates
>>
>>Dear Thomas,
>>
>>I support your view to complete the definitions of builin
>functions in
>>TTCN-3. I was once defining the error cases for the builtin functions
>>of
>>TTCN-3 - identifying the legal and illegal arguments. That
>did not make
>>it into the standard. But I still think that the error cases
>should be
>>added, such that there is a complete definition for the
>functions. The
>>sizeof function is only one case where it is not clear for which
>>arguments the functions are defined.
>>
>>With best regards,
>>
>>Ina.
>>
>>>
Original Message
>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only
>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>>> Sent: Tuesday, May 29, 2007 11:45 AM
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: Re: Size of templates
>>>
>>> Hello Claude and Stefan,
>>>
>>> Thanks for your answers. I take them as indications that the sizeof
>>> function is not defined for all of its parameters and that applying
>>> it so some templates could lead to either runtime errors or
>errors at
>>> compile time. Actually, that's what I feared: Another
>partial builtin
>>> function and no possibility to check whether the argument is within
>>> the domain of the function.
>>>
>>> I'll have a closer look at the situation and prepare a CR if needed.
>>>
>>> Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.
>>>
>>> Best regards
>>>
>>> Thomas
>>>
>>>
>>>
>>> ________________________________
>>>
>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only
>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
>>> Sent: Saturday, 26. May 2007 10:50
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: Re: Size of templates
>>>
>>>
>>>
>>>
>>>
>>> Hi Thomas,
>>>
>>>
>>>
>>>
>>>
>>> Some suggestions:
>>>
>>>
>>>
>>> 1) At compilation time a WARNING or ERROR message
>>> should be displayed since the value "*" can be zero up to infinity.
>>>
>>> 2) At runtime, use the currently received message
>>> matched against the constraint to determine the value to be
>returned
>>> by
>>>
>>> Sizeof. If the received message contains 20 integer,
>then return
>>> value 20, if none, then 0, etc.
>>>
>>> 3) return a TTCN-3 error verdict with the
>>> offending line number in the TTCN-3 code where the error occurs.
>>>
>>>
>>>
>>> Look a C.29 and C30 of ES20187301.
>>>
>>>
>>>
>>> C.30 indicates that an error occurs in the case where a
>record of
>>> integer xxx is used with the sizeoftype since there is no length
>>> constraint.
>>>
>>>
>>>
>>> Since the type you use is unconstrained from a length/number of
>>> elements point of view, it would make sense to cause
>>>
>>> A runtime error for a template of this type. Of
>course, specifying
>>> any other value than "*", would likely work.
>>>
>>>
>>>
>>> Consider the following:
>>>
>>>
>>>
>>> template R a_r2 := { 1, 2, * , 3, *, 9 };
>>>
>>>
>>>
>>> What should sizeof return here? It is impossible to
>>> determine the value here since "*" means 0 to infinity.
>>>
>>> I would say applying a sizeof operation on any template
>containing a
>>> "*" must cause either a static compilation error, or at a minimum a
>>> runtime error (which is less desirable).
>>>
>>>
>>>
>>>
>>>
>>> Now to put some more "salt into the wound", what
>happens with this:
>>>
>>>
>>>
>>>
>>>
>>> template R a_r3 := { ? } // what is returned here?
>>> // 1 or something else.
>>>
>>>
>>>
>>>
>>>
>>> Cheers,
>>>
>>>
>>>
>>> Claude.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ________________________________
>>>
>>>
>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only
>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of
>>Qelthin, Stefan
>>> Sent: 26 May 2007 10:14
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: Re: Size of templates
>>>
>>>
>>>
>>> Hi Thomas!
>>>
>>>
>>>
>>> Since the size is undefined or "any"-size the nicest
>theoritical
>>> value to be displayed would be "*". From an implementation
>and usage
>>> standpoint that would be a bit hard to use I guess... ;-)
>so I would
>>> go for the runtime error.
>>> Can't find it in the std so I guess it is up for discussion.
>>>
>>>
>>>
>>> BR
>>>
>>>
>>>
>>> /Stefan
>>>
>>>
>>>
>>>
>>> ________________________________
>>>
>>>
>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only
>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>>> Sent: den 25 maj 2007 16:49
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: Size of templates
>>>
>>> Hello together,
>>>
>>> TTCN-3 allows to use the sizeof function to compute the
>size of a
>>> template. Assume the following definitions
>>>
>>> type record of integer R;
>>> template R a_r := {*};
>>>
>>> What will be the result of evalating sizeof(a_r), will
>it be 0, 1,
>>> or runtime error? Any ideas?
>>>
>>> Best regards
>>>
>>> Thomas
>>>
>>>
>>
>
The administrator has disabled public write access.

Size of templates 30 May 2007 07:49 #7116

Hi,

Just to throw my 10 cents into the discussion:

It would be reasonable, if for all templates t,
sizeof(t) would just be a shorthand for
sizeof(valueof(t)).

And before you all cry, let's do it the way we have done it always:

Please describe a usage szenario that would require an extended interpretation
of sizeof(), when you provide an extended definition of the function.

Kind regards,
Matthias Jung



Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: Mittwoch, 30. Mai 2007 08:39
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates

Hello Gyorgy,

Sorry, but I disagree on what you stated.

Annex C.29 explicitly states that a template can be used as parameter of the sizeof predefined function:

This function returns the actual number of elements of a module parameter, constant, variable or template of a ...

From what do you conclude that the sizeof predefined function allows values only? I cannot find this restriction. What am I missing?

Btw.: the usage of 'value' in the proforma of sizeof does not qualify as such a restriction, in my opinion. I see this just as an informal hint to the reader that a value shall be used here. But this is in contradiction to the textual explanation as mentioned above.

Best regards

Thomas


>
Original Message
>From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
>[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext György Réthy (IJ/ETH)
>Sent: Tuesday, 29. May 2007 20:40
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: Size of templates
>
>Hi,
>
>I think that the problem does not exist as it originally was raised.
>The proforma of the sizeof predef. function is:
>
> sizeof(any_type value) return integer
>
>Note that it allows value parameter only, not a template parameter. If
>we re-write the original example to have a value parameter,
> template R a_r := {*};
>
> sizeof(valueof(a_r));
>
>, it will give a run-time error.
>
>If sizeof is allowed for templates, the only reasonable solution would
>be:
>- if ALL values that would match the actual template parameter of
>sizeof have the same size, this value is returned by sizeof.
>- all other cases shall result dynamic error
>
>//e.g.
>template R t_R := { 1,2,?,4 };
>sizeof (t_R); //returns 4
>
>//but
>sizeof (R:{*})//returns error
>
>Pls. note that the second example could not return anything else than
>error, as e.g. 0 would be returned by R:{}, 1 would be returned e.g. by
>R:{0}, R:{1}, R:{?} etc.
>
>BR, Gyorgy
>
>>
Original Message
>>From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
>>[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Schieferdecker, Ina
>>Sent: Tuesday, 2007 May 29. 12:49 PM
>>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>Subject: Re: Size of templates
>>
>>Dear Thomas,
>>
>>I support your view to complete the definitions of builin
>functions in
>>TTCN-3. I was once defining the error cases for the builtin functions
>>of
>>TTCN-3 - identifying the legal and illegal arguments. That
>did not make
>>it into the standard. But I still think that the error cases
>should be
>>added, such that there is a complete definition for the
>functions. The
>>sizeof function is only one case where it is not clear for which
>>arguments the functions are defined.
>>
>>With best regards,
>>
>>Ina.
>>
>>>
Original Message
>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only
>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>>> Sent: Tuesday, May 29, 2007 11:45 AM
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: Re: Size of templates
>>>
>>> Hello Claude and Stefan,
>>>
>>> Thanks for your answers. I take them as indications that the sizeof
>>> function is not defined for all of its parameters and that applying
>>> it so some templates could lead to either runtime errors or
>errors at
>>> compile time. Actually, that's what I feared: Another
>partial builtin
>>> function and no possibility to check whether the argument is within
>>> the domain of the function.
>>>
>>> I'll have a closer look at the situation and prepare a CR if needed.
>>>
>>> Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.
>>>
>>> Best regards
>>>
>>> Thomas
>>>
>>>
>>>
>>> ________________________________
>>>
>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only
>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
>>> Sent: Saturday, 26. May 2007 10:50
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: Re: Size of templates
>>>
>>>
>>>
>>>
>>>
>>> Hi Thomas,
>>>
>>>
>>>
>>>
>>>
>>> Some suggestions:
>>>
>>>
>>>
>>> 1) At compilation time a WARNING or ERROR message
>>> should be displayed since the value "*" can be zero up to infinity.
>>>
>>> 2) At runtime, use the currently received message
>>> matched against the constraint to determine the value to be
>returned
>>> by
>>>
>>> Sizeof. If the received message contains 20 integer,
>then return
>>> value 20, if none, then 0, etc.
>>>
>>> 3) return a TTCN-3 error verdict with the
>>> offending line number in the TTCN-3 code where the error occurs.
>>>
>>>
>>>
>>> Look a C.29 and C30 of ES20187301.
>>>
>>>
>>>
>>> C.30 indicates that an error occurs in the case where a
>record of
>>> integer xxx is used with the sizeoftype since there is no length
>>> constraint.
>>>
>>>
>>>
>>> Since the type you use is unconstrained from a length/number of
>>> elements point of view, it would make sense to cause
>>>
>>> A runtime error for a template of this type. Of
>course, specifying
>>> any other value than "*", would likely work.
>>>
>>>
>>>
>>> Consider the following:
>>>
>>>
>>>
>>> template R a_r2 := { 1, 2, * , 3, *, 9 };
>>>
>>>
>>>
>>> What should sizeof return here? It is impossible to
>>> determine the value here since "*" means 0 to infinity.
>>>
>>> I would say applying a sizeof operation on any template
>containing a
>>> "*" must cause either a static compilation error, or at a minimum a
>>> runtime error (which is less desirable).
>>>
>>>
>>>
>>>
>>>
>>> Now to put some more "salt into the wound", what
>happens with this:
>>>
>>>
>>>
>>>
>>>
>>> template R a_r3 := { ? } // what is returned here?
>>> // 1 or something else.
>>>
>>>
>>>
>>>
>>>
>>> Cheers,
>>>
>>>
>>>
>>> Claude.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ________________________________
>>>
>>>
>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only
>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of
>>Qelthin, Stefan
>>> Sent: 26 May 2007 10:14
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: Re: Size of templates
>>>
>>>
>>>
>>> Hi Thomas!
>>>
>>>
>>>
>>> Since the size is undefined or "any"-size the nicest
>theoritical
>>> value to be displayed would be "*". From an implementation
>and usage
>>> standpoint that would be a bit hard to use I guess... ;-)
>so I would
>>> go for the runtime error.
>>> Can't find it in the std so I guess it is up for discussion.
>>>
>>>
>>>
>>> BR
>>>
>>>
>>>
>>> /Stefan
>>>
>>>
>>>
>>>
>>> ________________________________
>>>
>>>
>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only
>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>>> Sent: den 25 maj 2007 16:49
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: Size of templates
>>>
>>> Hello together,
>>>
>>> TTCN-3 allows to use the sizeof function to compute the
>size of a
>>> template. Assume the following definitions
>>>
>>> type record of integer R;
>>> template R a_r := {*};
>>>
>>> What will be the result of evalating sizeof(a_r), will
>it be 0, 1,
>>> or runtime error? Any ideas?
>>>
>>> Best regards
>>>
>>> Thomas
>>>
>>>
>>
>


Telelogic Lifecycle Solutions:
Helping You Define, Design & Deliver Advanced Systems & Software
Learn More at www.telelogic.com



Dr. Matthias Jung
Senior Consultant
Telelogic Deutschland GmbH
Otto-Brenner-Straße 247,
Bielefeld33604,
Germany


Phone: +49 (521) 145 0333
Fax: +49 (521) 145 0350
Mobile phone: +49 (170) 1892704
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.telelogic.de

Telelogic - Requirements-Driven Innovation!
Telelogic - Product Life Demo
Aktuelle Events:
Synergy Developer, 11.06.2007, in Hallbergmoos
Synergy Build Manager, 12.-13.06.2007, in Hallbergmoos
Rhapsody + Simulink-Integration, 28.06.2007, in Hallbergmoos
Registrieren: www.telelogic.de/company/events/index.cfm
Telelogic Deutschland GmbH, 33604 Bielefeld, Otto-Brenner-Str. 247, Amtsgericht Bielefeld, HRB 34 265, Geschäftsführer Ulf Pansa




The information contained in this e-mail, including any attachment or enclosure, is intended only for the person or entity to which it is addressed and may contain confidential material. Any unauthorized use, review, retransmissions, dissemination, copying or other use of this information by persons or entities other than the intended recipient is prohibited.
The administrator has disabled public write access.

Size of templates 30 May 2007 10:53 #7117

Hi Thomas,





1) Suggestion: Review all the built-in functions (and parameters) to verify
correctness specifically when matching mechanisms are used.





2) Question regarding the use of '?' in matching mechanisms.



Is using '?' valid if applied to a field which is optional? ( No)



Have a look at example in B.1.2.3 Any value.



// Given the message type definition

type record MyMessageType

{

integer field1,

charstring field2,

boolean field3 optional,

integer[4] field4

}



//



EXAMPLE:

template Mymessage MyTemplate:=

{

field1 := ?, // will match any integer

field2 := ?, // will match any non-empty charstring value

field3 := ?, // will match true or false

field4 := ? // will match any sequence of integers

}



The above example is misleading as the template is invalid. The '?' is not
permitted for fields which are

Optional.



Possible results:

(a) compilation error.
(preferred solution).

(b) run-time error (error verdict) if the element is not present,


(c) 'no-match' if the element is not present (with no run-time error).
Not a desirable behaviour as it ignores the problem



If I've understood correctly, (a) is the most CORRECT behaviour to expect,
if the '?' is used in a template, for optional fields.



According to the type definition field3 is optional. Although it is
correct that '?' will match either true or false values, there is no

Explanation of what happens if field3 is not present.



Do you get a compilation error, runtime error, or a 'no-match'? Or is the
user forced to accompany the field with an ifpresent()?



Answer: even if the ifpresent() is there, it should still give at least a
runtime error since ? requires the presence of a value.

That is, adding the ifpresent is pointless. :-).





3) Can Any value be a record or must it be a 'basic' type such as
boolean or integer?





4) B1.3.2 Any number of elements or no element





Clarification:



EXAMPLE:

template Mymessage MyTemplate:=

{ :

field2 := "abcxyz",

field3 := '10*11'B, // where "*" may be any sequence of bits (possibly
empty)

field4 := {*, 2, 3} // where "*"may be any number of integer values or
omitted



The comment associated to field4 is misleading. The number of integer
values permitted should not exceed the number of

Elements specified by the type definition. That is, { 1, 4, 5, 6, 2, 3 }
would cause a run-time error since a maximum of 4

Integers are permitted based on the Mymessage type definition. The comment
should be extended to make this point clear to

Readers.



I realize that it is not in the spirit of a standard to be a tutorial for a
language, but such details are needed to ensure clarity from a usage and
implementation point of view (however obvious it might seem to many).



I think from a clarity point of view, new examples should be added
specifically for those cases, where it is unclear what the expected result
is.







Cheers,



Claude.



PS: Any operation which leads to an undefined result ( suchas sizeof ( { *}
) should force either a compilation error where possible and a runtime
'error' verdict at the least.







_____

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: 29 May 2007 11:45
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hello Claude and Stefan,



Thanks for your answers. I take them as indications that the sizeof function
is not defined for all of its parameters and that applying it so some
templates could lead to either runtime errors or errors at compile time.
Actually, that's what I feared: Another partial builtin function and no
possibility to check whether the argument is within the domain of the
function.



I'll have a closer look at the situation and prepare a CR if needed.



Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.







Best regards



Thomas






_____


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Saturday, 26. May 2007 10:50
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas,





Some suggestions:



1) At compilation time a WARNING or ERROR message should be displayed
since the value "*" can be zero up to infinity.

2) At runtime, use the currently received message matched against the
constraint to determine the value to be returned by

Sizeof. If the received message contains 20 integer, then return value 20,
if none, then 0, etc.

3) return a TTCN-3 error verdict with the offending line number in the
TTCN-3 code where the error occurs.



Look a C.29 and C30 of ES20187301.



C.30 indicates that an error occurs in the case where a record of integer
xxx is used with the sizeoftype since there is no length constraint.



Since the type you use is unconstrained from a length/number of elements
point of view, it would make sense to cause

A runtime error for a template of this type. Of course, specifying any
other value than "*", would likely work.



Consider the following:



template R a_r2 := { 1, 2, * , 3, *, 9 };



What should sizeof return here? It is impossible to determine the value
here since "*" means 0 to infinity.

I would say applying a sizeof operation on any template containing a "*"
must cause either a static compilation error, or at a minimum a runtime
error (which is less desirable).





Now to put some more "salt into the wound", what happens with this:





template R a_r3 := { ? } // what is returned here? // 1 or something
else.





Cheers,



Claude.














_____


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
Sent: 26 May 2007 10:14
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas!



Since the size is undefined or "any"-size the nicest theoritical value to be
displayed would be "*". From an implementation and usage standpoint that
would be a bit hard to use I guess... ;-) so I would go for the runtime
error. Can't find it in the std so I guess it is up for discussion.



BR



/Stefan




_____


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: den 25 maj 2007 16:49
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Size of templates

Hello together,

TTCN-3 allows to use the sizeof function to compute the size of a template.
Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will it be 0, 1, or
runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 31 May 2007 08:51 #7120

Hi,

I admit that Thomas is rigth, the definition of the predefined function is not consistent. It is not the formal parameter name ("value" that is a reserved word anyway) but the missing template keyword in the formal parameter I was refering to.

I think that just defining the returned value in case of templates as a shorthand for sizeof(valueof(t)) is too limiting. For example:
in case of template variable the template content is generated/changed on the fly. For example new elements of a record of template are added in a loop. One may not not the number of elements in a given template variable. But the individual elements may be also ranges, ? and so on. valueof would return simply en error when meeting the first matching mechanism, while the size still can be quite deterministic.

BR, Gyorgy

>
Original Message
>From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Dr.
>Matthias Jung
>Sent: Wednesday, 2007 May 30. 09:50 AM
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: Size of templates
>
>Hi,
>
>Just to throw my 10 cents into the discussion:
>
>It would be reasonable, if for all templates t,
> sizeof(t) would just be a shorthand for
> sizeof(valueof(t)).
>
>And before you all cry, let's do it the way we have done it always:
>
>Please describe a usage szenario that would require an
>extended interpretation
>of sizeof(), when you provide an extended definition of the function.
>
>Kind regards,
>Matthias Jung
>
>
>
>
Original Message
>From: active_ttcn3 : mts stf133 ttcn version 3 - active
>members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>Sent: Mittwoch, 30. Mai 2007 08:39
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: Size of templates
>
>Hello Gyorgy,
>
>Sorry, but I disagree on what you stated.
>
>Annex C.29 explicitly states that a template can be used as
>parameter of the sizeof predefined function:
>
>This function returns the actual number of elements of a
>module parameter, constant, variable or template of a ...
>
>From what do you conclude that the sizeof predefined function
>allows values only? I cannot find this restriction. What am I missing?
>
>Btw.: the usage of 'value' in the proforma of sizeof does not
>qualify as such a restriction, in my opinion. I see this just
>as an informal hint to the reader that a value shall be used
>here. But this is in contradiction to the textual explanation
>as mentioned above.
>
>Best regards
>
>Thomas
>
>
>>
Original Message
>>From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
>>[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext György Réthy (IJ/ETH)
>>Sent: Tuesday, 29. May 2007 20:40
>>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>Subject: Re: Size of templates
>>
>>Hi,
>>
>>I think that the problem does not exist as it originally was raised.
>>The proforma of the sizeof predef. function is:
>>
>> sizeof(any_type value) return integer
>>
>>Note that it allows value parameter only, not a template
>parameter. If
>>we re-write the original example to have a value parameter,
>> template R a_r := {*};
>>
>> sizeof(valueof(a_r));
>>
>>, it will give a run-time error.
>>
>>If sizeof is allowed for templates, the only reasonable
>solution would
>>be:
>>- if ALL values that would match the actual template parameter of
>>sizeof have the same size, this value is returned by sizeof.
>>- all other cases shall result dynamic error
>>
>>//e.g.
>>template R t_R := { 1,2,?,4 };
>>sizeof (t_R); //returns 4
>>
>>//but
>>sizeof (R:{*})//returns error
>>
>>Pls. note that the second example could not return anything else than
>>error, as e.g. 0 would be returned by R:{}, 1 would be
>returned e.g. by
>>R:{0}, R:{1}, R:{?} etc.
>>
>>BR, Gyorgy
>>
>>>
Original Message
>>>From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
>>>[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Schieferdecker, Ina
>>>Sent: Tuesday, 2007 May 29. 12:49 PM
>>>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>>Subject: Re: Size of templates
>>>
>>>Dear Thomas,
>>>
>>>I support your view to complete the definitions of builin
>>functions in
>>>TTCN-3. I was once defining the error cases for the builtin
>functions
>>>of
>>>TTCN-3 - identifying the legal and illegal arguments. That
>>did not make
>>>it into the standard. But I still think that the error cases
>>should be
>>>added, such that there is a complete definition for the
>>functions. The
>>>sizeof function is only one case where it is not clear for which
>>>arguments the functions are defined.
>>>
>>>With best regards,
>>>
>>>Ina.
>>>
>>>>
Original Message
>>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>>members only
>>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>>>> Sent: Tuesday, May 29, 2007 11:45 AM
>>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>>> Subject: Re: Size of templates
>>>>
>>>> Hello Claude and Stefan,
>>>>
>>>> Thanks for your answers. I take them as indications that
>the sizeof
>>>> function is not defined for all of its parameters and that
>applying
>>>> it so some templates could lead to either runtime errors or
>>errors at
>>>> compile time. Actually, that's what I feared: Another
>>partial builtin
>>>> function and no possibility to check whether the argument
>is within
>>>> the domain of the function.
>>>>
>>>> I'll have a closer look at the situation and prepare a CR
>if needed.
>>>>
>>>> Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.
>>>>
>>>> Best regards
>>>>
>>>> Thomas
>>>>
>>>>
>>>>
>>>> ________________________________
>>>>
>>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>>members only
>>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
>>>> Sent: Saturday, 26. May 2007 10:50
>>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>>> Subject: Re: Size of templates
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Hi Thomas,
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Some suggestions:
>>>>
>>>>
>>>>
>>>> 1) At compilation time a WARNING or ERROR message
>>>> should be displayed since the value "*" can be zero up to infinity.
>>>>
>>>> 2) At runtime, use the currently received message
>>>> matched against the constraint to determine the value to be
>>returned
>>>> by
>>>>
>>>> Sizeof. If the received message contains 20 integer,
>>then return
>>>> value 20, if none, then 0, etc.
>>>>
>>>> 3) return a TTCN-3 error verdict with the
>>>> offending line number in the TTCN-3 code where the error occurs.
>>>>
>>>>
>>>>
>>>> Look a C.29 and C30 of ES20187301.
>>>>
>>>>
>>>>
>>>> C.30 indicates that an error occurs in the case where a
>>record of
>>>> integer xxx is used with the sizeoftype since there is no length
>>>> constraint.
>>>>
>>>>
>>>>
>>>> Since the type you use is unconstrained from a length/number of
>>>> elements point of view, it would make sense to cause
>>>>
>>>> A runtime error for a template of this type. Of
>>course, specifying
>>>> any other value than "*", would likely work.
>>>>
>>>>
>>>>
>>>> Consider the following:
>>>>
>>>>
>>>>
>>>> template R a_r2 := { 1, 2, * , 3, *, 9 };
>>>>
>>>>
>>>>
>>>> What should sizeof return here? It is impossible to
>>>> determine the value here since "*" means 0 to infinity.
>>>>
>>>> I would say applying a sizeof operation on any template
>>containing a
>>>> "*" must cause either a static compilation error, or at a
>minimum a
>>>> runtime error (which is less desirable).
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Now to put some more "salt into the wound", what
>>happens with this:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> template R a_r3 := { ? } // what is returned here?
>>>> // 1 or something else.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Cheers,
>>>>
>>>>
>>>>
>>>> Claude.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ________________________________
>>>>
>>>>
>>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>>members only
>>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of
>>>Qelthin, Stefan
>>>> Sent: 26 May 2007 10:14
>>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>>> Subject: Re: Size of templates
>>>>
>>>>
>>>>
>>>> Hi Thomas!
>>>>
>>>>
>>>>
>>>> Since the size is undefined or "any"-size the nicest
>>theoritical
>>>> value to be displayed would be "*". From an implementation
>>and usage
>>>> standpoint that would be a bit hard to use I guess... ;-)
>>so I would
>>>> go for the runtime error.
>>>> Can't find it in the std so I guess it is up for discussion.
>>>>
>>>>
>>>>
>>>> BR
>>>>
>>>>
>>>>
>>>> /Stefan
>>>>
>>>>
>>>>
>>>>
>>>> ________________________________
>>>>
>>>>
>>>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>>members only
>>>> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
>>>> Sent: den 25 maj 2007 16:49
>>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>>> Subject: Size of templates
>>>>
>>>> Hello together,
>>>>
>>>> TTCN-3 allows to use the sizeof function to compute the
>>size of a
>>>> template. Assume the following definitions
>>>>
>>>> type record of integer R;
>>>> template R a_r := {*};
>>>>
>>>> What will be the result of evalating sizeof(a_r), will
>>it be 0, 1,
>>>> or runtime error? Any ideas?
>>>>
>>>> Best regards
>>>>
>>>> Thomas
>>>>
>>>>
>>>
>>
>
>
>
>
>Telelogic Lifecycle Solutions:
>Helping You Define, Design & Deliver Advanced Systems & Software
>Learn More at www.telelogic.com
>
>
>
>Dr. Matthias Jung
>Senior Consultant
>Telelogic Deutschland GmbH
>Otto-Brenner-Straße 247,
>Bielefeld33604,
>Germany
>
>
>Phone: +49 (521) 145 0333
>Fax: +49 (521) 145 0350
>Mobile phone: +49 (170) 1892704
>This email address is being protected from spambots. You need JavaScript enabled to view it.
>www.telelogic.de
>
>Telelogic - Requirements-Driven Innovation!
>Telelogic - Product Life Demo
>
>Aktuelle Events:
> Synergy Developer, 11.06.2007, in Hallbergmoos
> Synergy Build Manager, 12.-13.06.2007, in Hallbergmoos
> Rhapsody + Simulink-Integration, 28.06.2007, in
>Hallbergmoos
>Registrieren: www.telelogic.de/company/events/index.cfm
>Telelogic Deutschland GmbH, 33604 Bielefeld, Otto-Brenner-Str.
>247, Amtsgericht Bielefeld, HRB 34 265, Geschäftsführer Ulf Pansa
>
>
>
>
>
>The information contained in this e-mail, including any
>attachment or enclosure, is intended only for the person or
>entity to which it is addressed and may contain confidential
>material. Any unauthorized use, review, retransmissions,
>dissemination, copying or other use of this information by
>persons or entities other than the intended recipient is prohibited.
>
The administrator has disabled public write access.

Size of templates 31 May 2007 11:47 #7123

Hello Claude, Gyorgy, and Matthias,

let me just respond to this email, as Gyorgy responded already on
Matthias' one.

Regarding the suggestions of Claude:
1) I have checked the the other predefined functions, as far as I can
see sizeof is the only problematic one.
2) In my opinion AnyValue can be used on optional fields of records,
matching all values. But not matching if there is no value in the field.

AnyValueOrNone and ifpresent are restricted to optional fields, but
there are no limitations for AnyValue.
4) You are right, in this case '*' corresponds to two integers. But
there are some further problems regarding the examples:
4a) At the beginning of Annex B, a type MyMessageType is defined. There
are some templates for this type in Annex B using this type, but
actually most of the templates are of type MyMessage, which is not
defined in Annex B.
4b) Also note, that field3 is sometimes a boolean and sometimes a
bitstring in templates of type MyMessage.
4c) The example in B.1.3.1 defines field4 := {1, ?, 3}; But if this
template should be of type MyMessage, this would violate the length
restriction in the definiton of this field, which is a an array of 4
integers.

Best regards

Thomas


________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members
only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Wednesday, 30. May 2007 12:54
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates





Hi Thomas,





1) Suggestion: Review all the built-in functions (and
parameters) to verify correctness specifically when matching mechanisms
are used.





2) Question regarding the use of '?' in matching mechanisms.



Is using '?' valid if applied to a field which is optional? (
No)



Have a look at example in B.1.2.3 Any value.



// Given the message type definition

type record MyMessageType

{

integer field1,

charstring field2,

boolean field3 optional,

integer[4] field4

}



//



EXAMPLE:

template Mymessage MyTemplate:=

{

field1 := ?, // will match any integer

field2 := ?, // will match any non-empty charstring value

field3 := ?, // will match true or false

field4 := ? // will match any sequence of integers

}



The above example is misleading as the template is invalid. The
'?' is not permitted for fields which are

Optional.



Possible results:

(a) compilation error.
(preferred solution).

(b) run-time error (error verdict) if the element is not
present,

(c) 'no-match' if the element is not present (with no run-time
error). Not a desirable behaviour as it ignores the problem



If I've understood correctly, (a) is the most CORRECT behaviour
to expect, if the '?' is used in a template, for optional fields.



According to the type definition field3 is optional. Although
it is correct that '?' will match either true or false values, there is
no

Explanation of what happens if field3 is not present.



Do you get a compilation error, runtime error, or a 'no-match'?
Or is the user forced to accompany the field with an ifpresent()?



Answer: even if the ifpresent() is there, it should still give
at least a runtime error since ? requires the presence of a value.

That is, adding the ifpresent is pointless... :-).





3) Can Any value be a record or must it be a 'basic' type
such as boolean or integer?





4) B1.3.2 Any number of elements or no element





Clarification:



EXAMPLE:

template Mymessage MyTemplate:=

{ :

field2 := "abcxyz",

field3 := '10*11'B, // where "*" may be any sequence of bits
(possibly empty)

field4 := {*, 2, 3} // where "*"may be any number of integer
values or omitted



The comment associated to field4 is misleading. The number of
integer values permitted should not exceed the number of

Elements specified by the type definition. That is, { 1, 4, 5,
6, 2, 3 } would cause a run-time error since a maximum of 4

Integers are permitted based on the Mymessage type definition.
The comment should be extended to make this point clear to

Readers.



I realize that it is not in the spirit of a standard to be a
tutorial for a language, but such details are needed to ensure clarity
from a usage and implementation point of view (however obvious it might
seem to many).



I think from a clarity point of view, new examples should be
added specifically for those cases, where it is unclear what the
expected result is.







Cheers,



Claude.



PS: Any operation which leads to an undefined result ( suchas
sizeof ( { *} ) should force either a compilation error where possible
and a runtime 'error' verdict at the least.








________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active members
only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: 29 May 2007 11:45
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hello Claude and Stefan,



Thanks for your answers. I take them as indications that the
sizeof function is not defined for all of its parameters and that
applying it so some templates could lead to either runtime errors or
errors at compile time. Actually, that's what I feared: Another partial
builtin function and no possibility to check whether the argument is
within the domain of the function.



I'll have a closer look at the situation and prepare a CR if
needed.



Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.







Best regards



Thomas






________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude
Desroches
Sent: Saturday, 26. May 2007 10:50
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas,





Some suggestions:



1) At compilation time a WARNING or ERROR message
should be displayed since the value "*" can be zero up to infinity.

2) At runtime, use the currently received message
matched against the constraint to determine the value to be returned by

Sizeof. If the received message contains 20 integer,
then return value 20, if none, then 0, etc.

3) return a TTCN-3 error verdict with the
offending line number in the TTCN-3 code where the error occurs.



Look a C.29 and C30 of ES20187301.



C.30 indicates that an error occurs in the case where a
record of integer xxx is used with the sizeoftype since there is no
length constraint.



Since the type you use is unconstrained from a
length/number of elements point of view, it would make sense to cause

A runtime error for a template of this type. Of course,
specifying any other value than "*", would likely work.



Consider the following:



template R a_r2 := { 1, 2, * , 3, *, 9 };



What should sizeof return here? It is impossible to
determine the value here since "*" means 0 to infinity.

I would say applying a sizeof operation on any template
containing a "*" must cause either a static compilation error, or at a
minimum a runtime error (which is less desirable).





Now to put some more "salt into the wound", what happens
with this:





template R a_r3 := { ? } // what is returned here?
// 1 or something else.





Cheers,



Claude.














________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
Sent: 26 May 2007 10:14
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas!



Since the size is undefined or "any"-size the nicest
theoritical value to be displayed would be "*". From an implementation
and usage standpoint that would be a bit hard to use I guess... ;-) so I
would go for the runtime error. Can't find it in the std so I guess it
is up for discussion.



BR



/Stefan




________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: den 25 maj 2007 16:49
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Size of templates

Hello together,

TTCN-3 allows to use the sizeof function to compute the
size of a template. Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will
it be 0, 1, or runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 31 May 2007 21:11 #7126

Hi,

See in-line. Gyorgy


________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: Thursday, 2007 May 31. 01:47 PM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates


Hello Claude, Gyorgy, and Matthias,

let me just respond to this email, as Gyorgy responded already on Matthias' one.

Regarding the suggestions of Claude:
1) I have checked the the other predefined functions, as far as I can see sizeof is the only problematic one.
[György Réthy (IJ/ETH)] I think sizeoftype is also concerned. To cut it short I have submitted a CR.

2) In my opinion AnyValue can be used on optional fields of records, matching all values. But not matching if there is no value in the field.
AnyValueOrNone and ifpresent are restricted to optional fields, but there are no limitations for AnyValue.
[György Réthy (IJ/ETH)] Thomas is correct. AnyValue can be used on optional fields, it is just signals that you require the field be present in the matched value/message but the actual value of the field is not important. If the field is missing in the message/value, it simply will not match the template (ifpresent is quite the opposite: the field may be omitted but if present it shall be the specified value - unless the specified value is a matching symbol but this would take us far).

4) You are right, in this case '*' corresponds to two integers. But there are some further problems regarding the examples:
4a) At the beginning of Annex B, a type MyMessageType is defined. There are some templates for this type in Annex B using this type, but actually most of the templates are of type MyMessage, which is not defined in Annex B.
4b) Also note, that field3 is sometimes a boolean and sometimes a bitstring in templates of type MyMessage.
4c) The example in B.1.3.1 defines field4 := {1, ?, 3}; But if this template should be of type MyMessage, this would violate the length restriction in the definiton of this field, which is a an array of 4 integers.
[György Réthy (IJ/ETH)] The examples needs to be corrected. There are more errors (e.g. in B.1.2.2 no field name is given) and, anyway, I think the type is too far from the template examples. I think the right solution would be to correct B.1.1.1 and add its own type definition to each clause in Annex B.

Best regards

Thomas


________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Wednesday, 30. May 2007 12:54
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates





Hi Thomas,





1) Suggestion: Review all the built-in functions (and parameters)
to verify correctness specifically when matching mechanisms are used.





2) Question regarding the use of '?' in matching mechanisms.



Is using '?' valid if applied to a field which is optional? ( No)



Have a look at example in B.1.2.3 Any value.



// Given the message type definition

type record MyMessageType

{

integer field1,

charstring field2,

boolean field3 optional,

integer[4] field4

}



//



EXAMPLE:

template Mymessage MyTemplate:=

{

field1 := ?, // will match any integer

field2 := ?, // will match any non-empty charstring value

field3 := ?, // will match true or false

field4 := ? // will match any sequence of integers

}



The above example is misleading as the template is invalid. The '?'
is not permitted for fields which are

Optional.



Possible results:

(a) compilation error.
(preferred solution).

(b) run-time error (error verdict) if the element is not present,


(c) 'no-match' if the element is not present (with no run-time error). Not a desirable behaviour as it ignores the problem



If I've understood correctly, (a) is the most CORRECT behaviour to
expect, if the '?' is used in a template, for optional fields.



According to the type definition field3 is optional. Although it
is correct that '?' will match either true or false values, there is no

Explanation of what happens if field3 is not present.



Do you get a compilation error, runtime error, or a 'no-match'? Or
is the user forced to accompany the field with an ifpresent()?



Answer: even if the ifpresent() is there, it should still give at least a runtime error since ? requires the presence of a value.

That is, adding the ifpresent is pointless... :-).





3) Can Any value be a record or must it be a 'basic' type such
as boolean or integer?





4) B1.3.2 Any number of elements or no element





Clarification:



EXAMPLE:

template Mymessage MyTemplate:=

{ :

field2 := "abcxyz",

field3 := '10*11'B, // where "*" may be any sequence of bits (possibly empty)

field4 := {*, 2, 3} // where "*"may be any number of integer
values or omitted



The comment associated to field4 is misleading. The number of
integer values permitted should not exceed the number of

Elements specified by the type definition. That is, { 1, 4, 5, 6,
2, 3 } would cause a run-time error since a maximum of 4

Integers are permitted based on the Mymessage type definition. The
comment should be extended to make this point clear to

Readers.



I realize that it is not in the spirit of a standard to be a
tutorial for a language, but such details are needed to ensure clarity from a usage and implementation point of view (however obvious it might seem to many).



I think from a clarity point of view, new examples should be added specifically for those cases, where it is unclear what the expected result is.







Cheers,



Claude.



PS: Any operation which leads to an undefined result ( suchas
sizeof ( { *} ) should force either a compilation error where possible and a runtime 'error' verdict at the least.








________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: 29 May 2007 11:45
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hello Claude and Stefan,



Thanks for your answers. I take them as indications that the sizeof
function is not defined for all of its parameters and that applying it so some templates could lead to either runtime errors or errors at compile time. Actually, that's what I feared: Another partial builtin function and no possibility to check whether the argument is within the domain of the function.



I'll have a closer look at the situation and prepare a CR if needed.



Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.







Best regards



Thomas






________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Saturday, 26. May 2007 10:50
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas,





Some suggestions:



1) At compilation time a WARNING or ERROR message should
be displayed since the value "*" can be zero up to infinity.

2) At runtime, use the currently received message
matched against the constraint to determine the value to be returned by

Sizeof. If the received message contains 20 integer, then
return value 20, if none, then 0, etc.

3) return a TTCN-3 error verdict with the offending line
number in the TTCN-3 code where the error occurs.



Look a C.29 and C30 of ES20187301.



C.30 indicates that an error occurs in the case where a record
of integer xxx is used with the sizeoftype since there is no length constraint.



Since the type you use is unconstrained from a length/number
of elements point of view, it would make sense to cause

A runtime error for a template of this type. Of course,
specifying any other value than "*", would likely work.



Consider the following:



template R a_r2 := { 1, 2, * , 3, *, 9 };



What should sizeof return here? It is impossible to
determine the value here since "*" means 0 to infinity.

I would say applying a sizeof operation on any template
containing a "*" must cause either a static compilation error, or at a minimum a runtime error (which is less desirable).





Now to put some more "salt into the wound", what happens with
this:





template R a_r3 := { ? } // what is returned here? // 1
or something else.





Cheers,



Claude.














________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
Sent: 26 May 2007 10:14
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas!



Since the size is undefined or "any"-size the nicest
theoritical value to be displayed would be "*". From an implementation and usage standpoint that would be a bit hard to use I guess... ;-) so I would go for the runtime error. Can't find it in the std so I guess it is up for discussion.



BR



/Stefan




________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: den 25 maj 2007 16:49
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Size of templates

Hello together,

TTCN-3 allows to use the sizeof function to compute the size
of a template. Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will it be
0, 1, or runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 31 May 2007 22:17 #7128

Hi Claude,

just one comment: ? is allowed for optional fields as you can take any
value for an optional field.

It is only that * is not allowed for mandatory fields.

Cheers, Ina.


>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Claude
> Desroches
> Sent: Wednesday, May 30, 2007 12:54 PM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hi Thomas,
>
>
>
>
>
> 1) Suggestion: Review all the built-in functions (and
> parameters) to verify correctness specifically when matching
> mechanisms are used.
>
>
>
>
>
> 2) Question regarding the use of '?' in matching mechanisms.
>
>
>
> Is using '?' valid if applied to a field which is optional? ( No)
>
>
>
> Have a look at example in B.1.2.3 Any value.
>
>
>
> // Given the message type definition
>
> type record MyMessageType
>
> {
>
> integer field1,
>
> charstring field2,
>
> boolean field3 optional,
>
> integer[4] field4
>
> }
>
>
>
> //
>
>
>
> EXAMPLE:
>
> template Mymessage MyTemplate:=
>
> {
>
> field1 := ?, // will match any integer
>
> field2 := ?, // will match any non-empty charstring value
>
> field3 := ?, // will match true or false
>
> field4 := ? // will match any sequence of integers
>
> }
>
>
>
> The above example is misleading as the template is invalid.
> The '?' is not permitted for fields which are
>
> Optional.
>
>
>
> Possible results:
>
> (a) compilation error.
> (preferred solution).
>
> (b) run-time error (error verdict) if the element is not
> present,
>
> (c) 'no-match' if the element is not present (with no
> run-time error). Not a desirable behaviour as it ignores
> the problem
>
>
>
> If I've understood correctly, (a) is the most CORRECT
> behaviour to expect, if the '?' is used in a template, for
> optional fields.
>
>
>
> According to the type definition field3 is optional.
> Although it is correct that '?' will match either true or
> false values, there is no
>
> Explanation of what happens if field3 is not present.
>
>
>
> Do you get a compilation error, runtime error, or a
> 'no-match'? Or is the user forced to accompany the field
> with an ifpresent()?
>
>
>
> Answer: even if the ifpresent() is there, it should still
> give at least a runtime error since ? requires the presence
> of a value.
>
> That is, adding the ifpresent is pointless... :-).
>
>
>
>
>
> 3) Can Any value be a record or must it be a 'basic'
> type such as boolean or integer?
>
>
>
>
>
> 4) B1.3.2 Any number of elements or no element
>
>
>
>
>
> Clarification:
>
>
>
> EXAMPLE:
>
> template Mymessage MyTemplate:=
>
> { :
>
> field2 := "abcxyz",
>
> field3 := '10*11'B, // where "*" may be any sequence of bits
> (possibly empty)
>
> field4 := {*, 2, 3} // where "*"may be any number of integer
> values or omitted
>
>
>
> The comment associated to field4 is misleading. The number
> of integer values permitted should not exceed the number of
>
> Elements specified by the type definition. That is, { 1, 4,
> 5, 6, 2, 3 } would cause a run-time error since a maximum of 4
>
> Integers are permitted based on the Mymessage type
> definition. The comment should be extended to make this
> point clear to
>
> Readers.
>
>
>
> I realize that it is not in the spirit of a standard to be a
> tutorial for a language, but such details are needed to
> ensure clarity from a usage and implementation point of view
> (however obvious it might seem to many).
>
>
>
> I think from a clarity point of view, new examples should be
> added specifically for those cases, where it is unclear what
> the expected result is.
>
>
>
>
>
>
>
> Cheers,
>
>
>
> Claude.
>
>
>
> PS: Any operation which leads to an undefined result (
> suchas sizeof ( { *} ) should force either a compilation
> error where possible and a runtime 'error' verdict at the least.
>
>
>
>
>
>
>
> ________________________________
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
> Sent: 29 May 2007 11:45
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hello Claude and Stefan,
>
>
>
> Thanks for your answers. I take them as indications that the
> sizeof function is not defined for all of its parameters and
> that applying it so some templates could lead to either
> runtime errors or errors at compile time. Actually, that's
> what I feared: Another partial builtin function and no
> possibility to check whether the argument is within the
> domain of the function.
>
>
>
> I'll have a closer look at the situation and prepare a CR if needed.
>
>
>
> Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.
>
>
>
>
>
>
>
> Best regards
>
>
>
> Thomas
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext
> Claude Desroches
> Sent: Saturday, 26. May 2007 10:50
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hi Thomas,
>
>
>
>
>
> Some suggestions:
>
>
>
> 1) At compilation time a WARNING or ERROR message
> should be displayed since the value "*" can be zero up to infinity.
>
> 2) At runtime, use the currently received message
> matched against the constraint to determine the value to be
> returned by
>
> Sizeof. If the received message contains 20 integer,
> then return value 20, if none, then 0, etc.
>
> 3) return a TTCN-3 error verdict with the
> offending line number in the TTCN-3 code where the error occurs.
>
>
>
> Look a C.29 and C30 of ES20187301.
>
>
>
> C.30 indicates that an error occurs in the case where a
> record of integer xxx is used with the sizeoftype since there
> is no length constraint.
>
>
>
> Since the type you use is unconstrained from a
> length/number of elements point of view, it would make sense to cause
>
> A runtime error for a template of this type. Of
> course, specifying any other value than "*", would likely work.
>
>
>
> Consider the following:
>
>
>
> template R a_r2 := { 1, 2, * , 3, *, 9 };
>
>
>
> What should sizeof return here? It is impossible to
> determine the value here since "*" means 0 to infinity.
>
> I would say applying a sizeof operation on any template
> containing a "*" must cause either a static compilation
> error, or at a minimum a runtime error (which is less desirable).
>
>
>
>
>
> Now to put some more "salt into the wound", what
> happens with this:
>
>
>
>
>
> template R a_r3 := { ? } // what is returned here?
> // 1 or something else.
>
>
>
>
>
> Cheers,
>
>
>
> Claude.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
> Sent: 26 May 2007 10:14
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hi Thomas!
>
>
>
> Since the size is undefined or "any"-size the nicest
> theoritical value to be displayed would be "*". From an
> implementation and usage standpoint that would be a bit hard
> to use I guess... ;-) so I would go for the runtime error.
> Can't find it in the std so I guess it is up for discussion.
>
>
>
> BR
>
>
>
> /Stefan
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
> Sent: den 25 maj 2007 16:49
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Size of templates
>
> Hello together,
>
> TTCN-3 allows to use the sizeof function to compute the
> size of a template. Assume the following definitions
>
> type record of integer R;
> template R a_r := {*};
>
> What will be the result of evalating sizeof(a_r), will
> it be 0, 1, or runtime error? Any ideas?
>
> Best regards
>
> Thomas
>
>
The administrator has disabled public write access.

Size of templates 01 Jun 2007 07:46 #7130

  • G
  • G's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
  • Karma: 0
Hi,

I think the best things would be to have all examples of the standard be published in machine-processable source-code form! That is, there shall be an informative electronic annex (say a ZIP archive), which contain valid TTCN-3 modules with complete source code for all valid examples from the entire standard (not just annex "whatever").This archive should be suitable for direct tool processing!

Shay there should be a source module for each major section. They might import definitions from other section-modules. It shall be the responsibility of the ETSI (editor?) to test by automated means that the source archive is still valid before publishing any new version of the standard .

IMHO: TTCN-3 is a standard aimed for testing, isn't it? It is ironic that we have published standards many time that have source code snippets that are untested and contain "software errors".... I think it is against our own credibility as a tester community...

For the the intentionally erroneous examples (say "anti-examples") we should consider what to do. I propose to supply the anti-examples within the same source code archive, but they should be commented out. If the user would like to check that they are indeed erronous, then she/he could un-comment them and try to check it with her/his favourite tool....

BR, Gabor









Gábor Ziegler M.Sc.E.E., dr.univ
Test System Engineer

Test Competence Center



Ericsson Hungary Ltd.

Research & Development
Budapest, XI. Irinyi. J. u. 4-20.
www.ericsson.com

Office: +36 1 437 7361
Fax: +36 1 439 5176
Mobile: +30 30 219 9805
Email: This email address is being protected from spambots. You need JavaScript enabled to view it.

Ericsson Magyarország Kft., Székhely: Budapest, Laborc u.1. Nyilvántartó cégbíróság: Fővárosi Bíróság. Cégjegyzékszám: 01-09-070937

This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interception, unauthorized amendment, tampering and viruses, and we only send and receive emails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.





________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of György Réthy (IJ/ETH)
Sent: 2007. május 31. 23:12
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates


Hi,

See in-line. Gyorgy


________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: Thursday, 2007 May 31. 01:47 PM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates


Hello Claude, Gyorgy, and Matthias,

let me just respond to this email, as Gyorgy responded already on Matthias' one.

Regarding the suggestions of Claude:
1) I have checked the the other predefined functions, as far as I
can see sizeof is the only problematic one.
[György Réthy (IJ/ETH)] I think sizeoftype is also concerned. To
cut it short I have submitted a CR.

2) In my opinion AnyValue can be used on optional fields of records,
matching all values. But not matching if there is no value in the field.
AnyValueOrNone and ifpresent are restricted to optional fields,
but there are no limitations for AnyValue.
[György Réthy (IJ/ETH)] Thomas is correct. AnyValue can be used
on optional fields, it is just signals that you require the field be present in the matched value/message but the actual value of the field is not important. If the field is missing in the message/value, it simply will not match the template (ifpresent is quite the opposite: the field may be omitted but if present it shall be the specified value - unless the specified value is a matching symbol but this would take us far).

4) You are right, in this case '*' corresponds to two integers. But
there are some further problems regarding the examples:
4a) At the beginning of Annex B, a type MyMessageType is defined. There are some templates for this type in Annex B using this type, but actually most of the templates are of type MyMessage, which is not defined in Annex B.
4b) Also note, that field3 is sometimes a boolean and sometimes a bitstring in templates of type MyMessage.
4c) The example in B.1.3.1 defines field4 := {1, ?, 3}; But if
this template should be of type MyMessage, this would violate the length restriction in the definiton of this field, which is a an array of 4 integers.
[György Réthy (IJ/ETH)] The examples needs to be corrected.
There are more errors (e.g. in B.1.2.2 no field name is given) and, anyway, I think the type is too far from the template examples. I think the right solution would be to correct B.1.1.1 and add its own type definition to each clause in Annex B.

Best regards

Thomas


________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Wednesday, 30. May 2007 12:54
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates





Hi Thomas,





1) Suggestion: Review all the built-in functions (and
parameters) to verify correctness specifically when matching mechanisms are used.





2) Question regarding the use of '?' in matching mechanisms.



Is using '?' valid if applied to a field which is optional?
( No)



Have a look at example in B.1.2.3 Any value.



// Given the message type definition

type record MyMessageType

{

integer field1,

charstring field2,

boolean field3 optional,

integer[4] field4

}



//



EXAMPLE:

template Mymessage MyTemplate:=

{

field1 := ?, // will match any integer

field2 := ?, // will match any non-empty charstring value

field3 := ?, // will match true or false

field4 := ? // will match any sequence of integers

}



The above example is misleading as the template is invalid.
The '?' is not permitted for fields which are

Optional.



Possible results:

(a) compilation error.
(preferred solution).

(b) run-time error (error verdict) if the element is not
present,

(c) 'no-match' if the element is not present (with no run-
time error). Not a desirable behaviour as it ignores the problem



If I've understood correctly, (a) is the most CORRECT
behaviour to expect, if the '?' is used in a template, for optional fields.



According to the type definition field3 is optional.
Although it is correct that '?' will match either true or false values, there is no

Explanation of what happens if field3 is not present.



Do you get a compilation error, runtime error, or a 'no-
match'? Or is the user forced to accompany the field with an ifpresent()?



Answer: even if the ifpresent() is there, it should still
give at least a runtime error since ? requires the presence of a value.

That is, adding the ifpresent is pointless... :-
).





3) Can Any value be a record or must it be a 'basic'
type such as boolean or integer?





4) B1.3.2 Any number of elements or no element





Clarification:



EXAMPLE:

template Mymessage MyTemplate:=

{ :

field2 := "abcxyz",

field3 := '10*11'B, // where "*" may be any sequence of bits
(possibly empty)

field4 := {*, 2, 3} // where "*"may be any number of integer
values or omitted



The comment associated to field4 is misleading. The number of
integer values permitted should not exceed the number of

Elements specified by the type definition. That is, { 1, 4,
5, 6, 2, 3 } would cause a run-time error since a maximum of 4

Integers are permitted based on the Mymessage type definition.
The comment should be extended to make this point clear to

Readers.



I realize that it is not in the spirit of a standard to be a
tutorial for a language, but such details are needed to ensure clarity from a usage and implementation point of view (however obvious it might seem to many).



I think from a clarity point of view, new examples should be
added specifically for those cases, where it is unclear what the expected result is.







Cheers,



Claude.



PS: Any operation which leads to an undefined result ( suchas
sizeof ( { *} ) should force either a compilation error where possible and a runtime 'error' verdict at the least.








________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: 29 May 2007 11:45
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hello Claude and Stefan,



Thanks for your answers. I take them as indications that the
sizeof function is not defined for all of its parameters and that applying it so some templates could lead to either runtime errors or errors at compile time. Actually, that's what I feared: Another partial builtin function and no possibility to check whether the argument is within the domain of the function.



I'll have a closer look at the situation and prepare a CR if
needed.



Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.







Best regards



Thomas






________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Saturday, 26. May 2007 10:50
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas,





Some suggestions:



1) At compilation time a WARNING or ERROR message
should be displayed since the value "*" can be zero up to infinity.

2) At runtime, use the currently received message
matched against the constraint to determine the value to be returned by

Sizeof. If the received message contains 20 integer,
then return value 20, if none, then 0, etc.

3) return a TTCN-3 error verdict with the
offending line number in the TTCN-3 code where the error occurs.



Look a C.29 and C30 of ES20187301.



C.30 indicates that an error occurs in the case where a
record of integer xxx is used with the sizeoftype since there is no length constraint.



Since the type you use is unconstrained from a
length/number of elements point of view, it would make sense to cause

A runtime error for a template of this type. Of course,
specifying any other value than "*", would likely work.



Consider the following:



template R a_r2 := { 1, 2, * , 3, *, 9 };



What should sizeof return here? It is impossible to
determine the value here since "*" means 0 to infinity.

I would say applying a sizeof operation on any template
containing a "*" must cause either a static compilation error, or at a minimum a runtime error (which is less desirable).





Now to put some more "salt into the wound", what happens
with this:





template R a_r3 := { ? } // what is returned here?
// 1 or something else.





Cheers,



Claude.














________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
Sent: 26 May 2007 10:14
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas!



Since the size is undefined or "any"-size the nicest
theoritical value to be displayed would be "*". From an implementation and usage standpoint that would be a bit hard to use I guess... ;-) so I would go for the runtime error. Can't find it in the std so I guess it is up for discussion.



BR



/Stefan




________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: den 25 maj 2007 16:49
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Size of templates

Hello together,

TTCN-3 allows to use the sizeof function to compute the
size of a template. Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will
it be 0, 1, or runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 01 Jun 2007 10:10 #7132

Hi Thomas,



Can you give me the specific paragraph in CL which confirms point 2) as I
think that if a field is optional, and he '?' is specified, then there MUST
be a valid value given. The real question is: does using '?' really mean
that 'no value present' is also valid. I would think not.



Cheers,



Claude.





Present, otherwise it

Blue Cactus Consulting phone: +49 (0)30 9606 7985

Edinburger Str. 39 fax: +49 (0)30 9606 7987

13349 Berlin mobile: +49 (0)174 701 6792

Germany email: This email address is being protected from spambots. You need JavaScript enabled to view it.



_____

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: 31 May 2007 13:47
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hello Claude, Gyorgy, and Matthias,



let me just respond to this email, as Gyorgy responded already on Matthias'
one.



Regarding the suggestions of Claude:

1) I have checked the the other predefined functions, as far as I can see
sizeof is the only problematic one.

2) In my opinion AnyValue can be used on optional fields of records,
matching all values. But not matching if there is no value in the field.

AnyValueOrNone and ifpresent are restricted to optional fields, but there
are no limitations for AnyValue.

4) You are right, in this case '*' corresponds to two integers. But there
are some further problems regarding the examples:

4a) At the beginning of Annex B, a type MyMessageType is defined. There are
some templates for this type in Annex B using this type, but actually most
of the templates are of type MyMessage, which is not defined in Annex B.

4b) Also note, that field3 is sometimes a boolean and sometimes a bitstring
in templates of type MyMessage.

4c) The example in B.1.3.1 defines field4 := {1, ?, 3}; But if this template
should be of type MyMessage, this would violate the length restriction in
the definiton of this field, which is a an array of 4 integers.



Best regards



Thomas




_____


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Wednesday, 30. May 2007 12:54
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas,





1) Suggestion: Review all the built-in functions (and parameters) to verify
correctness specifically when matching mechanisms are used.





2) Question regarding the use of '?' in matching mechanisms.



Is using '?' valid if applied to a field which is optional? ( No)



Have a look at example in B.1.2.3 Any value.



// Given the message type definition

type record MyMessageType

{

integer field1,

charstring field2,

boolean field3 optional,

integer[4] field4

}



//



EXAMPLE:

template Mymessage MyTemplate:=

{

field1 := ?, // will match any integer

field2 := ?, // will match any non-empty charstring value

field3 := ?, // will match true or false

field4 := ? // will match any sequence of integers

}



The above example is misleading as the template is invalid. The '?' is not
permitted for fields which are

Optional.



Possible results:

(a) compilation error.
(preferred solution).

(b) run-time error (error verdict) if the element is not present,


(c) 'no-match' if the element is not present (with no run-time error).
Not a desirable behaviour as it ignores the problem



If I've understood correctly, (a) is the most CORRECT behaviour to expect,
if the '?' is used in a template, for optional fields.



According to the type definition field3 is optional. Although it is
correct that '?' will match either true or false values, there is no

Explanation of what happens if field3 is not present.



Do you get a compilation error, runtime error, or a 'no-match'? Or is the
user forced to accompany the field with an ifpresent()?



Answer: even if the ifpresent() is there, it should still give at least a
runtime error since ? requires the presence of a value.

That is, adding the ifpresent is pointless. :-).





3) Can Any value be a record or must it be a 'basic' type such as
boolean or integer?





4) B1.3.2 Any number of elements or no element





Clarification:



EXAMPLE:

template Mymessage MyTemplate:=

{ :

field2 := "abcxyz",

field3 := '10*11'B, // where "*" may be any sequence of bits (possibly
empty)

field4 := {*, 2, 3} // where "*"may be any number of integer values or
omitted



The comment associated to field4 is misleading. The number of integer
values permitted should not exceed the number of

Elements specified by the type definition. That is, { 1, 4, 5, 6, 2, 3 }
would cause a run-time error since a maximum of 4

Integers are permitted based on the Mymessage type definition. The comment
should be extended to make this point clear to

Readers.



I realize that it is not in the spirit of a standard to be a tutorial for a
language, but such details are needed to ensure clarity from a usage and
implementation point of view (however obvious it might seem to many).



I think from a clarity point of view, new examples should be added
specifically for those cases, where it is unclear what the expected result
is.







Cheers,



Claude.



PS: Any operation which leads to an undefined result ( suchas sizeof ( { *}
) should force either a compilation error where possible and a runtime
'error' verdict at the least.








_____


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: 29 May 2007 11:45
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hello Claude and Stefan,



Thanks for your answers. I take them as indications that the sizeof function
is not defined for all of its parameters and that applying it so some
templates could lead to either runtime errors or errors at compile time.
Actually, that's what I feared: Another partial builtin function and no
possibility to check whether the argument is within the domain of the
function.



I'll have a closer look at the situation and prepare a CR if needed.



Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.







Best regards



Thomas






_____


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Saturday, 26. May 2007 10:50
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas,





Some suggestions:



1) At compilation time a WARNING or ERROR message should be displayed
since the value "*" can be zero up to infinity.

2) At runtime, use the currently received message matched against the
constraint to determine the value to be returned by

Sizeof. If the received message contains 20 integer, then return value 20,
if none, then 0, etc.

3) return a TTCN-3 error verdict with the offending line number in the
TTCN-3 code where the error occurs.



Look a C.29 and C30 of ES20187301.



C.30 indicates that an error occurs in the case where a record of integer
xxx is used with the sizeoftype since there is no length constraint.



Since the type you use is unconstrained from a length/number of elements
point of view, it would make sense to cause

A runtime error for a template of this type. Of course, specifying any
other value than "*", would likely work.



Consider the following:



template R a_r2 := { 1, 2, * , 3, *, 9 };



What should sizeof return here? It is impossible to determine the value
here since "*" means 0 to infinity.

I would say applying a sizeof operation on any template containing a "*"
must cause either a static compilation error, or at a minimum a runtime
error (which is less desirable).





Now to put some more "salt into the wound", what happens with this:





template R a_r3 := { ? } // what is returned here? // 1 or something
else.





Cheers,



Claude.














_____


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
Sent: 26 May 2007 10:14
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Thomas!



Since the size is undefined or "any"-size the nicest theoritical value to be
displayed would be "*". From an implementation and usage standpoint that
would be a bit hard to use I guess... ;-) so I would go for the runtime
error. Can't find it in the std so I guess it is up for discussion.



BR



/Stefan




_____


From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: den 25 maj 2007 16:49
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Size of templates

Hello together,

TTCN-3 allows to use the sizeof function to compute the size of a template.
Assume the following definitions

type record of integer R;
template R a_r := {*};

What will be the result of evalating sizeof(a_r), will it be 0, 1, or
runtime error? Any ideas?

Best regards

Thomas
The administrator has disabled public write access.

Size of templates 01 Jun 2007 11:18 #7133

Hi Ina,



Can you give me a reference where this is stated or implied.



There is an example provided in 15.1 Declaring message templates,



EXAMPLE 2: Template for receiving messages.

// Given the message definition

type record MyMessageType

{

integer field1 optional,

charstring field2,

boolean field3

}

// a message template might be

template MyMessageType MyTemplate:=

{

field1 := ?,

field2 := pattern "abc*xyz",

field3 := true

}

// and a corresponding receive operation could be

MyPCO.receive(MyTemplate);





The above example could be improved by adding (clarifying text) explicit
comments regarding the use of the ? for field1. Better yet, would be
explicit text related to the use of the ? in matching mechanisms.

E.g.



field1 will match as long as any integer value is present.



Value { 99, "abcxyz", true } will match against MyTemplate

Value { "abcxyz", true } will not match against MyTemplate. No
runtime error shall occur.









Thanks,



Claude.







Blue Cactus Consulting phone: +49 (0)30 9606 7985

Edinburger Str. 39 fax: +49 (0)30 9606 7987

13349 Berlin mobile: +49 (0)174 701 6792

Germany email: This email address is being protected from spambots. You need JavaScript enabled to view it.



Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Schieferdecker, Ina
Sent: 01 June 2007 00:18
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Claude,



just one comment: ? is allowed for optional fields as you can take any

value for an optional field.



It is only that * is not allowed for mandatory fields.



Cheers, Ina.





>
Original Message

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Claude

> Desroches

> Sent: Wednesday, May 30, 2007 12:54 PM

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Re: Size of templates

>

>

>

> Hi Thomas,

>

>

>

>

>

> 1) Suggestion: Review all the built-in functions (and

> parameters) to verify correctness specifically when matching

> mechanisms are used.

>

>

>

>

>

> 2) Question regarding the use of '?' in matching mechanisms.

>

>

>

> Is using '?' valid if applied to a field which is optional? ( No)

>

>

>

> Have a look at example in B.1.2.3 Any value.

>

>

>

> // Given the message type definition

>

> type record MyMessageType

>

> {

>

> integer field1,

>

> charstring field2,

>

> boolean field3 optional,

>

> integer[4] field4

>

> }

>

>

>

> //

>

>

>

> EXAMPLE:

>

> template Mymessage MyTemplate:=

>

> {

>

> field1 := ?, // will match any integer

>

> field2 := ?, // will match any non-empty charstring value

>

> field3 := ?, // will match true or false

>

> field4 := ? // will match any sequence of integers

>

> }

>

>

>

> The above example is misleading as the template is invalid.

> The '?' is not permitted for fields which are

>

> Optional.

>

>

>

> Possible results:

>

> (a) compilation error.

> (preferred solution).

>

> (b) run-time error (error verdict) if the element is not

> present,

>

> (c) 'no-match' if the element is not present (with no

> run-time error). Not a desirable behaviour as it ignores

> the problem

>

>

>

> If I've understood correctly, (a) is the most CORRECT

> behaviour to expect, if the '?' is used in a template, for

> optional fields.

>

>

>

> According to the type definition field3 is optional.

> Although it is correct that '?' will match either true or

> false values, there is no

>

> Explanation of what happens if field3 is not present.

>

>

>

> Do you get a compilation error, runtime error, or a

> 'no-match'? Or is the user forced to accompany the field

> with an ifpresent()?

>

>

>

> Answer: even if the ifpresent() is there, it should still

> give at least a runtime error since ? requires the presence

> of a value.

>

> That is, adding the ifpresent is pointless... :-).

>

>

>

>

>

> 3) Can Any value be a record or must it be a 'basic'

> type such as boolean or integer?

>

>

>

>

>

> 4) B1.3.2 Any number of elements or no element

>

>

>

>

>

> Clarification:

>

>

>

> EXAMPLE:

>

> template Mymessage MyTemplate:=

>

> { :

>

> field2 := "abcxyz",

>

> field3 := '10*11'B, // where "*" may be any sequence of bits

> (possibly empty)

>

> field4 := {*, 2, 3} // where "*"may be any number of integer

> values or omitted

>

>

>

> The comment associated to field4 is misleading. The number

> of integer values permitted should not exceed the number of

>

> Elements specified by the type definition. That is, { 1, 4,

> 5, 6, 2, 3 } would cause a run-time error since a maximum of 4

>

> Integers are permitted based on the Mymessage type

> definition. The comment should be extended to make this

> point clear to

>

> Readers.

>

>

>

> I realize that it is not in the spirit of a standard to be a

> tutorial for a language, but such details are needed to

> ensure clarity from a usage and implementation point of view

> (however obvious it might seem to many).

>

>

>

> I think from a clarity point of view, new examples should be

> added specifically for those cases, where it is unclear what

> the expected result is.

>

>

>

>

>

>

>

> Cheers,

>

>

>

> Claude.

>

>

>

> PS: Any operation which leads to an undefined result (

> suchas sizeof ( { *} ) should force either a compilation

> error where possible and a runtime 'error' verdict at the least.

>

>

>

>

>

>

>

> ________________________________

>

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss

> Sent: 29 May 2007 11:45

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Re: Size of templates

>

>

>

> Hello Claude and Stefan,

>

>

>

> Thanks for your answers. I take them as indications that the

> sizeof function is not defined for all of its parameters and

> that applying it so some templates could lead to either

> runtime errors or errors at compile time. Actually, that's

> what I feared: Another partial builtin function and no

> possibility to check whether the argument is within the

> domain of the function.

>

>

>

> I'll have a closer look at the situation and prepare a CR if needed.

>

>

>

> Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.

>

>

>

>

>

>

>

> Best regards

>

>

>

> Thomas

>

>

>

>

>

>

> ________________________________

>

>

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext

> Claude Desroches

> Sent: Saturday, 26. May 2007 10:50

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Re: Size of templates

>

>

>

> Hi Thomas,

>

>

>

>

>

> Some suggestions:

>

>

>

> 1) At compilation time a WARNING or ERROR message

> should be displayed since the value "*" can be zero up to infinity.

>

> 2) At runtime, use the currently received message

> matched against the constraint to determine the value to be

> returned by

>

> Sizeof. If the received message contains 20 integer,

> then return value 20, if none, then 0, etc.

>

> 3) return a TTCN-3 error verdict with the

> offending line number in the TTCN-3 code where the error occurs.

>

>

>

> Look a C.29 and C30 of ES20187301.

>

>

>

> C.30 indicates that an error occurs in the case where a

> record of integer xxx is used with the sizeoftype since there

> is no length constraint.

>

>

>

> Since the type you use is unconstrained from a

> length/number of elements point of view, it would make sense to cause

>

> A runtime error for a template of this type. Of

> course, specifying any other value than "*", would likely work.

>

>

>

> Consider the following:

>

>

>

> template R a_r2 := { 1, 2, * , 3, *, 9 };

>

>

>

> What should sizeof return here? It is impossible to

> determine the value here since "*" means 0 to infinity.

>

> I would say applying a sizeof operation on any template

> containing a "*" must cause either a static compilation

> error, or at a minimum a runtime error (which is less desirable).

>

>

>

>

>

> Now to put some more "salt into the wound", what

> happens with this:

>

>

>

>

>

> template R a_r3 := { ? } // what is returned here?

> // 1 or something else.

>

>

>

>

>

> Cheers,

>

>

>

> Claude.

>

>

>

>

>

>

>

>

>

>

>

>

>

>

> ________________________________

>

>

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan

> Sent: 26 May 2007 10:14

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Re: Size of templates

>

>

>

> Hi Thomas!

>

>

>

> Since the size is undefined or "any"-size the nicest

> theoritical value to be displayed would be "*". From an

> implementation and usage standpoint that would be a bit hard

> to use I guess... ;-) so I would go for the runtime error.

> Can't find it in the std so I guess it is up for discussion.

>

>

>

> BR

>

>

>

> /Stefan

>

>

>

>

> ________________________________

>

>

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss

> Sent: den 25 maj 2007 16:49

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Size of templates

>

> Hello together,

>

> TTCN-3 allows to use the sizeof function to compute the

> size of a template. Assume the following definitions

>

> type record of integer R;

> template R a_r := {*};

>

> What will be the result of evalating sizeof(a_r), will

> it be 0, 1, or runtime error? Any ideas?

>

> Best regards

>

> Thomas

>

>
The administrator has disabled public write access.

Size of templates 01 Jun 2007 12:42 #7135

Hello Claude,

Let me provide some examples. Taking up Gabors suggestion I have run
this through a tool.

So, the code should be syntactically correct and the test case executes
with verdict pass.

Best regards

Thomas

module optionalFields {

type component Empty {};

function assert_true( in boolean condition) {
if (condition) {
setverdict(pass)
} else {
setverdict(fail)
}
}

function assert_false (in boolean condition) {
assert_true( not condition );
}

type record R { integer i optional };

const R c_r_value := { 1 };
const R c_r_omit := { omit };

template R a_r_anyValue := { ? };
template R a_r_anyIfPresent := { ? ifpresent };
template R a_r_ifPresent := { 1 ifpresent };

testcase tc () runs on Empty {
assert_true( match( c_r_value , a_r_anyValue ));
assert_false( match( c_r_omit, a_r_anyValue ));

assert_true( match( c_r_value, a_r_anyIfPresent )); // there is a
value, but it can be any value
assert_true( match( c_r_omit, a_r_anyIfPresent )); // don't care if
the field is absent

assert_true( match( c_r_value, a_r_ifPresent)); // the expected value
assert_true( match( c_r_omit, a_r_ifPresent)); // don't care if the
field is absent

}

control {
execute(tc());
}
}




________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members
only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
Sent: Friday, 01. June 2007 12:11
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates





Hi Thomas,



Can you give me the specific paragraph in CL which confirms
point 2) as I think that if a field is optional, and he '?' is
specified, then there MUST be a valid value given. The real question
is: does using '?' really mean that 'no value present' is also valid.
I would think not.



Cheers,



Claude.





Present, otherwise it

Blue Cactus Consulting phone: +49 (0)30 9606 7985

Edinburger Str. 39 fax: +49 (0)30 9606 7987

13349 Berlin mobile: +49 (0)174 701 6792

Germany email: This email address is being protected from spambots. You need JavaScript enabled to view it.




________________________________


From: active_ttcn3 : mts stf133 ttcn version 3 - active members
only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
Sent: 31 May 2007 13:47
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hello Claude, Gyorgy, and Matthias,



let me just respond to this email, as Gyorgy responded already
on Matthias' one.



Regarding the suggestions of Claude:

1) I have checked the the other predefined functions, as far as
I can see sizeof is the only problematic one.

2) In my opinion AnyValue can be used on optional fields of
records, matching all values. But not matching if there is no value in
the field.

AnyValueOrNone and ifpresent are restricted to optional
fields, but there are no limitations for AnyValue.

4) You are right, in this case '*' corresponds to two integers.
But there are some further problems regarding the examples:

4a) At the beginning of Annex B, a type MyMessageType is
defined. There are some templates for this type in Annex B using this
type, but actually most of the templates are of type MyMessage, which is
not defined in Annex B.

4b) Also note, that field3 is sometimes a boolean and sometimes
a bitstring in templates of type MyMessage.

4c) The example in B.1.3.1 defines field4 := {1, ?, 3}; But if
this template should be of type MyMessage, this would violate the length
restriction in the definiton of this field, which is a an array of 4
integers.



Best regards



Thomas

<--- snip, TD --->
The administrator has disabled public write access.

Size of templates 01 Jun 2007 13:13 #7136

Dear Gabor,

good idea! With the only downside, that new TTCN-3 editions contain typically new concepts for which no tools exist ... but for all other cases we can do this ... and may make this also the common ground to which the TTCN-3 tools should comply to. I will discuss with Anthony how to set this up.

With best regards,

Ina.

>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Gábor
> Ziegler (IJ/ETH)
> Sent: Friday, June 01, 2007 9:47 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
> Hi,
>
> I think the best things would be to have all examples of the
> standard be published in machine-processable source-code
> form! That is, there shall be an informative electronic annex
> (say a ZIP archive), which contain valid TTCN-3 modules with
> complete source code for all valid examples from the entire
> standard (not just annex "whatever").This archive should be
> suitable for direct tool processing!
>
> Shay there should be a source module for each major section.
> They might import definitions from other section-modules. It
> shall be the responsibility of the ETSI (editor?) to test by
> automated means that the source archive is still valid before
> publishing any new version of the standard .
>
> IMHO: TTCN-3 is a standard aimed for testing, isn't it? It is
> ironic that we have published standards many time that have
> source code snippets that are untested and contain "software
> errors".... I think it is against our own credibility as a
> tester community...
>
> For the the intentionally erroneous examples (say
> "anti-examples") we should consider what to do. I propose to
> supply the anti-examples within the same source code archive,
> but they should be commented out. If the user would like to
> check that they are indeed erronous, then she/he could
> un-comment them and try to check it with her/his favourite tool....
>
> BR, Gabor
>
>
>
>
>
>
>
>
>
> Gábor Ziegler M.Sc.E.E., dr.univ
> Test System Engineer
>
> Test Competence Center
>
>
>
> Ericsson Hungary Ltd.
>
> Research & Development
> Budapest, XI. Irinyi. J. u. 4-20.
> www.ericsson.com
>
> Office: +36 1 437 7361
> Fax: +36 1 439 5176
> Mobile: +30 30 219 9805
> Email: This email address is being protected from spambots. You need JavaScript enabled to view it.
>
> Ericsson Magyarország Kft., Székhely: Budapest, Laborc u.1.
> Nyilvántartó cégbíróság: Fővárosi Bíróság. Cégjegyzékszám:
> 01-09-070937
>
> This communication is confidential and intended solely for
> the addressee(s). Any unauthorized review, use, disclosure or
> distribution is prohibited. If you believe this message has
> been sent to you in error, please notify the sender by
> replying to this transmission and delete the message without
> disclosing it. Thank you.
>
> E-mail including attachments is susceptible to data
> corruption, interception, unauthorized amendment, tampering
> and viruses, and we only send and receive emails on the basis
> that we are not liable for any such corruption, interception,
> amendment, tampering or viruses or any consequences thereof.
>
>
>
>
>
> ________________________________
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of György
> Réthy (IJ/ETH)
> Sent: 2007. május 31. 23:12
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
> Hi,
>
> See in-line. Gyorgy
>
>
> ________________________________
>
> From: active_ttcn3 : mts stf133 ttcn version 3
> - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf
> Of Thomas Deiss
> Sent: Thursday, 2007 May 31. 01:47 PM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
> Hello Claude, Gyorgy, and Matthias,
>
> let me just respond to this email, as Gyorgy
> responded already on Matthias' one.
>
> Regarding the suggestions of Claude:
> 1) I have checked the the other predefined
> functions, as far as I can see sizeof is the only problematic one.
> [György Réthy (IJ/ETH)] I think sizeoftype is
> also concerned. To cut it short I have submitted a CR.
>
> 2) In my opinion AnyValue can be used on
> optional fields of records, matching all values. But not
> matching if there is no value in the field.
> AnyValueOrNone and ifpresent are restricted
> to optional fields, but there are no limitations for AnyValue.
> [György Réthy (IJ/ETH)] Thomas is correct.
> AnyValue can be used on optional fields, it is just signals
> that you require the field be present in the matched
> value/message but the actual value of the field is not
> important. If the field is missing in the message/value, it
> simply will not match the template (ifpresent is quite the
> opposite: the field may be omitted but if present it shall be
> the specified value - unless the specified value is a
> matching symbol but this would take us far).
>
> 4) You are right, in this case '*' corresponds
> to two integers. But there are some further problems
> regarding the examples:
> 4a) At the beginning of Annex B, a type
> MyMessageType is defined. There are some templates for this
> type in Annex B using this type, but actually most of the
> templates are of type MyMessage, which is not defined in Annex B.
> 4b) Also note, that field3 is sometimes a
> boolean and sometimes a bitstring in templates of type MyMessage.
> 4c) The example in B.1.3.1 defines field4 :=
> {1, ?, 3}; But if this template should be of type MyMessage,
> this would violate the length restriction in the definiton of
> this field, which is a an array of 4 integers.
> [György Réthy (IJ/ETH)] The examples needs to
> be corrected. There are more errors (e.g. in B.1.2.2 no field
> name is given) and, anyway, I think the type is too far from
> the template examples. I think the right solution would be to
> correct B.1.1.1 and add its own type definition to each
> clause in Annex B.
>
> Best regards
>
> Thomas
>
>
> ________________________________
>
> From: active_ttcn3 : mts stf133 ttcn
> version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> On Behalf Of ext Claude Desroches
> Sent: Wednesday, 30. May 2007 12:54
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
>
>
> Hi Thomas,
>
>
>
>
>
> 1) Suggestion: Review all the built-in
> functions (and parameters) to verify correctness specifically
> when matching mechanisms are used.
>
>
>
>
>
> 2) Question regarding the use of '?' in
> matching mechanisms.
>
>
>
> Is using '?' valid if applied to a
> field which is optional? ( No)
>
>
>
> Have a look at example in B.1.2.3 Any value.
>
>
>
> // Given the message type definition
>
> type record MyMessageType
>
> {
>
> integer field1,
>
> charstring field2,
>
> boolean field3 optional,
>
> integer[4] field4
>
> }
>
>
>
> //
>
>
>
> EXAMPLE:
>
> template Mymessage MyTemplate:=
>
> {
>
> field1 := ?, // will match any integer
>
> field2 := ?, // will match any
> non-empty charstring value
>
> field3 := ?, // will match true or false
>
> field4 := ? // will match any sequence
> of integers
>
> }
>
>
>
> The above example is misleading as the
> template is invalid. The '?' is not permitted for fields which are
>
> Optional.
>
>
>
> Possible results:
>
> (a) compilation error.
>
> (preferred solution).
>
> (b) run-time error (error verdict) if
> the element is not present,
>
> (c) 'no-match' if the element is not
> present (with no run-time error). Not a desirable
> behaviour as it ignores the problem
>
>
>
> If I've understood correctly, (a) is
> the most CORRECT behaviour to expect, if the '?' is used in
> a template, for optional fields.
>
>
>
> According to the type definition
> field3 is optional. Although it is correct that '?' will
> match either true or false values, there is no
>
> Explanation of what happens if field3
> is not present.
>
>
>
> Do you get a compilation error, runtime
> error, or a 'no-match'? Or is the user forced to accompany
> the field with an ifpresent()?
>
>
>
> Answer: even if the ifpresent() is
> there, it should still give at least a runtime error since ?
> requires the presence of a value.
>
> That is, adding the
> ifpresent is pointless... :-).
>
>
>
>
>
> 3) Can Any value be a record or
> must it be a 'basic' type such as boolean or integer?
>
>
>
>
>
> 4) B1.3.2 Any number of elements
> or no element
>
>
>
>
>
> Clarification:
>
>
>
> EXAMPLE:
>
> template Mymessage MyTemplate:=
>
> { :
>
> field2 := "abcxyz",
>
> field3 := '10*11'B, // where "*" may be
> any sequence of bits (possibly empty)
>
> field4 := {*, 2, 3} // where "*"may be
> any number of integer values or omitted
>
>
>
> The comment associated to field4 is
> misleading. The number of integer values permitted should
> not exceed the number of
>
> Elements specified by the type
> definition. That is, { 1, 4, 5, 6, 2, 3 } would cause a
> run-time error since a maximum of 4
>
> Integers are permitted based on the
> Mymessage type definition. The comment should be extended to
> make this point clear to
>
> Readers.
>
>
>
> I realize that it is not in the spirit
> of a standard to be a tutorial for a language, but such
> details are needed to ensure clarity from a usage and
> implementation point of view (however obvious it might seem to many).
>
>
>
> I think from a clarity point of view,
> new examples should be added specifically for those cases,
> where it is unclear what the expected result is.
>
>
>
>
>
>
>
> Cheers,
>
>
>
> Claude.
>
>
>
> PS: Any operation which leads to an
> undefined result ( suchas sizeof ( { *} ) should force
> either a compilation error where possible and a runtime
> 'error' verdict at the least.
>
>
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133 ttcn
> version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> On Behalf Of Thomas Deiss
> Sent: 29 May 2007 11:45
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hello Claude and Stefan,
>
>
>
> Thanks for your answers. I take them as
> indications that the sizeof function is not defined for all
> of its parameters and that applying it so some templates
> could lead to either runtime errors or errors at compile
> time. Actually, that's what I feared: Another partial builtin
> function and no possibility to check whether the argument is
> within the domain of the function.
>
>
>
> I'll have a closer look at the
> situation and prepare a CR if needed.
>
>
>
> Btw:: I suggest that sizeof( R:{?} )
> evaluates to 1.
>
>
>
>
>
>
>
> Best regards
>
>
>
> Thomas
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133
> ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
> Sent: Saturday, 26. May 2007 10:50
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hi Thomas,
>
>
>
>
>
> Some suggestions:
>
>
>
> 1) At compilation time a
> WARNING or ERROR message should be displayed since the value
> "*" can be zero up to infinity.
>
> 2) At runtime, use the
> currently received message matched against the constraint to
> determine the value to be returned by
>
> Sizeof. If the received
> message contains 20 integer, then return value 20, if none,
> then 0, etc.
>
> 3) return a TTCN-3 error
> verdict with the offending line number in the TTCN-3 code
> where the error occurs.
>
>
>
> Look a C.29 and C30 of ES20187301.
>
>
>
> C.30 indicates that an error
> occurs in the case where a record of integer xxx is used with
> the sizeoftype since there is no length constraint.
>
>
>
> Since the type you use is
> unconstrained from a length/number of elements point of view,
> it would make sense to cause
>
> A runtime error for a template
> of this type. Of course, specifying any other value than
> "*", would likely work.
>
>
>
> Consider the following:
>
>
>
> template R a_r2 := { 1, 2,
> * , 3, *, 9 };
>
>
>
> What should sizeof return here?
> It is impossible to determine the value here since "*"
> means 0 to infinity.
>
> I would say applying a sizeof
> operation on any template containing a "*" must cause either
> a static compilation error, or at a minimum a runtime error
> (which is less desirable).
>
>
>
>
>
> Now to put some more "salt into
> the wound", what happens with this:
>
>
>
>
>
> template R a_r3 := { ? } //
> what is returned here? // 1 or something else.
>
>
>
>
>
> Cheers,
>
>
>
> Claude.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133
> ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
> Sent: 26 May 2007 10:14
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hi Thomas!
>
>
>
> Since the size is undefined or
> "any"-size the nicest theoritical value to be displayed would
> be "*". From an implementation and usage standpoint that
> would be a bit hard to use I guess... ;-) so I would go for
> the runtime error. Can't find it in the std so I guess it is
> up for discussion.
>
>
>
> BR
>
>
>
> /Stefan
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133
> ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
> Sent: den 25 maj 2007 16:49
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Size of templates
>
> Hello together,
>
> TTCN-3 allows to use the sizeof
> function to compute the size of a template. Assume the
> following definitions
>
> type record of integer R;
> template R a_r := {*};
>
> What will be the result of
> evalating sizeof(a_r), will it be 0, 1, or runtime error? Any ideas?
>
> Best regards
>
> Thomas
>
>
The administrator has disabled public write access.

Size of templates 01 Jun 2007 13:49 #7137

Hi,

For the sake of verification, we should, as a community, consider the
definition of a TTCN-3 test suite which defines the expected results for all
operations defined in the standard. This would have the advantage of
clearly explaining how an operation, function, operator works, as well as
providing a basis for comparing and evaluating the status of the various
commercial tools. All tools should produce the same results, as specified
in the standard!

Cheers,

Claude.


Blue Cactus Consulting phone: +49 (0)30 9606 7985
Edinburger Str. 39 fax: +49 (0)30 9606 7987
13349 Berlin mobile: +49 (0)174 701 6792
Germany email: This email address is being protected from spambots. You need JavaScript enabled to view it.


Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Schieferdecker, Ina
Sent: 01 June 2007 15:13
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates

Dear Gabor,

good idea! With the only downside, that new TTCN-3 editions contain
typically new concepts for which no tools exist ... but for all other cases
we can do this ... and may make this also the common ground to which the
TTCN-3 tools should comply to. I will discuss with Anthony how to set this
up.

With best regards,

Ina.

>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Gábor
> Ziegler (IJ/ETH)
> Sent: Friday, June 01, 2007 9:47 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
> Hi,
>
> I think the best things would be to have all examples of the
> standard be published in machine-processable source-code
> form! That is, there shall be an informative electronic annex
> (say a ZIP archive), which contain valid TTCN-3 modules with
> complete source code for all valid examples from the entire
> standard (not just annex "whatever").This archive should be
> suitable for direct tool processing!
>
> Shay there should be a source module for each major section.
> They might import definitions from other section-modules. It
> shall be the responsibility of the ETSI (editor?) to test by
> automated means that the source archive is still valid before
> publishing any new version of the standard .
>
> IMHO: TTCN-3 is a standard aimed for testing, isn't it? It is
> ironic that we have published standards many time that have
> source code snippets that are untested and contain "software
> errors".... I think it is against our own credibility as a
> tester community...
>
> For the the intentionally erroneous examples (say
> "anti-examples") we should consider what to do. I propose to
> supply the anti-examples within the same source code archive,
> but they should be commented out. If the user would like to
> check that they are indeed erronous, then she/he could
> un-comment them and try to check it with her/his favourite tool....
>
> BR, Gabor
>
>
>
>
>
>
>
>
>
> Gábor Ziegler M.Sc.E.E., dr.univ
> Test System Engineer
>
> Test Competence Center
>
>
>
> Ericsson Hungary Ltd.
>
> Research & Development
> Budapest, XI. Irinyi. J. u. 4-20.
> www.ericsson.com
>
> Office: +36 1 437 7361
> Fax: +36 1 439 5176
> Mobile: +30 30 219 9805
> Email: This email address is being protected from spambots. You need JavaScript enabled to view it.
>
> Ericsson Magyarország Kft., Székhely: Budapest, Laborc u.1.
> Nyilvántartó cégbíróság: Fővárosi Bíróság. Cégjegyzékszám:
> 01-09-070937
>
> This communication is confidential and intended solely for
> the addressee(s). Any unauthorized review, use, disclosure or
> distribution is prohibited. If you believe this message has
> been sent to you in error, please notify the sender by
> replying to this transmission and delete the message without
> disclosing it. Thank you.
>
> E-mail including attachments is susceptible to data
> corruption, interception, unauthorized amendment, tampering
> and viruses, and we only send and receive emails on the basis
> that we are not liable for any such corruption, interception,
> amendment, tampering or viruses or any consequences thereof.
>
>
>
>
>
> ________________________________
>
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of György
> Réthy (IJ/ETH)
> Sent: 2007. május 31. 23:12
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
> Hi,
>
> See in-line. Gyorgy
>
>
> ________________________________
>
> From: active_ttcn3 : mts stf133 ttcn version 3
> - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf
> Of Thomas Deiss
> Sent: Thursday, 2007 May 31. 01:47 PM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
> Hello Claude, Gyorgy, and Matthias,
>
> let me just respond to this email, as Gyorgy
> responded already on Matthias' one.
>
> Regarding the suggestions of Claude:
> 1) I have checked the the other predefined
> functions, as far as I can see sizeof is the only problematic one.
> [György Réthy (IJ/ETH)] I think sizeoftype is
> also concerned. To cut it short I have submitted a CR.
>
> 2) In my opinion AnyValue can be used on
> optional fields of records, matching all values. But not
> matching if there is no value in the field.
> AnyValueOrNone and ifpresent are restricted
> to optional fields, but there are no limitations for AnyValue.
> [György Réthy (IJ/ETH)] Thomas is correct.
> AnyValue can be used on optional fields, it is just signals
> that you require the field be present in the matched
> value/message but the actual value of the field is not
> important. If the field is missing in the message/value, it
> simply will not match the template (ifpresent is quite the
> opposite: the field may be omitted but if present it shall be
> the specified value - unless the specified value is a
> matching symbol but this would take us far).
>
> 4) You are right, in this case '*' corresponds
> to two integers. But there are some further problems
> regarding the examples:
> 4a) At the beginning of Annex B, a type
> MyMessageType is defined. There are some templates for this
> type in Annex B using this type, but actually most of the
> templates are of type MyMessage, which is not defined in Annex B.
> 4b) Also note, that field3 is sometimes a
> boolean and sometimes a bitstring in templates of type MyMessage.
> 4c) The example in B.1.3.1 defines field4 :=
> {1, ?, 3}; But if this template should be of type MyMessage,
> this would violate the length restriction in the definiton of
> this field, which is a an array of 4 integers.
> [György Réthy (IJ/ETH)] The examples needs to
> be corrected. There are more errors (e.g. in B.1.2.2 no field
> name is given) and, anyway, I think the type is too far from
> the template examples. I think the right solution would be to
> correct B.1.1.1 and add its own type definition to each
> clause in Annex B.
>
> Best regards
>
> Thomas
>
>
> ________________________________
>
> From: active_ttcn3 : mts stf133 ttcn
> version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> On Behalf Of ext Claude Desroches
> Sent: Wednesday, 30. May 2007 12:54
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
>
>
> Hi Thomas,
>
>
>
>
>
> 1) Suggestion: Review all the built-in
> functions (and parameters) to verify correctness specifically
> when matching mechanisms are used.
>
>
>
>
>
> 2) Question regarding the use of '?' in
> matching mechanisms.
>
>
>
> Is using '?' valid if applied to a
> field which is optional? ( No)
>
>
>
> Have a look at example in B.1.2.3 Any value.
>
>
>
> // Given the message type definition
>
> type record MyMessageType
>
> {
>
> integer field1,
>
> charstring field2,
>
> boolean field3 optional,
>
> integer[4] field4
>
> }
>
>
>
> //
>
>
>
> EXAMPLE:
>
> template Mymessage MyTemplate:=
>
> {
>
> field1 := ?, // will match any integer
>
> field2 := ?, // will match any
> non-empty charstring value
>
> field3 := ?, // will match true or false
>
> field4 := ? // will match any sequence
> of integers
>
> }
>
>
>
> The above example is misleading as the
> template is invalid. The '?' is not permitted for fields which are
>
> Optional.
>
>
>
> Possible results:
>
> (a) compilation error.
>
> (preferred solution).
>
> (b) run-time error (error verdict) if
> the element is not present,
>
> (c) 'no-match' if the element is not
> present (with no run-time error). Not a desirable
> behaviour as it ignores the problem
>
>
>
> If I've understood correctly, (a) is
> the most CORRECT behaviour to expect, if the '?' is used in
> a template, for optional fields.
>
>
>
> According to the type definition
> field3 is optional. Although it is correct that '?' will
> match either true or false values, there is no
>
> Explanation of what happens if field3
> is not present.
>
>
>
> Do you get a compilation error, runtime
> error, or a 'no-match'? Or is the user forced to accompany
> the field with an ifpresent()?
>
>
>
> Answer: even if the ifpresent() is
> there, it should still give at least a runtime error since ?
> requires the presence of a value.
>
> That is, adding the
> ifpresent is pointless... :-).
>
>
>
>
>
> 3) Can Any value be a record or
> must it be a 'basic' type such as boolean or integer?
>
>
>
>
>
> 4) B1.3.2 Any number of elements
> or no element
>
>
>
>
>
> Clarification:
>
>
>
> EXAMPLE:
>
> template Mymessage MyTemplate:=
>
> { :
>
> field2 := "abcxyz",
>
> field3 := '10*11'B, // where "*" may be
> any sequence of bits (possibly empty)
>
> field4 := {*, 2, 3} // where "*"may be
> any number of integer values or omitted
>
>
>
> The comment associated to field4 is
> misleading. The number of integer values permitted should
> not exceed the number of
>
> Elements specified by the type
> definition. That is, { 1, 4, 5, 6, 2, 3 } would cause a
> run-time error since a maximum of 4
>
> Integers are permitted based on the
> Mymessage type definition. The comment should be extended to
> make this point clear to
>
> Readers.
>
>
>
> I realize that it is not in the spirit
> of a standard to be a tutorial for a language, but such
> details are needed to ensure clarity from a usage and
> implementation point of view (however obvious it might seem to many).
>
>
>
> I think from a clarity point of view,
> new examples should be added specifically for those cases,
> where it is unclear what the expected result is.
>
>
>
>
>
>
>
> Cheers,
>
>
>
> Claude.
>
>
>
> PS: Any operation which leads to an
> undefined result ( suchas sizeof ( { *} ) should force
> either a compilation error where possible and a runtime
> 'error' verdict at the least.
>
>
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133 ttcn
> version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.]
> On Behalf Of Thomas Deiss
> Sent: 29 May 2007 11:45
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hello Claude and Stefan,
>
>
>
> Thanks for your answers. I take them as
> indications that the sizeof function is not defined for all
> of its parameters and that applying it so some templates
> could lead to either runtime errors or errors at compile
> time. Actually, that's what I feared: Another partial builtin
> function and no possibility to check whether the argument is
> within the domain of the function.
>
>
>
> I'll have a closer look at the
> situation and prepare a CR if needed.
>
>
>
> Btw:: I suggest that sizeof( R:{?} )
> evaluates to 1.
>
>
>
>
>
>
>
> Best regards
>
>
>
> Thomas
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133
> ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext Claude Desroches
> Sent: Saturday, 26. May 2007 10:50
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hi Thomas,
>
>
>
>
>
> Some suggestions:
>
>
>
> 1) At compilation time a
> WARNING or ERROR message should be displayed since the value
> "*" can be zero up to infinity.
>
> 2) At runtime, use the
> currently received message matched against the constraint to
> determine the value to be returned by
>
> Sizeof. If the received
> message contains 20 integer, then return value 20, if none,
> then 0, etc.
>
> 3) return a TTCN-3 error
> verdict with the offending line number in the TTCN-3 code
> where the error occurs.
>
>
>
> Look a C.29 and C30 of ES20187301.
>
>
>
> C.30 indicates that an error
> occurs in the case where a record of integer xxx is used with
> the sizeoftype since there is no length constraint.
>
>
>
> Since the type you use is
> unconstrained from a length/number of elements point of view,
> it would make sense to cause
>
> A runtime error for a template
> of this type. Of course, specifying any other value than
> "*", would likely work.
>
>
>
> Consider the following:
>
>
>
> template R a_r2 := { 1, 2,
> * , 3, *, 9 };
>
>
>
> What should sizeof return here?
> It is impossible to determine the value here since "*"
> means 0 to infinity.
>
> I would say applying a sizeof
> operation on any template containing a "*" must cause either
> a static compilation error, or at a minimum a runtime error
> (which is less desirable).
>
>
>
>
>
> Now to put some more "salt into
> the wound", what happens with this:
>
>
>
>
>
> template R a_r3 := { ? } //
> what is returned here? // 1 or something else.
>
>
>
>
>
> Cheers,
>
>
>
> Claude.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133
> ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan
> Sent: 26 May 2007 10:14
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Size of templates
>
>
>
> Hi Thomas!
>
>
>
> Since the size is undefined or
> "any"-size the nicest theoritical value to be displayed would
> be "*". From an implementation and usage standpoint that
> would be a bit hard to use I guess... ;-) so I would go for
> the runtime error. Can't find it in the std so I guess it is
> up for discussion.
>
>
>
> BR
>
>
>
> /Stefan
>
>
>
>
> ________________________________
>
>
> From: active_ttcn3 : mts stf133
> ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss
> Sent: den 25 maj 2007 16:49
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Size of templates
>
> Hello together,
>
> TTCN-3 allows to use the sizeof
> function to compute the size of a template. Assume the
> following definitions
>
> type record of integer R;
> template R a_r := {*};
>
> What will be the result of
> evalating sizeof(a_r), will it be 0, 1, or runtime error? Any ideas?
>
> Best regards
>
> Thomas
>
>
The administrator has disabled public write access.

Size of templates 01 Jun 2007 14:24 #7138

Hi Claude,

I want to put it in the opposite way. Why do you think AnyValue is not allowed for optional fields? If I look at Table 9, it is stated (see Note 1) that AnyValueOrNone is allowed for optional fields only. But there is no such restriction for AnyValue. If I look at clause B1.2.4, again, there is an explicit limitation that * can be used for optional fields only; but there is no similar limitation for ? in clause B1.2.3.


BR, Gyorgy


________________________________

From: active_ttcn3 : mts stf133 ttcn version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Claude Desroches
Sent: Friday, 2007 June 01. 01:18 PM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates





Hi Ina,



Can you give me a reference where this is stated or implied.



There is an example provided in 15.1 Declaring message templates,



EXAMPLE 2: Template for receiving messages.

// Given the message definition

type record MyMessageType

{

integer field1 optional,

charstring field2,

boolean field3

}

// a message template might be

template MyMessageType MyTemplate:=

{

field1 := ?,

field2 := pattern "abc*xyz",

field3 := true

}

// and a corresponding receive operation could be

MyPCO.receive(MyTemplate);





The above example could be improved by adding (clarifying text) explicit comments regarding the use of the ? for field1. Better yet, would be explicit text related to the use of the ? in matching mechanisms.

E.g.



field1 will match as long as any integer value is present.



Value { 99, "abcxyz", true } will match against MyTemplate

Value { "abcxyz", true } will not match against MyTemplate. No runtime error shall occur.









Thanks,



Claude.







Blue Cactus Consulting phone: +49 (0)30 9606 7985

Edinburger Str. 39 fax: +49 (0)30 9606 7987

13349 Berlin mobile: +49 (0)174 701 6792

Germany email: This email address is being protected from spambots. You need JavaScript enabled to view it.



Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Schieferdecker, Ina
Sent: 01 June 2007 00:18
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Size of templates



Hi Claude,



just one comment: ? is allowed for optional fields as you can take any

value for an optional field.



It is only that * is not allowed for mandatory fields.



Cheers, Ina.





>
Original Message

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Claude

> Desroches

> Sent: Wednesday, May 30, 2007 12:54 PM

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Re: Size of templates

>

>

>

> Hi Thomas,

>

>

>

>

>

> 1) Suggestion: Review all the built-in functions (and

> parameters) to verify correctness specifically when matching

> mechanisms are used.

>

>

>

>

>

> 2) Question regarding the use of '?' in matching mechanisms.

>

>

>

> Is using '?' valid if applied to a field which is optional? ( No)

>

>

>

> Have a look at example in B.1.2.3 Any value.

>

>

>

> // Given the message type definition

>

> type record MyMessageType

>

> {

>

> integer field1,

>

> charstring field2,

>

> boolean field3 optional,

>

> integer[4] field4

>

> }

>

>

>

> //

>

>

>

> EXAMPLE:

>

> template Mymessage MyTemplate:=

>

> {

>

> field1 := ?, // will match any integer

>

> field2 := ?, // will match any non-empty charstring value

>

> field3 := ?, // will match true or false

>

> field4 := ? // will match any sequence of integers

>

> }

>

>

>

> The above example is misleading as the template is invalid.

> The '?' is not permitted for fields which are

>

> Optional.

>

>

>

> Possible results:

>

> (a) compilation error.

> (preferred solution).

>

> (b) run-time error (error verdict) if the element is not

> present,

>

> (c) 'no-match' if the element is not present (with no

> run-time error). Not a desirable behaviour as it ignores

> the problem

>

>

>

> If I've understood correctly, (a) is the most CORRECT

> behaviour to expect, if the '?' is used in a template, for

> optional fields.

>

>

>

> According to the type definition field3 is optional.

> Although it is correct that '?' will match either true or

> false values, there is no

>

> Explanation of what happens if field3 is not present.

>

>

>

> Do you get a compilation error, runtime error, or a

> 'no-match'? Or is the user forced to accompany the field

> with an ifpresent()?

>

>

>

> Answer: even if the ifpresent() is there, it should still

> give at least a runtime error since ? requires the presence

> of a value.

>

> That is, adding the ifpresent is pointless... :-).

>

>

>

>

>

> 3) Can Any value be a record or must it be a 'basic'

> type such as boolean or integer?

>

>

>

>

>

> 4) B1.3.2 Any number of elements or no element

>

>

>

>

>

> Clarification:

>

>

>

> EXAMPLE:

>

> template Mymessage MyTemplate:=

>

> { :

>

> field2 := "abcxyz",

>

> field3 := '10*11'B, // where "*" may be any sequence of bits

> (possibly empty)

>

> field4 := {*, 2, 3} // where "*"may be any number of integer

> values or omitted

>

>

>

> The comment associated to field4 is misleading. The number

> of integer values permitted should not exceed the number of

>

> Elements specified by the type definition. That is, { 1, 4,

> 5, 6, 2, 3 } would cause a run-time error since a maximum of 4

>

> Integers are permitted based on the Mymessage type

> definition. The comment should be extended to make this

> point clear to

>

> Readers.

>

>

>

> I realize that it is not in the spirit of a standard to be a

> tutorial for a language, but such details are needed to

> ensure clarity from a usage and implementation point of view

> (however obvious it might seem to many).

>

>

>

> I think from a clarity point of view, new examples should be

> added specifically for those cases, where it is unclear what

> the expected result is.

>

>

>

>

>

>

>

> Cheers,

>

>

>

> Claude.

>

>

>

> PS: Any operation which leads to an undefined result (

> suchas sizeof ( { *} ) should force either a compilation

> error where possible and a runtime 'error' verdict at the least.

>

>

>

>

>

>

>

> ________________________________

>

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss

> Sent: 29 May 2007 11:45

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Re: Size of templates

>

>

>

> Hello Claude and Stefan,

>

>

>

> Thanks for your answers. I take them as indications that the

> sizeof function is not defined for all of its parameters and

> that applying it so some templates could lead to either

> runtime errors or errors at compile time. Actually, that's

> what I feared: Another partial builtin function and no

> possibility to check whether the argument is within the

> domain of the function.

>

>

>

> I'll have a closer look at the situation and prepare a CR if needed.

>

>

>

> Btw:: I suggest that sizeof( R:{?} ) evaluates to 1.

>

>

>

>

>

>

>

> Best regards

>

>

>

> Thomas

>

>

>

>

>

>

> ________________________________

>

>

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of ext

> Claude Desroches

> Sent: Saturday, 26. May 2007 10:50

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Re: Size of templates

>

>

>

> Hi Thomas,

>

>

>

>

>

> Some suggestions:

>

>

>

> 1) At compilation time a WARNING or ERROR message

> should be displayed since the value "*" can be zero up to infinity.

>

> 2) At runtime, use the currently received message

> matched against the constraint to determine the value to be

> returned by

>

> Sizeof. If the received message contains 20 integer,

> then return value 20, if none, then 0, etc.

>

> 3) return a TTCN-3 error verdict with the

> offending line number in the TTCN-3 code where the error occurs.

>

>

>

> Look a C.29 and C30 of ES20187301.

>

>

>

> C.30 indicates that an error occurs in the case where a

> record of integer xxx is used with the sizeoftype since there

> is no length constraint.

>

>

>

> Since the type you use is unconstrained from a

> length/number of elements point of view, it would make sense to cause

>

> A runtime error for a template of this type. Of

> course, specifying any other value than "*", would likely work.

>

>

>

> Consider the following:

>

>

>

> template R a_r2 := { 1, 2, * , 3, *, 9 };

>

>

>

> What should sizeof return here? It is impossible to

> determine the value here since "*" means 0 to infinity.

>

> I would say applying a sizeof operation on any template

> containing a "*" must cause either a static compilation

> error, or at a minimum a runtime error (which is less desirable).

>

>

>

>

>

> Now to put some more "salt into the wound", what

> happens with this:

>

>

>

>

>

> template R a_r3 := { ? } // what is returned here?

> // 1 or something else.

>

>

>

>

>

> Cheers,

>

>

>

> Claude.

>

>

>

>

>

>

>

>

>

>

>

>

>

>

> ________________________________

>

>

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Qelthin, Stefan

> Sent: 26 May 2007 10:14

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Re: Size of templates

>

>

>

> Hi Thomas!

>

>

>

> Since the size is undefined or "any"-size the nicest

> theoritical value to be displayed would be "*". From an

> implementation and usage standpoint that would be a bit hard

> to use I guess... ;-) so I would go for the runtime error.

> Can't find it in the std so I guess it is up for discussion.

>

>

>

> BR

>

>

>

> /Stefan

>

>

>

>

> ________________________________

>

>

> From: active_ttcn3 : mts stf133 ttcn version 3 - active

> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Thomas Deiss

> Sent: den 25 maj 2007 16:49

> To: This email address is being protected from spambots. You need JavaScript enabled to view it.

> Subject: Size of templates

>

> Hello together,

>

> TTCN-3 allows to use the sizeof function to compute the

> size of a template. Assume the following definitions

>

> type record of integer R;

> template R a_r := {*};

>

> What will be the result of evalating sizeof(a_r), will

> it be 0, 1, or runtime error? Any ideas?

>

> Best regards

>

> Thomas

>

>
The administrator has disabled public write access.
  • Page:
  • 1
  • 2

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin