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,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!postnews.google.com!j32g2000yqh.googlegroups.com!not-for-mail From: xorquewasp@googlemail.com Newsgroups: comp.lang.ada Subject: Representing errno in SPARK Date: Tue, 9 Jun 2009 07:06:37 -0700 (PDT) Organization: http://groups.google.com Message-ID: <95bb6d31-f4fe-47c9-9274-72382ffad7ba@j32g2000yqh.googlegroups.com> NNTP-Posting-Host: 81.86.41.187 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1244556397 8657 127.0.0.1 (9 Jun 2009 14:06:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 Jun 2009 14:06:37 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j32g2000yqh.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:6393 Date: 2009-06-09T07:06:37-07:00 List-Id: What is the correct way to model a pair of subprograms that affect state completely outside of the SPARK program? Specifically, in this case, I have a procedure: procedure Errno_Set (Code : Integer); pragma Import (C, Errno_Set, "posix_errno_set"); And a function: function Errno_Get return Integer; pragma Import (C, Errno_Get, "posix_errno_get"); The problem in this case is that the C variable 'errno' that these subprograms refer to is completely external to the program but the value of the Errno_Get function depends on it and therefore the execution path the program takes depends on it. Those closest I can find in the SPARK95 manual is "external own variables" but even then, the variables are actually objects within the program: package body Device --# own State is OldX, -- state variable constituent --# in StatusPort, -- external variable constituent --# out Register; -- external variable constituent is OldX : Integer :=3D 0; -- only component that needs or permits initialization StatusPort : Integer; for StatusPort=92Address use .........; Register : Integer; for Register=92Address use ..........;