ada: Include design documentation within runtime sources

The existing design documentation, required when generating the Software
Architecture Design Specification and Software Component Design
Specification documents for the light and light-tasking runtimes, has been
included directly within runtime sources.

gcc/ada/ChangeLog:

	* libgnarl/a-dynpri.ads: Add design annotations.
	* libgnarl/a-reatim.ads: Likewise.
	* libgnarl/a-synbar.ads: Likewise.
	* libgnarl/a-taside.ads: Likewise.
	* libgnarl/s-tarest.ads: Likewise.
	* libgnarl/s-tasinf.ads: Likewise.
	* libgnarl/s-taspri__posix.ads: Likewise.
	* libgnarl/s-tpobmu.ads: Likewise.
	* libgnat/a-assert.ads: Likewise.
	* libgnat/a-comlin.ads: Likewise.
	* libgnat/a-nbnbig.ads: Likewise.
	* libgnat/a-nubinu.ads: Likewise.
	* libgnat/a-numeri.ads: Likewise.
	* libgnat/a-unccon.ads: Likewise.
	* libgnat/a-uncdea.ads: Likewise.
	* libgnat/ada.ads: Likewise.
	* libgnat/g-debuti.ads: Likewise.
	* libgnat/g-sestin.ads: Likewise.
	* libgnat/g-souinf.ads: Likewise.
	* libgnat/gnat.ads: Likewise.
	* libgnat/i-cexten.ads: Likewise.
	* libgnat/i-cexten__128.ads: Likewise.
	* libgnat/i-cstrin.adb: Likewise.
	* libgnat/i-cstrin.ads: Likewise.
	* libgnat/interfac__2020.ads: Likewise.
	* libgnat/machcode.ads: Likewise.
	* libgnat/s-addope.ads: Likewise.
	* libgnat/s-aridou.ads: Likewise.
	* libgnat/s-arit32.ads: Likewise.
	* libgnat/s-arit64.ads: Likewise.
	* libgnat/s-assert.ads: Likewise.
	* libgnat/s-atacco.ads: Likewise.
	* libgnat/s-atocou.ads: Likewise.
	* libgnat/s-atocou__builtin.adb: Likewise.
	* libgnat/s-atopri.ads: Likewise.
	* libgnat/s-bitops.ads: Likewise.
	* libgnat/s-boarop.ads: Likewise.
	* libgnat/s-bytswa.ads: Likewise.
	* libgnat/s-carsi8.ads: Likewise.
	* libgnat/s-carun8.ads: Likewise.
	* libgnat/s-casi16.ads: Likewise.
	* libgnat/s-casi32.ads: Likewise.
	* libgnat/s-casi64.ads: Likewise.
	* libgnat/s-caun16.ads: Likewise.
	* libgnat/s-caun32.ads: Likewise.
	* libgnat/s-caun64.ads: Likewise.
	* libgnat/s-exnint.ads: Likewise.
	* libgnat/s-exnllf.ads: Likewise.
	* libgnat/s-exnlli.ads: Likewise.
	* libgnat/s-expint.ads: Likewise.
	* libgnat/s-explli.ads: Likewise.
	* libgnat/s-expllu.ads: Likewise.
	* libgnat/s-expmod.ads: Likewise.
	* libgnat/s-exponn.ads: Likewise.
	* libgnat/s-expont.ads: Likewise.
	* libgnat/s-exponu.ads: Likewise.
	* libgnat/s-expuns.ads: Likewise.
	* libgnat/s-fatflt.ads: Likewise.
	* libgnat/s-fatgen.ads: Likewise.
	* libgnat/s-fatlfl.ads: Likewise.
	* libgnat/s-fatllf.ads: Likewise.
	* libgnat/s-flocon.ads: Likewise.
	* libgnat/s-geveop.ads: Likewise.
	* libgnat/s-imageb.ads: Likewise.
	* libgnat/s-imaged.ads: Likewise.
	* libgnat/s-imagef.ads: Likewise.
	* libgnat/s-imagei.ads: Likewise.
	* libgnat/s-imagen.ads: Likewise.
	* libgnat/s-imageu.ads: Likewise.
	* libgnat/s-imagew.ads: Likewise.
	* libgnat/s-imde128.ads: Likewise.
	* libgnat/s-imde32.ads: Likewise.
	* libgnat/s-imde64.ads: Likewise.
	* libgnat/s-imen16.ads: Likewise.
	* libgnat/s-imen32.ads: Likewise.
	* libgnat/s-imenu8.ads: Likewise.
	* libgnat/s-imfi32.ads: Likewise.
	* libgnat/s-imfi64.ads: Likewise.
	* libgnat/s-imgbiu.ads: Likewise.
	* libgnat/s-imgboo.ads: Likewise.
	* libgnat/s-imgcha.ads: Likewise.
	* libgnat/s-imgint.ads: Likewise.
	* libgnat/s-imgllb.ads: Likewise.
	* libgnat/s-imglli.ads: Likewise.
	* libgnat/s-imgllu.ads: Likewise.
	* libgnat/s-imgllw.ads: Likewise.
	* libgnat/s-imgrea.ads: Likewise.
	* libgnat/s-imguns.ads: Likewise.
	* libgnat/s-imguti.ads: Likewise.
	* libgnat/s-imgwiu.ads: Likewise.
	* libgnat/s-maccod.ads: Likewise.
	* libgnat/s-multip.ads: Likewise.
	* libgnat/s-pack03.ads: Likewise.
	* libgnat/s-pack05.ads: Likewise.
	* libgnat/s-pack06.ads: Likewise.
	* libgnat/s-pack07.ads: Likewise.
	* libgnat/s-pack09.ads: Likewise.
	* libgnat/s-pack10.ads: Likewise.
	* libgnat/s-pack100.ads: Likewise.
	* libgnat/s-pack101.ads: Likewise.
	* libgnat/s-pack102.ads: Likewise.
	* libgnat/s-pack103.ads: Likewise.
	* libgnat/s-pack104.ads: Likewise.
	* libgnat/s-pack105.ads: Likewise.
	* libgnat/s-pack106.ads: Likewise.
	* libgnat/s-pack107.ads: Likewise.
	* libgnat/s-pack108.ads: Likewise.
	* libgnat/s-pack109.ads: Likewise.
	* libgnat/s-pack11.ads: Likewise.
	* libgnat/s-pack110.ads: Likewise.
	* libgnat/s-pack111.ads: Likewise.
	* libgnat/s-pack112.ads: Likewise.
	* libgnat/s-pack113.ads: Likewise.
	* libgnat/s-pack114.ads: Likewise.
	* libgnat/s-pack115.ads: Likewise.
	* libgnat/s-pack116.ads: Likewise.
	* libgnat/s-pack117.ads: Likewise.
	* libgnat/s-pack118.ads: Likewise.
	* libgnat/s-pack119.ads: Likewise.
	* libgnat/s-pack12.ads: Likewise.
	* libgnat/s-pack120.ads: Likewise.
	* libgnat/s-pack121.ads: Likewise.
	* libgnat/s-pack122.ads: Likewise.
	* libgnat/s-pack123.ads: Likewise.
	* libgnat/s-pack124.ads: Likewise.
	* libgnat/s-pack125.ads: Likewise.
	* libgnat/s-pack126.ads: Likewise.
	* libgnat/s-pack127.ads: Likewise.
	* libgnat/s-pack13.ads: Likewise.
	* libgnat/s-pack14.ads: Likewise.
	* libgnat/s-pack15.ads: Likewise.
	* libgnat/s-pack17.ads: Likewise.
	* libgnat/s-pack18.ads: Likewise.
	* libgnat/s-pack19.ads: Likewise.
	* libgnat/s-pack20.ads: Likewise.
	* libgnat/s-pack21.ads: Likewise.
	* libgnat/s-pack22.ads: Likewise.
	* libgnat/s-pack23.ads: Likewise.
	* libgnat/s-pack24.ads: Likewise.
	* libgnat/s-pack25.ads: Likewise.
	* libgnat/s-pack26.ads: Likewise.
	* libgnat/s-pack27.ads: Likewise.
	* libgnat/s-pack28.ads: Likewise.
	* libgnat/s-pack29.ads: Likewise.
	* libgnat/s-pack30.ads: Likewise.
	* libgnat/s-pack31.ads: Likewise.
	* libgnat/s-pack33.ads: Likewise.
	* libgnat/s-pack34.ads: Likewise.
	* libgnat/s-pack35.ads: Likewise.
	* libgnat/s-pack36.ads: Likewise.
	* libgnat/s-pack37.ads: Likewise.
	* libgnat/s-pack38.ads: Likewise.
	* libgnat/s-pack39.ads: Likewise.
	* libgnat/s-pack40.ads: Likewise.
	* libgnat/s-pack41.ads: Likewise.
	* libgnat/s-pack42.ads: Likewise.
	* libgnat/s-pack43.ads: Likewise.
	* libgnat/s-pack44.ads: Likewise.
	* libgnat/s-pack45.ads: Likewise.
	* libgnat/s-pack46.ads: Likewise.
	* libgnat/s-pack47.ads: Likewise.
	* libgnat/s-pack48.ads: Likewise.
	* libgnat/s-pack49.ads: Likewise.
	* libgnat/s-pack50.ads: Likewise.
	* libgnat/s-pack51.ads: Likewise.
	* libgnat/s-pack52.ads: Likewise.
	* libgnat/s-pack53.ads: Likewise.
	* libgnat/s-pack54.ads: Likewise.
	* libgnat/s-pack55.ads: Likewise.
	* libgnat/s-pack56.ads: Likewise.
	* libgnat/s-pack57.ads: Likewise.
	* libgnat/s-pack58.ads: Likewise.
	* libgnat/s-pack59.ads: Likewise.
	* libgnat/s-pack60.ads: Likewise.
	* libgnat/s-pack61.ads: Likewise.
	* libgnat/s-pack62.ads: Likewise.
	* libgnat/s-pack63.ads: Likewise.
	* libgnat/s-pack65.ads: Likewise.
	* libgnat/s-pack66.ads: Likewise.
	* libgnat/s-pack67.ads: Likewise.
	* libgnat/s-pack68.ads: Likewise.
	* libgnat/s-pack69.ads: Likewise.
	* libgnat/s-pack70.ads: Likewise.
	* libgnat/s-pack71.ads: Likewise.
	* libgnat/s-pack72.ads: Likewise.
	* libgnat/s-pack73.ads: Likewise.
	* libgnat/s-pack74.ads: Likewise.
	* libgnat/s-pack75.ads: Likewise.
	* libgnat/s-pack76.ads: Likewise.
	* libgnat/s-pack77.ads: Likewise.
	* libgnat/s-pack78.ads: Likewise.
	* libgnat/s-pack79.ads: Likewise.
	* libgnat/s-pack80.ads: Likewise.
	* libgnat/s-pack81.ads: Likewise.
	* libgnat/s-pack82.ads: Likewise.
	* libgnat/s-pack83.ads: Likewise.
	* libgnat/s-pack84.ads: Likewise.
	* libgnat/s-pack85.ads: Likewise.
	* libgnat/s-pack86.ads: Likewise.
	* libgnat/s-pack87.ads: Likewise.
	* libgnat/s-pack88.ads: Likewise.
	* libgnat/s-pack89.ads: Likewise.
	* libgnat/s-pack90.ads: Likewise.
	* libgnat/s-pack91.ads: Likewise.
	* libgnat/s-pack92.ads: Likewise.
	* libgnat/s-pack93.ads: Likewise.
	* libgnat/s-pack94.ads: Likewise.
	* libgnat/s-pack95.ads: Likewise.
	* libgnat/s-pack96.ads: Likewise.
	* libgnat/s-pack97.ads: Likewise.
	* libgnat/s-pack98.ads: Likewise.
	* libgnat/s-pack99.ads: Likewise.
	* libgnat/s-parame.ads: Likewise.
	* libgnat/s-rident.ads: Likewise.
	* libgnat/s-spark.ads: Likewise.
	* libgnat/s-spcuop.ads: Likewise.
	* libgnat/s-stoele.ads: Likewise.
	* libgnat/s-traent.ads: Likewise.
	* libgnat/s-unstyp.ads: Likewise.
	* libgnat/s-vaispe.ads: Likewise.
	* libgnat/s-valspe.ads: Likewise.
	* libgnat/s-vauspe.ads: Likewise.
	* libgnat/s-veboop.ads: Likewise.
	* libgnat/s-vector.ads: Likewise.
	* libgnat/s-vs_int.ads: Likewise.
	* libgnat/s-vs_lli.ads: Likewise.
	* libgnat/s-vs_llu.ads: Likewise.
	* libgnat/s-vs_uns.ads: Likewise.
	* libgnat/s-vsllli.ads: Likewise.
	* libgnat/text_io.ads: Likewise.
	* libgnat/unchconv.ads: Likewise.
	* libgnat/unchdeal.ads: Likewise.
	* s-pack.ads.tmpl: Likewise.
This commit is contained in:
Pat Bernardi
2022-07-18 01:56:28 -04:00
committed by Marc Poulhiès
parent ab3106747e
commit a1dfd384a9
233 changed files with 1465 additions and 334 deletions

View File

@@ -13,6 +13,10 @@
-- --
------------------------------------------------------------------------------
-- This unit implements dynamic priority support for Ada tasking as defined
-- in ARM D.5.1. It allows a tasks priority to be changed after the task has
-- been created.
with System;
with Ada.Task_Identification;

View File

@@ -33,6 +33,13 @@
-- --
------------------------------------------------------------------------------
-- Package ``Ada.Real_Time`` provides basic definitions and operations related
-- to the types defined ``Time`` and ``Time_Span`` as defined by ARM D.8. The
-- types ``Time`` and ``Time_Span`` are implemented by the ``Duration`` type.
--
-- This software layer provides the Ada abstraction for time handling and
-- delays, using the services provided by lower layers.
with System.Task_Primitives.Operations;
pragma Elaborate_All (System.Task_Primitives.Operations);

View File

@@ -33,6 +33,10 @@
-- --
------------------------------------------------------------------------------
-- This package implements functionality defined by ARM D.10.1 to
-- synchronously release multiple blocked tasks after the number
-- of blocked tasks has reached a specified threshold.
package Ada.Synchronous_Barriers with SPARK_Mode => Off is
pragma Preelaborate (Synchronous_Barriers);

View File

@@ -33,6 +33,8 @@
-- --
------------------------------------------------------------------------------
-- This package implements Ada task identification as defined by ARM C.7.1.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised.
-- This is enforced by setting the corresponding assertion policy to Ignore.

View File

@@ -33,12 +33,11 @@
-- intended to be used in a restricted run time.
-- This package represents the high level tasking interface used by the
-- compiler to expand Ada 95 tasking constructs into simpler run time calls
-- (aka GNARLI, GNU Ada Run-time Library Interface)
-- compiler to expand Ada 95 tasking constructs into simpler run-time calls.
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes
-- in exp_ch9.adb and possibly exp_ch7.adb
-- The compiler generates direct calls to this interface, via Rtsfind. Any
-- changes to this interface may require corresponding compiler changes in
-- exp_ch9.adb and possibly exp_ch7.adb.
-- The restricted GNARLI is also composed of System.Protected_Objects and
-- System.Protected_Objects.Single_Entry

