Re: Loading database from string (C API)
Edd Barrett <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Dec 12, 2013 at 05:30:36PM +0100, Jan Wielemaker wrote:
> I'd replace the call to load_files/2 by something else and
> then dump the content of the stream. E.g.
>
> test_files(_Id, [stream(Stream)]) :-
> copy_stream_data(Stream, user_output),
> flush_output(user_output).
>
> That should print f(1). to the user output. Most likely it will not
> do that. The precise output might give you a hint what is wrong.
It does indeed print 'f(1).'. We didn't want that to happen did we?
I also checked if loading from a stream works, it does:
---8<---
?- open('a.pl', read, Stream).
Stream = <stream>(0x166c275e0e00).
?- load_files(blah, [stream(Stream)]).
% blah compiled 0.00 sec, 2 clauses
true.
---8<---
Hmm, this is mysterious. I will think a bit more, but in the interest of
moving on I may just write the database text to a file and consult it.
--
Best Regards
Edd Barrett
http://www.theunixzoo.co.uk