Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Small problems with cl-ncurses

15 views
Skip to first unread message

bradb

unread,
Oct 2, 2005, 2:46:33 AM10/2/05
to
Hi all, I am playing with cl-ncurses and so far I am having a few
issues with input.
Basically I set (cbreak) mode, which means that (I think) each char
should come through raw to me, without needing an enter. Man page here
http://www.delorie.com/gnu/docs/ncurses/man/curs_inopts.3x.html

However, this simple program - which should
1) Clear the terminal & print a
2) Wait for a char, but do no echoing
3) Print b
4) wait for a char and exit

(asdf:operate 'asdf:load-op 'cl-ncurses)
(in-package :cl-ncurses) ; needed in SBCL, not for CMUCL
(defun start ()
(initscr)
(erase)
(cbreak)
(noecho)
(refresh)
(addch (char-code #\a))
(refresh)
(getch)
(addch (char-code #\b))
(refresh)
(getch)
(print "after rl")
(nocbreak)
(echo)
(endwin))

(start)

Doesn't behave as expected. The getch accepts multiple chars until
return is pressed. Am I doing something very wrong? Is the Lisp shell
mucking me up?

Thanks
Brad

bradb

unread,
Oct 2, 2005, 3:03:23 AM10/2/05
to
The following C program from an Xterm behaves as expected

#include <curses.h>
#include <signal.h>

int main(int argc, char *argv[])
{
/* initialize your non-curses data structures here */

(void) initscr(); /* initialize the curses library */
//keypad(stdscr, TRUE); /* enable keyboard mapping */
//(void) nonl(); /* tell curses not to do NL->CR/NL on
output */
(void) cbreak(); /* take input chars one at a time, no wait
for \n */
(void) noecho(); /* echo input - in color */
addch('a');
getch(); /* refresh, accept single keystroke of input */
addch('b');
getch(); /* refresh, accept single keystroke of input */
endwin ();
}

Julian Squires

unread,
Oct 2, 2005, 9:43:22 AM10/2/05
to
On 2005-10-02, bradb <brad.be...@gmail.com> wrote:
> Doesn't behave as expected. The getch accepts multiple chars until
> return is pressed. Am I doing something very wrong? Is the Lisp shell
> mucking me up?

Works for me. You're not using SLIME or linedit or anything with it,
are you?

--
Julian Squires

bradb

unread,
Oct 2, 2005, 12:23:01 PM10/2/05
to
I am using Vllisp - and it turns out that is what is mucking me up. I
suspect that funnel.pl (which funnels standard input & .lisp-pipe
together) is the problem. Maybe I can fix it there... Wish I knew Perl
right about now....

Thanks
Brad

bradb

unread,
Oct 3, 2005, 12:09:18 AM10/3/05
to
I posted this to the ncurses devel list - but thought that it couldn't
hurt to throw it here also.

Hi all, I am trying to use the getyx macro, and get the error
; Warning: This function is undefined:
; WRAP-GETYX
; Error in KERNEL:%COERCE-TO-FUNCTION: the function WRAP-GETYX is
undefined.

My program does basically ...


(asdf:operate 'asdf:load-op 'cl-ncurses)
(in-package :cl-ncurses)

(let (x y)
(getyx stdscr y x)
(mvaddstr 20 0 (format nil "~a ~a" x y)))

I am new to Lisp in general, so I don't really know how to go about
fixing this...
Any help is much appreciated.

Thanks
Brad

bradb

unread,
Oct 3, 2005, 1:49:05 AM10/3/05
to
I'm replying here because the post to ncurses-devel hasn't come to my
mail box yet. Anyhow - I have somehow managed to hack up my system so
that cl-ncurses:getyx works.

The problem appears to be in the asdf packaging
1) The glue.so file isn't being "linked"
2) The glue.lisp file isn't being loaded

I don't know how to fix this myself, but hopefully someone can look
into this & not waste too much time getting to the root of the problem.
Not that an experienced Lisper would take so long to find the issue :)

Brad

0 new messages