diff options
| author | Pierre Weis <Pierre.Weis@inria.fr> | 2010-05-03 09:18:20 +0000 |
|---|---|---|
| committer | Pierre Weis <Pierre.Weis@inria.fr> | 2010-05-03 09:18:20 +0000 |
| commit | b443ee91ff92ffcbb21d0dce9b9cc35f32cb466e (patch) | |
| tree | 6e3f9d863a1a91b294603a0972a0c9ddc8c9015d /stdlib/format.ml | |
| parent | 1a868db7b80381cd2aae138b6542c1f80e58f82d (diff) | |
| download | ocaml-b443ee91ff92ffcbb21d0dce9b9cc35f32cb466e.tar.gz | |
Documentation. Adding a <<deprecated>> section to list deprecated stuff out of the way from the regular stuff.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10348 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/format.ml')
| -rw-r--r-- | stdlib/format.ml | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/stdlib/format.ml b/stdlib/format.ml index 90bcea7288..a8d6ec9e14 100644 --- a/stdlib/format.ml +++ b/stdlib/format.ml @@ -1069,8 +1069,8 @@ let implode_rev s0 = function (* [mkprintf] is the printf-like function generator: given the - [to_s] flag that tells if we are printing into a string, - the [get_out] function that has to be called to get a [ppf] function to - output onto. - It generates a [kprintf] function that takes as arguments a [k] + output onto, + it generates a [kprintf] function that takes as arguments a [k] continuation function to be called at the end of formatting, and a printing format string to print the rest of the arguments according to the format string. @@ -1311,24 +1311,31 @@ let ifprintf ppf = ikfprintf ignore ppf;; let printf fmt = fprintf std_formatter fmt;; let eprintf fmt = fprintf err_formatter fmt;; +let ksprintf k = + let b = Buffer.create 512 in + let k ppf = k (string_out b ppf) in + mkprintf true (fun _ -> formatter_of_buffer b) k +;; + +let sprintf fmt = ksprintf (fun s -> s) fmt;; + +(************************************************************** + + Deprecated stuff. + + **************************************************************) + let kbprintf k b = mkprintf false (fun _ -> formatter_of_buffer b) k ;; +(* Deprecated error prone function bprintf. *) let bprintf b = let k ppf = pp_flush_queue ppf false in kbprintf k b ;; -let ksprintf k = - let b = Buffer.create 512 in - let k ppf = k (string_out b ppf) in - mkprintf true (fun _ -> formatter_of_buffer b) k -;; - -let sprintf fmt = ksprintf (fun s -> s) fmt;; - -(* Obsolete alias for ksprintf. *) +(* Deprecated alias for ksprintf. *) let kprintf = ksprintf;; at_exit print_flush |
