Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] possible typechecker bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile Starynkevitch <basile.starynkevitch@i...>
Subject: Re: [Caml-list] how can I print graphics on my local printer under Linux?
PL wrote:
> 
> I am doing graphics with Caml. These graphs are drawn in a new window on my
> screen,
> opened by Caml. I would like to have these graphs printed on my local
> printer.

May I suggest using the camlimages library (also used in advi)? See 
http://pauillac.inria.fr/camlimages/ for more. Another option would be 
(on unix or linux systems) to open a pipe to some software like gnuplot, 
  latex, lout, troff, etc etc.... The Graphics library is portable, but 
(IMHO) not very rich (because of the portability issue).

> I have troubles understanding the #install_printer intruction of Caml.

This question is (I suppose) unrelated to the previous one. The 
#install_printer directive (only available with the interactive toplevel 
-and perhaps in the debugger) tell the toplevel how to print your 
datatypes (usually abstract ones). Here is a simplistic example (where 
@. is a pretty printing indication, see the Format module documentation 
of the stdlib

# type color_t = Blue | Red;;
type color_t = Blue | Red
# let color_printer ff col = match col with
   Blue -> Format.fprintf ff "Blue_Color@."
   | Red ->  Format.fprintf ff "Red_Color@."
   ;;
val color_printer : Format.formatter -> color_t -> unit = <fun>
# #install_printer color_printer;;
# Blue;;
- : color_t = Blue_Color

Hope above will help you

-- 
Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr
Project cristal.inria.fr - phone +33 1 3963 5197 - mobile 6 8501 2359
home email: basile at starynkevitch dot net
all opinions are only mine

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners