caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier@Theory.Stanford.EDU>
To: benjamin.pierce@dcs.ed.ac.uk
Cc: caml-list@margaux
Subject: Re: Non-blocking input in caml-light
Date: Wed, 26 May 1993 15:24:09 -0700 (PDT)	[thread overview]
Message-ID: <9305262224.AA00939@Tamuz.Stanford.EDU> (raw)
In-Reply-To: <4194.737978909@ed.dcs> from "Benjamin Pierce" at May 21, 93 11:08:29 am

> Est-ce qu'on peut faire un "read-char" tel que l'on ne bloque pas si
> il n'y a rien a lire?

Ah, il est bien connu que c'est une des operations les plus difficiles
a faire en Unix! Essentiellement, il faut:

        1- passer le tty driver en mode CBREAK ou RAW, pour que les
           caracteres tapes soient envoyes immediatement au programme
           (et non pas accumules ligne a ligne)
        2- avant de lire, utiliser select avec un timeout de 0 pour tester
           s'il y a des caracteres disponibles.

1- se fait avec les bons ioctl, de preference dans un morceau de code C
(on peut le faire en Caml Light a l'aide de la fonction ioctl de la
bibliotheque Unix, mais c'est du sport, cf. l'annexe de [1]).
2- se fait en C ou en Caml Light avec la bibliotheque Unix [1].

Autres possibilites: RT, la toolkit X Windows de Caml Light, permet
surement de faire ca. Ou bien, tant qu'a ecrire du C, il vaut
peut-etre mieux s'interfacer avec curses.

- Xavier

[1] "Programmation du systeme Unix en Caml Light", INRIA, rapport
technique 147, sur ftp.inria.fr, fichier INRIA/publication/RT0147.ps.Z.




      reply	other threads:[~1993-05-27  7:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-05-21 10:08 Benjamin Pierce
1993-05-26 22:24 ` Xavier Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9305262224.AA00939@Tamuz.Stanford.EDU \
    --to=xavier@theory.stanford.edu \
    --cc=benjamin.pierce@dcs.ed.ac.uk \
    --cc=caml-list@margaux \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).