Subject: Re: I/O in Lisp
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 30 Aug 2004 04:07:23 -0500
Newsgroups: comp.lang.lisp
Message-ID: <0vOdna7KS7XWc6_cRVn-tA@speakeasy.net>
Ray Dillinger  <bear@sonic.net> wrote:
+---------------
| Still, let's say I want something that's simple, but outside
| the standard, such as cursor control on a character-based
| interface (the "curses" library in UNIX).
| 
| This requires operating system calls, and therefore cannot
| be implemented using the functions given in the standard.
+---------------

The only operating system calls this requires are two "ioctl()" calls:
one to turn off/on echoing of input and one to switch between line-
oriented and character-oriented input ("cbreak") [and even that makes
sense only on Unix-like systems, and is *NOT* even portable across all 
of those (BSD-style vs. System-V-style, for example)]. Everything else
can be done just fine entirely within Common Lisp.

However, as others have pointed out[1], rather than re-implement "curses"
in Lisp (even tough that's certainly possible), what most people do is
just use some FFI (such as UFFI or CMUCL's "alien") to call out to a C
library version of "curses"...


-Rob

[1] A previous versions of this reply (which I've tried to cancel)
    credited Mathew Danish, who did mention UFFI, but I was really
    talking about Christopher Stacy's comments about UFFI & "curses".

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607