Hi,
I have a simple program that reads an input file containing one integer
and one atom on each line. I have two builds of GNU Prolog 1.3.0, one
on a 32-bit Linux (SuSE 9.3) and the other on a 64-bit Linux (SuSE Linux
Enterprise Desktop 10). The program behaves differently in the two
environments. The difference seems to come down to what happens when I
call `read_integer' when the input stream pointer is immediately before
the newline which is the last character in the file. On the 32-bit
machine, the `read_integer' simply fails; on the 64-bit machine, I get
"warning: ... user directive failed" and the program exits.
I can work around the problem by consuming the newline and testing for
end_of_file before invoking `read_integer', so I don't need this fixed
urgently.
I run the test case by doing
% gplc --no-debugger --no-top-level example.pl
% example <input.dat
Code and sample input is below.
-- Scott
-------- example.pl
:- initialization(main).
main :-
read_pairs(Ps),
print(Ps),
nl.
read_pairs([P | Ps]) :-
catch(read_pair(P), _, fail),
read_pairs(Ps).
read_pairs([]) :-
at_end_of_stream.
read_pair(pair(I, A)) :-
peek_char(C),
read_integer(I),
read_atom(A).
-------- input.dat
0 a
1 b
_______________________________________________
Bug-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-prolog