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/fmd.ads | 50 ++++++-------------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) (limited to 'src/fmd.ads') 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