logo       

Re: SWI-Prolog 5.6.0 problem.: msg#01625

Subject: Re: SWI-Prolog 5.6.0 problem.
On Saturday 31 December 2005 13:41, Paulo Moura wrote:
> On 2005/12/31, at 10:38, Martin Sondergaard wrote:
> > I've found a problem with the new version, 5.6.0.
> > I'm using Windows XP.
> >
> > I can't get "read_line_to_codes" to work.
> >
> >
> > 6 ?- read_line_to_codes(user, X).
> > ERROR: read_util:read_line_to_codes/2: stream `user' does not exist
> > ERROR: Unhandled exception: _G1

Recent versions implement read_line_to_codes/2 as foreign language
predicate. The C interface however doesn't provide the trick to
interpret `user' as `user_input' for reading and `user_output' for
output.  Not sure whether I should support this or simply claim that
read_line_to_codes/2 only works using ISO stream handles and aliases.

> The same on MacOS X 10.4. A quick read of the documentation states
> that read_line_to_codes/2 requires that the first argument be a
> stream. It's not clear that a stream alias ("user" in this case) can
> also be used. In addition, the alias "user" does not seam to be
> associated with the default input stream. Try:
>
>       ?- current_input(S), stream_property(S, P).
>
> Your goal will work if you use "user_input" instead of "user". In
> fact, The ISO Prolog standard specifies in section 7.1.0.2.3 the
> aliases "user_input" and "user_output" for the predefined standard
> input and output streams.
>
> Jan: I would expect that stream_property/2 would return the property
> alias(user_input) for the current input stream at startup; similar
> for the current output stream.

Fixed. Aliases didn't work for the standard streams since the
introduction of multi-threading :-)

You've just submitted the last bug report I've dealt with in 2005 :-)

        Cheers --- Jan




<Prev in Thread] Current Thread [Next in Thread>