|
[gobo-eiffel-commits] CVS: gobo/library/xml/parser/eiffel xm_eiffel_utf16_input_stream.e,1.2,1.3
From: Franck Arnaud <farnaud@us...> - 2002-09-19 16:55
|
Update of /cvsroot/gobo-eiffel/gobo/library/xml/parser/eiffel
In directory usw-pr-cvs1:/tmp/cvs-serv5973
Modified Files:
xm_eiffel_utf16_input_stream.e
Log Message:
fix marginal cases and clarify code
Index: xm_eiffel_utf16_input_stream.e
===================================================================
RCS file: /cvsroot/gobo-eiffel/gobo/library/xml/parser/eiffel/xm_eiffel_utf16_input_stream.e,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** xm_eiffel_utf16_input_stream.e 3 Sep 2002 19:16:11 -0000 1.2
--- xm_eiffel_utf16_input_stream.e 19 Sep 2002 16:54:57 -0000 1.3
***************
*** 56,83 ****
read_character is
-- Read the next item in input stream.
! -- Make the result available in `last_item'.
do
if not is_detected then
utf16_detect_read_character
is_detected := True
! -- Detection may eat characters so we do a normal
! -- read afterwards, fill queue for normal read.
! elseif utf_queue.count > 0 then
! -- Last character was read from queue.
! utf_queue.remove
! end
! -- If `utf_queue' still contains something,
! -- this is the next character, so do nothing.
! if utf_queue.count = 0 then
! -- Otherwise we read via our routine if we
! -- are in a UTF16 file otherwise leave it to
! -- parent.
! if is_utf16 then
! utf16_read_character
else
! impl.read_character
end
! end
end
read_string (nb: INTEGER) is
--- 56,107 ----
read_character is
-- Read the next item in input stream.
! -- Make the result available in `last_character'.
do
+ -- see 'last_character': it chooses from impl or the queue
+
if not is_detected then
utf16_detect_read_character
is_detected := True
!
! -- If detection has not put back read character in queue,
! -- read from upstream, which may be empty if the stream
! -- contains only the byte order character.
! if utf_queue.count = 0 and not impl.end_of_input then
! noqueue_read_character
! end
! else
! if utf_queue.count > 0 then
! -- Last character was read from queue, remove it.
! utf_queue.remove
! -- Next character may or may not be from queue.
! if utf_queue.count = 0 and not impl.end_of_input then
! noqueue_read_character
! end
else
! -- Straightforward case.
! noqueue_read_character
end
! end
! end
!
! feature {NONE} -- Input
!
! noqueue_read_character is
! -- Read character after detection and when detection queue has
! -- been flushed..
! require
! open_read: is_open_read
! not_end: not end_of_input
! detected: is_detected
! queue_empty: utf_queue.count = 0
! do
! if is_utf16 then
! utf16_read_character
! else
! impl.read_character
! end
end
+
+ feature -- Input
read_string (nb: INTEGER) is
***************
*** 96,101 ****
from
last_string.wipe_out
- i := nb
read_character
until
i = 0 or end_of_input
--- 120,125 ----
from
last_string.wipe_out
read_character
+ i := nb
until
i = 0 or end_of_input
***************
*** 208,211 ****
--- 232,237 ----
utf_queue.force (second_char)
end
+ else
+ utf_queue.force (first_char)
end
end
***************
*** 281,287 ****
do
debug ("xml_parser")
! std.output.put_string ("[")
! std.output.put_string (a_char.out)
! std.output.put_string ("]")
end
-- Convert to UTF8
--- 307,313 ----
do
debug ("xml_parser")
! std.error.put_string ("[")
! std.error.put_string (a_char.out)
! std.error.put_string ("]")
end
-- Convert to UTF8
|
| Thread | Author | Date |
|---|---|---|
| [gobo-eiffel-commits] CVS: gobo/library/xml/parser/eiffel xm_eiffel_utf16_input_stream.e,1.2,1.3 | Franck Arnaud <farnaud@us...> |