comp.lang.ada
 help / color / mirror / Atom feed
From: xorquewasp@googlemail.com
Subject: Re: Representing errno in SPARK
Date: Tue, 9 Jun 2009 08:02:24 -0700 (PDT)
Date: 2009-06-09T08:02:24-07:00	[thread overview]
Message-ID: <90f77911-389b-484e-b7f8-5f4d5e81e84e@y7g2000yqa.googlegroups.com> (raw)
In-Reply-To: 8a00d4ad-0ca3-4908-abf0-4fa980decb19@o36g2000vbi.googlegroups.com

roderick.chap...@googlemail.com wrote:
> Create an abstraction of that state as a SPARK abstract own
> variable, thus:
>
> package POSIX
> --# own Errno;
>
>   procedure Errno_Set (Code : Integer);
>   --# global out Errno;
>   --# derives Errno from Code;
>   pragma Import (C, Errno_Set, "posix_errno_set");
>
>   function Errno_Get return Integer;
>   --# global in Errno;
>   pragma Import (C, Errno_Get, "posix_errno_get");
>
> end POSIX;

Thank you, that's actually what I have here. The problem, however,
is that the package also has a body and SPARK doesn't seem to
like this:

$ spark posix-error.ads posix-error.adb
...
 304  end POSIX.Error;
          ^
***        Semantic Error    : 28: The own variable POSIX_errno does
not have a
           definition [SR95 7.2.3].

Is it, by any chance, an issue due to Errno_Get and Errno_Set being
defined in the private section of the package spec? I think probably
not...

>
> 2) do NOT use an external own variable for this - these
> are for _volatile_ states, which Errno is not...

Ok.

>
> 3) You should read the "Informed Design Method" manual
> (Informed.pdf) that comes with the SPARK distibution.
>

That's where I first got the idea for the above. The device
driver example in the SPARK95 manual made me think my
solution was incorrect, however.



  reply	other threads:[~2009-06-09 15:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 14:06 Representing errno in SPARK xorquewasp
2009-06-09 14:32 ` roderick.chapman
2009-06-09 15:02   ` xorquewasp [this message]
2009-06-09 16:03     ` Phil Thornley
2009-06-09 16:11       ` xorquewasp
2009-06-09 17:26         ` Phil Thornley
replies disabled

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