View File

@@ -30,11 +30,11 @@
------------------------------------------------------------------------------
-- This package contains the definitions and routines associated with the
-- implementation and use of the Task_Info pragma. It is specialized
-- implementation and use of the ``Task_Info`` pragma. It is specialized
-- appropriately for targets that make use of this pragma.
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes.
-- The compiler generates direct calls to this interface, via Rtsfind. Any
-- changes to this interface may require corresponding compiler changes.
-- The functionality in this unit is now provided by the predefined package
-- System.Multiprocessors and the CPU aspect. This package is obsolescent.

View File

@@ -30,7 +30,11 @@
-- --
------------------------------------------------------------------------------
-- This is a POSIX-like version of this package
-- This is the POSIX compliant systems implementation
-- This package and its children provide a binding to the underlying platform.
-- The base types are defined here while the functional implementations
-- are in ``Task_Primitives.Operations``.
-- Note: this file can only be used for POSIX compliant systems

View File

@@ -29,6 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package provides primitives used for protected objects on
-- multiprocessor systems.
package System.Tasking.Protected_Objects.Multiprocessors is
procedure Served (Entry_Call : Entry_Call_Link);

View File

@@ -33,6 +33,8 @@
-- --
------------------------------------------------------------------------------
-- This package provides the assertion feature defined by ARM 11.4.2
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised when calling Assert.
-- This is enforced by setting the corresponding assertion policy to Ignore.

View File

@@ -33,6 +33,10 @@
-- --
------------------------------------------------------------------------------
-- This language package providing support for obtaining the values of its
-- command line arguments and to set the exit status of the program as defined
-- by ARM A.15.
package Ada.Command_Line is
pragma Preelaborate;

View File

