[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3 readline bugs: source positions, readline-options, endless loop on
From: |
Martin Grabmueller |
Subject: |
Re: 3 readline bugs: source positions, readline-options, endless loop on error |
Date: |
Thu, 25 Jan 2001 12:37:07 +0100 |
> Date: Thu, 25 Jan 2001 11:43:23 +0100 (MET)
> From: Dirk Herrmann <address@hidden>
>
> > Two possible fixes came to my mind:
> >
> > - Check the argument in `set-readline-input-port!' and only accept
> > valid open input ports.
> > - When the argument check in `%readline' fails, reset the current
> > input port to the standard input file port.
> >
> > I think the first is preferable.
>
> That's what I think, too. Could you provide a patch?
I modified the `set-readline-*put-port!' procedures (see below), but
got two questions:
- Is scm-error the right way to report the error? The output is
guile> (set-readline-output-port! #t)
ERROR: In procedure set-readline-output-port!:
ERROR: Not an open output port: #t
ABORT: (wrong-type-arg)
, which seems okay to me.
- How can I test whether a given port is a file port? The problem is
that my patch works when you pass a stupid value like #t to the
procedures, but not for string ports, for example. They lead to the
same endless loop like before the patch.
(define-public (set-readline-input-port! p)
(if (and (input-port? p)
(not (port-closed? p)))
(set! input-port p)
(scm-error 'wrong-type-arg "set-readline-input-port!"
"Not an open input port: ~S"
(list p)
#f)))
(define-public (set-readline-output-port! p)
(if (and (output-port? p)
(not (port-closed? p)))
(set! output-port p)
(scm-error 'wrong-type-arg "set-readline-output-port!"
"Not an open output port: ~S"
(list p)
#f)))
Regards,
'Martin
--
Martin Grabmueller address@hidden
http://www.pintus.de/mgrabmue/ address@hidden on EFnet