PeekCode2
Implements ISO's peek_code/2: unifies the second argument with the code of the next character of the input stream identified by the first (an alias or $stream(...) term) without consuming it, as -1 at end of stream.
Throws
if the first argument is unbound.
if it does not identify an open channel.
(stream_type) if it identifies an output channel instead.
Fails, rather than erroring, if the channel is closed.