Re: char-ready?

From: Erick Gallesio <eg_at_kaolin.unice.fr>
Date: Wed, 22 Mar 1995 18:38:46 +0000

> Johann Friedrich Heinrichmeyer writes
> i found a primitive for char-ready in 2.1.6, but i see only "Truth" as a
> possible return value??????
>
> Char-ready would be nice for communication with other programs. SCM uses
> ioctls, my first idea is to use select ...
>

I had modified it for the next release, but I'm a little bit confused with it.
I'm wondering if char-ready? should answer #t as soon as a character is typed
or when the user as typed Return (i.e. I'm wondering if char-ready? should set
the lin in raw-mode or not). I have looked at some other Scheme and it seems
that they use the canonical mode buffering. What is the opinion of the mailing
list about this ?)

In the meantime, here is the version I have for char-ready in the file port.c

#include <sys/ioctl.h>
#include <sys/time.h>

        .
        .
        .

PRIMITIVE STk_char_readyp(SCM port)
{
  port = verify_port("char-ready?", port, F_READ);
  if (Eof(port->storage_as.port.f)) return Truth;
  if (ISPORTP(port)) /* !eof -> */ return Truth;
  else {
#ifdef FIONREAD
    int result;

    ioctl(fileno(port->storage_as.port.f), FIONREAD, &result);
    return result ? Truth : Ntruth;
#else
    return Truth;
#endif
  }
}


                -- Erick


                -- Erick

                -- Erick
Received on Wed Mar 22 1995 - 18:38:57 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST