From 5b3307b32f88c391ef65b7683b4178229e3bae24 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 4 Nov 2017 11:04:16 +1100 Subject: Removed use of obsolescent ASCII and replaced with Ada.Characters.Latin_1 --- src/stv.adb | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/stv.adb') diff --git a/src/stv.adb b/src/stv.adb index 20b5b29..f0950fb 100644 --- a/src/stv.adb +++ b/src/stv.adb @@ -1,7 +1,11 @@ +pragma Restrictions (No_Obsolescent_Features); + + with + Ada.Characters.Latin_1, GNAT.Command_Line, GNAT.Strings, Ada.Command_Line, @@ -23,6 +27,7 @@ use procedure STV is + package Latin renames Ada.Characters.Latin_1; package ACom renames Ada.Command_Line; package GCom renames GNAT.Command_Line; package GStr renames GNAT.Strings; @@ -117,8 +122,8 @@ begin GCom.Set_Usage (Config => Config, Usage => "[switches]", - Help => "Note that the -c, -p, -o, -e, -s options are all" & ASCII.LF & - "required for normal operation." & ASCII.LF); + Help => "Note that the -c, -p, -o, -e, -s options are all" & Latin.LF & + "required for normal operation." & Latin.LF); -- Parse options @@ -144,18 +149,18 @@ begin -- Check candidate data option is valid if Candidate_File.all = "" then - Put_Line ("Candidate data file not provided." & ASCII.LF & Further_Help); + Put_Line ("Candidate data file not provided." & Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; if not File.Exists (Candidate_File.all) then - Put_Line ("Candidate data file does not exist." & ASCII.LF & Further_Help); + Put_Line ("Candidate data file does not exist." & Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; if File.Kind (Candidate_File.all) /= File.Ordinary_File then Put_Line ("Candidate data file name appears to refer to a directory or special file." & - ASCII.LF & Further_Help); + Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; @@ -163,18 +168,18 @@ begin -- Check preference data option is valid if Preference_File.all = "" then - Put_Line ("Preference data file not provided." & ASCII.LF & Further_Help); + Put_Line ("Preference data file not provided." & Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; if not File.Exists (Preference_File.all) then - Put_Line ("Preference data file does not exist." & ASCII.LF & Further_Help); + Put_Line ("Preference data file does not exist." & Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; if File.Kind (Preference_File.all) /= File.Ordinary_File then Put_Line ("Preference data file name appears to refer to a directory or special file." & - ASCII.LF & Further_Help); + Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; @@ -182,12 +187,12 @@ begin -- Check output directory option is valid if Output_Dir.all = "" then - Put_Line ("Output logging directory not provided." & ASCII.LF & Further_Help); + Put_Line ("Output logging directory not provided." & Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; if File.Exists (Output_Dir.all) then - Put_Line ("Output logging directory already exists." & ASCII.LF & Further_Help); + Put_Line ("Output logging directory already exists." & Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; @@ -195,7 +200,7 @@ begin -- Check number to elect option is valid if Number_To_Elect < 1 then - Put_Line ("Number of candidates to be elected too low." & ASCII.LF & Further_Help); + Put_Line ("Number of candidates to be elected too low." & Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; @@ -207,7 +212,7 @@ begin exception when Constraint_Error => Put_Line ("Invalid State/Territory or State/Territory not provided." & - ASCII.LF & Further_Help); + Latin.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end; @@ -266,13 +271,13 @@ begin -- Finish up logging Finish_Time := Simple_Time.Now; Log_Msg := SU.To_Unbounded_String - ("Finished election count at " & Simple_Time.Image (Finish_Time) & ASCII.LF & + ("Finished election count at " & Simple_Time.Image (Finish_Time) & Latin.LF & Simple_Time.Image (Finish_Time - Start_Time) & " seconds elapsed."); Open (Log_File, Append_File, SU.To_String (Main_Log)); Put_Line (Log_File, SU.To_String (Log_Msg)); Close (Log_File); if Verbose then - Put_Line (Standard_Error, ASCII.LF & SU.To_String (Log_Msg)); + Put_Line (Standard_Error, Latin.LF & SU.To_String (Log_Msg)); end if; -- cgit