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

TOPIC: Follow-up on: No break or continue statements?

Follow-up on: No break or continue statements? 12 Feb 2004 17:13 #6625

Hi all,

Our discussion recently got me thinking some more, and I ran into a problem.

This will sound like a dumb question, but I can't figure this one out from
the standard: What is the semantics of an alt statement w.r.t flow of
control after executing a leaf node?

Example:


...

alt
{
[]PCO1.receive(something)
{
log("reached leaf A");
}
[]PCO1.receive
{
alt
{
[]PCO1.receive
{
log("reached leaf B");
}
}
}
}

log("Is there life after the alt?");

...

What I am asking is, will the 'life after alt' log ever execute in this
case?
In TTCN-2, execution halted at the leaves, is the same true in TTCN-3?
How do you 'repeat' from the top-level alt after reaching leaf B without
using GOTO?

Regards,
/Johan
The administrator has disabled public write access.

Follow-up on: No break or continue statements? 12 Feb 2004 17:19 #6626

Dear Johan,

please find my answers included:

Johan Nordin wrote:
> Hi all,
>
> Our discussion recently got me thinking some more, and I ran into a problem.
>
> This will sound like a dumb question, but I can't figure this one out from
> the standard: What is the semantics of an alt statement w.r.t flow of
> control after executing a leaf node?
>
> Example:
>
>
> ...
>
> alt
> {
> []PCO1.receive(something)
> {
> log("reached leaf A");
> }
> []PCO1.receive
> {
> alt
> {
> []PCO1.receive
> {
> log("reached leaf B");
> }
> }
> }
> }
>
> log("Is there life after the alt?");
>
> ...
>
> What I am asking is, will the 'life after alt' log ever execute in this
> case?

yes.

> In TTCN-2, execution halted at the leaves, is the same true in TTCN-3?
> How do you 'repeat' from the top-level alt after reaching leaf B without
> using GOTO?

if you do not like to use a label/goto you could put the alt into a loop
(repeat will not do the trick because you have 2 nested alts).

Cheers, Ina.

>
> Regards,
> /Johan

--
Ina Schieferdecker
Fraunhofer FOKUS email: This email address is being protected from spambots. You need JavaScript enabled to view it.
Kaiserin-Augusta-Allee 31 tel: ++49-30-3463-7241
D-10589 Berlin fax: ++49-30-3463-8241
The administrator has disabled public write access.

Follow-up on: No break or continue statements? 12 Feb 2004 17:33 #6627

Hi Johan,

I don't see your problems:

> What I am asking is, will the 'life after alt' log ever execute in this
> case?

It will be executed after
- log("reached leaf A")
and after

> alt
> {
> []PCO1.receive
> {
> log("reached leaf B");
> }
> }

(which is the 'alt within the alt')

if you want a repetition of the top alt after the 'alt within the alt',
it will look like:

> []PCO1.receive
> {
> alt
> {
> []PCO1.receive
> {
> log("reached leaf B");
> }
> }
repeat; //Here ist the repeat for the top alt
> }

Hope I understood your questions.

Regards
Jens


Johan Nordin wrote:

> Hi all,
>
> Our discussion recently got me thinking some more, and I ran into a problem.
>
> This will sound like a dumb question, but I can't figure this one out from
> the standard: What is the semantics of an alt statement w.r.t flow of
> control after executing a leaf node?
>
> Example:
>
>
> ...
>
> alt
> {
> []PCO1.receive(something)
> {
> log("reached leaf A");
> }
> []PCO1.receive
> {
> alt
> {
> []PCO1.receive
> {
> log("reached leaf B");
> }
> }
> }
> }
>
> log("Is there life after the alt?");
>
> ...
>
> What I am asking is, will the 'life after alt' log ever execute in this
> case?
> In TTCN-2, execution halted at the leaves, is the same true in TTCN-3?
> How do you 'repeat' from the top-level alt after reaching leaf B without
> using GOTO?
>
> Regards,
> /Johan

--
======================================================================
Prof. Dr. Jens Grabowski
Institute for Informatics phone: +49 551 39 14690
University of Goettingen fax: +49 551 39 14415
Lotzestrasse 16-18
DE-37083 Göttingen This email address is being protected from spambots. You need JavaScript enabled to view it.
(Germany) www.swe.informatik.uni-goettingen.de
======================================================================
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin