summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-11-04 11:04:16 +1100
committerJed Barber <jjbarber@y7mail.com>2017-11-04 11:04:16 +1100
commit5b3307b32f88c391ef65b7683b4178229e3bae24 (patch)
treecfdaefed203e3b3a896230d5c41f50dee0ce809b
parentd1d6ff0de6894b1066e3e09f67eb4a6de4d3753b (diff)
Removed use of obsolescent ASCII and replaced with Ada.Characters.Latin_1HEADmaster
-rw-r--r--src/candidates-containers.adb3
-rw-r--r--src/election.adb10
-rw-r--r--src/stv.adb33
3 files changed, 27 insertions, 19 deletions
diff --git a/src/candidates-containers.adb b/src/candidates-containers.adb
index b9b56c7..995c45d 100644
--- a/src/candidates-containers.adb
+++ b/src/candidates-containers.adb
@@ -2,6 +2,7 @@
with
+ Ada.Characters.Latin_1,
Ada.Containers.Vectors,
Ada.Text_IO,
CSV;
@@ -197,7 +198,7 @@ package body Candidates.Containers is
for Box of CandidateID_Map_Maps.Element (Group_Cursor) loop
SU.Append (Result, CandidateID'Image (Box) & " ");
end loop;
- SU.Append (Result, ASCII.LF);
+ SU.Append (Result, Ada.Characters.Latin_1.LF);
end loop;
return SU.To_String (Result);
end To_String;
diff --git a/src/election.adb b/src/election.adb
index 797c117..fb869e7 100644
--- a/src/election.adb
+++ b/src/election.adb
@@ -2,6 +2,7 @@
with
+ Ada.Characters.Latin_1,
Ada.Strings.Fixed,
Ada.Strings.Unbounded,
Ada.Text_IO,
@@ -19,6 +20,7 @@ use type
package body Election is
+ package Latin renames Ada.Characters.Latin_1;
package SU renames Ada.Strings.Unbounded;
@@ -109,7 +111,7 @@ package body Election is
Bundle_Containers.Read_Bundles (Preference_File, Pref_Data);
if Verbose then
- Put_Line (Standard_Error, "Done." & ASCII.LF);
+ Put_Line (Standard_Error, "Done." & Latin.LF);
Put_Line (Standard_Error, "Setting up election...");
end if;
@@ -134,7 +136,7 @@ package body Election is
Work_To_Do := True;
if Verbose then
- Put_Line (Standard_Error, "Done." & ASCII.LF);
+ Put_Line (Standard_Error, "Done." & Latin.LF);
end if;
end Setup;
@@ -536,11 +538,11 @@ package body Election is
Int_Image (Next_Log_Num) & " between candidates: ");
for V in Valid_Response loop
CurrentID := Entries.Reference (From_Vector.Element (V).Index).ID;
- SU.Append (Log_Msg, ASCII.LF & Indent &
+ SU.Append (Log_Msg, Latin.LF & Indent &
Candidates.Name_And_Party (Cand_Data (CurrentID)));
end loop;
CurrentID := Entries.Reference (From_Vector.Element (Result).Index).ID;
- SU.Append (Log_Msg, ASCII.LF & Candidates.Name_And_Party (Cand_Data (CurrentID)) &
+ SU.Append (Log_Msg, Latin.LF & Candidates.Name_And_Party (Cand_Data (CurrentID)) &
" was selected to be excluded.");
Put_Line (Main_Log, SU.To_String (Log_Msg));
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;