comp.lang.ada
 help / color / mirror / Atom feed
From: Phil Thornley <phil.jpthornley@googlemail.com>
Subject: Re: Representing errno in SPARK
Date: Tue, 9 Jun 2009 09:03:42 -0700 (PDT)
Date: 2009-06-09T09:03:42-07:00	[thread overview]
Message-ID: <51812f56-6c0a-407a-9f53-98c9b15f957c@p4g2000vba.googlegroups.com> (raw)
In-Reply-To: 90f77911-389b-484e-b7f8-5f4d5e81e84e@y7g2000yqa.googlegroups.com

On Jun 9, 4:02 pm, xorquew...@googlemail.com wrote:
...
>
> 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...

No it's not that.

What you are trying to do (by having other SPARK code in the body) is
mixing code that is inside and outside the 'SPARK boundary' in a
single package.

One possibility is to move the Errno abstraction and the two imported
operations to another package internal to POSIX (but this means having
an implementation for the POSIX versions of these subprograms). So:

1 - Remove the Import pragmas from POSIX spec.
2 - Create an internal package (eg POSIX.Internals) in the POSIX body
that has the Errno abstraction and the imported subprograms.
3 - In the refinement annotation on the POSIX body put "--# own Errno
is Internals.Errno;".
4 - Call through to these imported subprograms in the implementation
of the subprograms that you now have to provide.

(A second possibility is simply to create an Errno in the package body
with a comment that it isn't actually used by the code ...)

Phil Thornley



  reply	other threads:[~2009-06-09 16:03 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
2009-06-09 16:03     ` Phil Thornley [this message]
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