diff options
author | Pierre Weis <Pierre.Weis@inria.fr> | 2012-04-27 12:13:29 +0000 |
---|---|---|
committer | Pierre Weis <Pierre.Weis@inria.fr> | 2012-04-27 12:13:29 +0000 |
commit | 30c8f97c210766cdb3ca2dfc13f2416e9039bb2c (patch) | |
tree | e6d9790a8a29f9c2272e7957ef1ffbffd6b47258 /stdlib | |
parent | 2b94ebecf8fb14af357624e82ec7ab1df38c91e0 (diff) |
Documentation for set/get_formatter_out_functions.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12408 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/format.mli | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/stdlib/format.mli b/stdlib/format.mli index 9fcb8f08c..d85e5b683 100644 --- a/stdlib/format.mli +++ b/stdlib/format.mli @@ -367,6 +367,11 @@ val get_formatter_output_functions : (** {6:meaning Changing the meaning of standard formatter pretty printing} *) +(** The [Format] module is versatile enough to let you completely redefine + the meaning of pretty printing: you may provide your own functions to define + how to handle indentation, line breaking, and even printing of all the + characters that have to be printed! *) + type formatter_out_functions = { out_string : string -> int -> int -> unit; out_flush : unit -> unit; @@ -376,12 +381,25 @@ type formatter_out_functions = { ;; val set_formatter_out_functions: formatter_out_functions -> unit;; -val get_formatter_out_functions: unit -> formatter_out_functions;; +(** [set_formatter_out_functions out_funs] + redirects the pretty-printer output to the functions [out_funs.out_string] and + [out_funs.out_flush] as described in [set_formatter_output_functions]. In + addition, the pretty-printer function that outputs a newline is set + to the function [out_funs.out_newline] and the function that outputs + indentation spaces is set to the function [out_funs.out_spaces]. -(** The [Format] module is versatile enough to let you completely redefine - the meaning of pretty printing: you may provide your own functions to define - how to handle indentation, line breaking, and even printing of all the - characters that have to be printed! *) + This way, you can change the meaning of indentation (which can be + something else than just printing space characters) and the meaning of new + lines opening (which can be connected to any other action needed by the + application at hand). The two functions [out_spaces] and [out_newline] are + normally connected to [out_string] and [out_flush]: respective default + values for [out_space] and [out_newline] are + [out_string (String.make n ' ') 0 n] and [out_string "\n" 0 1]. *) + +val get_formatter_out_functions: unit -> formatter_out_functions;; +(** Return the current output functions of the pretty-printer, + including line breaking and indentation functions. Useful to record the + current setting and restore it afterwards. *) val set_all_formatter_output_functions : out:(string -> int -> int -> unit) -> @@ -390,20 +408,10 @@ val set_all_formatter_output_functions : spaces:(int -> unit) -> unit ;; -(** [set_all_formatter_output_functions out flush outnewline outspace] - redirects the pretty-printer output to the functions [out] and - [flush] as described in [set_formatter_output_functions]. In - addition, the pretty-printer function that outputs a newline is set - to the function [outnewline] and the function that outputs - indentation spaces is set to the function [outspace]. - - This way, you can change the meaning of indentation (which can be - something else than just printing space characters) and the - meaning of new lines opening (which can be connected to any other - action needed by the application at hand). The two functions - [outspace] and [outnewline] are normally connected to [out] and - [flush]: respective default values for [outspace] and [outnewline] - are [out (String.make n ' ') 0 n] and [out "\n" 0 1]. *) +(** + Deprecated. + @since 4.0. +*) val get_all_formatter_output_functions : unit -> @@ -412,10 +420,10 @@ val get_all_formatter_output_functions : (unit -> unit) * (int -> unit) ;; -(** Return the current output functions of the pretty-printer, - including line breaking and indentation functions. Useful to record the - current setting and restore it afterwards. *) - +(** + Deprecated. + @since 4.0. +*) (** {6:tagsmeaning Changing the meaning of printing semantics tags} *) type formatter_tag_functions = { @@ -432,10 +440,7 @@ type formatter_tag_functions = { [print] versions are the ``tag printing'' functions that can perform regular printing when a tag is closed or opened. *) -val set_formatter_tag_functions : - formatter_tag_functions -> unit -;; - +val set_formatter_tag_functions : formatter_tag_functions -> unit;; (** [set_formatter_tag_functions tag_funs] changes the meaning of opening and closing tags to use the functions in [tag_funs]. @@ -451,9 +456,7 @@ val set_formatter_tag_functions : called at tag opening and tag closing time, to output regular material in the pretty-printer queue. *) -val get_formatter_tag_functions : - unit -> formatter_tag_functions -;; +val get_formatter_tag_functions : unit -> formatter_tag_functions;; (** Return the current tag functions of the pretty-printer. *) (** {6 Multiple formatted output} *) |