lablgtk and pipes ...

Sven LUTHER luther at dpt-info.u-strasbg.fr
Thu May 3 15:54:43 CEST 2001


On Thu, May 03, 2001 at 03:31:15PM +0200, Nicolas GEORGE wrote:
> Le quartidi 14 floréal, an CCIX, Sven LUTHER a écrit :
> > $ gunzip -c testgtk.ml.gz | lablgtk -labels 
> 
> Here, the toplevel is in interactive mode, so it requires the ;; before it
> runs the statements.
> 
> { gunzip -c testgtk.ml.gz; echo ';;' } | lablgtk -labels
> 
> should work (depending on your shell) but there are dirty things on stdout.

Well, 

(gunzip -c testgtk.ml.gz; echo ";;") | lablgtk -labels

did work with bash. but like you said there is lot of scrolling of empty
lines.

> > $ gunzip -c testgtk.ml.gz | lablgtk -labels -
> 
> The OCaml toplevel does not recognize - to be stdin.

BUt it could be fixed to handle this ? Does this make sense ?

> gunzip -c testgtk.ml.gz | lablgtk -labels /dev/fd/0

This works also, ...

> should work, but it is very dirty.
> 
> It is also possible to submit a feature wish/patch to the development
> team : in toplevel/toploop.ml, 
> 
>     let filename = find_in_path !Config.load_path name in
>     let ic = open_in_bin filename in
> 
> could become
> 
>     let (filename, ic) =
>       if name = "-" then
>         (name, stdin)
>       else
>         let filename = find_in_path !Config.load_path name in
> 	(filename, open_in_bin_filename) in
> 
> But this may cause lots of problems (if the script uses stdin, or if the
> user tries tu #use "-" when he is already using stdin).

mmm, yes, this could be done.

Is this a feature we would like to have and would be worth to be asked for, or
is it something nobody will ever be needing aside of me, and i should let it
be ?

BTW, one could also imagine liking the ocaml toplevel with zlib and have it
uncompress gzip'ed file on the fly.

Friendly,

Sven Luther




More information about the Lablgtk-list mailing list