diff --git a/.gitmodules b/.gitmodules index d4faed9b..051cdf70 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "deps/simple_logging"] path = deps/simple_logging url = https://github.com/alire-project/simple_logging.git +[submodule "deps/aaa"] + path = deps/aaa + url = https://github.com/mosteo/aaa.git diff --git a/alire.gpr b/alire.gpr index 1c763d01..aef89a2b 100644 --- a/alire.gpr +++ b/alire.gpr @@ -1,3 +1,4 @@ +with "aaa"; with "semantic_versioning"; with "simple_logging"; diff --git a/deps/aaa b/deps/aaa new file mode 160000 index 00000000..3b263b6c --- /dev/null +++ b/deps/aaa @@ -0,0 +1 @@ +Subproject commit 3b263b6cb858c1ca0043674d21ae3e618c4026e2 diff --git a/src/alire-releases.adb b/src/alire-releases.adb index 019f2eb7..8e46b23a 100644 --- a/src/alire-releases.adb +++ b/src/alire-releases.adb @@ -1,11 +1,11 @@ +with AAA.Table_IO; + -- with Alire.Platform; with Alire.Platforms; with Alire.Requisites.Booleans; with GNAT.IO; -- To keep preelaborable -with Table_IO; - package body Alire.Releases is use all type Alire.Properties.Labeled.Labels; @@ -352,7 +352,7 @@ package body Alire.Releases is if R.Origin.Is_Native then Put_Line ("Origin (native package):"); declare - Table : Table_IO.Table; + Table : AAA.Table_IO.Table; begin for Dist in Platforms.Distributions loop if R.Origin.Package_Name (Dist) /= Origins.Unavailable.Image then diff --git a/src/table_io.adb b/src/table_io.adb deleted file mode 100644 index e7adf22d..00000000 --- a/src/table_io.adb +++ /dev/null @@ -1,87 +0,0 @@ -with Ada.Containers; -with Ada.Strings.Fixed; - -with GNAT.IO; - -package body Table_IO is - - use all type Ada.Containers.Count_Type; - - ------------ - -- Append -- - ------------ - - procedure Append (T : in out Table; Cell : String) is - begin - if T.Rows.Is_Empty then - T.New_Row; - end if; - - if Natural (T.Max_Widths.Length) < T.Next_Column then - T.Max_Widths.Append (Cell'Length); - else - T.Max_Widths (T.Next_Column) := - Natural'Max (Cell'Length, T.Max_Widths (T.Next_Column)); - end if; - - T.Rows (Natural (T.Rows.Length)).Append (Cell); - T.Next_Column := T.Next_Column + 1; - end Append; - - ------------- - -- New_Row -- - ------------- - - procedure New_Row (T : in out Table) is - begin - T.Next_Column := 1; - T.Rows.Append (String_Vectors.Empty_Vector); - end New_Row; - - ---------------- - -- Put_Padded -- - ---------------- - - procedure Put_Padded (T : Table; - Col : Positive; - Text : String; - Align : Ada.Strings.Alignment) - is - Field : String (1 .. T.Max_Widths (Col)); - begin - Ada.Strings.Fixed.Move (Text, - Field, - Drop => Ada.Strings.Error, - Justify => Align); - GNAT.IO.Put (Field); - end Put_Padded; - - ----------- - -- Print -- - ----------- - - procedure Print (T : Table; - Separator : String := " "; - Align : Alignments := (1 .. 0 => <>)) - is - use GNAT.IO; - begin - for Row of T.Rows loop - for I in 1 .. Natural (Row.Length) loop - Put_Padded (T, - I, - Row (I), - (if Align'Length >= I - then Align (I) - else Ada.Strings.Left)); - - if I < Natural (Row.Length) then - Put (Separator); - else - New_Line; - end if; - end loop; - end loop; - end Print; - -end Table_IO; diff --git a/src/table_io.ads b/src/table_io.ads deleted file mode 100644 index f3ee876e..00000000 --- a/src/table_io.ads +++ /dev/null @@ -1,37 +0,0 @@ -with Ada.Containers.Indefinite_Vectors; -with Ada.Containers.Vectors; - -with Ada.Strings; - -package Table_IO with Preelaborate is - - type Table is tagged private; - - procedure Append (T : in out Table; Cell : String); - - procedure New_Row (T : in out Table); - - type Alignments is array (Positive range <>) of Ada.Strings.Alignment; - - procedure Print (T : Table; - Separator : String := " "; - Align : Alignments := (1 .. 0 => <>)); - -private - - package Natural_Vectors is new Ada.Containers.Vectors (Positive, Natural); - - package String_Vectors is new Ada.Containers.Indefinite_Vectors (Positive, - String); - subtype Row is String_Vectors.Vector; - use all type Row; - - package Row_Vectors is new Ada.Containers.Vectors (Positive, Row); - - type Table is tagged record - Next_Column : Positive := 1; - Rows : Row_Vectors.Vector; - Max_Widths : Natural_Vectors.Vector; - end record; - -end Table_IO;