From 579eb1e41e2390ef88c4f3878eabd38b8dfc3fe8 Mon Sep 17 00:00:00 2001 From: Pierre Weis Date: Sat, 27 Sep 2008 20:50:01 +0000 Subject: [PATCH] Documentation. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9040 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- stdlib/printf.ml | 13 +++++++++---- stdlib/printf.mli | 13 ++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/stdlib/printf.ml b/stdlib/printf.ml index 45b265d23..92ce25476 100644 --- a/stdlib/printf.ml +++ b/stdlib/printf.ml @@ -362,10 +362,15 @@ type positional_specification = Calling [got_spec] with appropriate arguments, we ``return'' a positional specification and an index to go on scanning the [fmt] format at hand. - We do not support [*$] specifications, since this would lead to type - checking problems: a [*$] positional specification means ``take the next - argument to [printf] (which must be an integer value)'', name this integer - value $n$; [*$] now designates parameter $n$. + Note that this is optimized for the regular case, i.e. no positional + parameter, since in this case we juste ``return'' the constant + [Spec_none]; in case we have a positional parameter, we ``return'' a + [Spec_index] [positional_specification] which a bit more costly. + + Note also that we do not support [*$] specifications, since this would + lead to type checking problems: a [*$] positional specification means + ``take the next argument to [printf] (which must be an integer value)'', + name this integer value $n$; [*$] now designates parameter $n$. Unfortunately, the type of a parameter specified via a [*$] positional specification should be the type of the corresponding argument to diff --git a/stdlib/printf.mli b/stdlib/printf.mli index 3e6c7b169..059779922 100644 --- a/stdlib/printf.mli +++ b/stdlib/printf.mli @@ -122,6 +122,7 @@ val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a (see module {!Buffer}). *) (** Formatted output functions with continuations. *) + val kfprintf : (out_channel -> 'a) -> out_channel -> ('b, out_channel, unit, 'a) format4 -> 'b;; (** Same as [fprintf], but instead of returning immediately, @@ -180,7 +181,10 @@ module CamlinternalPr : sig val sub_format : (('a, 'b, 'c, 'd, 'e, 'f) format6 -> int) -> (('a, 'b, 'c, 'd, 'e, 'f) format6 -> int -> char -> int) -> - char -> ('a, 'b, 'c, 'd, 'e, 'f) format6 -> int -> int + char -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + int -> + int val summarize_format_type : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string @@ -192,11 +196,14 @@ module CamlinternalPr : sig (Sformat.index -> 'i -> 'j -> int -> 'h) -> (Sformat.index -> 'k -> int -> 'h) -> (Sformat.index -> int -> 'h) -> - (Sformat.index -> ('l, 'm, 'n, 'o, 'p, 'q) format6 -> int -> 'h) -> 'h + (Sformat.index -> ('l, 'm, 'n, 'o, 'p, 'q) format6 -> int -> 'h) -> + 'h val kapr : (('a, 'b, 'c, 'd, 'e, 'f) format6 -> Obj.t array -> 'g) -> - ('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + 'g + end;; end;;