From 36b0cbf19bd44c94bbe5aa67730347290f20628c Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 9 Nov 2021 17:05:44 +1300 Subject: Refactored packages --- src/deckdata-fmd.ads | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/deckdata-fmd.ads (limited to 'src/deckdata-fmd.ads') diff --git a/src/deckdata-fmd.ads b/src/deckdata-fmd.ads new file mode 100644 index 0000000..bf251f3 --- /dev/null +++ b/src/deckdata-fmd.ads @@ -0,0 +1,89 @@ + + +-- This source is licensed under the Sunset License v1.0 + + +with + + Ada.Containers.Vectors, + Ada.Strings.Unbounded, + Ada.Text_IO; + +private with + + Ada.Strings.Fixed, + Ada.Strings.Maps; + + +package Deckdata.FMD is + + + procedure Put_Header + (File_Handle : in Ada.Text_IO.File_Type; + Version : in String := "1.4"); + + + + + procedure Put_Fields + (File_Handle : in Ada.Text_IO.File_Type; + Field_IDs : in Field_ID_Vector); + + + + + procedure Start_Pack_Section + (File_Handle : in Ada.Text_IO.File_Type); + + procedure Put_Pack + (File_Handle : in Ada.Text_IO.File_Type; + Q_Data : in Field_ID_Vector; + A_Data : in 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); + + + + + procedure Start_Entry_Section + (File_Handle : in Ada.Text_IO.File_Type); + + procedure Put_Entry + (File_Handle : in Ada.Text_IO.File_Type; + Data : in Field_Vector; + Quantity : in Positive); + + procedure End_Entry_Section + (File_Handle : in Ada.Text_IO.File_Type); + + + + + procedure Put_Footer + (File_Handle : in Ada.Text_IO.File_Type); + + +private + + + procedure Replace_All + (Text : in out SU.Unbounded_String; + Char : in Character; + 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; + + +end Deckdata.FMD; + + -- cgit