From 708f3f8cd68a19361fd1d9a3e6b5d548e313448e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 18 Jan 2018 20:44:01 +0100 Subject: simulate: remove use of Nam_Buffer. --- src/vhdl/simulate/simul-execution.adb | 56 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'src/vhdl/simulate') diff --git a/src/vhdl/simulate/simul-execution.adb b/src/vhdl/simulate/simul-execution.adb index 18cd20c3f..0958462a5 100644 --- a/src/vhdl/simulate/simul-execution.adb +++ b/src/vhdl/simulate/simul-execution.adb @@ -1330,32 +1330,36 @@ package body Simul.Execution is if Is_Character (Id) then Result := String_To_Iir_Value ((1 => Get_Character (Id))); else - Image (Id); - if Nam_Buffer (1) = '\' then - -- Reformat extended identifiers for to_image. - pragma Assert (Nam_Buffer (Nam_Length) = '\'); - declare - Npos : Natural; - K : Natural; - C : Character; - begin - Npos := 1; - K := 2; - while K < Nam_Length loop - C := Nam_Buffer (K); - Nam_Buffer (Npos) := C; - Npos := Npos + 1; - if C = '\' then - K := K + 2; - else - K := K + 1; - end if; - end loop; - Nam_Length := Npos - 1; - end; - end if; - Result := - String_To_Iir_Value (Nam_Buffer (1 .. Nam_Length)); + declare + Img : String := Image (Id); + begin + if Img (Img'First) = '\' then + -- Reformat extended identifiers for to_image. + pragma Assert (Img (Img'Last) = '\'); + declare + Npos : Natural; + K : Natural; + C : Character; + begin + Npos := Img'First; + K := Npos + 1; + while K < Img'Last loop + C := Img (K); + Img (Npos) := C; + Npos := Npos + 1; + if C = '\' then + K := K + 2; + else + K := K + 1; + end if; + end loop; + Result := String_To_Iir_Value + (Img (Img'First .. Npos - 1)); + end; + else + Result := String_To_Iir_Value (Img); + end if; + end; end if; end if; end; -- cgit v1.2.3