From cc0b6f96520345939a0ad662078397900f03e658 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Thu, 23 Jul 2015 16:38:26 +0200 Subject: [PATCH] expose `Format.asprintf` for V>=4.01, fixes #597 --- .gitignore | 1 + src/{batFormat.mli => batFormat.mliv} | 7 +++++++ 2 files changed, 8 insertions(+) rename src/{batFormat.mli => batFormat.mliv} (98%) diff --git a/.gitignore b/.gitignore index 0975a97b0..bc27b88b6 100644 --- a/.gitignore +++ b/.gitignore @@ -32,5 +32,6 @@ src/batMarshal.mli src/batPrintexc.mli src/batPrintf.ml src/batPrintf.mli +src/batFormat.mli src/batSys.mli src/batBigarray.mli diff --git a/src/batFormat.mli b/src/batFormat.mliv similarity index 98% rename from src/batFormat.mli rename to src/batFormat.mliv index 3305759de..cce3822b1 100644 --- a/src/batFormat.mli +++ b/src/batFormat.mliv @@ -688,6 +688,13 @@ val sprintf : ('a, unit, string) format -> 'a;; buffer of your own: flushing the formatter and the buffer at the end of pretty-printing returns the desired string. *) +##V>=4.01##val asprintf : ('a, formatter, unit, string) format4 -> 'a;; +##V>=4.01##(** Same as [printf] above, but instead of printing on a formatter, returns a +##V>=4.01## string containing the result of formatting the arguments. The type of +##V>=4.01## asprintf is general enough to interact nicely with [%a] conversions. +##V>=4.01## @since 4.01.0 +##V>=4.01##*) + val ifprintf : formatter -> ('a, formatter, unit) format -> 'a;; (** Same as [fprintf] above, but does not print anything. Useful to ignore some material when conditionally printing.