From: Rod Chapman <roderick.chapman@googlemail.com>
Subject: Re: SPARK left/right shift.
Date: Tue, 21 Jul 2009 02:31:32 -0700 (PDT)
Date: 2009-07-21T02:31:32-07:00 [thread overview]
Message-ID: <31cd16f8-fdca-4127-8b5d-a0b1817888da@q11g2000yqi.googlegroups.com> (raw)
In-Reply-To: 9d0eb92b-bb21-40eb-ac6d-2e1e829b95cc@s15g2000yqs.googlegroups.com
OK - it's done as follows. We create a SPARK "shadow" specification
of
package Interfaces and a new package SPARK_Interfaces for which there
is an Ada version (for the compiler) and a shadow version (for the
Examiner.)
1) Add the following to your Examiner index file:
interfaces spec is in interfaces.shs
spark_interfaces spec is in spark_interfaces.shs
2) interfaces.shs contains
package Interfaces
is
type Unsigned_32 is mod 2**32;
-- ... and similarly for other Unsigned_XX types
end Interfaces;
3) spark_interfaces.shs contains
with Interfaces;
--# inherit Interfaces;
package SPARK_Interfaces
is
function Rotate_Left_32
(Value : Interfaces.Unsigned_32;
Amount : Natural) return Interfaces.Unsigned_32;
end SPARK_Interfaces;
(note this removes the overloading, and declares the function so it's
legal SPARK)
4) spark_interfaces.ads contains
with Interfaces;
package SPARK_Interfaces
is
function Rotate_Left_32
(Value : Interfaces.Unsigned_32;
Amount : Natural) return Interfaces.Unsigned_32 renames
Interfaces.Rotate_Left;
end SPARK_Interfaces;
(note this _renames_ the original function from Interfaces, so you
still
get the efficiency of the Intrinsic version.)
OK?
- Rod
next prev parent reply other threads:[~2009-07-21 9:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 9:07 SPARK left/right shift xorque
2009-07-21 9:21 ` Rod Chapman
2009-07-21 9:31 ` Rod Chapman [this message]
2009-07-21 9:38 ` xorque
2009-07-21 9:54 ` Rod Chapman
2009-07-21 10:00 ` xorque
2009-07-21 10:40 ` Georg Bauhaus
2009-07-21 10:46 ` Jean-Pierre Rosen
2009-07-21 11:33 ` xorque
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox