From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA23442; Fri, 6 Sep 2002 03:36:30 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA23316 for ; Fri, 6 Sep 2002 03:36:28 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g861aS126673 for ; Fri, 6 Sep 2002 03:36:28 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id DAA27011 for caml-list@inria.fr; Fri, 6 Sep 2002 03:36:28 +0200 Date: Fri, 6 Sep 2002 03:36:28 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] camlp4: pretty printing not to a file Message-ID: <20020906033628.A26991@verdot.inria.fr> References: <20020830074629.GA4422@barcelona.lrde.epita.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from jehenrik@yahoo.com on Thu, Sep 05, 2002 at 12:29:23PM -0400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Thu, Sep 05, 2002 at 12:29:23PM -0400, jehenrik wrote: > Thanks for the response, this seems to be what I am looking for, but the > code snippet you sent does not work for me. I'm running ocaml+camlp4 > 3.04 Indeed your code does not work in the latest version 3.06, because the interface of Spretty has changed. Spretty is not documented because it is likely to change and you use it with your own risks. The message you get: > print_expr2 r;; > - : string = "" is an error from me, I am sorry. Not a bug, but an error in the message. I changed it in my current version and now the message will be: print_expr2 r;; Exception: Failure "no loaded printer for expr". indicating that you need to load a printer. Do: #load "pr_o.cmo";; to get a printing module (or pr_r.cmo if you want to pretty print in revised syntax). > Spretty.print_pretty Format.print_char Format.print_string > Format.print_flush "" "" 78 > (fun (_,_) -> ()) (pr.pr_fun "top" x "" [<>]); Mmmm... I see that this code has been borrowed from the module Pcaml of Camlp4. But I am not sure of my code, in particular the use of "Format" because Spretty has its own pretty printing features which does not use Format. I have to look at that. And in version 3.06, because of interface change, this code does not work any more. Write it as: Spretty.print_pretty Format.print_char Format.print_string Format.print_flush "" "" 78 (fun _ _ -> "", 0, 0, 0) 0 (pr_fun "top" x "" [<>]); But I repeat that this code is not documented and you use it at your own risks. Well, since I see that people would like to use the Camlp4 pretty printing like that, I am going to see how I could propose that with a good interface and without these hacks. In the meantime, you can ask me for hints. -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- 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