@@ -13,14 +13,16 @@
-- --
------------------------------------------------------------------------------
-- This unit is provided as a replacement for the standard unit
-- Ada.Numerics.Big_Numbers.Big_Integers when only proof with SPARK is
-- intended. It cannot be used for execution, as all subprograms are marked
-- imported with no definition.
-- This package provides a reduced and non-executable implementation of the
-- ARM A.5.6 defined ``Ada.Numerics.Big_Numbers.Big_Integers`` for use in
-- SPARK proofs in the runtime. As it is only intended for SPARK proofs, this
-- package is marked as a Ghost package and consequently does not have a
-- runtime footprint.
-- Contrary to Ada.Numerics.Big_Numbers.Big_Integers, this unit does not
-- depend on System or Ada.Finalization, which makes it more convenient for
-- use in run-time units.
-- use in run-time units. Note, since it is a ghost unit, all subprograms are
-- marked as imported.
-- Ghost code in this unit is meant for analysis only, not for run-time
-- checking. This is enforced by setting the assertion policy to Ignore.
@@ -36,16 +38,20 @@ is
type Big_Integer is private
with Integer_Literal => From_Universal_Image;
-- Private type that holds the integer value
function Is_Valid (Arg : Big_Integer) return Boolean
with
Import,
Global => null;
-- Return whether a passed big integer is valid
subtype Valid_Big_Integer is Big_Integer
with Dynamic_Predicate => Is_Valid (Valid_Big_Integer),
Predicate_Failure => raise Program_Error;
-- Holds a valid Big_Integer
-- Comparison operators defined for valid Big_Integer values
function "=" (L, R : Valid_Big_Integer) return Boolean with
Import,
Global => null;
@@ -70,18 +76,21 @@ is
with
Import,
Global => null;
-- Create a Big_Integer from an Integer value
subtype Big_Positive is Big_Integer
with Dynamic_Predicate =>
(if Is_Valid (Big_Positive)
then Big_Positive > To_Big_Integer (0)),
Predicate_Failure => raise Constraint_Error;
-- Positive subtype of Big_Integers, analogous to Positive and Integer
subtype Big_Natural is Big_Integer
with Dynamic_Predicate =>
(if Is_Valid (Big_Natural)
then Big_Natural >= To_Big_Integer (0)),
Predicate_Failure => raise Constraint_Error;
-- Natural subtype of Big_Integers, analogous to Natural and Integer
function In_Range
(Arg : Valid_Big_Integer; Low, High : Big_Integer) return Boolean
@@ -89,6 +98,7 @@ is
with
Import,
Global => null;
-- Check whether Arg is in the range Low .. High
function To_Integer (Arg : Valid_Big_Integer) return Integer
with
@@ -98,14 +108,18 @@ is
High => To_Big_Integer (Integer'Last))
or else raise Constraint_Error,
Global => null;
-- Convert a valid Big_Integer into an Integer
generic
type Int is range <>;
package Signed_Conversions is
-- Generic package to implement conversion functions for
-- arbitrary ranged types.
function To_Big_Integer (Arg : Int) return Valid_Big_Integer
with
Global => null;
-- Convert a ranged type into a valid Big_Integer
function From_Big_Integer (Arg : Valid_Big_Integer) return Int
with
@@ -114,15 +128,19 @@ is
High => To_Big_Integer (Int'Last))
or else raise Constraint_Error,
Global => null;
-- Convert a valid Big_Integer into a ranged type
end Signed_Conversions;
generic
type Int is mod <>;
package Unsigned_Conversions is
-- Generic package to implement conversion functions for
-- arbitrary modular types.
function To_Big_Integer (Arg : Int) return Valid_Big_Integer
with
Global => null;
-- Convert a modular type into a valid Big_Integer
function From_Big_Integer (Arg : Valid_Big_Integer) return Int
with
@@ -131,6 +149,7 @@ is
High => To_Big_Integer (Int'Last))
or else raise Constraint_Error,
Global => null;
-- Convert a valid Big_Integer into a modular type
end Unsigned_Conversions;
@@ -138,10 +157,12 @@ is
with
Import,
Global => null;
-- Create a valid Big_Integer from a String
function From_Universal_Image (Arg : String) return Valid_Big_Integer
renames From_String;
-- Mathematical operators defined for valid Big_Integer values
function "+" (L : Valid_Big_Integer) return Valid_Big_Integer
with
Import,
@@ -209,10 +230,12 @@ is
Pre => (L /= To_Big_Integer (0) and R /= To_Big_Integer (0))
or else raise Constraint_Error,
Global => null;
-- Calculate the greatest common divisor for two Big_Integer values
private
pragma SPARK_Mode (Off);
type Big_Integer is null record;
-- Solely consists of Ghost code
end Ada.Numerics.Big_Numbers.Big_Integers_Ghost;

View File

@@ -13,9 +13,18 @@
-- --
------------------------------------------------------------------------------
-- This package defines the base types used for big numbers in Ada as defined
-- by ARM A.5.5.
package Ada.Numerics.Big_Numbers
with Pure
is
subtype Field is Integer range 0 .. 255;
-- The width of a big number. This is used when converting
-- the internal representation into a string.
subtype Number_Base is Integer range 2 .. 16;
-- The base of a big number. This is used when converting
-- the internal representation into a string.
end Ada.Numerics.Big_Numbers;

View File

@@ -13,23 +13,24 @@
-- --
------------------------------------------------------------------------------
-- This package is the top of the Ada.Numerics hierarchy as defined by ARM
-- A.5. It provides an exception used by all children and basic mathematical
-- constants.
package Ada.Numerics is
pragma Pure;
Argument_Error : exception;
-- The Argument_Error exception is raised whenever an invalid
-- value has passed as an argument to the subprograms defined
-- this this package and its children.
Pi : constant :=
3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511;
-- ["03C0"] : constant := Pi;
-- This is the Greek letter Pi (for Ada 2005 AI-388). Note that it is
-- conforming to have this constant present even in Ada 95 mode, as there
-- is no way for a normal mode Ada 95 program to reference this identifier.
-- ???This is removed for now, because nobody uses it, and it causes
-- trouble for tools other than the compiler. If people want to use the
-- Greek letter in their programs, they can easily define it themselves.
-- The mathematical constant Pi
e : constant :=
2.71828_18284_59045_23536_02874_71352_66249_77572_47093_69996;
-- The mathematical constant e
end Ada.Numerics;

View File

@@ -13,11 +13,15 @@
-- --
------------------------------------------------------------------------------
-- This package is defined by ARM 13.9 to implement unchecked type
-- conversions.
generic
type Source (<>) is limited private;
type Target (<>) is limited private;
function Ada.Unchecked_Conversion (S : Source) return Target;
-- Returns the bit pattern of ``S`` for type ``Target``
pragma No_Elaboration_Code_All (Ada.Unchecked_Conversion);
pragma Pure (Ada.Unchecked_Conversion);

View File

@@ -13,6 +13,9 @@
-- --
------------------------------------------------------------------------------
-- This package is defined by ARM 13.11.2 to implement unchecked storage
-- deallocation of an object designated by a value of an access type.
generic
type Object (<>) is limited private;
type Name is access Object;
@@ -21,6 +24,8 @@ procedure Ada.Unchecked_Deallocation (X : in out Name) with
Depends => (X => null, -- X on exit does not depend on its input value
null => X), -- X's input value has no effect
Post => X = null; -- X's output value is null
-- Deallocate object denoted by X, and set X to null.
pragma Preelaborate (Unchecked_Deallocation);
pragma Import (Intrinsic, Ada.Unchecked_Deallocation);

View File

@@ -13,6 +13,8 @@
-- --
------------------------------------------------------------------------------
-- This is an empty package at the top of the Ada package hierarchy
package Ada is
pragma No_Elaboration_Code_All;
pragma Pure;

View File

@@ -57,7 +57,7 @@ package GNAT.Debug_Utilities is
function Image (S : String) return String;
-- Returns a string image of S, obtained by prepending and appending
-- quote (") characters and doubling any quote characters in the string.
-- The maximum length of the result is thus 2 ** S'Length + 2.
-- The maximum length of the result is thus 2 * S'Length + 2.
function Image (A : System.Address) return Image_String;
-- Returns a string of the form 16#hhhh_hhhh# for 32-bit addresses

View File

@@ -29,8 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package provides facilities for obtaining information on secondary
-- stack usage. See System.Secondary_Stack for documentation.
-- This package provides a public interface to the internal package
-- ``System.Secondary_Stack``. It allows users to query the current high water
-- mark of the secondary stack, the stack used to return unconstrained types.
with System.Secondary_Stack;
@@ -38,5 +39,7 @@ package GNAT.Secondary_Stack_Info is
function SS_Get_Max return Long_Long_Integer
renames System.Secondary_Stack.SS_Get_Max;
-- Return the high water mark of the secondary stack for the current
-- secondary stack in bytes.
end GNAT.Secondary_Stack_Info;

View File

@@ -58,11 +58,15 @@ is
Import, Convention => Intrinsic;
-- Return the name of the current file, not including the path information.
-- The result is considered to be a static string constant.
--
-- This function is an intrinsic, implemented by the compiler.
function Line return Positive with
Import, Convention => Intrinsic;
-- Return the current input line number. The result is considered to be a
-- static expression.
--
-- This function is an intrinsic, implemented by the compiler.
function Source_Location return String with
Volatile_Function,
@@ -74,6 +78,8 @@ is
-- additional suffixes of the same form are appended after the separating
-- string " instantiated at ". The result is considered to be a static
-- string constant.
--
-- This function is an intrinsic, implemented by the compiler.
function Enclosing_Entity return String with
Volatile_Function,
@@ -90,12 +96,16 @@ is
-- the string returned will be the name of the instance, not the generic
-- package itself. This is useful in identifying and logging information
-- from within generic templates.
--
-- This function is an intrinsic, implemented by the compiler.
function Compilation_ISO_Date return String with
Volatile_Function,
Global => Source_Code_Information,
Import, Convention => Intrinsic;
-- Returns date of compilation as a static string "yyyy-mm-dd".
--
-- This function is an intrinsic, implemented by the compiler.
function Compilation_Date return String with
Volatile_Function,
@@ -103,6 +113,8 @@ is
Import, Convention => Intrinsic;
-- Returns date of compilation as a static string "mmm dd yyyy". This is
-- in local time form, and is exactly compatible with C macro __DATE__.
--
-- This function is an intrinsic, implemented by the compiler.
function Compilation_Time return String with
Volatile_Function,
@@ -110,5 +122,7 @@ is
Import, Convention => Intrinsic;
-- Returns GMT time of compilation as a static string "hh:mm:ss". This is
-- in local time form, and is exactly compatible with C macro __TIME__.
--
-- This function is an intrinsic, implemented by the compiler.
end GNAT.Source_Info;

View File

@@ -29,9 +29,12 @@
-- --
------------------------------------------------------------------------------
-- This is the parent package for a library of useful units provided with GNAT
-- This is parent package of the GNAT package hierarchy, a collection of
-- useful packages provided with GNAT. It contains types and exception
-- definitions that a commonly used by GNAT child packages. As definitions
-- these do not appear in the runtime code if they are not used.
-- Note: this unit is used during bootstrap, see ADA_GENERATED_FILES in
-- This unit is used during bootstrap, see ADA_GENERATED_FILES in
-- gcc-interface/Make-lang.in for details on the constraints.
package GNAT is

View File

@@ -29,8 +29,11 @@
-- --
------------------------------------------------------------------------------
-- This package contains additional C-related definitions, intended for use
-- with either manually or automatically generated bindings to C libraries.
-- This package contains additional C type definitions that are not defined
-- by ARM B.2 and is intended for use with manual or automatically generated
-- bindings to C libraries. Specifically, it defines types for bitfields,
-- C void types, incomplete and unknown structs and classes, C bool, 64-bit
-- and 128-bit types, and 128-bit floating-point types.
with System;
@@ -54,39 +57,38 @@ package Interfaces.C.Extensions is
type incomplete_class_def_ptr is access incomplete_class_def;
for incomplete_class_def_ptr'Storage_Size use 0;
-- C bool
subtype bool is Interfaces.C.C_bool;
-- C bool
-- 64-bit integer types
subtype long_long is Interfaces.C.long_long;
subtype unsigned_long_long is Interfaces.C.unsigned_long_long;
-- 128-bit integer type available on 64-bit platforms:
-- typedef int signed_128 __attribute__ ((mode (TI)));
type Signed_128 is record
low, high : unsigned_long_long;
end record;
-- 128-bit integer type available on 64-bit platforms:
-- typedef int signed_128 __attribute__ ((mode (TI)));
pragma Convention (C_Pass_By_Copy, Signed_128);
for Signed_128'Alignment use unsigned_long_long'Alignment * 2;
-- 128-bit floating-point type available on x86:
-- typedef float float_128 __attribute__ ((mode (TF)));
type Float_128 is record
low, high : unsigned_long_long;
end record;
-- 128-bit floating-point type available on x86:
-- typedef float float_128 __attribute__ ((mode (TF)));
pragma Convention (C_Pass_By_Copy, Float_128);
for Float_128'Alignment use unsigned_long_long'Alignment * 2;
-- 128-bit complex floating-point type available on x86:
-- typedef _Complex float cfloat_128 __attribute__ ((mode (TC)));
type CFloat_128 is record
re, im : Float_128;
end record;
-- 128-bit complex floating-point type available on x86:
-- typedef _Complex float cfloat_128 __attribute__ ((mode (TC)));
pragma Convention (C_Pass_By_Copy, CFloat_128);
-- Types for bitfields

View File

@@ -29,8 +29,11 @@
-- --
------------------------------------------------------------------------------
-- This package contains additional C-related definitions, intended for use
-- with either manually or automatically generated bindings to C libraries.
-- This package contains additional C type definitions that are not defined
-- by ARM B.2 and is intended for use with manual or automatically generated
-- bindings to C libraries. Specifically, it defines types for bitfields,
-- C void types, incomplete and unknown structs and classes, C bool, 64-bit
-- and 128-bit types, and 128-bit floating-point types.
with System;
@@ -54,30 +57,29 @@ package Interfaces.C.Extensions is
type incomplete_class_def_ptr is access incomplete_class_def;
for incomplete_class_def_ptr'Storage_Size use 0;
-- C bool
subtype bool is Interfaces.C.C_bool;
-- C bool
-- 64-bit integer types
subtype long_long is Interfaces.C.long_long;
subtype unsigned_long_long is Interfaces.C.unsigned_long_long;
-- 128-bit floating-point type available on x86:
-- typedef float float_128 __attribute__ ((mode (TF)));
type Float_128 is record
low, high : unsigned_long_long;
end record;
-- 128-bit floating-point type available on x86:
-- typedef float float_128 __attribute__ ((mode (TF)));
pragma Convention (C_Pass_By_Copy, Float_128);
for Float_128'Alignment use unsigned_long_long'Alignment * 2;
-- 128-bit complex floating-point type available on x86:
-- typedef _Complex float cfloat_128 __attribute__ ((mode (TC)));
type CFloat_128 is record
re, im : Float_128;
end record;
-- 128-bit complex floating-point type available on x86:
-- typedef _Complex float cfloat_128 __attribute__ ((mode (TC)));
pragma Convention (C_Pass_By_Copy, CFloat_128);
-- Types for bitfields

View File

@@ -43,6 +43,7 @@ is
-- since arbitrary addresses can be converted, and it is quite likely that
-- this type will in fact be used for aliasing values of other types.
-- Convert between chars_ptr and a C pointer
function To_chars_ptr is
new Ada.Unchecked_Conversion (System.Parameters.C_Address, chars_ptr);
@@ -73,9 +74,12 @@ is
function Memory_Alloc (Size : size_t) return chars_ptr;
pragma Import (C, Memory_Alloc, System.Parameters.C_Malloc_Linkname);
-- Allocate a chunk of memory on the heap
procedure Memory_Free (Address : chars_ptr);
pragma Import (C, Memory_Free, "__gnat_free");
-- Deallocate a previously allocated chunk of memory from the heap. On
-- runtimes that do not allow deallocation this is a no-op.
---------
-- "+" --

View File

@@ -33,6 +33,10 @@
-- --
------------------------------------------------------------------------------
-- This package declares types and subprograms that allow the allocation,
-- reference, update and deallocation of C-style strings, as defined by
-- ARM B.3.1.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
-- setting the corresponding assertion policy to Ignore. These preconditions
@@ -49,6 +53,7 @@ package Interfaces.C.Strings with
is
pragma Preelaborate;
-- Definitions for C character arrays
type char_array_access is access all char_array;
for char_array_access'Size use System.Parameters.ptr_bits;
@@ -63,30 +68,38 @@ is
type chars_ptr_array is array (size_t range <>) of aliased chars_ptr;
Null_Ptr : constant chars_ptr;
-- Null value for private type chars_ptr
function To_Chars_Ptr
(Item : char_array_access;
Nul_Check : Boolean := False) return chars_ptr
with
SPARK_Mode => Off; -- To_Chars_Ptr'Result is aliased with Item
-- Extract raw chars_ptr from char_array access type
function New_Char_Array (Chars : char_array) return chars_ptr with
Volatile_Function,
Post => New_Char_Array'Result /= Null_Ptr,
Global => (Input => C_Memory);
-- Copy the contents of Chars into a newly allocated chars_ptr
function New_String (Str : String) return chars_ptr with
Volatile_Function,
Post => New_String'Result /= Null_Ptr,
Global => (Input => C_Memory);
-- Copy the contents of Str into a newly allocated chars_ptr
procedure Free (Item : in out chars_ptr) with
SPARK_Mode => Off;
-- When deallocation is prohibited (eg: cert runtimes) this routine
-- will raise Program_Error
-- will raise Program_Error.
Dereference_Error : exception;
-- This exception is raised when a subprogram of this unit tries to
-- dereference a chars_ptr with the value Null_Ptr.
-- The Value functions copy the contents of a chars_ptr object
-- into a char_array/String.
function Value (Item : chars_ptr) return char_array with
Pre => Item /= Null_Ptr,
Global => (Input => C_Memory);
@@ -112,7 +125,11 @@ is
function Strlen (Item : chars_ptr) return size_t with
Pre => Item /= Null_Ptr,
Global => (Input => C_Memory);
-- Return the length of a string contained in a chars_ptr
-- Update the contents of a chars_ptr with a char_array/String. If the
-- update exceeds the original length of the chars_ptr the Update_Error
-- exception is raised.
procedure Update
(Item : chars_ptr;
Offset : size_t;

View File

@@ -35,15 +35,26 @@
-- This is the runtime version of this unit (not used during GNAT build)
-- ``Interfaces`` is the parent of several library packages that declare types
-- and other entities useful for interfacing to foreign languages as defined
-- by ARM B.2.
--
-- It defines signed and modular integer types of 8, 16, 32, 64 and 128 bits.
-- For each such modular type, shifting and rotating intrinsic subprograms
-- are specified. There is also the definition of IEEE 754 floating point
-- types (``IEEE_Float_32``, ``IEEE_Float_64``, and ``IEEE_Extended_Float``).
package Interfaces with
Always_Terminates
is
pragma No_Elaboration_Code_All;
pragma Pure;
pragma Implementation_Defined;
-- All identifiers in this unit are implementation defined
pragma Implementation_Defined;
-- Definitions of 8, 16, 24, 32, 64 and 128 bit signed and unsigned integer
-- types.
type Integer_8 is range -2 ** 7 .. 2 ** 7 - 1;
for Integer_8'Size use 8;
@@ -56,15 +67,15 @@ is
type Integer_64 is new Long_Long_Integer;
for Integer_64'Size use 64;
-- Note: we use Long_Long_Integer'First instead of -2 ** 63 to allow this
-- unit to compile when using custom target configuration files where the
-- maximum integer is 32 bits. This is useful for static analysis tools
-- such as SPARK or CodePeer. In the normal case Long_Long_Integer is
-- always 64-bits so we get the desired 64-bit type.
-- We use Long_Long_Integer'First instead of -2 ** 63 to allow this unit to
-- compile when using custom target configuration files where the maximum
-- integer is 32 bits. This is useful for static analysis tools such as
-- SPARK or CodePeer. In the normal case Long_Long_Integer is 64-bits so we
-- get the desired 64-bit type.
type Integer_128 is new Long_Long_Long_Integer;
-- Note: we use Long_Long_Long_Integer instead of literal bounds to allow
-- this unit to be compiled with compilers not supporting 128-bit integers.
-- We use Long_Long_Long_Integer instead of literal bounds to allow this
-- unit to be compiled with compilers not supporting 128-bit integers.
-- We do not put a confirming size clause of 128 bits for the same reason.
type Unsigned_8 is mod 2 ** 8;
@@ -88,6 +99,8 @@ is
type Unsigned_128 is mod 2 ** Long_Long_Long_Integer'Size;
-- See comment on Integer_128 above
-- Compiler intrinsics implemented by the compiler
function Shift_Left
(Value : Unsigned_8;
Amount : Natural) return Unsigned_8
@@ -221,9 +234,9 @@ is
type IEEE_Float_64 is digits 15;
for IEEE_Float_64'Size use 64;
-- If there is an IEEE extended float available on the machine, we assume
-- that it is available as Long_Long_Float.
-- If there is an IEEE extended float available on the machine, we
-- assume that it is available as Long_Long_Float.
--
-- Note: it is harmless, and explicitly permitted, to include additional
-- types in interfaces, so it is not wrong to have IEEE_Extended_Float
-- defined even if the extended format is not available.

View File

@@ -13,6 +13,8 @@
-- --
------------------------------------------------------------------------------
-- This package is a renaming of :ref:`system.machine_code`
with System.Machine_Code;
package Machine_Code renames System.Machine_Code;

View File

@@ -31,14 +31,14 @@
-- This package provides arithmetic and logical operations on type Address.
-- It is intended for use by other packages in the System hierarchy. For
-- applications requiring this capability, see System.Storage_Elements or
-- the operations introduced in System.Aux_DEC;
-- The reason we need this package is that arithmetic operations may not
-- be available in the case where type Address is non-private and the
-- operations have been made abstract in the spec of System (to avoid
-- inappropriate use by applications programs). In addition, the logical
-- operations may not be available if type Address is a signed integer.
-- applications requiring this capability, use `System.Storage_Elements`
-- instead.
--
-- The reason for this package is that arithmetic operations may not be
-- available in the case where type Address is non-private and the operations
-- have been made abstract in the spec of System (to avoid inappropriate use
-- by applications programs). In addition, the logical operations may not be
-- available if type Address is a signed integer.
package System.Address_Operations is
pragma Pure;
@@ -47,24 +47,29 @@ package System.Address_Operations is
-- a modular type with the same length as Address, i.e. they provide
-- twos complement wrap around arithmetic treating the address value
-- as an unsigned value, with no overflow checking.
--
-- Note that we do not use the infix names for these operations to
-- avoid problems with ambiguities coming from declarations in package
-- Standard (which may or may not be visible depending on the exact
-- form of the declaration of type System.Address).
--
-- For addition, subtraction, and multiplication, the effect of overflow
-- is 2's complement wrapping (as though the type Address were unsigned).
--
-- For division and modulus operations, the caller is responsible for
-- ensuring that the Right argument is non-zero, and the effect of the
-- call is not specified if a zero argument is passed.
function AddA (Left, Right : Address) return Address;
-- Computes the sum of ``Left`` and ``Right``
function SubA (Left, Right : Address) return Address;
-- Computes the difference between ``Left`` and ``Right``
function MulA (Left, Right : Address) return Address;
-- Computes the product of ``Left`` and ``Right``
function DivA (Left, Right : Address) return Address;
-- Computes the quotient of ``Left`` and ``Right``
function ModA (Left, Right : Address) return Address;
-- Computes the modulus of ``Left`` and ``Right``
-- The semantics of the logical operations are those that apply to
-- a modular type with the same length as Address, i.e. they provide
@@ -72,7 +77,9 @@ package System.Address_Operations is
-- bit if Address is a signed integer type).
function AndA (Left, Right : Address) return Address;
-- Computes the bit-wise 'and' mask of ``Left`` and ``Right``
function OrA (Left, Right : Address) return Address;
-- Computes the bit-wise 'or' mask of ``Left`` and ``Right``
pragma Inline_Always (AddA);
pragma Inline_Always (SubA);

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package provides software routines for doing arithmetic on "double"
-- signed integer values in cases where either overflow checking is required,
-- or intermediate results are longer than the result type.
-- This generic package provides software routines for doing arithmetic on
-- double word signed integer values in cases where either overflow checking
-- is required, or intermediate results are longer than the result type.
with Ada.Numerics.Big_Numbers.Big_Integers_Ghost;
@@ -100,24 +100,45 @@ is
with
Pre => In_Double_Int_Range (Big (X) + Big (Y)),
Post => Add_With_Ovflo_Check'Result = X + Y;
-- Raises Constraint_Error if sum of operands overflows Double_Int,
-- otherwise returns the signed integer sum.
-- Raises Constraint_Error if sum of operands overflows 64 bits,
-- otherwise returns the 64-bit signed integer sum.
--
-- The sum of ``X`` and ``Y`` is first computed using wrap-around
-- semantics.
--
-- If the sign of ``X`` and ``Y`` are opposed, no overflow is possible and
-- the result is correct.
--
-- Otherwise, ``X`` and ``Y`` have the same sign; if the sign of the result
-- is not identical to ``X`` (or ``Y``), then an overflow occurred and
-- the exception *Constraint_Error* is raised; otherwise the result is
-- correct.
function Subtract_With_Ovflo_Check (X, Y : Double_Int) return Double_Int
with
Pre => In_Double_Int_Range (Big (X) - Big (Y)),
Post => Subtract_With_Ovflo_Check'Result = X - Y;
-- Raises Constraint_Error if difference of operands overflows Double_Int,
-- otherwise returns the signed integer difference.
-- Raises Constraint_Error if difference of operands overflows 64
-- bits, otherwise returns the 64-bit signed integer difference.
--
-- The logic of the implementation is reversed from *Add_With_Ovflo_Check*:
-- if ``X`` and ``Y`` have the same sign, no overflow is checked, otherwise
-- a sign of the result is compared with the sign of ``X`` to check for
-- overflow.
function Multiply_With_Ovflo_Check (X, Y : Double_Int) return Double_Int
with
Pre => In_Double_Int_Range (Big (X) * Big (Y)),
Post => Multiply_With_Ovflo_Check'Result = X * Y;
pragma Convention (C, Multiply_With_Ovflo_Check);
-- Raises Constraint_Error if product of operands overflows Double_Int,
-- otherwise returns the signed integer product. Gigi may also call this
-- routine directly.
-- Raises Constraint_Error if product of operands overflows 64
-- bits, otherwise returns the 64-bit signed integer product.
-- GIGI may also call this routine directly.
--
-- The multiplication is done using pencil and paper algorithm using base
-- 2**32. The multiplication is done on unsigned values, then the correct
-- signed value is returned. Overflow check is performed by looking at
-- higher digits.
function Same_Sign (X, Y : Big_Integer) return Boolean is
(X = Big (Double_Int'(0))
@@ -153,13 +174,32 @@ is
Big (X) * Big (Y) / Big (Z), Big (R))
else
Big (Q) = Big (X) * Big (Y) / Big (Z));
-- Performs the division of (X * Y) / Z, storing the quotient in Q
-- and the remainder in R. Constraint_Error is raised if Z is zero,
-- or if the quotient does not fit in Double_Int. Round indicates if
-- the result should be rounded. If Round is False, then Q, R are
-- the normal quotient and remainder from a truncating division.
-- If Round is True, then Q is the rounded quotient. The remainder
-- R is not affected by the setting of the Round flag.
-- Performs the division of (``X`` * ``Y``) / ``Z``, storing the quotient
-- in ``Q`` and the remainder in ``R``.
--
-- Constraint_Error is raised if ``Z`` is zero, or if the quotient does not
-- fit in ``Double_Int``.
--
-- ``Round`` indicates if the result should be rounded. If ``Round`` is
-- False, then ``Q``, ``R`` are the normal quotient and remainder from a
-- truncating division. If ``Round`` is True, then ``Q`` is the rounded
-- quotient. The remainder ``R`` is not affected by the setting of the
-- ``Round`` flag.
--
-- The multiplication is done using pencil and paper algorithm using base
-- 2**32. The multiplication is done on unsigned values. The result is a
-- 128 bit value.
--
-- The overflow is detected on the intermediate value.
--
-- If Z is a 32 bit value, the division is done using pencil and paper
-- algorithm.
--
-- Otherwise, the division is performed using the algorithm D from section
-- 4.3.1 of "The Art of Computer Programming Vol. 2" [TACP2]. Rounding is
-- applied on the result.
--
-- Finally, the sign is applied to the result and returned.
procedure Double_Divide
(X, Y, Z : Double_Int;
@@ -180,12 +220,26 @@ is
Big (X) / (Big (Y) * Big (Z)), Big (R))
else
Big (Q) = Big (X) / (Big (Y) * Big (Z)));
-- Performs the division X / (Y * Z), storing the quotient in Q and
-- the remainder in R. Constraint_Error is raised if Y or Z is zero,
-- or if the quotient does not fit in Double_Int. Round indicates if the
-- result should be rounded. If Round is False, then Q, R are the normal
-- quotient and remainder from a truncating division. If Round is True,
-- then Q is the rounded quotient. The remainder R is not affected by the
-- setting of the Round flag.
-- Performs the division ``X`` / (``Y`` * ``Z``), storing the quotient in
-- ``Q`` and the remainder in ``R``. Constraint_Error is raised if ``Y`` or
-- ``Z`` is zero, or if the quotient does not fit in ``Double_Int``.
--
-- ``Round`` indicates if the result should be rounded. If ``Round`` is
-- False, then ``Q``, ``R`` are the normal quotient and remainder from a
-- truncating division. If ``Round`` is True, then ``Q`` is the rounded
-- quotient. The remainder ``R`` is not affected by the setting of the
-- ``Round`` flag.
--
-- Division by 0 is first detected.
--
-- The intermediate value ``Y`` * ``Z`` is then computed on 128 bits. The
-- multiplication is done on unsigned values.
--
-- If the high 64 bits of the intermediate value is not 0, then 0 is
-- returned. The overflow case of the largest negative number divided by
-- -1 is detected here.
--
-- 64-bit division is then performed, the result is rounded, its sign is
-- corrected, and then returned.
end System.Arith_Double;

View File

@@ -106,12 +106,31 @@ is
Big (X) * Big (Y) / Big (Z), Big (R))
else
Big (Q) = Big (X) * Big (Y) / Big (Z));
-- Performs the division of (X * Y) / Z, storing the quotient in Q
-- and the remainder in R. Constraint_Error is raised if Z is zero,
-- or if the quotient does not fit in 32 bits. Round indicates if
-- the result should be rounded. If Round is False, then Q, R are
-- the normal quotient and remainder from a truncating division.
-- If Round is True, then Q is the rounded quotient. The remainder
-- R is not affected by the setting of the Round flag.
-- Performs the division of (``X`` * ``Y``) / ``Z``, storing the quotient
-- in ``Q`` and the remainder in ``R``.
--
-- Constraint_Error is raised if ``Z`` is zero, or if the quotient does not
-- fit in 32-bits.
--
-- ``Round`` indicates if the result should be rounded. If ``Round`` is
-- False, then ``Q``, ``R`` are the normal quotient and remainder from a
-- truncating division. If ``Round`` is True, then ``Q`` is the rounded
-- quotient. The remainder ``R`` is not affected by the setting of the
-- ``Round`` flag.
--
-- The multiplication is done using pencil and paper algorithm using base
-- 2**32. The multiplication is done on unsigned values. The result is a
-- 128 bit value.
--
-- The overflow is detected on the intermediate value.
--
-- If Z is a 32 bit value, the division is done using pencil and paper
-- algorithm.
--
-- Otherwise, the division is performed using the algorithm D from section
-- 4.3.1 of "The Art of Computer Programming Vol. 2" [TACP2]. Rounding is
-- applied on the result.
--
-- Finally, the sign is applied to the result and returned.
end System.Arith_32;

View File

@@ -81,6 +81,17 @@ is
Post => Add_With_Ovflo_Check64'Result = X + Y;
-- Raises Constraint_Error if sum of operands overflows 64 bits,
-- otherwise returns the 64-bit signed integer sum.
--
-- The sum of ``X`` and ``Y`` is first computed using wrap-around
-- semantics.
--
-- If the sign of ``X`` and ``Y`` are opposed, no overflow is possible and
-- the result is correct.
--
-- Otherwise, ``X`` and ``Y`` have the same sign; if the sign of the result
-- is not identical to ``X`` (or ``Y``), then an overflow occurred and
-- the exception *Constraint_Error* is raised; otherwise the result is
-- correct.
function Subtract_With_Ovflo_Check64 (X, Y : Int64) return Int64
with
@@ -88,6 +99,11 @@ is
Post => Subtract_With_Ovflo_Check64'Result = X - Y;
-- Raises Constraint_Error if difference of operands overflows 64
-- bits, otherwise returns the 64-bit signed integer difference.
--
-- The logic of the implementation is reversed from *Add_With_Ovflo_Check*:
-- if ``X`` and ``Y`` have the same sign, no overflow is checked, otherwise
-- a sign of the result is compared with the sign of ``X`` to check for
-- overflow.
function Multiply_With_Ovflo_Check64 (X, Y : Int64) return Int64
with
@@ -96,7 +112,12 @@ is
pragma Export (C, Multiply_With_Ovflo_Check64, "__gnat_mulv64");
-- Raises Constraint_Error if product of operands overflows 64
-- bits, otherwise returns the 64-bit signed integer product.
-- Gigi may also call this routine directly.
-- GIGI may also call this routine directly.
--
-- The multiplication is done using pencil and paper algorithm using base
-- 2**32. The multiplication is done on unsigned values, then the correct
-- signed value is returned. Overflow check is performed by looking at
-- higher digits.
function Same_Sign (X, Y : Big_Integer) return Boolean is
(X = Big (Int64'(0))
@@ -132,13 +153,32 @@ is
Big (X) * Big (Y) / Big (Z), Big (R))
else
Big (Q) = Big (X) * Big (Y) / Big (Z));
-- Performs the division of (X * Y) / Z, storing the quotient in Q
-- and the remainder in R. Constraint_Error is raised if Z is zero,
-- or if the quotient does not fit in 64 bits. Round indicates if
-- the result should be rounded. If Round is False, then Q, R are
-- the normal quotient and remainder from a truncating division.
-- If Round is True, then Q is the rounded quotient. The remainder
-- R is not affected by the setting of the Round flag.
-- Performs the division of (``X`` * ``Y``) / ``Z``, storing the quotient
-- in ``Q`` and the remainder in ``R``.
--
-- Constraint_Error is raised if ``Z`` is zero, or if the quotient does not
-- fit in 64-bits.
--
-- ``Round`` indicates if the result should be rounded. If ``Round`` is
-- False, then ``Q``, ``R`` are the normal quotient and remainder from a
-- truncating division. If ``Round`` is True, then ``Q`` is the rounded
-- quotient. The remainder ``R`` is not affected by the setting of the
-- ``Round`` flag.
--
-- The multiplication is done using pencil and paper algorithm using base
-- 2**32. The multiplication is done on unsigned values. The result is a
-- 128 bit value.
--
-- The overflow is detected on the intermediate value.
--
-- If Z is a 32 bit value, the division is done using pencil and paper
-- algorithm.
--
-- Otherwise, the division is performed using the algorithm D from section
-- 4.3.1 of "The Art of Computer Programming Vol. 2" [TACP2]. Rounding is
-- applied on the result.
--
-- Finally, the sign is applied to the result and returned.
procedure Scaled_Divide
(X, Y, Z : Int64;
@@ -165,13 +205,27 @@ is
Big (X) / (Big (Y) * Big (Z)), Big (R))
else
Big (Q) = Big (X) / (Big (Y) * Big (Z)));
-- Performs the division X / (Y * Z), storing the quotient in Q and
-- the remainder in R. Constraint_Error is raised if Y or Z is zero,
-- or if the quotient does not fit in 64 bits. Round indicates if the
-- result should be rounded. If Round is False, then Q, R are the normal
-- quotient and remainder from a truncating division. If Round is True,
-- then Q is the rounded quotient. The remainder R is not affected by the
-- setting of the Round flag.
-- Performs the division ``X`` / (``Y`` * ``Z``), storing the quotient in
-- ``Q`` and the remainder in ``R``. Constraint_Error is raised if ``Y`` or
-- ``Z`` is zero, or if the quotient does not fit in 64-bits.
--
-- ``Round`` indicates if the result should be rounded. If ``Round`` is
-- False, then ``Q``, ``R`` are the normal quotient and remainder from a
-- truncating division. If ``Round`` is True, then ``Q`` is the rounded
-- quotient. The remainder ``R`` is not affected by the setting of the
-- ``Round`` flag.
--
-- Division by 0 is first detected.
--
-- The intermediate value ``Y`` * ``Z`` is then computed on 128 bits. The
-- multiplication is done on unsigned values.
--
-- If the high 64 bits of the intermediate value is not 0, then 0 is
-- returned. The overflow case of the largest negative number divided by
-- -1 is detected here.
--
-- 64-bit division is then performed, the result is rounded, its sign is
-- corrected, and then returned.
procedure Double_Divide
(X, Y, Z : Int64;

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package provides support for assertions (including pragma Assert,
-- pragma Debug, and Precondition/Postcondition/Predicate/Invariant aspects
-- and their corresponding pragmas).
-- This package provides support for assertions (including ``pragma Assert``,
-- ``pragma Debug``, and Precondition/Postcondition/Predicate/Invariant
-- aspects and their corresponding pragmas).
-- This unit may be used directly from an application program by providing
-- an appropriate WITH, and the interface can be expected to remain stable.

View File

@@ -33,6 +33,9 @@
-- --
------------------------------------------------------------------------------
-- Provides the means to convert addresses to access types as defined by ARM
-- 13.7.2.
generic
type Object (<>) is limited private;
@@ -46,6 +49,7 @@ package System.Address_To_Access_Conversions is
type Object_Pointer is access all Object;
for Object_Pointer'Size use Standard'Address_Size;
-- Access type definition to the object
pragma No_Strict_Aliasing (Object_Pointer);
-- Strictly speaking, this routine should not be used to generate pointers
@@ -56,8 +60,15 @@ package System.Address_To_Access_Conversions is
function To_Pointer (Value : Address) return Object_Pointer with
Global => null;
-- Return ``Value`` as an access to *Object*.
--
-- This function is an intrinsic so implemented by the compiler.
function To_Address (Value : Object_Pointer) return Address with
SPARK_Mode => Off;
-- Return ``Value`` as an *Address*.
--
-- This function is an intrinsic so implemented by the compiler.
pragma Import (Intrinsic, To_Pointer);
pragma Import (Intrinsic, To_Address);

View File

@@ -29,7 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package provides atomic counter on platforms where it is supported:
-- This package provides atomic counters routines
-- This package support the following platforms:
-- - all Alpha platforms
-- - all AARCH64 platforms
-- - all ARM platforms

View File

@@ -29,9 +29,8 @@
-- --
------------------------------------------------------------------------------
-- This package implements Atomic_Counter and Atomic_Unsigned operations for
-- platforms where GCC supports __atomic_add_fetch and __atomic_sub_fetch
-- builtins.
-- This package implements unsigned and signed atomic counters using GCC's
-- __atomic_add_fetch and __atomic_sub_fetch builtins.
with System.Atomic_Primitives; use System.Atomic_Primitives;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- This package contains both atomic primitives defined from GCC built-in
-- This package contains atomic primitives defined from GCC built-in
-- functions and operations used by the compiler to generate the lock-free
-- implementation of protected objects.

View File

@@ -29,11 +29,12 @@
-- --
------------------------------------------------------------------------------
-- Operations on packed bit strings
-- This package provides subprograms on bit strings. The compiler uses these
-- subprograms for packed array operations.
package System.Bit_Ops is
-- Note: in all the following routines, the System.Address parameters
-- In all the following routines, the System.Address parameters
-- represent the address of the first byte of an array used to represent
-- a packed array (of type System.Unsigned_Types.Packed_Bytes{1,2,4})
-- The length in bits is passed as a separate parameter. Note that all
@@ -45,30 +46,49 @@ package System.Bit_Ops is
Right : System.Address;
Rlen : Natural;
Result : System.Address);
-- Bitwise "and" of given bit string with result being placed in Result.
-- The and operation is allowed to destroy unused bits in the last byte,
-- i.e. to leave them set in an undefined manner. Note that Left, Right
-- and Result always have the same length in bits (Len).
-- Bitwise "and" of given bit string with result being placed in
-- ``Result``. The and operation is allowed to destroy unused bits in
-- the last byte, i.e. to leave them set in an undefined manner. Note that
-- ``Left``, ``Right`` and ``Result`` always have the same length in bits.
--
-- The procedure raises Constraint_Error if ``Llen`` and ``Rlen`` are not
-- equal.
--
-- The bitwise "and" operation is performed byte per byte, where the number
-- of bytes is the smallest number not less than ``Llen`` (or ``Rlen``)
-- divided by the 8.
function Bit_Eq
(Left : System.Address;
Llen : Natural;
Right : System.Address;
Rlen : Natural) return Boolean;
-- Left and Right are the addresses of two bit packed arrays with Llen
-- and Rlen being the respective length in bits. The routine compares the
-- two bit strings for equality, being careful not to include the unused
-- bits in the final byte. Note that the result is always False if Rlen
-- is not equal to Llen.
-- ``Left`` and ``Right`` are the addresses of two bit packed arrays with
-- ``Llen`` and ``Rlen`` being the respective length in bits. The routine
-- compares the two bit strings for equality, being careful not to include
-- the unused bits in the final byte.
--
-- Note that the result is always False if ``Rlen`` is not equal to
-- ``Llen``.
--
-- Otherwise all the bytes but the last one are compared, and False is
-- returned if they aren't equal. Only the ``Llen`` mod 8 bits of the last
-- byte are compared, and false is returned if they aren't equal.
--
-- Otherwise, True is returned.
procedure Bit_Not
(Opnd : System.Address;
Len : Natural;
Result : System.Address);
-- Bitwise "not" of given bit string with result being placed in Result.
-- The not operation is allowed to destroy unused bits in the last byte,
-- i.e. to leave them set in an undefined manner. Note that Result and
-- Opnd always have the same length in bits (Len).
-- Bitwise "not" of given bit string with result being placed in
-- ``Result``. The not operation is allowed to destroy unused bits in the
-- last byte, i.e. to leave them set in an undefined manner. Note that
-- ``Result`` and ``Opnd`` always have the same length in bits (``Len``).
--
-- The bitwise "not" operation is performed byte per byte, where the
-- number of bytes is the smallest number not less that ``Len`` divided by
-- the number of bits in a byte (8).
procedure Bit_Or
(Left : System.Address;
@@ -76,10 +96,13 @@ package System.Bit_Ops is
Right : System.Address;
Rlen : Natural;
Result : System.Address);
-- Bitwise "or" of given bit string with result being placed in Result.
-- Bitwise "or" of given bit string with result being placed in ``Result``.
-- The or operation is allowed to destroy unused bits in the last byte,
-- i.e. to leave them set in an undefined manner. Note that Left, Right
-- and Result always have the same length in bits (Len).
-- i.e. to leave them set in an undefined manner. Note that ``Left``,
-- ``Right`` and ``Result`` always have the same length in bits.
--
-- The implementation is similar to *Bit_And* but for the bitwise "or"
-- operation.
procedure Bit_Xor
(Left : System.Address;
@@ -87,9 +110,12 @@ package System.Bit_Ops is
Right : System.Address;
Rlen : Natural;
Result : System.Address);
-- Bitwise "xor" of given bit string with result being placed in Result.
-- The xor operation is allowed to destroy unused bits in the last byte,
-- i.e. to leave them set in an undefined manner. Note that Left, Right
-- and Result always have the same length in bits (Len).
-- Bitwise "xor" of given bit string with result being placed in
-- ``Result``. The xor operation is allowed to destroy unused bits in the
-- last byte, i.e. to leave them set in an undefined manner. Note that
-- ``Left``, ``Right`` and ``Result`` always have the same length in bits.
--
-- The implementation is similar to *Bit_And* but for the bitwise "xor"
-- operation.
end System.Bit_Ops;

