Hi Blake,

thanks for that information. Actually the SIGINT is delivered to GNU APL as
expected. The problem is that when I return from the GNU APL SIGINT handler then readline seems to be blocked in the old readline() call and returns only after another
char (any char - does not have to be newline) was typed.

/// Jürgen


On 07/21/2014 08:21 PM, Blake McBride wrote:
Does this help?

This may be related to the cooked/uncooked/rare <http://en.wikipedia.org/wiki/POSIX_terminal_interface#Early_Unices%3a_Seventh_Edition_Unix> terminal modes; |^C| does not always send a signal. It seems likely that readline uncooks the terminal, and thus any signals caused by keyboard input must be due to logic within readline itself; it seems plausible that it might only trigger a SIGINT on two sequential |^C|s (especially since for many programs that utilise readline such as shells and REPLs, the program exiting on a single |^C| would be very annoying!).

You might be able to change this behaviour by using the readline API to rebind |^C| to some of your own code that triggers a SIGINT. I haven't used readline from Haskell, just from C, so I'm not sure exactly how you'd go about this, but the binding <http://hackage.haskell.org/packages/archive/readline/latest/doc/html/System-Console-Readline.html> seems rich enough to achieve it.



On Mon, Jul 21, 2014 at 12:39 PM, Juergen Sauermann <juergen.sauerm...@t-online.de <mailto:juergen.sauerm...@t-online.de>> wrote:

    Hi David,

    I see. The problem is that the line input (readline) does not
    return even
    though I tell it to (by setting *rl_done* in the signal handler
    for ^C). I haven't
    found a way to fix this (hints more than welcome). This could also
    be caused
    by terminal settings ("cooked mode") but I thought readline would
    handle this.

    Long term I will most likely replace readline because so far it
    has created more problems
    than it has helped. That would be a bigger issue and should also
    be aligned with Elias'
    emacs mode. So it would  be after the next GNU APL release.

    /// Jürgen



    On 07/21/2014 06:32 PM, David B. Lamkins wrote:
    Thanks, Jüergen.

    The real issue, from my perspective, is that APL doesn't report the
    ATTENTION message until it sees a newline on input. It seems to me that
    typing a ^C should immediately suspend execution and show the ATTENTION
    message.

    On Mon, 2014-07-21 at 18:23 +0200, Juergen Sauermann wrote:
    Hi David,

    I have changed readline to display a new line right after ^C, see SVN 382.

    For reasons that I don't fully understand, the next character after ^C
    will be eaten by
    readline; I tried a number of things to prevent this but haven't succeeded.

    I believe readline will be one of the next things removed from GNU APL.

    /// Jürgen


    On 07/21/2014 02:32 AM, David Lamkins wrote:
    When the session is not executing APL code, the attention signal is
    not handled until the next newline.

    To see this, enter the characters Control-C, 1, Return.


-- "The secret to creativity is knowing how to hide your sources."
        Albert Einstein


    http://soundcloud.com/davidlamkins
    http://reverbnation.com/lamkins
    http://reverbnation.com/lcw
    http://lamkins-guitar.com/
    http://lamkins.net/
    http://successful-lisp.com/



Reply via email to