comp.lang.ada
 help / color / mirror / Atom feed
* problem with separate task body
@ 1993-05-18 20:10 Szamos
  0 siblings, 0 replies; 2+ messages in thread
From: Szamos @ 1993-05-18 20:10 UTC (permalink / raw)


I'm having some problem to make a separate task body.
 
Given the following short example code:
  PROCEDURE Main;
     testvar : INTEGER; 

  TASK One IS
     Entry First;
  END One;

  TASK BODY One IS
  BEGIN 
     --  whatever 
  END;

  TASK Two IS
  END Two;

  TASK BODY Two IS
  BEGIN
     --   some code
     testvar := 1;
     One.First;
     --  etc.
   END Two;

   BEGIN
     NULL;
   END;

This code *compiles* and work fine.   But when I try to use subunits, so 
I can have the BODYs in in different files I ran into a problem.

Given the previous code with the following change:

   TASK BODY Two IS SEPARATE;
   -- body omitted here

   BEGIN
      NULL;
   END Main;

and having a separate unit:

SEPARATE (Main)
TASK BODY Two IS
BEGIN
   ---  code
  testvar := 1;
  One.First;
  ---  more code
END Two;

when I try to compile this subunit I get the following:
   One.First;
---^
A:error: RM 8.3: identifier undefined

I tried everything I could, (ie: DECLARE) to no avail.   And only the 
entry points are not visible, ordinary variables (ie: testvar) do not
gave me the error.

So, anyone has any idea how to get around this problem?

Thanks,
    Janos 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: problem with separate task body
@ 1993-05-18 21:39 Kenneth Anderson
  0 siblings, 0 replies; 2+ messages in thread
From: Kenneth Anderson @ 1993-05-18 21:39 UTC (permalink / raw)


In comp.lang.ada you write:

>So, anyone has any idea how to get around this problem?

The following code files compile for me with no problems using
SunAda 1.1(i).

------------------- test.a ---------------------------------------------------
procedure Main is

   testvar : INTEGER;

task One is
   entry First;
end One;

task body One is
begin
   --  whatever
   null;
end;

task Two IS
end Two;

task body Two is separate;

begin
   null;
end;
-------------------------------------------------------------------------------

--------------------- task2.a ------------------------------------------------
separate( main )
task body two is
  BEGIN
     --   some code
     testvar := 1;
     One.First;
     --  etc.
   END Two;
-------------------------------------------------------------------------------

In other words, the code that you showed us (with a few syntax corrections)
should work fine...

Hope this helps,


>Thanks,
>    Janos

Ken
--
-------------------------------------------------------------------------------
-
Ken Anderson                           |  "I'd much rather live in perfection,
U.C. Irvine                            |   than deal with reality." -- Kenbod
-------------------------------------------------------------------------------
-
Happy! Happy! Happy! Joy! Joy! Joy!    |  Practice random kindness and
                         -- Stimpy     |  senseless acts of beauty.
                                       |  -- Anne Herbert
-------------------------------------------------------------------------------
-

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1993-05-18 21:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-05-18 20:10 problem with separate task body Szamos
  -- strict thread matches above, loose matches on Subject: below --
1993-05-18 21:39 Kenneth Anderson

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