View File

@@ -38,6 +38,7 @@ package System.Boolean_Array_Operations is
pragma Pure;
type Boolean_Array is array (Integer range <>) of Boolean;
-- The base type for the boolean array operations
package Boolean_Operations renames System.Vectors.Boolean_Operations;
@@ -52,14 +53,27 @@ package System.Boolean_Array_Operations is
procedure Vector_Not is
new Unary_Operation ("not", Boolean_Operations."not");
-- Instantiation of Unary_Operation with function *not*
procedure Vector_And is new Binary_Operation ("and", System.Vectors."and");
-- Instantiation of Binary_Operation with function *and*
procedure Vector_Or is new Binary_Operation ("or", System.Vectors."or");
-- Instantiation of Binary_Operation with function *or*
procedure Vector_Xor is new Binary_Operation ("xor", System.Vectors."xor");
-- Instantiation of Binary_Operation with function *xor*
procedure Vector_Nand is
new Binary_Operation (Boolean_Operations.Nand, Boolean_Operations.Nand);
-- Instantiation of Binary_Operation with function *nand*
procedure Vector_Nor is
new Binary_Operation (Boolean_Operations.Nor, Boolean_Operations.Nor);
-- Instantiation of Binary_Operation with function *nor*
procedure Vector_Nxor is
new Binary_Operation (Boolean_Operations.Nxor, Boolean_Operations.Nxor);
-- Instantiation of Binary_Operation with function *nxor*
end System.Boolean_Array_Operations;

