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

TOPIC: question about label

question about label 04 Sep 2007 06:49 #7217

Hi all
I have a question when read about core language 19.4 (2005 version).
It says "A label statement can be used freely like other TTCN-3 behavioural
program statements according to the
syntax rules defined in annex A. It can be used before or after a TTCN-3
statement but not as the first statement of an
alternative or top alternative in an alt statement, interleave statement or
altstep."

But in the following example,it gives :
EXAMPLE:
label MyLabel; // Defines the label MyLabel
// The labels L1, L2 and L3 are defined in the following TTCN-3 code fragment
:
label L1; // Definition of label L1
alt{
[] PCO1.receive(MySig1)
{
label L2; // Definition of label L2
PCO1.send(MySig2);
PCO1.receive(MySig3)
}
[] PCO2.receive(MySig4)
{
PCO2.send(MySig5);
PCO2.send(MySig6);
label L3; // Definition of label L3
PCO2.receive(MySig7);
}
}

Here I think the label L2's definition is error according to the description
above."It can be used before or after a TTCN-3 statement but not as the
first statement of an alternative"

How do you think? thanks
The administrator has disabled public write access.

question about label 04 Sep 2007 12:47 #7222

Hello Xuezhi,

The explanation given by Theo is in deed the correct one. His is in deed an
explanation by example.

My only contribution here is may be to rephrase the problem:

First the definition in the standard says as you mentioned:

It can be used before or after a TTCN-3 statement but not as the first
statement of an alternative or top alternative in an alt statement,
interleave statement = or altstep."

But in the following example,it gives :
EXAMPLE:
label MyLabel; // Defines the label MyLabel
// The labels L1, L2 and L3 are defined in the following TTCN-3 code frag=
ment
:
label L1; // Definition of label L1 <
this is before the alt,
so OK.

alt{
[] PCO1.receive(MySig1) <
this is the first statement of
the alt, so OK
{
label L2; // Definition of label L2 <
this label is inside
the block of the first statement
PCO1.send(MySig2);
PCO1.receive(MySig3)
}
[] PCO2.receive(MySig4)
{
PCO2.send(MySig5);
PCO2.send(MySig6);
label L3; // Definition of label L3 <
this is deeply
inside the block of the second alt, so this is super OK

PCO2.receive(MySig7);
}
}

>Here I think the label L2's definition is error according to the
>description above."It can be used before or after a TTCN-3 statement but
>not as the first statement of an alternative"

Your interpretation doesn't take into account the difference between "first
statement" and "within the block of the first statement". Within a block you
are kind of no longer in an alt construct but within some regular sequential
ttcn-3 statements.

Theo's example is the only case that would be in error.

Hope this makes it clear.

Cheers
Bernard Stepien
University of Ottawa
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin