From 866565c42134dbe8828c9a9b8140a90598df4069 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Sat, 6 Nov 2021 00:53:55 +1300 Subject: Factored out deck datatypes into their own package --- src/csv.adb | 29 ++++++++++++---- src/csv.ads | 17 ++++------ src/datatypes.ads | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ src/deck_convert.adb | 14 ++++---- src/deck_io.adb | 93 ++++++++++++++++++++++++++-------------------------- src/deck_io.ads | 78 +++++++------------------------------------ src/fmd.adb | 30 +++++++++-------- src/fmd.ads | 50 ++++------------------------ 8 files changed, 205 insertions(+), 193 deletions(-) create mode 100644 src/datatypes.ads diff --git a/src/csv.adb b/src/csv.adb index 9d4f498..036401b 100644 --- a/src/csv.adb +++ b/src/csv.adb @@ -5,7 +5,8 @@ with Ada.Characters.Latin_1, Ada.Strings.Fixed, Ada.Strings.Maps, - Ada.Text_IO; + Ada.Text_IO, + Datatypes; use @@ -63,24 +64,40 @@ package body CSV is end Put_Cell; + procedure Put_Header + (File_Handle : in Ada.Text_IO.File_Type; + Titles : in Datatypes.Field_ID_Vector) is + begin + for Position in Datatypes.Field_Ordinal range + Titles.First_Index .. Datatypes.Field_Ordinal'Pred (Titles.Last_Index) + loop + Put_Cell (File_Handle, SU.Unbounded_String (Titles.Element (Position))); + Put (File_Handle, Separator_Char); + end loop; + Put_Cell (File_Handle, SU.Unbounded_String (Titles.Last_Element)); + New_Line (File_Handle); + end Put_Header; + + procedure Put_Row (File_Handle : in Ada.Text_IO.File_Type; - Cells : in Data_Vectors.Vector; + Cells : in Datatypes.Field_Vector; Quantity : in Positive) is + use type Datatypes.Field_Ordinal; Counter : Positive := 1; - Position : Vector_Index := Cells.First_Index; + Position : Datatypes.Field_Ordinal := Cells.First_Index; begin while Counter < Quantity loop if Position <= Cells.Last_Index then - Put_Cell (File_Handle, To_Unbounded_String (Cells.Element (Position))); + Put_Cell (File_Handle, SU.Unbounded_String (Cells.Element (Position))); end if; Put (File_Handle, Separator_Char); - Position := Vector_Index'Succ (Position); + Position := Datatypes.Field_Ordinal'Succ (Position); Counter := Counter + 1; end loop; if Position <= Cells.Last_Index then - Put_Cell (File_Handle, To_Unbounded_String (Cells.Element (Position))); + Put_Cell (File_Handle, SU.Unbounded_String (Cells.Element (Position))); end if; New_Line (File_Handle); end Put_Row; diff --git a/src/csv.ads b/src/csv.ads index cc1eef5..ec0c096 100644 --- a/src/csv.ads +++ b/src/csv.ads @@ -4,7 +4,8 @@ with Ada.Containers.Vectors, Ada.Strings.Unbounded, - Ada.Text_IO; + Ada.Text_IO, + Datatypes; generic @@ -25,20 +26,14 @@ package CSV is Data : in Ada.Strings.Unbounded.Unbounded_String); - generic - - type Vector_Index is range <>; - type Vector_Data is private; - - with package Data_Vectors is new Ada.Containers.Vectors (Vector_Index, Vector_Data); + procedure Put_Header + (File_Handle : in Ada.Text_IO.File_Type; + Titles : in Datatypes.Field_ID_Vector); - with function To_Unbounded_String - (Data : in Vector_Data) - return Ada.Strings.Unbounded.Unbounded_String is <>; procedure Put_Row (File_Handle : in Ada.Text_IO.File_Type; - Cells : in Data_Vectors.Vector; + Cells : in Datatypes.Field_Vector; Quantity : in Positive); diff --git a/src/datatypes.ads b/src/datatypes.ads new file mode 100644 index 0000000..164e7c9 --- /dev/null +++ b/src/datatypes.ads @@ -0,0 +1,87 @@ + + +with + + Ada.Containers.Vectors, + Ada.Containers.Ordered_Maps, + Ada.Strings.Unbounded; + + +package Datatypes is + + + package SU renames Ada.Strings.Unbounded; + + + + + type Field_Ordinal is new Positive; + type Field_ID is new SU.Unbounded_String; + + package Field_ID_Vectors is new Ada.Containers.Vectors + (Index_Type => Field_Ordinal, + Element_Type => Field_ID); + + subtype Field_ID_Vector is Field_ID_Vectors.Vector; + + + type Template is record + Question : Field_ID_Vectors.Vector; + Answer : Field_ID_Vectors.Vector; + end record; + + package Template_Vectors is new Ada.Containers.Vectors + (Index_Type => Positive, + Element_Type => Template); + + subtype Template_Vector is Template_Vectors.Vector; + + + type Model_ID is new SU.Unbounded_String; + + type Model is record + Fields : Field_ID_Vectors.Vector; + Templates : Template_Vectors.Vector; + end record; + + package Model_Maps is new Ada.Containers.Ordered_Maps + (Key_Type => Model_ID, + Element_Type => Model); + + subtype Model_Map is Model_Maps.Map; + + + type Field is new SU.Unbounded_String; + + package Field_Vectors is new Ada.Containers.Vectors + (Index_Type => Field_Ordinal, + Element_Type => Field); + + subtype Field_Vector is Field_Vectors.Vector; + + + type Note is record + Model : Model_ID; + Fields : Field_Vectors.Vector; + end record; + + package Note_Vectors is new Ada.Containers.Vectors + (Index_Type => Positive, + Element_Type => Note); + + subtype Note_Vector is Note_Vectors.Vector; + + + type Media_ID is new SU.Unbounded_String; + type Media_Name is new SU.Unbounded_String; + + package Media_Maps is new Ada.Containers.Ordered_Maps + (Key_Type => Media_ID, + Element_Type => Media_Name); + + subtype Media_Map is Media_Maps.Map; + + +end Datatypes; + + diff --git a/src/deck_convert.adb b/src/deck_convert.adb index 6154b1c..75a35d0 100644 --- a/src/deck_convert.adb +++ b/src/deck_convert.adb @@ -11,11 +11,13 @@ with Ada.Strings.Unbounded, Ada.Text_IO, SQLite3, + Datatypes, Deck_IO; use - Ada.Text_IO; + Ada.Text_IO, + Datatypes; procedure Deck_Convert is @@ -46,10 +48,10 @@ procedure Deck_Convert is procedure Strip_Formatting - (Notes : in out Deck_IO.Note_Vectors.Vector) + (Notes : in out Note_Vector) is procedure Strip - (Text : in out Deck_IO.Note; + (Text : in out Note; Item : in String) is Position : Natural; @@ -101,9 +103,9 @@ procedure Deck_Convert is Deck : Deck_IO.Deck_Handle; - Models : Deck_IO.Model_Maps.Map; - Notes : Deck_IO.Note_Vectors.Vector; - Media : Deck_IO.Media_Maps.Map; + Models : Model_Map; + Notes : Note_Vector; + Media : Media_Map; begin diff --git a/src/deck_io.adb b/src/deck_io.adb index 5207fe7..4c87164 100644 --- a/src/deck_io.adb +++ b/src/deck_io.adb @@ -8,6 +8,7 @@ with Ada.Strings.Maps, Ada.Text_IO, CSV, + Datatypes, FMD, GNAT.Regpat, GNATCOLL.JSON, @@ -15,7 +16,7 @@ with use - Ada.Text_IO; + Datatypes; package body Deck_IO is @@ -25,6 +26,7 @@ package body Deck_IO is package FD renames Ada.Directories; package Strfix renames Ada.Strings.Fixed; package Strmap renames Ada.Strings.Maps; + package TIO renames Ada.Text_IO; package Pat renames GNAT.Regpat; package JS renames GNATCOLL.JSON; @@ -48,7 +50,7 @@ package body Deck_IO is end To_Unbounded_String; function To_Unbounded_String - (Item : in Field) + (Item : in Datatypes.Field) return SU.Unbounded_String is begin return SU.Unbounded_String (Item); @@ -71,12 +73,12 @@ package body Deck_IO is function Generate_Temp_Name return String is - Handle : File_Type; + Handle : TIO.File_Type; Filename : SU.Unbounded_String; begin - Create (File => Handle); - Filename := +Name (Handle); - Close (Handle); + TIO.Create (File => Handle); + Filename := +TIO.Name (Handle); + TIO.Close (Handle); return -Filename; end Generate_Temp_Name; @@ -84,8 +86,8 @@ package body Deck_IO is function Matches - (Models : in Model_Maps.Map; - Notes : in Note_Vectors.Vector) + (Models : in Model_Map; + Notes : in Note_Vector) return Boolean is use type Ada.Containers.Count_Type; @@ -105,28 +107,30 @@ package body Deck_IO is procedure Read_Media_Map (Filename : in String; - Media_Map : out Media_Maps.Map) + Media : out Media_Map) is Temp : String := Generate_Temp_Name; - Input_Handle : File_Type; + Input_Handle : TIO.File_Type; Raw_Data : SU.Unbounded_String; JSON_Data : JS.JSON_Value; procedure Map_Iteration (Name : in JS.UTF8_String; - Value : in JS.JSON_Value) is + Value : in JS.JSON_Value) + is + Val : SU.Unbounded_String := JS.Get (Value); begin - Media_Map.Insert (Media_ID (+Name), JS.Get (Value)); + Media.Insert (Media_ID (+Name), Media_Name (Val)); end Map_Iteration; begin UnZip.Extract (Filename, "media", Temp); - Open (Input_Handle, In_File, Temp); - while not End_Of_File (Input_Handle) loop - SU.Append (Raw_Data, Get_Line (Input_Handle) & Latin.LF); + TIO.Open (Input_Handle, TIO.In_File, Temp); + while not TIO.End_Of_File (Input_Handle) loop + SU.Append (Raw_Data, TIO.Get_Line (Input_Handle) & Latin.LF); end loop; - Close (Input_Handle); + TIO.Close (Input_Handle); FD.Delete_File (Temp); JSON_Data := JS.Read (-Raw_Data); @@ -174,7 +178,7 @@ package body Deck_IO is procedure Extract_Field_IDs (Value : in JS.JSON_Array; - FIDs : out Field_ID_Vectors.Vector) + FIDs : out Field_ID_Vector) is Index : Positive; Item : JS.JSON_Value; @@ -199,7 +203,7 @@ package body Deck_IO is procedure Regex_Fields (Raw_Data : in JS.UTF8_String; - FIDs : out Field_ID_Vectors.Vector) + FIDs : out Field_ID_Vector) is use type Pat.Match_Location; Matches : Pat.Match_Array (0 .. 1); @@ -225,7 +229,7 @@ package body Deck_IO is procedure Extract_Templates (Value : in JS.JSON_Array; - TMPLs : out Template_Vectors.Vector) + TMPLs : out Template_Vector) is Index : Positive; Item : JS.JSON_Value; @@ -247,7 +251,7 @@ package body Deck_IO is procedure Extract_Model (Name : in JS.UTF8_String; Value : in JS.JSON_Value; - Models : in out Model_Maps.Map) + Models : in out Model_Map) is Current_Model : Model; begin @@ -259,7 +263,7 @@ package body Deck_IO is procedure Query_Models (Deck : in out Deck_Handle; - Models : out Model_Maps.Map) + Models : out Model_Map) is Statement : SQLite3.SQLite3_Statement; Raw_Data : SU.Unbounded_String; @@ -284,7 +288,7 @@ package body Deck_IO is procedure Tokenize_Fields (Raw_Data : in SU.Unbounded_String; - Fields : out Field_Vectors.Vector) + Fields : out Field_Vector) is Charset : Strmap.Character_Set := Strmap.To_Set (Latin.US); Position : Positive := 1; @@ -293,9 +297,10 @@ package body Deck_IO is while Next /= 0 and Position <= SU.Length (Raw_Data) loop Next := SU.Index (Raw_Data, Charset, Position); if Position <= Next then - Fields.Append (Field (SU.Unbounded_Slice (Raw_Data, Position, Next - 1))); + Fields.Append (Datatypes.Field (SU.Unbounded_Slice + (Raw_Data, Position, Next - 1))); else - Fields.Append (Field (SU.Unbounded_Slice + Fields.Append (Datatypes.Field (SU.Unbounded_Slice (Raw_Data, Position, SU.Length (Raw_Data)))); end if; Position := Next + 1; @@ -305,7 +310,7 @@ package body Deck_IO is procedure Query_Notes (Deck : in out Deck_Handle; - Notes : out Note_Vectors.Vector) + Notes : out Note_Vector) is use type SQLite3.Status_Code; Statement : SQLite3.SQLite3_Statement; @@ -349,17 +354,15 @@ package body Deck_IO is procedure Write_CSV (Directory : in String; Basename : in String; - Models : in Model_Maps.Map; - Notes : in Note_Vectors.Vector; + Models : in Model_Map; + Notes : in Note_Vector; Overwrite : in Boolean := False) is package My_CSV is new CSV; - procedure Put_Header is new My_CSV.Put_Row (Field_Ordinal, Field_ID, Field_ID_Vectors); - procedure Put_Row is new My_CSV.Put_Row (Field_Ordinal, Field, Field_Vectors); Counter : Positive := 1; Outname : SU.Unbounded_String; - File_Handle : File_Type; + File_Handle : TIO.File_Type; Row_Size : Positive; begin for C in Models.Iterate loop @@ -371,15 +374,15 @@ package body Deck_IO is FD.Delete_File (-Outname); end if; end if; - Create (File_Handle, Out_File, -Outname); + TIO.Create (File_Handle, TIO.Out_File, -Outname); Row_Size := Positive (Model_Maps.Element (C).Fields.Length); - Put_Header (File_Handle, Model_Maps.Element (C).Fields, Row_Size); + My_CSV.Put_Header (File_Handle, Model_Maps.Element (C).Fields); for N of Notes loop if N.Model = Model_Maps.Key (C) then - Put_Row (File_Handle, N.Fields, Row_Size); + My_CSV.Put_Row (File_Handle, N.Fields, Row_Size); end if; end loop; - Close (File_Handle); + TIO.Close (File_Handle); Counter := Counter + 1; end loop; end Write_CSV; @@ -390,18 +393,14 @@ package body Deck_IO is procedure Write_FMD (Directory : in String; Basename : in String; - Models : in Model_Maps.Map; - Notes : in Note_Vectors.Vector; - Media : in Media_Maps.Map; + Models : in Model_Map; + Notes : in Note_Vector; + Media : in Media_Map; Overwrite : in Boolean := False) is - procedure Put_Fields is new FMD.Put_Fields (Field_Ordinal, Field_ID, Field_ID_Vectors); - procedure Put_Pack is new FMD.Put_Pack (Field_Ordinal, Field_ID, Field_ID_Vectors); - procedure Put_Entry is new FMD.Put_Entry (Field_Ordinal, Field, Field_Vectors); - Counter : Positive := 1; Outname : SU.Unbounded_String; - File_Handle : File_Type; + File_Handle : TIO.File_Type; Entry_Size : Positive; begin for C in Models.Iterate loop @@ -413,24 +412,24 @@ package body Deck_IO is FD.Delete_File (-Outname); end if; end if; - Create (File_Handle, Out_File, -Outname); + TIO.Create (File_Handle, TIO.Out_File, -Outname); Entry_Size := Positive (Model_Maps.Element (C).Fields.Length); FMD.Put_Header (File_Handle); - Put_Fields (File_Handle, Model_Maps.Element (C).Fields); + FMD.Put_Fields (File_Handle, Model_Maps.Element (C).Fields); FMD.Start_Pack_Section (File_Handle); for Tmpl of Model_Maps.Element (C).Templates loop - Put_Pack (File_Handle, Tmpl.Question, Tmpl.Answer); + FMD.Put_Pack (File_Handle, Tmpl.Question, Tmpl.Answer); end loop; FMD.End_Pack_Section (File_Handle); FMD.Start_Entry_Section (File_Handle); for N of Notes loop if N.Model = Model_Maps.Key (C) then - Put_Entry (File_Handle, N.Fields, Entry_Size); + FMD.Put_Entry (File_Handle, N.Fields, Entry_Size); end if; end loop; FMD.End_Entry_Section (File_Handle); FMD.Put_Footer (File_Handle); - Close (File_Handle); + TIO.Close (File_Handle); Counter := Counter + 1; end loop; end Write_FMD; diff --git a/src/deck_io.ads b/src/deck_io.ads index 7121a37..0145c4e 100644 --- a/src/deck_io.ads +++ b/src/deck_io.ads @@ -4,7 +4,8 @@ with Ada.Containers.Vectors, Ada.Containers.Ordered_Maps, - Ada.Strings.Unbounded; + Ada.Strings.Unbounded, + Datatypes; private with @@ -22,70 +23,15 @@ package Deck_IO is type Deck_Handle is limited private; - type Field_Ordinal is new Positive; - type Field_ID is new SU.Unbounded_String; - - package Field_ID_Vectors is new Ada.Containers.Vectors - (Index_Type => Field_Ordinal, - Element_Type => Field_ID); - - - type Template is record - Question : Field_ID_Vectors.Vector; - Answer : Field_ID_Vectors.Vector; - end record; - - package Template_Vectors is new Ada.Containers.Vectors - (Index_Type => Positive, - Element_Type => Template); - - - type Model_ID is new SU.Unbounded_String; - - type Model is record - Fields : Field_ID_Vectors.Vector; - Templates : Template_Vectors.Vector; - end record; - - package Model_Maps is new Ada.Containers.Ordered_Maps - (Key_Type => Model_ID, - Element_Type => Model); - - - type Field is new SU.Unbounded_String; - - package Field_Vectors is new Ada.Containers.Vectors - (Index_Type => Field_Ordinal, - Element_Type => Field); - - - type Note is record - Model : Model_ID; - Fields : Field_Vectors.Vector; - end record; - - package Note_Vectors is new Ada.Containers.Vectors - (Index_Type => Positive, - Element_Type => Note); - - function Matches - (Models : in Model_Maps.Map; - Notes : in Note_Vectors.Vector) + (Models : in Datatypes.Model_Map; + Notes : in Datatypes.Note_Vector) return Boolean; - type Media_ID is new SU.Unbounded_String; - subtype Media_Name is SU.Unbounded_String; - - package Media_Maps is new Ada.Containers.Ordered_Maps - (Key_Type => Media_ID, - Element_Type => Media_Name); - - procedure Read_Media_Map (Filename : in String; - Media_Map : out Media_Maps.Map); + Media : out Datatypes.Media_Map); procedure Open_Database @@ -103,29 +49,29 @@ package Deck_IO is procedure Query_Models (Deck : in out Deck_Handle; - Models : out Model_Maps.Map) + Models : out Datatypes.Model_Map) with Pre => Is_Open (Deck); procedure Query_Notes (Deck : in out Deck_Handle; - Notes : out Note_Vectors.Vector) + Notes : out Datatypes.Note_Vector) with Pre => Is_Open (Deck); procedure Write_CSV (Directory : in String; Basename : in String; - Models : in Model_Maps.Map; - Notes : in Note_Vectors.Vector; + Models : in Datatypes.Model_Map; + Notes : in Datatypes.Note_Vector; Overwrite : in Boolean := False) with Pre => Matches (Models, Notes); procedure Write_FMD (Directory : in String; Basename : in String; - Models : in Model_Maps.Map; - Notes : in Note_Vectors.Vector; - Media : in Media_Maps.Map; + Models : in Datatypes.Model_Map; + Notes : in Datatypes.Note_Vector; + Media : in Datatypes.Media_Map; Overwrite : in Boolean := False) with Pre => Matches (Models, Notes); diff --git a/src/fmd.adb b/src/fmd.adb index cd512cb..9fbb4e5 100644 --- a/src/fmd.adb +++ b/src/fmd.adb @@ -5,7 +5,8 @@ with Ada.Characters.Latin_1, Ada.Strings.Fixed, Ada.Strings.Maps, - Ada.Text_IO; + Ada.Text_IO, + Datatypes; use @@ -42,13 +43,13 @@ package body FMD is procedure Put_Fields (File_Handle : in Ada.Text_IO.File_Type; - Field_IDs : in Data_Vectors.Vector) + Field_IDs : in Datatypes.Field_ID_Vector) is Text : SU.Unbounded_String; begin Put_Line (File_Handle, (4 * ' ') & ""); for FID of Field_IDs loop - Text := Prep (To_Unbounded_String (FID)); + Text := Prep (SU.Unbounded_String (FID)); Put_Line (File_Handle, (8 * ' ') & "" & (-Text) & ""); end loop; Put_Line (File_Handle, (4 * ' ') & ""); @@ -66,21 +67,23 @@ package body FMD is procedure Put_Pack (File_Handle : in Ada.Text_IO.File_Type; - Q_Data : in Data_Vectors.Vector; - A_Data : in Data_Vectors.Vector) + Q_Data : in Datatypes.Field_ID_Vector; + A_Data : in Datatypes.Field_ID_Vector) is Text : SU.Unbounded_String; begin Put_Line (File_Handle, (8 * ' ') & ""); - Text := Prep (To_Unbounded_String (Q_Data.First_Element)); + Text := Prep (SU.Unbounded_String (Q_Data.First_Element)); Put_Line (File_Handle, (12 * ' ') & "" & (-Text) & ""); - for I in Vector_Index range Vector_Index'Succ (Q_Data.First_Index) .. Q_Data.Last_Index loop - Text := Prep (To_Unbounded_String (Q_Data.Element (I))); + for I in Datatypes.Field_Ordinal range + Datatypes.Field_Ordinal'Succ (Q_Data.First_Index) .. Q_Data.Last_Index + loop + Text := Prep (SU.Unbounded_String (Q_Data.Element (I))); -- Fresh Memory unfortunately cannot cope with multiple question fields Put_Line (File_Handle, (12 * ' ') & ""); end loop; for FID of A_Data loop - Text := Prep (To_Unbounded_String (FID)); + Text := Prep (SU.Unbounded_String (FID)); Put_Line (File_Handle, (12 * ' ') & "" & (-Text) & ""); end loop; Put_Line (File_Handle, (8 * ' ') & ""); @@ -105,22 +108,23 @@ package body FMD is procedure Put_Entry (File_Handle : in Ada.Text_IO.File_Type; - Data : in Data_Vectors.Vector; + Data : in Datatypes.Field_Vector; Quantity : in Positive) is + use type Datatypes.Field_Ordinal; Counter : Positive := 1; - Position : Vector_Index := Data.First_Index; + Position : Datatypes.Field_Ordinal := Data.First_Index; Text : SU.Unbounded_String; begin Put_Line (File_Handle, (8 * ' ') & ""); while Counter <= Quantity loop if Position <= Data.Last_Index then - Text := Prep (To_Unbounded_String (Data.Element (Position))); + Text := Prep (SU.Unbounded_String (Data.Element (Position))); Put_Line (File_Handle, (12 * ' ') & "" & (-Text) & ""); else Put_Line (File_Handle, (12 * ' ') & ""); end if; - Position := Vector_Index'Succ (Position); + Position := Datatypes.Field_Ordinal'Succ (Position); Counter := Counter + 1; end loop; Put_Line (File_Handle, (8 * ' ') & ""); diff --git a/src/fmd.ads b/src/fmd.ads index 1c64deb..6b06d20 100644 --- a/src/fmd.ads +++ b/src/fmd.ads @@ -4,7 +4,8 @@ with Ada.Containers.Vectors, Ada.Strings.Unbounded, - Ada.Text_IO; + Ada.Text_IO, + Datatypes; private with @@ -22,20 +23,9 @@ package FMD is - generic - - type Vector_Index is range <>; - type Vector_Data is private; - - with package Data_Vectors is new Ada.Containers.Vectors (Vector_Index, Vector_Data); - - with function To_Unbounded_String - (Data : in Vector_Data) - return Ada.Strings.Unbounded.Unbounded_String is <>; - procedure Put_Fields (File_Handle : in Ada.Text_IO.File_Type; - Field_IDs : in Data_Vectors.Vector); + Field_IDs : in Datatypes.Field_ID_Vector); @@ -43,25 +33,12 @@ package FMD is procedure Start_Pack_Section (File_Handle : in Ada.Text_IO.File_Type); - - generic - - type Vector_Index is range <>; - type Vector_Data is private; - - with package Data_Vectors is new Ada.Containers.Vectors (Vector_Index, Vector_Data); - - with function To_Unbounded_String - (Data : in Vector_Data) - return Ada.Strings.Unbounded.Unbounded_String is <>; - procedure Put_Pack (File_Handle : in Ada.Text_IO.File_Type; - Q_Data : in Data_Vectors.Vector; - A_Data : in Data_Vectors.Vector) + Q_Data : in Datatypes.Field_ID_Vector; + A_Data : in Datatypes.Field_ID_Vector) with Pre => not Q_Data.Is_Empty and not A_Data.Is_Empty; - procedure End_Pack_Section (File_Handle : in Ada.Text_IO.File_Type); @@ -71,24 +48,11 @@ package FMD is procedure Start_Entry_Section (File_Handle : in Ada.Text_IO.File_Type); - - generic - - type Vector_Index is range <>; - type Vector_Data is private; - - with package Data_Vectors is new Ada.Containers.Vectors (Vector_Index, Vector_Data); - - with function To_Unbounded_String - (Data : in Vector_Data) - return Ada.Strings.Unbounded.Unbounded_String is <>; - procedure Put_Entry (File_Handle : in Ada.Text_IO.File_Type; - Data : in Data_Vectors.Vector; + Data : in Datatypes.Field_Vector; Quantity : in Positive); - procedure End_Entry_Section (File_Handle : in Ada.Text_IO.File_Type); @@ -124,13 +88,11 @@ private Sub : in String) with Pre => Ada.Strings.Fixed.Count (Sub, Ada.Strings.Maps.To_Set (Char)) = 0; - procedure Replace_All (Text : in out SU.Unbounded_String; Item : in String; Sub : in String); - function Prep (Text : in SU.Unbounded_String) return SU.Unbounded_String; -- cgit