View File

@@ -30,8 +30,8 @@
------------------------------------------------------------------------------
-- Intrinsic routines for byte swapping. These are used by the expanded code
-- (supporting alternative byte ordering), and by the GNAT.Byte_Swapping run
-- time package which provides user level routines for byte swapping.
-- (supporting alternative byte ordering), and by the ``GNAT.Byte_Swapping``
-- run-time package which provides user level routines for byte swapping.
with Interfaces;

View File

@@ -43,12 +43,23 @@ package System.Compare_Array_Signed_8 is
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Compare the array starting at address Left of length Left_Len
-- with the array starting at address Right of length Right_Len.
-- Compare the array starting at address ``Left`` of length ``Left_Len``
-- with the array starting at address ``Right`` of length ``Right_Len``.
-- The comparison is in the normal Ada semantic sense of array
-- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
-- Left>Right respectively. This function works with 4 byte words
-- if the operands are aligned on 4-byte boundaries and long enough.
-- comparison.
--
-- The result is -1, 0, +1 for ``Left`` < ``Right``, ``Left`` = ``Right``,
-- ``Left`` > ``Right`` respectively.
--
-- If addresses are not word aligned or if the length is less than a word,
-- then the result of *Compare_Array_S8_Unaligned* is returned.
--
-- This function iterates on the common number of words, comparing words.
-- If two words are not equal, the result of *Compare_Array_S8_Unaligned*
-- on these words is returned.
--
-- Finally, the result of *Compare_Array_S8_Unaligned* on the remaining
-- bytes is returned.
function Compare_Array_S8_Unaligned
(Left : System.Address;
@@ -58,5 +69,8 @@ package System.Compare_Array_Signed_8 is
-- Same functionality as Compare_Array_S8 but always proceeds by
-- bytes. Used when the caller knows that the operands are unaligned,
-- or short enough that it makes no sense to go by words.
--
-- This subprogram compares ``Left`` and ``Right`` byte per byte and
-- returns immediately when two bytes differ.
end System.Compare_Array_Signed_8;

View File

@@ -43,12 +43,16 @@ package System.Compare_Array_Unsigned_8 is
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Compare the array starting at address Left of length Left_Len with the
-- array starting at address Right of length Right_Len. The comparison is
-- in the normal Ada semantic sense of array comparison. The result is -1,
-- 0, +1 for Left < Right, Left = Right, Left > Right respectively. This
-- function works with 4 byte words if the operands are aligned on 4-byte
-- boundaries and long enough.
-- Compare the array starting at address ``Left`` of length ``Left_Len``
-- with the array starting at address ``Right`` of length ``Right_Len``.
-- The comparison is in the normal Ada semantic sense of array
-- comparison.
--
-- The result is -1, 0, +1 for ``Left`` < ``Right``, ``Left`` = ``Right``,
-- ``Left`` > ``Right`` respectively.
--
-- The same algorithm is used as in package
-- ``System.Compare_Array_Signed_8``.
function Compare_Array_U8_Unaligned
(Left : System.Address;
@@ -58,5 +62,8 @@ package System.Compare_Array_Unsigned_8 is
-- Same functionality as Compare_Array_U8 but always proceeds by bytes.
-- Used when the caller knows that the operands are unaligned, or short
-- enough that it makes no sense to go by words.
--
-- The same algorithm is used as in package
-- ``System.Compare_Array_Signed_8``.
end System.Compare_Array_Unsigned_8;

View File

@@ -43,11 +43,26 @@ package System.Compare_Array_Signed_16 is
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Compare the array starting at address Left of length Left_Len
-- with the array starting at address Right of length Right_Len.
-- Compare the array starting at address ``Left`` of length ``Left_Len``
-- with the array starting at address ``Right`` of length ``Right_Len``.
-- The comparison is in the normal Ada semantic sense of array
-- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
-- Left>Right respectively. This function works with 4 byte words
-- if the operands are aligned on 4-byte boundaries and long enough.
-- comparison.
--
-- The result is -1, 0, +1 for ``Left`` < ``Right``, ``Left`` = ``Right``,
-- ``Left`` > ``Right`` respectively.
--
-- If both addresses are word aligned, the function iterates through all
-- of the equal words.
--
-- Then, if the addresses are half word aligned, the function iterates on
-- the remaining half words, and returns as soon as two half words are not
-- equal.
--
-- Otherwise, the function iterates on the remaining unaligned half words,
-- compares them using unaligned accesses, and returns as soon as two half
-- words are not equal.
--
-- Finally, at this point, all the words are equal. The result is decided
-- by comparing their lengths.
end System.Compare_Array_Signed_16;

View File

@@ -43,11 +43,23 @@ package System.Compare_Array_Signed_32 is
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural)
return Integer;
-- Compare the array starting at address Left of length Left_Len
-- with the array starting at address Right of length Right_Len.
return Integer;
-- Compare the array starting at address ``Left`` of length ``Left_Len``
-- with the array starting at address ``Right`` of length ``Right_Len``.
-- The comparison is in the normal Ada semantic sense of array
-- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
-- Left>Right respectively.
-- comparison.
--
-- The result is -1, 0, +1 for ``Left`` < ``Right``, ``Left`` = ``Right``,
-- ``Left`` > ``Right`` respectively.
--
-- If the addresses are word aligned, the function iterates on the words,
-- and returns as soon as two words are not equal.
--
-- Otherwise, the function iterates on the unaligned words, compares them
-- using unaligned accesses, and returns as soon as two words are not
-- equal.
--
-- Finally, at this point all the words are equal. The result is decided
-- by comparing their lengths.
end System.Compare_Array_Signed_32;

View File

@@ -43,10 +43,22 @@ package System.Compare_Array_Signed_64 is
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Compare the array starting at address Left of length Left_Len
-- with the array starting at address Right of length Right_Len.
-- Compare the array starting at address ``Left`` of length ``Left_Len``
-- with the array starting at address ``Right`` of length ``Right_Len``.
-- The comparison is in the normal Ada semantic sense of array
-- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
-- Left>Right respectively.
-- comparison.
--
-- The result is -1, 0, +1 for ``Left`` < ``Right``, ``Left`` = ``Right``,
-- ``Left`` > ``Right`` respectively.
--
-- If the addresses are double word aligned, the function iterates on the
-- double words, and returns as soon as two double words are not equal.
--
-- Otherwise, the function iterates on the unaligned double words, compares
-- them using unaligned accesses, and returns as soon as two double words
-- are not equal.
--
-- Finally, at this point all the double words are equal. The result is
-- decided by comparing their lengths.
end System.Compare_Array_Signed_64;

View File

@@ -43,11 +43,15 @@ package System.Compare_Array_Unsigned_16 is
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Compare the array starting at address Left of length Left_Len
-- with the array starting at address Right of length Right_Len.
-- Compare the array starting at address ``Left`` of length ``Left_Len``
-- with the array starting at address ``Right`` of length ``Right_Len``.
-- The comparison is in the normal Ada semantic sense of array
-- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
-- Left>Right respectively. This function works with 4 byte words
-- if the operands are aligned on 4-byte boundaries and long enough.
-- comparison.
--
-- The result is -1, 0, +1 for ``Left`` < ``Right``, ``Left`` = ``Right``,
-- ``Left`` > ``Right`` respectively.
--
-- The same algorithm is used as in package
-- ``System.Compare_Array_Signed_16``.
end System.Compare_Array_Unsigned_16;

View File

@@ -43,10 +43,15 @@ package System.Compare_Array_Unsigned_32 is
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Compare the array starting at address Left of length Left_Len
-- with the array starting at address Right of length Right_Len.
-- Compare the array starting at address ``Left`` of length ``Left_Len``
-- with the array starting at address ``Right`` of length ``Right_Len``.
-- The comparison is in the normal Ada semantic sense of array
-- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
-- Left>Right respectively.
-- comparison.
--
-- The result is -1, 0, +1 for ``Left`` < ``Right``, ``Left`` = ``Right``,
-- ``Left`` > ``Right`` respectively.
--
-- The same algorithm is used as in package
-- ``System.Compare_Array_Signed_32``.
end System.Compare_Array_Unsigned_32;

View File

@@ -43,10 +43,15 @@ package System.Compare_Array_Unsigned_64 is
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer;
-- Compare the array starting at address Left of length Left_Len
-- with the array starting at address Right of length Right_Len.
-- Compare the array starting at address ``Left`` of length ``Left_Len``
-- with the array starting at address ``Right`` of length ``Right_Len``.
-- The comparison is in the normal Ada semantic sense of array
-- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
-- Left>Right respectively.
-- comparison.
--
-- The result is -1, 0, +1 for ``Left`` < ``Right``, ``Left`` = ``Right``,
-- ``Left`` > ``Right`` respectively.
--
-- The same algorithm is used as in package
-- ``System.Compare_Array_Signed_64``.
end System.Compare_Array_Unsigned_64;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Integer exponentiation (checks off)
-- This package implements Integer exponentiation (checks off)
-- Preconditions, postconditions, ghost code, loop invariants and assertions
-- in this unit are meant for analysis only, not for run-time checking, as it
@@ -52,5 +52,14 @@ is
function Exn_Integer (Left : Integer; Right : Natural) return Integer
renames Exponn_Integer.Expon;
-- Return the power of ``Left`` by ``Right`` where ``Left`` is an Integer.
-- No check is made on the validity of the result.
--
-- This function is implemented using the standard logarithmic approach:
-- ``Right`` gets shifted right testing successive low order bits, and
-- ``Left`` is raised to the next power of 2.
--
-- As checks aren't enabled for this service, the result is not defined
-- in case of overflow.
end System.Exn_Int;

View File

@@ -29,7 +29,8 @@
-- --
------------------------------------------------------------------------------
-- Long_Long_Float exponentiation (checks off)
-- This package implements ``[Long_[Long_]]Float`` exponentiation
-- (checks off).
with System.Exponr;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Long_Long_Integer exponentiation (checks off)
-- This package implements Long_Long_Integer exponentiation (checks off)
-- Preconditions, postconditions, ghost code, loop invariants and assertions
-- in this unit are meant for analysis only, not for run-time checking, as it
@@ -53,5 +53,14 @@ is
function Exn_Long_Long_Integer
(Left : Long_Long_Integer; Right : Natural) return Long_Long_Integer
renames Exponn_Integer.Expon;
-- Return the power of ``Left`` by ``Right`` where ``Left`` is a
-- Long_Long_Integer. No check is made on the validity of the result.
--
-- This function is implemented using the standard logarithmic approach:
-- ``Right`` gets shifted right testing successive low order bits, and
-- ``Left`` is raised to the next power of 2.
--
-- As checks aren't enabled for this service, the result is not defined
-- in case of overflow.
end System.Exn_LLI;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Integer exponentiation (checks on)
-- This package implements Integer exponentiation (checks on)
-- Preconditions, postconditions, ghost code, loop invariants and assertions
-- in this unit are meant for analysis only, not for run-time checking, as it
@@ -52,5 +52,13 @@ is
function Exp_Integer (Left : Integer; Right : Natural) return Integer
renames Expont_Integer.Expon;
-- Return the power of ``Left`` by ``Right`` where ``Left`` is an
-- Integer.
--
-- This function is implemented using the standard logarithmic approach:
-- ``Right`` gets shifted right testing successive low order bits, and
-- ``Left`` is raised to the next power of 2.
--
-- In case of overflow, Constraint_Error is raised.
end System.Exp_Int;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Long_Long_Integer exponentiation (checks on)
-- This package implements Long_Long_Integer exponentiation
-- Preconditions, postconditions, ghost code, loop invariants and assertions
-- in this unit are meant for analysis only, not for run-time checking, as it
@@ -53,5 +53,13 @@ is
function Exp_Long_Long_Integer
(Left : Long_Long_Integer; Right : Natural) return Long_Long_Integer
renames Expont_Integer.Expon;
-- Return the power of ``Left`` by ``Right`` where ``Left`` is a
-- Long_Long_Integer.
--
-- This function is implemented using the standard logarithmic approach:
-- ``Right`` gets shifted right testing successive low order bits, and
-- ``Left`` is raised to the next power of 2.
--
-- In case of overflow, Constraint_Error is raised.
end System.Exp_LLI;

View File

@@ -29,16 +29,16 @@
-- --
------------------------------------------------------------------------------
-- This function performs exponentiation of unsigned types with binary modulus
-- values exceeding that of System.Unsigned_Types.Unsigned.
-- The result is always full width, the caller must do a masking operation if
-- the modulus is less than 2 ** Long_Long_Unsigned'Size.
-- This function performs exponentiation of unsigned types (with binary
-- modulus values exceeding that of Unsigned_Types.Unsigned). The result
-- is always full width, the caller must do a masking operation if the
-- modulus is less than 2 ** (Long_Long_Unsigned'Size).
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced
-- by setting the corresponding assertion policy to Ignore. Postconditions
-- and contract cases should not be executed at runtime as well, in order
-- not to slow down the execution of these functions.
-- Note: preconditions in this unit are meant for analysis only, not for
-- run-time checking, so that the expected exceptions are raised. This is
-- enforced by setting the corresponding assertion policy to Ignore.
-- Postconditions and contract cases should not be executed at run-time as
-- well, in order not to slow down the execution of these functions.
pragma Assertion_Policy (Pre => Ignore,
Post => Ignore,
@@ -56,5 +56,13 @@ is
function Exp_Long_Long_Unsigned is new Exponu (Long_Long_Unsigned);
pragma Pure_Function (Exp_Long_Long_Unsigned);
-- Return the power of ``Left`` by ``Right`` where ``Left`` is a
-- Long_Long_Unsigned.
--
-- This function is implemented using the standard logarithmic approach:
-- ``Right`` gets shifted right testing successive low order bits, and
-- ``Left`` is raised to the next power of 2.
--
-- In case of overflow, Constraint_Error is raised.
end System.Exp_LLU;

View File

@@ -32,6 +32,7 @@
-- This function performs exponentiation of a modular type with nonbinary
-- modulus values. Arithmetic is done in Long_Long_Unsigned, with explicit
-- accounting for the modulus value which is passed as the second argument.
--
-- Note that 1 is a binary modulus (2**0), so the compiler should not (and
-- will not) call this function with Modulus equal to 1.
@@ -80,5 +81,11 @@ is
with
Pre => Modulus /= 0 and then Modulus not in Power_Of_2,
Post => Big (Exp_Modular'Result) = Big (Left) ** Right mod Big (Modulus);
-- Return the power of ``Left`` by ``Right` modulo ``Modulus``.
--
-- This function is implemented using the standard logarithmic approach:
-- ``Right`` gets shifted right testing successive low order bits, and
-- ``Left`` is raised to the next power of 2. The multiplications are
-- performed using modular multiplications.
end System.Exp_Mod;

View File

@@ -29,7 +29,8 @@
-- --
------------------------------------------------------------------------------
-- Signed integer exponentiation (checks off)
-- This package provides functions for signed integer exponentiation. This
-- is the version of the package with checks disabled.
with Ada.Numerics.Big_Numbers.Big_Integers_Ghost;
@@ -69,5 +70,12 @@ is
with
Pre => In_Int_Range (Big (Left) ** Right),
Post => Expon'Result = Left ** Right;
-- Calculate ``Left`` ** ``Right``. If ``Left`` is 0 then 0 is returned
-- and if ``Right`` is 0 then 1 is returned. In all other cases the result
-- is set to 1 and then computed in a loop as follows:
-- If ``Right`` is a multiple of 2 then multiply the result with ``Left``.
-- Divide ``Right`` by 2.
-- If ``Right is 0, return.
-- Multiply ``Left`` with itself.
end System.Exponn;

View File

@@ -29,7 +29,8 @@
-- --
------------------------------------------------------------------------------
-- Signed integer exponentiation (checks on)
-- This package provides functions for signed integer exponentiation. This
-- is the version of the package with checks enabled.
with Ada.Numerics.Big_Numbers.Big_Integers_Ghost;
@@ -69,5 +70,12 @@ is
with
Pre => In_Int_Range (Big (Left) ** Right),
Post => Expon'Result = Left ** Right;
-- Calculate ``Left`` ** ``Right``. If ``Left`` is 0 then 0 is returned
-- and if ``Right`` is 0 then 1 is returned. In all other cases the result
-- is set to 1 and then computed in a loop as follows:
-- If ``Right`` is a multiple of 2 then multiply the result with ``Left``.
-- Divide ``Right`` by 2.
-- If ``Right is 0, return.
-- Multiply ``Left`` with itself.
end System.Expont;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Modular integer exponentiation
-- This function implements unsigned integer exponentiation
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced
@@ -50,3 +50,10 @@ function System.Exponu (Left : Int; Right : Natural) return Int
with
SPARK_Mode,
Post => System.Exponu'Result = Left ** Right;
-- Calculate ``Left`` ** ``Right``. If ``Left`` is 0 then 0 is returned
-- and if ``Right`` is 0 then 1 is returned. In all other cases the result
-- is set to 1 and then computed in a loop as follows:
-- If ``Right`` is a multiple of 2 then multiply the result with ``Left``.
-- Divide ``Right`` by 2.
-- If ``Right is 0, return.
-- Multiply ``Left`` with itself.

View File

@@ -29,10 +29,11 @@
-- --
------------------------------------------------------------------------------
-- This function performs exponentiation of unsigned types with binary modulus
-- values up to and including that of System.Unsigned_Types.Unsigned.
-- The result is always full width, the caller must do a masking operation if
-- the modulus is less than 2 ** Unsigned'Size.
-- This function performs exponentiation of unsigned types (with binary
-- modulus values up to and including that of Unsigned_Types.Unsigned).
--
-- The result is always full width, the caller must do a masking operation
-- the modulus is less than 2 ** (Unsigned'Size).
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced
@@ -56,5 +57,13 @@ is
function Exp_Unsigned is new Exponu (Unsigned);
pragma Pure_Function (Exp_Unsigned);
-- Return the power of ``Left`` by ``Right`` where ``Left`` is an
-- Unsigned.
--
-- This function is implemented using the standard logarithmic approach:
-- ``Right`` gets shifted right testing successive low order bits, and
-- ``Left`` is raised to the next power of 2.
--
-- In case of overflow, Constraint_Error is raised.
end System.Exp_Uns;

View File

@@ -30,7 +30,8 @@
------------------------------------------------------------------------------
-- This package contains an instantiation of the floating-point attribute
-- runtime routines for the type Float.
-- runtime routines for the type Float. It is an instantiation of
-- ``System.Fat_Gen`` for Float.
with System.Fat_Gen;

View File

@@ -31,8 +31,9 @@
-- This generic package provides a target independent implementation of the
-- floating-point attributes that denote functions. The implementations here
-- should be portable and reasonably efficient. The runtime contains a set of
-- instantiations of this package for all predefined floating-point types.
-- are portable, but very slow. The runtime contains a set of instantiations
-- of this package for all predefined floating-point types, and these should
-- be replaced by efficient assembly language code where possible.
generic
type T is digits <>;
@@ -51,48 +52,146 @@ package System.Fat_Gen is
-- problem, but the resulting inefficiency would be annoying.
function Adjacent (X, Towards : T) return T;
-- If ``Towards`` = ``X``, the function returns ``X``; oterwise, it yields
-- the machien number of the type *T* adjacent to ``X`` in the direction
-- ``Towards``, if that machine number exists.
function Ceiling (X : T) return T;
-- Truncate ``X``. If the truncation is equal to ``X`` return ``X``. If
-- ``X`` is less than zero, return the truncation, otherwise add one
-- to the truncation.
function Compose (Fraction : T; Exponent : UI) return T;
-- Decompose the ``Fraction`` into its fraction and exponent parts. Call
-- *Scaling* with the returned fraction part and ``Exponent``.
function Copy_Sign (Value, Sign : T) return T;
-- Take the absolute value of ``Value``. Negate the result if ``Sign`` is
-- less than zero.
function Exponent (X : T) return UI;
-- Decompose `X`` and return the exponent part.
function Floor (X : T) return T;
-- Truncate ``X``. If the truncation is equal to ``X`` return ``X``. If
-- ``X`` is greater than zero, return the truncation, otherwise subtract
-- one from the truncation.
function Fraction (X : T) return T;
-- Decompose `X`` and return the fraction part
function Leading_Part (X : T; Radix_Digits : UI) return T;
-- Return ``X`` if the ``Radix_Digits`` is larger than the type's machine
-- mantissa. Otherwise scale down and truncate ``X`` by the difference
-- between the exponent of ``X`` and ``Radix_Digits``, then scale the
-- result back up.
function Machine (X : T) return T;
-- Force ``X`` to be stored in memory and retrieve the result
function Machine_Rounding (X : T) return T;
-- Truncate the absolute value of ``X`` + 0.5. If ``X`` is negative, negate
-- the result.
function Model (X : T) return T;
-- If ``X`` is a model number of *T*, the function returns ``X``;
-- otherwise it yields the value obtained by rounding or truncating ``X``
-- to either one of the adjacent model numbers of *T*.
--
-- We treat *Model* as identical to *Machine*. This is true of IEEE and
-- other nice floating-point systems, but not necessarily true of all
-- systems.
function Pred (X : T) return T;
-- Return the machine number immediately below the value of ``X``.
--
-- If zero, return the negative of *Succ* (``X``).
--
-- If ``X`` = *T*'First, return negative infinity.
--
-- If ``X`` is already infinity, return ``X``.
--
-- Otherwise, subtract from ``X`` a number equivalent to the value of its
-- least significant bit.
function Remainder (X, Y : T) return T;
-- Return the remainder (n) of ``X`` divided by ``Y``.
-- If abs(n - ``X`` / ``Y``) = 1/2 then n is chosen to be even.
--
-- Calculate the modulus remainder: if abs(``X``) < abs(``Y``) then the
-- remainder is abs(``X``). Otherwise, decompose abs(``X``) and abs(``Y``).
-- Then:
--
-- .. code-block:: ada
--
-- P := Compose (Y_Frac, X_Exp);
-- K := X_Exp - Y_Exp;
-- Rem := |X|;
-- for J in reverse 0 .. K loop
-- if Rem >= P then
-- Rem := Rem - P;
-- end if;
-- P := P * 0.5;
-- end loop;
--
-- Return the IEEE remainder by adjusting result such that if
-- abs(n - X/Y) = 1/2 then n is even.
function Rounding (X : T) return T;
-- The function yields the integral value nearest to ``X``, rounding away
-- from zero if ``X`` lies exactly halfway between two integers.
--
-- The function truncates the absolute value of ``X`` + 0.5. If ``X`` is
-- negative, negate the result.
function Scaling (X : T; Adjustment : UI) return T;
-- Let v be the value ``X`` * *T*'Machine_RadixAdjustment. If v is a
-- machine number of the type *T*, or if abs(v) >= *T*'Model_Small, the
-- function yields v; otherwise, it yields either one of the machine
-- numbers of the type *T* adjacent to v.
--
-- If ``X`` or ``Adjustment`` equal zero, return ``X``. Otherwise, return
-- ``X`` * Machine_Radix ** ``Adjustment``.
function Succ (X : T) return T;
-- Returns the machine number immediately above the value of X.
--
-- If zero, return the smallest denormal.
--
-- If ``X`` = *T*'Last, return infinity.
--
-- If ``X`` is already infinity, return ``X``.
--
-- Otherwise, add to X a number equivalent to the value of its least
-- significant bit.
function Truncation (X : T) return T;
-- The function yields the value *Ceiling* (``X``) when ``X`` is negative,
-- and *Floor* (``X``) otherwise.
--
-- Return *T*'Machine (RM1 + N) - RM1 where N is abs(``X``) and
-- RM1 = radix ** (mantissa - 1). Negate the result where ``X`` is
-- negative.
function Unbiased_Rounding (X : T) return T;
-- The integral value nearest to ``X``, rounding toward the even integer
-- if ``X`` lies exactly halfway between two integers.
--
-- This function truncates abs(``X``). If the tail of the result is greater
-- than 0.5 add one to the result. If the tail equals 0.5, round to the
-- nearest even integer. Negate the result if ``X`` is negative.
function Valid (X : not null access T) return Boolean;
-- This function checks if the object of type T referenced by X is valid,
-- and returns True/False accordingly. The parameter is passed by reference
-- (access) here, as the object of type T may be an abnormal value that
-- cannot be passed in a floating-point register, and the whole point of
-- 'Valid is to prevent exceptions. Note that the object of type T must
-- have the natural alignment for type T.
-- This function checks if the object of type *T* referenced by ``X`` is
-- valid, and returns True/False accordingly. The parameter is passed by
-- reference (access) here, as the object of type T may be an abnormal
-- value that cannot be passed in a floating-point register, and the whole
-- point of 'Valid is to prevent exceptions. Note that the object of
-- type *T* must have the natural alignment for type *T*.
--
-- If denormalized numbers are valid: return True unless ``X`` is infinity
-- or NaN. If denormalized numbers are not valid, return False if ``X`` is
-- a denormal number.
type S is new String (1 .. T'Size / Character'Size);
type P is access all S with Storage_Size => 0;

View File

@@ -30,7 +30,8 @@
------------------------------------------------------------------------------
-- This package contains an instantiation of the floating-point attribute
-- runtime routines for the type Long_Float.
-- runtime routines for the type Long_Float. It is an instantiation of
-- ``System.Fat_Gen`` for Long_Float.
with System.Fat_Gen;

View File

@@ -30,7 +30,8 @@
------------------------------------------------------------------------------
-- This package contains an instantiation of the floating-point attribute
-- runtime routines for the type Long_Long_Float.
-- runtime routines for the type Long_Long_Float. It is an instantiation of
-- ``System.Fat_Gen`` for Long_Long_Float.
with System.Fat_Gen;

View File

@@ -56,4 +56,8 @@ package System.Float_Control is
--
-- The call to Reset simply has no effect if the target environment
-- does not give rise to such concerns.
-- The *Reset* procedure is a no-op on all Bareboard targets, the FPU
-- configuration being under full control there.
end System.Float_Control;

View File

@@ -33,7 +33,7 @@
-- If the arguments are aligned on word boundaries and the word size is a
-- multiple M of the element size, the operations will be done M elements
-- at a time using vector operations on a word.
--
-- All routines assume argument arrays have the same length, and arguments
-- with mode "in" do not alias arguments with mode "out" or "in out".
-- If the number N of elements to be processed is not a multiple of M
@@ -56,6 +56,8 @@ package System.Generic_Vector_Operations is
procedure Binary_Operation
(R, X, Y : System.Address;
Length : System.Storage_Elements.Storage_Count);
-- *Binary_Operation* iterates on the elements pointed to by `X` and `Y`
-- and places the result in `R`.
generic
with function Element_Op (X : Element) return Element;
@@ -63,4 +65,7 @@ package System.Generic_Vector_Operations is
procedure Unary_Operation
(R, X : System.Address;
Length : System.Storage_Elements.Storage_Count);
-- *Unary_Operation* iterates on the elements pointed to by `X`
-- and places the result in `R`.
end System.Generic_Vector_Operations;

View File

@@ -30,7 +30,8 @@
------------------------------------------------------------------------------
-- Contains the routine for computing the image in based format of signed and
-- unsigned integers for use by Text_IO.Integer_IO and Text_IO.Modular_IO.
-- unsigned integers for use by ``Text_IO.Integer_IO`` and
-- ``Text_IO.Modular_IO``.
generic

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- decimal fixed point types, and also for conversion operations required in
-- Text_IO.Decimal_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Decimal_IO`` conversions routines for decimal fixed point
-- types.
generic

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- ordinary fixed point types whose Small is the ratio of two Int values, and
-- also for conversion operations required in Text_IO.Fixed_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Fixed_IO`` conversions routines for for ordinary fixed
-- point types whose Small is the ratio of two Int values.
generic

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- signed integer types, and also for conversion operations required in
-- Text_IO.Integer_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Integer_IO`` conversions routines for signed integer
-- types.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- Enumeration_Type'Image for all enumeration types except those in package
-- Standard (where we have no opportunity to build image tables), and in
-- package System (where it is too early to start building image tables).
-- ``Image`` attribute support for all enumeration types except those in
-- package Standard (where we have no opportunity to build image tables), and
-- in package System (where it is too early to start building image tables).
-- Special routines exist for the enumeration types in these packages.
generic

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- modular integer types, and also for conversion operations required in
-- Text_IO.Modular_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Modular_IO`` conversions routines for modular integer
-- types.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- Contains the routine for computing the image of signed and unsigned
-- integers up to Integer for use by Text_IO.Integer_IO and
-- Text_IO.Modular_IO.
-- Contains the routines for computing the image of signed and unsigned
-- integers up to ``Integer`` for use by ``Ada.Text_IO.Integer_IO`` and
-- ``Ada.Text_IO.Modular_IO``.
generic

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- decimal fixed point types up to 128-bit mantissa, and also for conversion
-- operations required in Text_IO.Decimal_IO for them.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Decimal_IO`` conversions routines for decimal fixed point
-- types up to 128-bit mantissa.
with Interfaces;
with System.Image_D;

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- decimal fixed point types up to 32-bit mantissa, and also for conversion
-- operations required in Text_IO.Decimal_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Decimal_IO`` conversions routines for decimal fixed point
-- types up to 32-bit mantissa.
with Interfaces;
with System.Image_D;
@@ -49,6 +49,12 @@ package System.Img_Decimal_32 is
P : out Natural;
Scale : Integer)
renames Impl.Image_Decimal;
-- Computes fixed_type'Image (V), where V is the integer value (in units of
-- delta) of a decimal type whose Scale is as given and stores the result
-- S (1 .. P), updating P on return. The result is computed according to
-- the rules for image for fixed-point types (RM 3.5(34)). The caller
-- guarantees that S is long enough to hold the result and has a lower
-- bound of 1.
procedure Set_Image_Decimal32
(V : Int32;
@@ -59,5 +65,13 @@ package System.Img_Decimal_32 is
Aft : Natural;
Exp : Natural)
renames Impl.Set_Image_Decimal;
-- Sets the image of V, where V is the integer value (in units of delta)
-- of a decimal type with the specified Scale, starting at S (P + 1) and
-- updating P to point to the last character stored, the caller promises
-- that the buffer is large enough and no check is made. Constraint_Error
-- will not necessarily be raised if this requirement is violated, since
-- it is perfectly valid to compile this unit with checks off. The Fore,
-- Aft and Exp values can be set to any valid values for the case of use
-- by Text_IO.Decimal_IO.
end System.Img_Decimal_32;

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- decimal fixed point types up to 64-bit mantissa, and also for conversion
-- operations required in Text_IO.Decimal_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Decimal_IO`` conversions routines for decimal fixed point
-- types up to 64-bit mantissa.
with Interfaces;
with System.Image_D;
@@ -49,6 +49,12 @@ package System.Img_Decimal_64 is
P : out Natural;
Scale : Integer)
renames Impl.Image_Decimal;
-- Computes fixed_type'Image (V), where V is the integer value (in units of
-- delta) of a decimal type whose Scale is as given and stores the result
-- S (1 .. P), updating P on return. The result is computed according to
-- the rules for image for fixed-point types (RM 3.5(34)). The caller
-- guarantees that S is long enough to hold the result and has a lower
-- bound of 1.
procedure Set_Image_Decimal64
(V : Int64;
@@ -59,5 +65,13 @@ package System.Img_Decimal_64 is
Aft : Natural;
Exp : Natural)
renames Impl.Set_Image_Decimal;
-- Sets the image of V, where V is the integer value (in units of delta)
-- of a decimal type with the specified Scale, starting at S (P + 1) and
-- updating P to point to the last character stored, the caller promises
-- that the buffer is large enough and no check is made. Constraint_Error
-- will not necessarily be raised if this requirement is violated, since
-- it is perfectly valid to compile this unit with checks off. The Fore,
-- Aft and Exp values can be set to any valid values for the case of use
-- by Text_IO.Decimal_IO.
end System.Img_Decimal_64;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Instantiation of System.Image_N for enumeration types whose names table
-- Instantiation of ``System.Image_N`` for enumeration types whose names table
-- has a length that fits in a 16-bit but not a 8-bit integer.
with Interfaces;
@@ -47,5 +47,17 @@ package System.Img_Enum_16 is
Names : String;
Indexes : System.Address)
renames Impl.Image_Enumeration;
-- Used to compute Enum'Image (Str) where Enum is some enumeration type
-- other than those defined in package Standard. Names is a string with
-- a lower bound of 1 containing the characters of all the enumeration
-- literals concatenated together in sequence. Indexes is the address of
-- an array of type array (0 .. N) of Interfaces.Integer_16, where N is the
-- number of enumeration literals in the type. The Indexes values are the
-- starting subscript of each enumeration literal, indexed by Pos values,
-- with an extra entry at the end containing Names'Length + 1. The reason
-- that Indexes is passed by address is that the actual type is created on
-- the fly by the expander. The desired 'Image value is stored in S
-- (1 .. P) and P is set on return. The caller guarantees that S is long
-- enough to hold the result and that the lower bound is 1.
end System.Img_Enum_16;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Instantiation of System.Image_N for enumeration types whose names table
-- Instantiation of ``System.Image_N`` for enumeration types whose names table
-- has a length that fits in a 32-bit but not a 16-bit integer.
with Interfaces;
@@ -47,5 +47,17 @@ package System.Img_Enum_32 is
Names : String;
Indexes : System.Address)
renames Impl.Image_Enumeration;
-- Used to compute Enum'Image (Str) where Enum is some enumeration type
-- other than those defined in package Standard. Names is a string with
-- a lower bound of 1 containing the characters of all the enumeration
-- literals concatenated together in sequence. Indexes is the address of
-- an array of type array (0 .. N) of Interfaces.Integer_32, where N is the
-- number of enumeration literals in the type. The Indexes values are the
-- starting subscript of each enumeration literal, indexed by Pos values,
-- with an extra entry at the end containing Names'Length + 1. The reason
-- that Indexes is passed by address is that the actual type is created on
-- the fly by the expander. The desired 'Image value is stored in S
-- (1 .. P) and P is set on return. The caller guarantees that S is long
-- enough to hold the result and that the lower bound is 1.
end System.Img_Enum_32;

View File

@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Instantiation of System.Image_N for enumeration types whose names table
-- Instantiation of ``System.Image_N`` for enumeration types whose names table
-- has a length that fits in a 8-bit integer.
with Interfaces;
@@ -47,5 +47,17 @@ package System.Img_Enum_8 is
Names : String;
Indexes : System.Address)
renames Impl.Image_Enumeration;
-- Used to compute Enum'Image (Str) where Enum is some enumeration type
-- other than those defined in package Standard. Names is a string with
-- a lower bound of 1 containing the characters of all the enumeration
-- literals concatenated together in sequence. Indexes is the address of
-- an array of type array (0 .. N) of Interfaces.Integer_8, where N is the
-- number of enumeration literals in the type. The Indexes values are the
-- starting subscript of each enumeration literal, indexed by Pos values,
-- with an extra entry at the end containing Names'Length + 1. The reason
-- that Indexes is passed by address is that the actual type is created on
-- the fly by the expander. The desired 'Image value is stored in S
-- (1 .. P) and P is set on return. The caller guarantees that S is long
-- enough to hold the result and that the lower bound is 1.
end System.Img_Enum_8;

View File

@@ -29,8 +29,8 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- ordinary fixed point types up to 32-bit small and mantissa.
-- This package contains the routines for supporting the ``Image`` attribute
-- for ordinary fixed point types up to 32-bit small and mantissa.
with Interfaces;
with System.Arith_32;
@@ -52,6 +52,16 @@ package System.Img_Fixed_32 is
For0 : Natural;
Aft0 : Natural)
renames Impl.Image_Fixed;
-- Computes fixed_type'Image (V), where V is the integer value (in units of
-- small) of an ordinary fixed point type with small Num/Den, and stores
-- the result in S (1 .. P), updating P on return. The result is computed
-- according to the rules for image for fixed-point types (RM 3.5(34)).
-- For0 and Aft0 are the values of the Fore and Aft attributes for the
-- fixed point type whose mantissa type is Int32 and whose small is
-- Num/Den. This function is used only for fixed point whose Small is an
-- integer or its reciprocal (see package System.Image_R for the handling
-- of other ordinary fixed-point types). The caller guarantees that S is
-- long enough to hold the result and has a lower bound of 1.
procedure Set_Image_Fixed32
(V : Int32;
@@ -65,5 +75,14 @@ package System.Img_Fixed_32 is
Aft : Natural;
Exp : Natural)
renames Impl.Set_Image_Fixed;
-- Sets the image of V, where V is the integer value (in units of small)
-- of a fixed point type with small Num/Den, starting at S (P + 1) and
-- updating P to point to the last character stored, the caller promises
-- that the buffer is large enough and no check is made. Constraint_Error
-- will not necessarily be raised if this requirement is violated, since
-- it is perfectly valid to compile this unit with checks off. For0 and
-- Aft0 are the values of the Fore and Aft attributes for the fixed point
-- type whose mantissa type is Int32 and whose small is Num/Den. The Fore,
-- Aft and Exp can be set to any valid values for use by Text_IO.Fixed_IO.
end System.Img_Fixed_32;

View File

@@ -29,8 +29,8 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- ordinary fixed point types up to 64-bit small and mantissa.
-- This package contains the routines for supporting the ``Image`` attribute
-- for ordinary fixed point types up to 64-bit small and mantissa.
with Interfaces;
with System.Arith_64;
@@ -52,6 +52,16 @@ package System.Img_Fixed_64 is
For0 : Natural;
Aft0 : Natural)
renames Impl.Image_Fixed;
-- Computes fixed_type'Image (V), where V is the integer value (in units of
-- small) of an ordinary fixed point type with small Num/Den, and stores
-- the result in S (1 .. P), updating P on return. The result is computed
-- according to the rules for image for fixed-point types (RM 3.5(34)).
-- For0 and Aft0 are the values of the Fore and Aft attributes for the
-- fixed point type whose mantissa type is Int64 and whose small is
-- Num/Den. This function is used only for fixed point whose Small is an
-- integer or its reciprocal (see package System.Image_R for the handling
-- of other ordinary fixed-point types). The caller guarantees that S is
-- long enough to hold the result and has a lower bound of 1.
procedure Set_Image_Fixed64
(V : Int64;
@@ -65,5 +75,14 @@ package System.Img_Fixed_64 is
Aft : Natural;
Exp : Natural)
renames Impl.Set_Image_Fixed;
-- Sets the image of V, where V is the integer value (in units of small)
-- of a fixed point type with small Num/Den, starting at S (P + 1) and
-- updating P to point to the last character stored, the caller promises
-- that the buffer is large enough and no check is made. Constraint_Error
-- will not necessarily be raised if this requirement is violated, since
-- it is perfectly valid to compile this unit with checks off. For0 and
-- Aft0 are the values of the Fore and Aft attributes for the fixed point
-- type whose mantissa type is Int64 and whose small is Num/Den. The Fore,
-- Aft and Exp can be set to any valid values for use by Text_IO.Fixed_IO.
end System.Img_Fixed_64;

View File

@@ -30,8 +30,8 @@
------------------------------------------------------------------------------
-- Contains the routine for computing the image in based format of signed and
-- unsigned integers up to Integer for use by Text_IO.Integer_IO and
-- Text_IO.Modular_IO.
-- unsigned integers up to ``Integer`` for use by ``Ada.Text_IO.Integer_IO``
-- and ``Ada.Text_IO.Modular_IO``.
with System.Image_B;
with System.Unsigned_Types;
@@ -50,6 +50,15 @@ package System.Img_BIU is
S : out String;
P : in out Natural)
renames Impl.Set_Image_Based_Integer;
-- Sets the signed image of V in based format, using base value B (2..16)
-- starting at S (P + 1), updating P to point to the last character stored.
-- The image includes a leading minus sign if necessary, but no leading
-- spaces unless W is positive, in which case leading spaces are output if
-- necessary to ensure that the output string is no less than W characters
-- long. The caller promises that the buffer is large enough and no check
-- is made for this. Constraint_Error will not necessarily be raised if
-- this is violated, since it is perfectly valid to compile this unit with
-- checks off.
procedure Set_Image_Based_Unsigned
(V : Unsigned;
@@ -58,5 +67,13 @@ package System.Img_BIU is
S : out String;
P : in out Natural)
renames Impl.Set_Image_Based_Unsigned;
-- Sets the unsigned image of V in based format, using base value B (2..16)
-- starting at S (P + 1), updating P to point to the last character stored.
-- The image includes no leading spaces unless W is positive, in which case
-- leading spaces are output if necessary to ensure that the output string
-- is no less than W characters long. The caller promises that the buffer
-- is large enough and no check is made for this. Constraint_Error will not
-- necessarily be raised if this is violated, since it is perfectly valid
-- to compile this unit with checks off).
end System.Img_BIU;

View File

@@ -31,6 +31,9 @@
-- Boolean'Image
-- This package provides support for ``Image`` attribute on ``Boolean``. The
-- compiler performs direct calls to this unit to implement the attribute.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
-- setting the corresponding assertion policy to Ignore. Postconditions and
@@ -57,8 +60,9 @@ is
and then (if V then S'Length >= 4 else S'Length >= 5),
Post => (if V then P = 4 else P = 5)
and then System.Val_Spec.Is_Boolean_Image_Ghost (S (1 .. P), V);
-- Computes Boolean'Image (V) and stores the result in S (1 .. P)
-- setting the resulting value of P. The caller guarantees that S
-- is long enough to hold the result, and that S'First is 1.
-- Computes Boolean'Image (``V``) and stores the result in
-- ``S`` (1 .. ``P``) setting the resulting value of ``P``. The caller
-- guarantees that ``S`` is long enough to hold the result, and that
-- ``S``'First is 1.
end System.Img_Bool;

View File

@@ -31,6 +31,9 @@
-- Character'Image
-- This package provides support for ``Image`` attribute on ``Character``. The
-- compiler performs direct calls to this unit to implement the attribute.
package System.Img_Char is
pragma Pure;
@@ -38,18 +41,21 @@ package System.Img_Char is
(V : Character;
S : in out String;
P : out Natural);
-- Computes Character'Image (V) and stores the result in S (1 .. P)
-- setting the resulting value of P. The caller guarantees that S is
-- long enough to hold the result, and that S'First is 1.
-- Computes Character'Image (``V``) and stores the result in
-- ``S`` (1 .. ``P``) setting the resulting value of ``P``. The caller
-- guarantees that ``S`` is long enough to hold the result, and that
-- ``S``'First is 1.
procedure Image_Character_05
(V : Character;
S : in out String;
P : out Natural);
-- Computes Character'Image (V) and stores the result in S (1 .. P)
-- setting the resulting value of P. The caller guarantees that S is
-- long enough to hold the result, and that S'First is 1. This version
-- is for use in Ada 2005 and beyond, where soft hyphen is a non-graphic
-- and results in "SOFT_HYPHEN" as the output.
-- Computes Character'Image (``V``) and stores the result in
-- ``S`` (1 .. ``P``) setting the resulting value of ``P``. The caller
-- guarantees that ``S`` is long enough to hold the result, and that
-- ``S``'First is 1.
--
-- This version is for use in Ada 2005 and beyond, where soft hyphen is
-- a non-graphic and results in "SOFT_HYPHEN" as the output.
end System.Img_Char;

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- signed integer types up to Integer, and also for conversion operations
-- required in Text_IO.Integer_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Integer_IO`` conversions routines for signed integer
-- types up to Size ``Integer'Size``.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
@@ -66,11 +66,32 @@ is
S : in out String;
P : out Natural)
renames Impl.Image_Integer;
-- Computes Integer'Image (``V``) and stores the result in
-- ``S`` (1 .. ``P``) setting the resulting value of ``P``.
-- The caller guarantees that ``S`` is long enough to hold the result,
-- and that ``S``'First is 1.
--
-- If ``V`` is not negative, the subprogram writes the leading blank in
-- ``S``. It then calls *Set_Image_Integer* unconditionally.
procedure Set_Image_Integer
(V : Integer;
S : in out String;
P : in out Natural)
renames Impl.Set_Image_Integer;
-- Stores the image of ``V`` in ``S`` starting at ``S`` (``P`` + 1), ``P``
-- is updated to point to the last character stored. The value stored is
-- identical to the value of Integer'Image (``V``) except that no leading
-- space is stored when ``V`` is non-negative. The caller guarantees that
-- ``S`` is long enough to hold the result. ``S`` need not have a lower
-- bound of 1.
--
-- If ``V`` is negative, the subprogram writes the leading '-' character,
-- otherwise work with -``V`` (always work with negative value to avoid
-- overflow: the largest negative number is not a special case).
--
-- This subprogram then uses recursion: if the value is equal or less than
-- -10, recurse with the value divided by 10. Then add the digit for the
-- remainder.
end System.Img_Int;

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- Contains the routine for computing the image in based format of signed and
-- unsigned integers larger than Integer for use by Text_IO.Integer_IO and
-- Text_IO.Modular_IO.
-- Contains the routine for computing the image in based format
-- of signed and unsigned integers larger than `Integer` for use
-- by ``Ada.Text_IO.Integer_IO`` and ``Text_IO.Modular_IO``.
with System.Image_B;
with System.Unsigned_Types;
@@ -50,6 +50,15 @@ package System.Img_LLB is
S : out String;
P : in out Natural)
renames Impl.Set_Image_Based_Integer;
-- Sets the signed image of V in based format, using base value B (2..16)
-- starting at S (P + 1), updating P to point to the last character stored.
-- The image includes a leading minus sign if necessary, but no leading
-- spaces unless W is positive, in which case leading spaces are output if
-- necessary to ensure that the output string is no less than W characters
-- long. The caller promises that the buffer is large enough and no check
-- is made for this. Constraint_Error will not necessarily be raised if
-- this is violated, since it is perfectly valid to compile this unit with
-- checks off.
procedure Set_Image_Based_Long_Long_Unsigned
(V : Long_Long_Unsigned;
@@ -58,5 +67,13 @@ package System.Img_LLB is
S : out String;
P : in out Natural)
renames Impl.Set_Image_Based_Unsigned;
-- Sets the unsigned image of V in based format, using base value B (2..16)
-- starting at S (P + 1), updating P to point to the last character stored.
-- The image includes no leading spaces unless W is positive, in which case
-- leading spaces are output if necessary to ensure that the output string
-- is no less than W characters long. The caller promises that the buffer
-- is large enough and no check is made for this. Constraint_Error will not
-- necessarily be raised if this is violated, since it is perfectly valid
-- to compile this unit with checks off).
end System.Img_LLB;

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- signed integer types larger than Integer, and also for conversion
-- operations required in Text_IO.Integer_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Integer_IO`` conversions routines for signed integer
-- types larger than Size ``Integer'Size``.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
@@ -66,11 +66,32 @@ is
S : in out String;
P : out Natural)
renames Impl.Image_Integer;
-- Computes Long_Long_Integer'Image (``V``) and stores the result in
-- ``S`` (1 .. ``P``) setting the resulting value of ``P``. The caller
-- guarantees that ``S`` is long enough to hold the result, and that
-- ``S``'First is 1.
--
-- If ``V`` is not negative, the subprogram writes the leading blank in
-- ``S``. It then calls *Set_Image_Long_Long_Integer*.
procedure Set_Image_Long_Long_Integer
(V : Long_Long_Integer;
S : in out String;
P : in out Natural)
renames Impl.Set_Image_Integer;
-- Stores the image of ``V`` in ``S`` starting at ``S`` (``P`` + 1),
-- ``P`` is updated to point to the last character stored. The value
-- stored is identical to the value of Long_Long_Integer'Image (``V``)
-- except that no leading space is stored when ``V`` is non-negative. The
-- caller guarantees that ``S`` is long enough to hold the result. ``S``
-- need not have a lower bound of 1.
--
-- If ``V`` is negative, the subprogram writes the leading '-' character,
-- otherwise work with -``V`` (always work with negative value to avoid
-- overflow: the largest negative number is not a special case).
--
-- This subprogram then uses recursion: if the value is equal or less than
-- -10, recurse with the value divided by 10. Then add the digit for the
-- remainder.
end System.Img_LLI;

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- modular integer types larger than Unsigned, and also for conversion
-- operations required in Text_IO.Modular_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Modular_IO`` conversions routines for unsigned (modular)
-- integer types larger than Size ``Unsigned'Size``.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
@@ -63,11 +63,28 @@ is
S : in out String;
P : out Natural)
renames Impl.Image_Unsigned;
-- Computes Long_Long_Unsigned'Image (``V``) and stores the result in
-- ``S`` (1 .. ``P``) setting the resulting value of ``P``. The caller
-- guarantees that ``S`` is long enough to hold the result, and that
-- ``S``'First is 1.
--
-- The subprogram writes the leading blank in ``S`` and calls
-- *Set_Image_Long_Long_Unsigned*.
procedure Set_Image_Long_Long_Unsigned
(V : Long_Long_Unsigned;
S : in out String;
P : in out Natural)
renames Impl.Set_Image_Unsigned;
-- Stores the image of ``V`` in ``S`` starting at ``S`` (``P`` + 1),
-- ``P`` is updated to point to the last character stored. The value
-- stored is identical to the value of Long_Long_Unsigned'Image (``V``)
-- except that no leading space is stored.
-- The caller guarantees that ``S`` is long enough to hold the result.
-- ``S`` need not have a lower bound of 1.
--
-- This subprogram uses recursion: if the value is equal or greater than
-- 10, recurse with the value divided by 10. Then add the digit for the
-- remainder.
end System.Img_LLU;

View File

@@ -49,6 +49,15 @@ package System.Img_LLW is
S : out String;
P : in out Natural)
renames Impl.Set_Image_Width_Integer;
-- Sets the signed image of V in based format, using base value B (2..16)
-- starting at S (P + 1), updating P to point to the last character stored.
-- The image includes a leading minus sign if necessary, but no leading
-- spaces unless W is positive, in which case leading spaces are output if
-- necessary to ensure that the output string is no less than W characters
-- long. The caller promises that the buffer is large enough and no check
-- is made for this. Constraint_Error will not necessarily be raised if
-- this is violated, since it is perfectly valid to compile this unit with
-- checks off.
procedure Set_Image_Width_Long_Long_Unsigned
(V : Long_Long_Unsigned;
@@ -56,5 +65,13 @@ package System.Img_LLW is
S : out String;
P : in out Natural)
renames Impl.Set_Image_Width_Unsigned;
-- Sets the unsigned image of V in based format, using base value B (2..16)
-- starting at S (P + 1), updating P to point to the last character stored.
-- The image includes no leading spaces unless W is positive, in which case
-- leading spaces are output if necessary to ensure that the output string
-- is no less than W characters long. The caller promises that the buffer
-- is large enough and no check is made for this. Constraint_Error will not
-- necessarily be raised if this is violated, since it is perfectly valid
-- to compile this unit with checks off).
end System.Img_LLW;

View File

@@ -29,6 +29,8 @@
-- --
------------------------------------------------------------------------------
-- Image for fixed and float types (also used for Float_IO/Fixed_IO output)
-- This obsolete package is preserved for the sake of backward compatibility
with System.Img_LLF;
@@ -43,5 +45,13 @@ package System.Img_Real is
Aft : Natural;
Exp : Natural)
renames System.Img_LLF.Set_Image_Long_Long_Float;
-- Sets the image of ``V`` starting at ``S`` (``P`` + 1), updating ``P``
-- to point to the last character stored, the caller promises that the
-- buffer is large enough and no check is made for this. Constraint_Error
-- will not necessarily be raised if this is violated, since it is
-- perfectly valid to compile this unit with checks off). The ``Fore``,
-- ``Aft`` and ``Exp`` values can be set to any valid values for the case
-- of use from Text_IO. Note that no space is stored at the start for
-- non-negative values.
end System.Img_Real;

View File

@@ -29,9 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- modular integer types up to Unsigned, and also for conversion operations
-- required in Text_IO.Modular_IO for such types.
-- This package provides the subprograms supporting the ``Image`` attribute
-- and ``Ada.Text_IO.Modular_IO`` conversions routines for modular integer
-- types up to size ``Unsigned'Size``.
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
@@ -63,11 +63,27 @@ is
S : in out String;
P : out Natural)
renames Impl.Image_Unsigned;
-- Computes Unsigned'Image (``V``) and stores the result in
-- ``S`` (1 .. ``P``) setting the resulting value of ``P``. The caller
-- guarantees that ``S`` is long enough to hold the result, and that
-- ``S``'First is 1.
--
-- The subprogram writes the leading blank in ``S`` and calls
-- *Set_Image_Unsigned*.
procedure Set_Image_Unsigned
(V : Unsigned;
S : in out String;
P : in out Natural)
renames Impl.Set_Image_Unsigned;
-- Stores the image of ``V`` in ``S`` starting at ``S`` (``P`` + 1), ``P``
-- is updated to point to the last character stored. The value stored is
-- identical to the value of Unsigned'Image (``V``) except that no leading
-- space is stored. The caller guarantees that ``S`` is long enough to hold
-- the result. ``S`` need not have a lower bound of 1.
--
-- This subprogram uses recursion: if the value is equal or greater than
-- 10, recurse with the value divided by 10. Then add the digit for the
-- remainder.
end System.Img_Uns;

View File

@@ -29,7 +29,9 @@
-- --
------------------------------------------------------------------------------
-- This package provides some common utilities used by the s-imgxxx files
-- This package provides some common utilities used by the `System.Img_*`
-- packages. It contains subprograms to set the decimal digits for a string
-- and set the string for a floating-point invalid value.
package System.Img_Util is

View File

@@ -30,8 +30,8 @@
------------------------------------------------------------------------------
-- Contains the routine for computing the image of signed and unsigned
-- integers up to Integer for use by Text_IO.Integer_IO and
-- Text_IO.Modular_IO.
-- integers up to Integer for use by ``Ada.Text_IO.Integer_IO`` and
-- ``Ada.Text_IO.Modular_IO``.
with System.Image_W;
with System.Unsigned_Types;

View File

@@ -30,8 +30,10 @@
------------------------------------------------------------------------------
-- This package provides machine code support, both for intrinsic machine
-- operations, and also for machine code statements. See GNAT documentation
-- for full details.
-- operations, and also for machine code statements. It implements the
-- *System.Machine_code* package defined in ARM 13.8 and GNAT Reference Manual
-- (chapter 'Implementation of Specific Ada Features', 'Machine Code
-- Insertions').
package System.Machine_Code
with SPARK_Mode => Off
@@ -39,9 +41,8 @@ is
pragma No_Elaboration_Code_All;
pragma Pure;
-- All identifiers in this unit are implementation defined
pragma Implementation_Defined;
-- All identifiers in this unit are implementation defined
type Asm_Input_Operand is private;
type Asm_Output_Operand is private;
@@ -50,12 +51,17 @@ is
No_Input_Operands : constant Asm_Input_Operand;
No_Output_Operands : constant Asm_Output_Operand;
-- These constants are used as default value to denote respectively no
-- input operands and no output operands.
type Asm_Input_Operand_List is
array (Integer range <>) of Asm_Input_Operand;
type Asm_Output_Operand_List is
array (Integer range <>) of Asm_Output_Operand;
-- The types *Asm_Input_Operand_List* and *Asm_Output_Operand_List* are
-- arrays of respectively *Asm_Input_Operand* and *Asm_Output_Operand*.
-- They are used to describe lists of operands for the Asm subprograms.
type Asm_Insn is private;
-- This type is not used directly. It is declared only so that the
@@ -116,6 +122,9 @@ is
Inputs : Asm_Input_Operand := No_Input_Operands;
Clobber : String := "";
Volatile : Boolean := False) return Asm_Insn;
-- The parameters are described in the GNAT Reference Manual [GRM].
--
-- These are intrinsic subprograms, fully implemented by the compiler.
pragma Import (Intrinsic, Asm);

View File

@@ -13,6 +13,10 @@
-- --
------------------------------------------------------------------------------
-- This is the top level unit for multiprocessor task support as defined by
-- ARM D.16. It provides the base types to enumerate CPUs and the
-- functionality to get the number of CPUs on the current system.
package System.Multiprocessors is
pragma Preelaborate (Multiprocessors);

View File

@@ -34,6 +34,8 @@
package System.Pack_03 is
pragma Preelaborate;
-- 3-bit element type definition
Bits : constant := 3;
type Bits_03 is mod 2 ** Bits;

View File

@@ -34,6 +34,8 @@
package System.Pack_05 is
pragma Preelaborate;
-- 5-bit element type definition
Bits : constant := 5;
type Bits_05 is mod 2 ** Bits;

View File

@@ -34,6 +34,8 @@
package System.Pack_06 is
pragma Preelaborate;
-- 6-bit element type definition
Bits : constant := 6;
type Bits_06 is mod 2 ** Bits;

View File

@@ -34,6 +34,8 @@
package System.Pack_07 is
pragma Preelaborate;
-- 7-bit element type definition
Bits : constant := 7;
type Bits_07 is mod 2 ** Bits;

View File

@@ -34,6 +34,8 @@
package System.Pack_09 is
pragma Preelaborate;
-- 9-bit element type definition
Bits : constant := 9;
type Bits_09 is mod 2 ** Bits;

View File

@@ -34,6 +34,8 @@
package System.Pack_10 is
pragma Preelaborate;
-- 10-bit element type definition
Bits : constant := 10;
type Bits_10 is mod 2 ** Bits;

View File

@@ -34,6 +34,8 @@
package System.Pack_100 is
pragma Preelaborate;
-- 100-bit element type definition
Bits : constant := 100;
type Bits_100 is mod 2 ** Bits;

View File

@@ -34,6 +34,8 @@
package System.Pack_101 is
pragma Preelaborate;
-- 101-bit element type definition
Bits : constant := 101;
type Bits_101 is mod 2 ** Bits;

Some files were not shown because too many files have changed in this diff Show More