diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-02-25 01:58:42 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-02-25 19:19:23 +0100 |
commit | 83449709c345372656d849d893d2d797a83bd683 (patch) | |
tree | 44c12e5beedde39c6aa744a7934e6362710708ee /libraries | |
parent | ab2e4632eb987f9173f56bab05adf18308e060fb (diff) | |
download | ghdl-83449709c345372656d849d893d2d797a83bd683.tar.gz ghdl-83449709c345372656d849d893d2d797a83bd683.tar.bz2 ghdl-83449709c345372656d849d893d2d797a83bd683.zip |
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.
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/std/textio-body.vhdl | 8 |
1 files changed, 3 insertions, 5 deletions
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 |