From 6fbf97420e457570428b3ffbbd8b8de272252e39 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Thu, 4 Nov 2021 12:18:49 +1300 Subject: FMD output now functional, no media support yet --- src/fmd.ads | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 src/fmd.ads (limited to 'src/fmd.ads') diff --git a/src/fmd.ads b/src/fmd.ads new file mode 100644 index 0000000..fe720d5 --- /dev/null +++ b/src/fmd.ads @@ -0,0 +1,134 @@ + + +with + + Ada.Containers.Vectors, + Ada.Strings.Unbounded, + Ada.Text_IO; + +private with + + Ada.Strings.Fixed, + Ada.Strings.Maps; + + +package FMD is + + + procedure Put_Header + (File_Handle : in Ada.Text_IO.File_Type; + Version : in String := "1.4"); + + + + + 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); + + + + + 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) + 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); + + + 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; + 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 + + + package SU renames Ada.Strings.Unbounded; + + + function "+" + (S : in String) + return SU.Unbounded_String + renames SU.To_Unbounded_String; + + function "-" + (US : in SU.Unbounded_String) + return String + renames SU.To_String; + + + + + procedure Escape + (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 Standard_Escapes + (Text : in out SU.Unbounded_String); + + +end FMD; + + -- cgit