From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 3BDF6BBC1 for ; Wed, 9 Apr 2008 09:36:41 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiECAIYO/EfRVYa7c2dsb2JhbACRTQEMAwQFCRSUbIV6 X-IronPort-AV: E=Sophos;i="4.25,627,1199660400"; d="scan'208";a="24783130" Received: from mu-out-0910.google.com ([209.85.134.187]) by mail4-smtp-sop.national.inria.fr with ESMTP; 09 Apr 2008 09:36:40 +0200 Received: by mu-out-0910.google.com with SMTP id w8so3396877mue.4 for ; Wed, 09 Apr 2008 00:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=eHF8HYAwMyvE1Ta/uYVKtdSmENNgfJwX/WWubPziVmI=; b=rvF4BfX6dzpQnHkP6nAO/gweavjaNWCtO/KHcflSsxWJQMsibGPemVy7kZDoVPNS/dp5jJe3qIDQDdqnrIi4XdJ/HpvtU5yHIOmWtL/w0/csWoHyQrnRX/8sbimmwPXv5lbwF0KEC9LB9ou3RvYtFLB1i2dgsr8E4trW10S8KEs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LXi8owiyD9Q+OJQslNWwAm9kcbACSa9lv9GHHoUuXfv/9PIMoHtF5qLIykgMfpTvKH6Hez4+MEpbGg5wIZBiVkaPydvv0++aEwmgqtxbMw/GXaSjqKwsykrSJITH4uUhUIHSf8n5OqEHRyRNEvU9BB9iKw7KHIJhBbJz31Khgmo= Received: by 10.78.122.16 with SMTP id u16mr1125260huc.113.1207726600056; Wed, 09 Apr 2008 00:36:40 -0700 (PDT) Received: by 10.78.15.19 with HTTP; Wed, 9 Apr 2008 00:36:40 -0700 (PDT) Message-ID: <95513600804090036m1bf04367w5736f67f3f37135b@mail.gmail.com> Date: Wed, 9 Apr 2008 09:36:40 +0200 From: "Olivier Andrieu" To: forum@x9c.fr Subject: Re: [Caml-list] weird behavior with camlp4o Cc: caml-list@yquem.inria.fr In-Reply-To: <1207726165.47fc70555cb83@imp.ovh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1207726165.47fc70555cb83@imp.ovh.net> X-Spam: no; 0.00; andrieu:01 oandrieu:01 camlp:01 ocaml:01 camlp:01 cmo:01 cmo:01 denotes:01 ocamlc:01 ocamlopt:01 -pp:01 wrote:01 abstract:01 caml-list:01 descriptor:02 On Wed, Apr 9, 2008 at 9:29 AM, wrote: > Selon "Andrew I. Schein" : > > Greetings list - > > > > I was playing around with OCaml 3.10.2 camlp4o like this: > > > > camlp4o pa_breakcont.cmo sample1.ml > > > > with my macro pa_breakcont.cmo and got the expected macro translation > > printed to my terminal. However, when I type: > > > > camlp4o pa_breakcont.cmo sample1.ml > out.ml > > > > out.ml contains binary output. Am I misusing camlp4o? > > I have encountered the same problem a few days ago while working on > Ocaml-Java to make it camlp4-compatible. > > The fact is that the kind of output (binary dump of abstract tree or > source code in textual form) is chosen according to the nature of the > output file descriptor. If the output file descriptor denotes a tty > then the textual form is chosen, otherwise the binary form is chosen. > > That being said, I don't know what is the rationale of this choice, > as I have not come up with a use case for the binary form. It's simply more efficient for ocamlc or ocamlopt when camlp4 is called via the -pp option: no need to pretty-print and then reparse the source. -- Olivier