aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-diinio.ads
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-02-08 11:13:54 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2012-02-08 11:13:54 +0100
commit7b50c4a3fab8576892a1358bfa08a99e7d510201 (patch)
treeac74688e2712a1abbfa5739a283cc020bbff4d7a /gcc/ada/s-diinio.ads
parentf62054146e86e792b6ce061bd418b9a2384ae9a5 (diff)
downloadgcc-7b50c4a3fab8576892a1358bfa08a99e7d510201.zip
gcc-7b50c4a3fab8576892a1358bfa08a99e7d510201.tar.gz
gcc-7b50c4a3fab8576892a1358bfa08a99e7d510201.tar.bz2
[multiple changes]
2012-02-08 Vincent Celier <celier@adacore.com> * gcc-interface/Make-lang.in: Add g-byorma.o to gnatbind objects (g-buorma is now imported by sinput). Update dependencies. * scn.adb (Initialize_Scanner): Call Check_For_BOM * sinput-p.adb (Source_File_Is_Subunit): Call Check_For_BOM * sinput.adb: New procedure Check_For_BOM * sinput.ads: New procedure Check_For_BOM 2012-02-08 Vincent Pucci <pucci@adacore.com> * impunit.adb: Dimension package names updated * Makefile.rtl: s-dim added * sem_dim.adb (Is_Procedure_Put_Call): minor changes (Is_Dim_IO_Package_Instantiation): minor changes * sem_dim.ads: minor changes in comments * snames.ads-tmpl: Name_Dim added Name_Dim_Float_IO and Name_Dim_Integer_IO removed * s-dim.ads: New package. Define the dimension terminology. * s-diflio.adb, s-diinio.adb, s-dimkio.ads, s-dimmks.ads, * s-dmotpr.ads: Package names updated. * s-diflio.ads, s-diinio.ads: Documentation added and package names updated. 2012-02-08 Gary Dismukes <dismukes@adacore.com> * gcc-interface/utils2.c (build_call_alloc_dealloc_proc): Revise test for storage pools to test for an underlying record type rather than testing Is_Tagged_Type, so that simple storage pools will be handled the same as normal Ada storage pools. From-SVN: r184004
Diffstat (limited to 'gcc/ada/s-diinio.ads')
-rw-r--r--gcc/ada/s-diinio.ads78
1 files changed, 70 insertions, 8 deletions
diff --git a/gcc/ada/s-diinio.ads b/gcc/ada/s-diinio.ads
index dfbcb79..eab6a52 100644
--- a/gcc/ada/s-diinio.ads
+++ b/gcc/ada/s-diinio.ads
@@ -2,7 +2,7 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- S Y S T E M . D I M _ I N T E G E R _ I O --
+-- S Y S T E M . D I M . I N T E G E R _ I O --
-- --
-- S p e c --
-- --
@@ -29,19 +29,81 @@
-- --
------------------------------------------------------------------------------
--- This package is a generic package that provides IO facilities for integer
--- dimensioned types.
+-- This package provides output routines for integer dimensioned types. All
+-- Put routines are modelled after those in package Ada.Text_IO.Integer_IO
+-- with the addition of an extra default parameter.
--- Note that there is a default string parameter in every Put routine
--- rewritten at compile time to output the corresponding dimensions as a
--- suffix of the numeric value.
+-- All the examples in this package are based on the MKS system of units:
+
+-- type Mks_Type is new Integer
+-- with
+-- Dimension_System => ((Meter, 'm'),
+-- (Kilogram, "kg"),
+-- (Second, 's'),
+-- (Ampere, 'A'),
+-- (Kelvin, 'K'),
+-- (Mole, "mol"),
+-- (Candela, "cd"));
+
+-- Parameter Symbol may be used in the following manner:
+
+-- Case 1. A value is supplied for Symbol
+
+-- The string appears as a suffix of Item
+
+-- Obj : Mks_Type := 2;
+-- Put (Obj, Symbols => " dimensionless");
+
+-- The corresponding output is: 2 dimensionless
+
+-- Case 2. No value is supplied for Symbol and Item is dimensionless
+
+-- Item appears without a suffix
+
+-- Obj : Mks_Type := 2;
+-- Put (Obj);
+
+-- The corresponding output is: 2
+
+-- Case 3. No value is supplied for Symbol and Item has a dimension
+
+-- If the type of Item is a dimensioned subtype whose symbolic name is not
+-- empty, then the symbolic name appears as a suffix.
+
+-- subtype Length is Mks_Type
+-- with
+-- Dimension => ('m',
+-- Meter => 1,
+-- others => 0);
+
+-- Obj : Length := 2;
+-- Put (Obj);
+
+-- The corresponding output is: 2 m
+
+-- Otherwise, a new string is created and appears as a suffix of Item.
+-- This string results in the successive concatanations between each
+-- dimension symbolic name raised by its corresponding dimension power from
+-- the dimensions of Item.
+
+-- subtype Random is Mks_Type
+-- with
+-- Dimension => ("",
+-- Meter => 3,
+-- Candela => 2,
+-- others => 0);
+
+-- Obj : Random := 5;
+-- Put (Obj);
+
+-- The corresponding output is: 5 m**3.cd**2
with Ada.Text_IO; use Ada.Text_IO;
generic
type Num_Dim_Integer is range <>;
-package System.Dim_Integer_IO is
+package System.Dim.Integer_IO is
Default_Width : Field := Num_Dim_Integer'Width;
Default_Base : Number_Base := 10;
@@ -67,4 +129,4 @@ package System.Dim_Integer_IO is
pragma Inline (Put);
-end System.Dim_Integer_IO;
+end System.Dim.Integer_IO;