From 83449709c345372656d849d893d2d797a83bd683 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 25 Feb 2020 01:58:42 +0100 Subject: vhdl: handle CR+LF for readline in grt. Fix #1145 Previously CR+LF was handled in std.textio.readline. But that doesn't work if CR is at position 128 because we would need to read the next character. Now untruncated_text_read handles CR/CR+LF/LF and calls ungetc if needed. --- libraries/std/textio-body.vhdl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'libraries/std') diff --git a/libraries/std/textio-body.vhdl b/libraries/std/textio-body.vhdl index 235da706a..8ea3dc789 100644 --- a/libraries/std/textio-body.vhdl +++ b/libraries/std/textio-body.vhdl @@ -428,16 +428,14 @@ package body textio is loop untruncated_text_read (f, str, len); exit when len = 0; - if str (len) = LF or str (len) = CR then + if str (len) = LF then -- LRM 14.3 -- The representation of the line does not contain the representation -- of the end of the line. is_eol := true; len := len - 1; - -- End of line is any of LF/CR/CR+LF/LF+CR. - if len > 0 and (str (len) = LF or str (len) = CR) then - len := len - 1; - end if; + -- End of line is any of LF/CR/CR+LF. This is now handled + -- by untruncated_text_read because we need to do a look-ahead. elsif endfile (f) then is_eol := true; else -- cgit v1.2.3