comp.lang.ada
 help / color / mirror / Atom feed
From: Phil Thornley <phil.jpthornley@googlemail.com>
Subject: Re: SPARK examiner visibility problem
Date: Mon, 14 Sep 2009 00:40:39 -0700 (PDT)
Date: 2009-09-14T00:40:39-07:00	[thread overview]
Message-ID: <2e0ddf8d-4a67-48f1-931e-e14b6c5a95ef@t2g2000yqn.googlegroups.com> (raw)
In-Reply-To: 8d72d20b-489b-4494-9b13-1b00ee902850@j4g2000yqa.googlegroups.com

On 13 Sep, 23:47, Laurie Dillon <lauradi...@gmail.com> wrote:
> I am having trouble with a toy example of encapsulating IO for a SPARK
> program.  My example seems to be consistent with the Spark_IO example
> in the Barnes book.
>
[...]

> For example, consider the following spec:
> ---------------------------------------------------------------------------­--------
> --# inherit Std_IO;
> package MyGps
> --# own home;
> is
>
>    type Location is
>    record
>       x : Integer;
>       y : Integer;
>    end record;
>
>    procedure MoveTo (theLoc : in Location);
>    --  moves home to the given location
>    --# global out home;
>    --# derives home from theLoc;
>
>    function Distance (theLoc : Location) return Integer;
>    --  returns the (taxi) distance from home to the given location
>    --# global home;
>
>    procedure GetLocation (theLoc : out Location);
>    --  prompts user for theLoc
>    --# derives theLoc from Std_IO.stdin;
>
> end MyGps;
> ---------------------------------------------------------------------------­------------------
> Examiner report says:
>
>    Unit name:  MyGps
>    Unit type:  package specification
>    Unit has been analysed, any errors are listed below.
>
> 1 error(s) or warning(s)
>
> Line
>   23     --# derives theLoc from Std_IO.stdin;
>                                  ^1
> *** (  1)  Semantic Error    :752: The identifier Std_IO.stdin is
> either undeclared
>            or not visible at this point. This identifier must appear
> in a
>            preceding legal global annotation or formal parameter list.

It needs to have the global annotation added :

   procedure GetLocation (theLoc : out Location);
   --  prompts user for theLoc
   --# global in Std_IO.stdin;
   --# derives theLoc from Std_IO.stdin;

Cheers,

Phil



  parent reply	other threads:[~2009-09-14  7:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-13 22:47 SPARK examiner visibility problem Laurie Dillon
2009-09-14  0:32 ` Britt
2009-09-14  4:26   ` Laurie Dillon
2009-09-14  6:28 ` Ludovic Brenta
2009-09-14  8:16   ` Phil Thornley
2009-09-14  7:40 ` Phil Thornley [this message]
2009-09-14 16:12 ` Phil Thornley
2009-09-14 22:44   ` Laurie Dillon
replies disabled

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