English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
ANNOUNCE: mlexpect 0.9
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-01-02 (21:11)
From: Ian T Zimmerman <itz@t...>
Subject: ANNOUNCE: mlexpect 0.9

mlexpect 0.9 has been uploaded to


All comments of any kind are heartily welcome.

I quote the README file:

This is mlexpect, a feeble attempt to to the same thing in ocaml as
Don Libes' expect program does in Tcl.

Install the GNU way: configure, make, make install.  This will add the
following to your system:

expect.cma	... a ocaml bytecode library 
expect_lib.mli	... a ocaml interface source file for the library
expect_lib.cmi  ... compiled interface file
mlexpect	... a ocaml toplevel with the expect library linked

Also, for people who still miss C macro hackery :-) I added a camlp4
gizmo in expect_p4.cmo.  When you load it you can write things like

        spawn_id_0 * "exact string"     => handle_exact_string
        spawn_id_1 * /"pattern"/        => handle_pattern
        spawn_id_1 * Eof                => handle_eof

the handlers must be of type int -> spawn_id -> unit.  The first
parameter is the ordinal of the clause in the expect construct
(starting with 0, as hinted above) and the second is the spawn_id on
which match occurred.  Thus you can use the same handler in multiple


`interact' is missing.  I planned to include it and have it work the
same as the interact command in real expect, but it proved so
complicated and requiring so many dirty tricks that I gave up for this
first release.  Maybe later, if someone can suggest a way to do it
without breaking all the rules of clean programming (i.e. the interact
function would have to use pretty much all the internals of the Buffer
submodule, as matching must be done at every buffer position for
multiple regexps in turn).

The Pty functions assume either a plain BSD style pty allocation
scheme without any kernel or libc support (which is the way it works
on my system, Linux 2.0/GNU), or SysV style ptys (/dev/ptmx,
ptsname(), etc.; latest Linux 2.1 kernels work like this).  If your
system doesn't have the SysV bells & whistles but OTOH is also
incompatible with BSD and Linux < 2.1 as far as manual allocation
(eg. if the device names are something else than [pt]ty[p-s][0-9a-f]),
you're in for some source hacking.

Ob-apology: No French version.


There are 2 (count 'em, two) ways of referring to ptys under Linux up
to 2.0.  The old obsolete scheme gives both masters and slaves major
device no. 4, same as regular ttys, and starts their minor nos. at 128
and 192 respectively.  The new way gives a separate major no. both to
pty masters (2) and slaves (3).  IF YOUR ACTUAL DEVICE FILES USE ONE
That's what happened to me during testing.  You really should convert
consistently to the new scheme ASAP.  This may mean editing
/etc/devinfo and re-running /dev/MAKEDEV.

Other than that, it works; even in this immature state it statisfies
my first goal, which was to erase all traces of Tcl from my machine
:-)  Enjoy.

Note the email address below is current, the one in most source files
(@rahul.net) is outdated.

Ian T Zimmerman                        <itz@transbay.net>
I came to the conclusion that what was wrong about the guillotine
was that the condemned man had no chance at all, absolutely none.
Albert Camus, _The Outsider_