From 4edf243e194587a5435b6386c9f936b6b6e9da73 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 5 Jan 2016 06:27:47 +0100 Subject: textio read character: improve code. --- libraries/std/textio_body.vhdl | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'libraries/std/textio_body.vhdl') diff --git a/libraries/std/textio_body.vhdl b/libraries/std/textio_body.vhdl index ddf85d7dd..2042e681a 100644 --- a/libraries/std/textio_body.vhdl +++ b/libraries/std/textio_body.vhdl @@ -769,53 +769,56 @@ package body textio is -- Set to TRUE if T has been scanned, to FALSE if F has been scanned. variable res : boolean; + + variable c : character; begin -- By default, it is a failure. good := false; state := blank; for i in l'range loop + c := l (i); case state is when blank => - if is_whitespace (l (i)) then + if is_whitespace (c) then null; - elsif to_lower (l (i)) = 't' then + elsif c = 'f' or c = 'T' then res := true; state := l_tf; - elsif to_lower (l (i)) = 'f' then + elsif c = 'f' or c = 'F' then res := false; state := l_tf; else return; end if; when l_tf => - if res = true and to_lower (l (i)) = 'r' then + if res = true and (c = 'r' or c = 'R') then state := l_ra; - elsif res = false and to_lower (l (i)) = 'a' then + elsif res = false and (c = 'a' or C = 'A') then state := l_ra; else return; end if; when l_ra => - if res = true and to_lower (l (i)) = 'u' then + if res = true and (c = 'u' or C = 'U') then state := l_ul; - elsif res = false and to_lower (l (i)) = 'l' then + elsif res = false and (c = 'l' or c = 'L') then state := l_ul; else return; end if; when l_ul => - if res = true and to_lower (l (i)) = 'e' then + if res = true and (c = 'e' or c = 'E') then trim_next (l, i); good := true; value := true; return; - elsif res = false and to_lower (l (i)) = 's' then + elsif res = false and (c = 's' or c = 'S') then state := l_es; else return; end if; when l_es => - if res = false and to_lower (l (i)) = 'e' then + if res = false and (c = 'e' or c = 'E') then trim_next (l, i); good := true; value := false; -- cgit v1.2.3