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-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!o36g2000vbi.googlegroups.com!not-for-mail From: roderick.chapman@googlemail.com Newsgroups: comp.lang.ada Subject: Re: Representing errno in SPARK Date: Tue, 9 Jun 2009 07:32:16 -0700 (PDT) Organization: http://groups.google.com Message-ID: <8a00d4ad-0ca3-4908-abf0-4fa980decb19@o36g2000vbi.googlegroups.com> References: <95bb6d31-f4fe-47c9-9274-72382ffad7ba@j32g2000yqh.googlegroups.com> NNTP-Posting-Host: 192.108.117.69 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1244557936 13391 127.0.0.1 (9 Jun 2009 14:32:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 Jun 2009 14:32:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o36g2000vbi.googlegroups.com; posting-host=192.108.117.69; posting-account=HCzrEgkAAABSfGsTnv-u5wET6EzuneVi User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6394 Date: 2009-06-09T07:32:16-07:00 List-Id: On Jun 9, 3:06=A0pm, xorquew...@googlemail.com wrote: > What is the correct way to model a pair of subprograms > that affect state completely outside of the SPARK program? 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; Notes 1) POSIX.Errno is _never_ actually declared in SPARK - it's just an abstraction for something that is outside the SPARK boundary. 2) do NOT use an external own variable for this - these are for _volatile_ states, which Errno is not... 3) You should read the "Informed Design Method" manual (Informed.pdf) that comes with the SPARK distibution. - Rod