For Programmers: Free Programming Magazines  


Home > Archive > Prolog > April 2004 > Writing to standard error from gnu-prolog









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Writing to standard error from gnu-prolog
Roger Clayton

2004-04-27, 2:23 am

So here's the problem:
I need to report a message to the standard error stream
rather than the standard output in a gnu-prolog program.
(The program I writing is part of a compiler for a logic
programming language).

Although the gnu-prolog manual is excellent in most
respects, I'm having trouble finding the sequence of
builtin predicates to make this happen.

When the interactive environment is consulted for
available output streams, the results are:

------------
| ?- current_stream(X), current_alias(X,Y).

X = '$stream'(0)
Y = top_level_input ? ;

X = '$stream'(0)
Y = user_input ? ;

X = '$stream'(0)
Y = debugger_input ? ;

X = '$stream'(1)
Y = top_level_output ? ;

X = '$stream'(1)
Y = user_output ? ;

X = '$stream'(1)
Y = debugger_output

yes
--------

The fact that all the output aliases point to stream 1
makes me suspect that these are the same stream and,
moreover, none of these are actually labeled as the
standard error.

Any attempt to set the stream (using set_output/1) to
anything other than '$stream'(1) generates an
'existence error'. New streams generated using the
open/3 or open/4 predicates seem only to create output
files.

I hope someone out there has had some experience with
this and can point me in the right direction to make
this happen.

Thanks,

Roger Clayton

<merge these lines for email address>
rjc4 .waikato .nz
@cs .ac

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com