From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,6d47e90d50b280da X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!y7g2000yqa.googlegroups.com!not-for-mail From: xorquewasp@googlemail.com Newsgroups: comp.lang.ada Subject: Re: Representing errno in SPARK Date: Tue, 9 Jun 2009 08:02:24 -0700 (PDT) Organization: http://groups.google.com Message-ID: <90f77911-389b-484e-b7f8-5f4d5e81e84e@y7g2000yqa.googlegroups.com> References: <95bb6d31-f4fe-47c9-9274-72382ffad7ba@j32g2000yqh.googlegroups.com> <8a00d4ad-0ca3-4908-abf0-4fa980decb19@o36g2000vbi.googlegroups.com> NNTP-Posting-Host: 81.86.41.187 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1244559745 19101 127.0.0.1 (9 Jun 2009 15:02:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 Jun 2009 15:02:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y7g2000yqa.googlegroups.com; posting-host=81.86.41.187; posting-account=D9GNUgoAAAAmg7CCIh9FhKHNAJmHypsp User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009030814 Iceweasel/3.0.9 (Debian-3.0.9-1),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6396 Date: 2009-06-09T08:02:24-07:00 List-Id: 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"); > > =A0 function Errno_Get return Integer; > --# global in Errno; > =A0 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.