From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id B47667F9BB for ; Tue, 1 Jul 2014 16:40:07 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel@kerneis.info) identity=pra; client-ip=176.31.113.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel@kerneis.info"; x-sender="gabriel@kerneis.info"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel@kerneis.info designates 176.31.113.173 as permitted sender) identity=mailfrom; client-ip=176.31.113.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel@kerneis.info"; x-sender="gabriel@kerneis.info"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@wanbli.kerneis.info designates 176.31.113.173 as permitted sender) identity=helo; client-ip=176.31.113.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel@kerneis.info"; x-sender="postmaster@wanbli.kerneis.info"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhEFABDIslOwH3Gt/2dsb2JhbABagw1Sg0jDEwGBDBZ1hAQBBSMPAQUIAQE3AQ8EBw4MAhgOAgJXBhuIPgEIqzl3hQIBBZcXEQaBK40cWAeCd4FMkEmLaYUxjQqDQzwvgQI X-IPAS-Result: AhEFABDIslOwH3Gt/2dsb2JhbABagw1Sg0jDEwGBDBZ1hAQBBSMPAQUIAQE3AQ8EBw4MAhgOAgJXBhuIPgEIqzl3hQIBBZcXEQaBK40cWAeCd4FMkEmLaYUxjQqDQzwvgQI X-IronPort-AV: E=Sophos;i="5.01,581,1400018400"; d="scan'208";a="83149974" Received: from wanbli.kerneis.info ([176.31.113.173]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 01 Jul 2014 16:39:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kerneis.info; s=wanbli-rsa1; h=Subject:Message-ID:References:In-Reply-To:Cc:From:Date:Content-Transfer-Encoding:Content-Type:MIME-Version:To; bh=PTSeOY2OeFzafR8mutXW84YEIHtFy5Bqcgub089Ayug=; b=ml6Wl3c8jr3KFo5MJmydMNJKeQKD2TkwU3QwZglnTIabcHPwaowRkPiVQOQY6CaVKi/8kRAxwj+5dC8hwaVKhoCe5oeVZXSdIKC7S7XtjhK/52m95/bT4xJaCeYhSZdQCgSOknVski0uqMaMAQ/C/Mn+mBWu87a9MNnYCN4JbgU=; Received: from www-data by wanbli.kerneis.info with local (Exim 4.80) (envelope-from ) id 1X1zDm-00084j-Ix; Tue, 01 Jul 2014 14:39:47 +0000 To: Tianyi Cui X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 01 Jul 2014 15:39:46 +0100 From: Gabriel Kerneis Cc: OCaml Mailing List In-Reply-To: References: <20140701095955.GE4120@kerneis.info> Message-ID: <468a14a33d21f1ee3bdadbce329f9c7c@kerneis.info> X-Sender: gabriel@kerneis.info User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: gabriel@kerneis.info X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on wanbli.kerneis.info X-Spam-Level: X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on wanbli.kerneis.info) Subject: Re: [Caml-list] Extending Format strings Le 2014-07-01 15:15, Tianyi Cui a écrit : > I found https://github.com/janestreet/custom_printf [5] quite > straightforward to understand and easy to use, if most of your types > already have sexp converters and to_string functions. Thanks. This is a nice hack (provided you are happy to use a pre-processor). However, if I understand correctly, it is limited to making %s and %a more convenient to use for existing Printf functions. I should probably have given more details in my initial request. CIL's Pretty.dprintf [1] constructs and returns a "document" (similar to PPrint.document, if you are more familiar with this library), to be later formated and rendered to a given width. I am not sure custom_printf provides that level of flexibility. [1] http://kerneis.github.io/cil/doc/html/cil/api/Pretty.html#VALdprintf Best, -- Gabriel