Re: Questions about standalone application behavior

Boris Vassilev <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFw8osJRm+LzCwF3AAREke5Sbkh=Fv=34sKZKw=5bkfuZfmb2Q@mail.gmail.com>
Hello,

I have long ago noticed the two occurences of "|:" and learned to
ignore it.... didn't know it is not supposed to happen. To avoid
seeing it, I use:

    prompt(_Old, '')

effectively setting the prompt to an empty string.

To your original program, it behaves exactly as Richard described
(using `current_input` instead of `stdin`). I thought this is the
expected behaviour.

About signals:

http://www.swi-prolog.org/pldoc/man?section=signal

Generally, this sort of works:

    foo(int) :- % 'int' here is the name of the SIGINT signal
        format('foobar\n').

    ...
    on_signal(int, _Old, foo).

?- current_signal(int, 2, Handler).
Handler = foo.

% pressing Ctrl+C somewhere here does nothing, sometimes!
?- format('hmm').
foobar!
hmm
true.

?-

which happens because (as documented in the manual) "When using a
Prolog predicate, delivery is delayed to a safe moment." What exactly
is a safe moment I don't know.

On your third question, I have wondered the same and came to the
conclusion that "cross-compilation" should not be possible with the
existing facilities. I would love to know I am wrong.

Hope that helps,
Boris

On Mon, Sep 23, 2013 at 8:01 AM, Richard A. O'Keefe <[email protected]> wrote:
>
> On 23/09/2013, at 4:22 PM, Kyle Marple wrote:
>
>> My example has a typo: 'stdin' should be 'current_input'.
>
> Silly me for not noticing that.
>
> OK, that mistake fixed, the program works as expected.
> SWI Prolog version 6.50, running on Mac OS X 10.7.5.
>
> There is one quirk:  the prompt gets printed:
>
> m% zork
> This is a test!
> |:<EOF>m%
>
> That's what I expect with input from standard input.
>
> m% cat >zork.dat
> a
> b
> c
> <EOF>
> m% zork <zork.dat
> This is a test!
> |:a
> b
> c
> |:
>
> You will note the two occurrences of "|:" .
>
> That doesn't seem right.
>
>
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.