streams: bivalent stream signals a condition for bytes out of range

Sometimes a byte may be not within the character code range. In that case, when
we read the char, the system will signal a condition.

Alternatively (and that's the behavior before this commit) we could return the
character #\Nul. That was done by virtue of ECL_CHAR_CODE skipping tag bytes, so
the returned NIL was treated as 0.
This commit is contained in:
Daniel Kochmański 2025-07-29 11:42:35 +02:00
parent 43fef5fad8
commit 41f52d8d0f

View file

@ -157,7 +157,9 @@ char_byte(cl_object byte)
unlikely_if (byte != OBJNULL && Null(cl_integerp(byte))) { unlikely_if (byte != OBJNULL && Null(cl_integerp(byte))) {
FEwrong_type_argument(@[byte], byte); FEwrong_type_argument(@[byte], byte);
} }
return byte == OBJNULL ? EOF : ECL_CHAR_CODE(cl_code_char(byte)); /* INV cl_code_char can return NIL for bytes outside of the char range.
ecl_char_code will signal a condition then. */
return byte == OBJNULL ? EOF : ecl_char_code(cl_code_char(byte));
} }
static ecl_character static ecl_character