From 69bbb91b44a1677fd1a0e5accce91f756b06727a Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 9 May 2015 22:01:45 +0200 Subject: Rename Get_Location_Str to Image. --- src/vhdl/disp_tree.adb | 3 +-- src/vhdl/errorout.adb | 34 +--------------------------------- src/vhdl/errorout.ads | 4 +--- src/vhdl/parse.adb | 3 ++- src/vhdl/parse_psl.adb | 2 +- src/vhdl/psl-errors.ads | 15 ++++++++++++++- src/vhdl/sem_scopes.adb | 5 +++-- 7 files changed, 23 insertions(+), 43 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/disp_tree.adb b/src/vhdl/disp_tree.adb index 21c9d34ab..62fc3c4bf 100644 --- a/src/vhdl/disp_tree.adb +++ b/src/vhdl/disp_tree.adb @@ -21,7 +21,6 @@ with Ada.Text_IO; use Ada.Text_IO; with Name_Table; with Tokens; -with Errorout; with Files_Map; with PSL.Dump_Tree; with Nodes_Meta; @@ -309,7 +308,7 @@ package body Disp_Tree is function Image_Location_Type (Loc : Location_Type) return String is begin - return Errorout.Get_Location_Str (Loc); + return Files_Map.Image (Loc); end Image_Location_Type; function Image_Iir_Direction (Dir : Iir_Direction) return String is diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb index 877fea25d..a36412009 100644 --- a/src/vhdl/errorout.adb +++ b/src/vhdl/errorout.adb @@ -832,41 +832,9 @@ package body Errorout is -- Disp a node location. -- Used for output of message. - function Get_Location_Str - (Name : Name_Id; Line, Col : Natural; Filename : Boolean) - return String - is - Line_Str : constant String := Natural'Image (Line); - Col_Str : constant String := Natural'Image (Col); - begin - if Filename then - return Name_Table.Image (Name) - & ':' & Line_Str (Line_Str'First + 1 .. Line_Str'Last) - & ':' & Col_Str (Col_Str'First + 1 .. Col_Str'Last); - else - return Line_Str (Line_Str'First + 1 .. Line_Str'Last) - & ':' & Col_Str (Col_Str'First + 1 .. Col_Str'Last); - end if; - end Get_Location_Str; - - function Get_Location_Str (Loc : Location_Type; Filename : Boolean := True) - return string - is - Line, Col : Natural; - Name : Name_Id; - begin - if Loc = Location_Nil then - -- Avoid a crash. - return "??:??:??"; - else - Location_To_Position (Loc, Name, Line, Col); - return Get_Location_Str (Name, Line, Col, Filename); - end if; - end Get_Location_Str; - function Disp_Location (Node: Iir) return String is begin - return Get_Location_Str (Get_Location (Node)); + return Image (Get_Location (Node)); end Disp_Location; function Disp_Name (Kind : Iir_Kind) return String is diff --git a/src/vhdl/errorout.ads b/src/vhdl/errorout.ads index ce694fe37..e0625993e 100644 --- a/src/vhdl/errorout.ads +++ b/src/vhdl/errorout.ads @@ -92,10 +92,8 @@ package Errorout is -- Disp a node location. -- Used for output of message. function Disp_Location (Node: Iir) return String; - function Get_Location_Str (Loc : Location_Type; Filename : Boolean := True) - return String; - -- Disp non-terminal name from KIND. + -- Disp non-terminal name from KIND. function Disp_Name (Kind : Iir_Kind) return String; -- SUBPRG must be a subprogram declaration or an enumeration literal diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index 3ad8c1148..d94f4bb7b 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -27,6 +27,7 @@ with Flags; use Flags; with Parse_Psl; with Name_Table; with Str_Table; +with Files_Map; use Files_Map; with Xrefs; -- Recursive descendant parser. @@ -3874,7 +3875,7 @@ package body Parse is -- FIXME: in case of multiple missing parenthesises, several -- messages will be displayed Error_Msg_Parse ("missing ')' for opening parenthesis at " - & Get_Location_Str (Loc, Filename => False)); + & Image (Loc, Filename => False)); return Expr; when others => -- Surely a parse error... diff --git a/src/vhdl/parse_psl.adb b/src/vhdl/parse_psl.adb index b71dc745f..506218ade 100644 --- a/src/vhdl/parse_psl.adb +++ b/src/vhdl/parse_psl.adb @@ -348,7 +348,7 @@ package body Parse_Psl is Res := Parse_FL_Property (Prio_Lowest); if Current_Token /= Tok_Right_Paren then Error_Msg_Parse ("missing matching ')' for '(' at line " - & Get_Location_Str (Loc, False)); + & Image (Loc, False)); else Scan; end if; diff --git a/src/vhdl/psl-errors.ads b/src/vhdl/psl-errors.ads index e99bb7de6..7742dcfef 100644 --- a/src/vhdl/psl-errors.ads +++ b/src/vhdl/psl-errors.ads @@ -1,3 +1,16 @@ +with Types; use Types; with Errorout; +with Files_Map; -package PSL.Errors renames Errorout; +package PSL.Errors is + function Image (Loc : Location_Type; Filename : Boolean := True) + return String renames Files_Map.Image; + + procedure Error_Kind (Msg : String; N : PSL_Node) renames + Errorout.Error_Kind; + + procedure Error_Msg_Parse (Msg: String) + renames Errorout.Error_Msg_Parse; + procedure Error_Msg_Sem (Msg: String; Loc: PSL_Node) + renames Errorout.Error_Msg_Sem; +end PSL.Errors; diff --git a/src/vhdl/sem_scopes.adb b/src/vhdl/sem_scopes.adb index f77e6e827..cdc35afc9 100644 --- a/src/vhdl/sem_scopes.adb +++ b/src/vhdl/sem_scopes.adb @@ -19,6 +19,7 @@ with Ada.Text_IO; with GNAT.Table; with Flags; use Flags; with Name_Table; -- use Name_Table; +with Files_Map; use Files_Map; with Errorout; use Errorout; with Iirs_Utils; use Iirs_Utils; @@ -1277,7 +1278,7 @@ package body Sem_Scopes is Put (": "); Decl := Get_Declaration (Inter); Put (Iir_Kind'Image (Get_Kind (Decl))); - Put_Line (", loc: " & Get_Location_Str (Get_Location (Decl))); + Put_Line (", loc: " & Image (Get_Location (Decl))); if Get_Kind (Decl) in Iir_Kinds_Subprogram_Declaration then Put_Line (" " & Disp_Subprg (Decl)); end if; @@ -1335,7 +1336,7 @@ package body Sem_Scopes is Put (": "); Decl := Get_Declaration (Inter); Put (Iir_Kind'Image (Get_Kind (Decl))); - Put_Line (", loc: " & Get_Location_Str (Get_Location (Decl))); + Put_Line (", loc: " & Image (Get_Location (Decl))); if Get_Kind (Decl) in Iir_Kinds_Subprogram_Declaration then Put_Line (" " & Disp_Subprg (Decl)); end if; -- cgit v1.2.3