From e837a3899bb7d2bd8dc4d99ae0cb10ae0d4a1a75 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 14 Jul 2019 06:49:54 +0200 Subject: vhdl: refactoring: remove configure function with string access. --- src/ghdldrv/ghdldrv.adb | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src/ghdldrv/ghdldrv.adb') diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb index 463b3e9c6..8daaae6bd 100644 --- a/src/ghdldrv/ghdldrv.adb +++ b/src/ghdldrv/ghdldrv.adb @@ -907,6 +907,8 @@ package body Ghdldrv is -- Elaboration. + Primary_Id : Name_Id; + Secondary_Id : Name_Id; Base_Name : String_Access; Elab_Name : String_Access; Filelist_Name : String_Access; @@ -914,16 +916,17 @@ package body Ghdldrv is procedure Set_Elab_Units (Cmd_Name : String; Args : Argument_List; - Run_Arg : out Natural) - is + Run_Arg : out Natural) is begin - Extract_Elab_Unit (Cmd_Name, Args, Run_Arg); - if Sec_Name = null then - Base_Name := Prim_Name; - Unit_Name := Prim_Name; + Extract_Elab_Unit (Cmd_Name, Args, Run_Arg, Primary_Id, Secondary_Id); + if Secondary_Id = Null_Identifier then + Base_Name := new String'(Image (Primary_Id)); + Unit_Name := new String'(Image (Primary_Id)); else - Base_Name := new String'(Prim_Name.all & '-' & Sec_Name.all); - Unit_Name := new String'(Prim_Name.all & '(' & Sec_Name.all & ')'); + Base_Name := + new String'(Image (Primary_Id) & '-' & Image (Secondary_Id)); + Unit_Name := + new String'(Image (Primary_Id) & '(' & Image (Secondary_Id) & ')'); end if; Filelist_Name := null; @@ -945,7 +948,8 @@ package body Ghdldrv is end; end Set_Elab_Units; - procedure Set_Elab_Units (Cmd_Name : String; Args : Argument_List) + procedure Set_Elab_Units (Cmd_Name : String; + Args : Argument_List) is Next_Arg : Natural; begin @@ -1150,15 +1154,17 @@ package body Ghdldrv is is pragma Unreferenced (Cmd); Suffix : constant String_Access := Get_Executable_Suffix; + Prim_Id : Name_Id; + Sec_Id : Name_Id; Opt_Arg : Natural; begin - Extract_Elab_Unit ("-r", Args, Opt_Arg); - if Sec_Name = null then + Extract_Elab_Unit ("-r", Args, Opt_Arg, Prim_Id, Sec_Id); + if Sec_Id = Null_Identifier then Base_Name := new String' - (Prim_Name.all & Suffix.all); + (Image (Prim_Id) & Suffix.all); else Base_Name := new String' - (Prim_Name.all & '-' & Sec_Name.all & Suffix.all); + (Image (Prim_Id) & '-' & Image (Sec_Id) & Suffix.all); end if; if not Is_Regular_File (Base_Name.all & Nul) then Error ("file '" & Base_Name.all & "' does not exist"); @@ -1518,7 +1524,7 @@ package body Ghdldrv is Setup_Compiler (True); -- Create list of files. - Files_List := Build_Dependence (Prim_Name, Sec_Name); + Files_List := Build_Dependence (Primary_Id, Secondary_Id); if Errorout.Nbr_Errors /= 0 then raise Errorout.Compilation_Error; @@ -1666,7 +1672,7 @@ package body Ghdldrv is if Need_Elaboration then if not Flag_Verbose then Put ("elaborate "); - Put (Prim_Name.all); + Put (Image (Primary_Id)); --Disp_Library_Unit (Get_Library_Unit (Unit)); New_Line; end if; @@ -1782,7 +1788,7 @@ package body Ghdldrv is end if; Setup_Libraries (True); - Files_List := Build_Dependence (Prim_Name, Sec_Name); + Files_List := Build_Dependence (Primary_Id, Secondary_Id); Put_Line ("# Makefile automatically generated by ghdl"); Put ("# Version: GHDL "); -- cgit v1.2.3