comp.lang.ada
 help / color / mirror / Atom feed
From: Jukka-Pekka Suominen <jukka-pekka.suominen@abo.fi>
Subject: Need help with DIALOG
Date: Thu, 18 Apr 2002 07:35:29 +0300
Date: 2002-04-18T07:35:29+03:00	[thread overview]
Message-ID: <3cbe4d93@newsflash.abo.fi> (raw)

Hi!
Before you ask, yes, this is a homework assignment, but I've only been 
learning ada for a few days, so I would appreciate some help. Anyway, the 
assignment is as follows. You have a simple conversation between two 
processes as illustrated below. Show how this can be constructed as a 
colloquy (which I get explained as being dialog statements combined with 
select).

the code:

x, y, z : integer;

process B;

process A;
begin
  ...
  action conversation with ( B ) do
   ensure A_acceptance_test
   by
     -- A_primary
     -- uses x, y
   else by
     -- A_secondary
     -- uses y, z
   else
     error
 end conversation;
 ...
end A;

process B;
begin
  ...
  action conversation with ( A ) do
    ensure B_acceptance_test
    by 
      -- B_primary
      -- uses x, y
    else by
      -- B_secondary
      -- uses y, z
    else
      error
  end conversation;
  ...
end B;

And here's what I managed to throw together. Is it anywhere near how it 
should be done?

x, y, z : integer;
DIALOG the_dialog SHARES (x, y, z);
process B;
process A;
begin
  SELECT
    DISCUSS the_dialog BY
      -- something involving x, y
  TO ARRANGE A_acceptance_test;
  OR
    DISCUSS the_dialog BY
        -- something involving y, z
    TO ARRANGE A_acceptance_test;
  ELSE
    -- error handling
  END SELECT;
END A;
process B;
begin
  SELECT
    DISCUSS the_dialog BY
      -- something involving x, y
   TO ARRANGE B_acceptance_test;
  OR
    DISCUSS the_dialog BY
      -- something involving y, z
    TO ARRANGE B_acceptance_test;
  ELSE
      -- error handling
  END SELECT;
END B;

Any helps would be greatly appreciated.
-- 
Jukka-Pekka Suominen                           Assembler is for wimps!
�bo Akademi - MNF/IB                      *Real* programmers flip switches!



             reply	other threads:[~2002-04-18  4:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-18  4:35 Jukka-Pekka Suominen [this message]
2002-04-18 19:02 ` Need help with DIALOG Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox