<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="OptParse.StdOpt.html"> <link rel="next" href="OptParse.OptParser.html"> <link rel="Up" href="OptParse.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Base64" rel="Chapter" href="Base64.html"> <link title="BitSet" rel="Chapter" href="BitSet.html"> <link title="Dllist" rel="Chapter" href="Dllist.html"> <link title="DynArray" rel="Chapter" href="DynArray.html"> <link title="Enum" rel="Chapter" href="Enum.html"> <link title="ExtArray" rel="Chapter" href="ExtArray.html"> <link title="ExtHashtbl" rel="Chapter" href="ExtHashtbl.html"> <link title="ExtList" rel="Chapter" href="ExtList.html"> <link title="ExtString" rel="Chapter" href="ExtString.html"> <link title="Global" rel="Chapter" href="Global.html"> <link title="IO" rel="Chapter" href="IO.html"> <link title="OptParse" rel="Chapter" href="OptParse.html"> <link title="Option" rel="Chapter" href="Option.html"> <link title="PMap" rel="Chapter" href="PMap.html"> <link title="RefList" rel="Chapter" href="RefList.html"> <link title="Std" rel="Chapter" href="Std.html"> <link title="UChar" rel="Chapter" href="UChar.html"> <link title="UTF8" rel="Chapter" href="UTF8.html"> <link title="Unzip" rel="Chapter" href="Unzip.html"><link title="Standard formatters" rel="Section" href="#6_Standardformatters"> <link title="Low-level formatting" rel="Section" href="#6_Lowlevelformatting"> <title>OptParse.Formatter</title> </head> <body> <div class="navbar"><a class="pre" href="OptParse.StdOpt.html" title="OptParse.StdOpt">Previous</a> <a class="up" href="OptParse.html" title="OptParse">Up</a> <a class="post" href="OptParse.OptParser.html" title="OptParse.OptParser">Next</a> </div> <h1>Module <a href="type_OptParse.Formatter.html">OptParse.Formatter</a></h1> <pre><span class="keyword">module</span> Formatter: <code class="code">sig</code> <a href="OptParse.Formatter.html">..</a> <code class="code">end</code></pre><div class="info module top"> This module contains the types and functions for implementing custom usage message formatters.<br> </div> <hr width="100%"> <pre><code><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> = {</code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTt.indent">indent</span> : <code class="type">unit -> unit</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Increase the indentation level.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTt.dedent">dedent</span> : <code class="type">unit -> unit</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Decrease the indentation level.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTt.format_usage">format_usage</span> : <code class="type">string -> string</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Format usage string into style of this formatter.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTt.format_heading">format_heading</span> : <code class="type">string -> string</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Format heading into style of this formatter.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTt.format_description">format_description</span> : <code class="type">string -> string</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Format description into style of this formatter.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTt.format_option">format_option</span> : <code class="type">char list * string list -> string list -> string option -> string</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Format option into style of this formatter (see explanation below).</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr></table> } <br> This is the type of a formatter. The <code class="code">format_option</code> has signature <code class="code">format_option (snames,lnames) metavars help</code>, where <code class="code">snames</code> is a list of the short option names, <code class="code">lnames</code> is a list of the long option names, <code class="code">metavars</code> is a list of the metavars the option takes as arguments, and <code class="code">help</code> is the help string supplied by the user.<br> <br> <h6 id="6_Standardformatters">Standard formatters</h6><br> <pre><span id="VALindented_formatter"><span class="keyword">val</span> indented_formatter</span> : <code class="type">?level:int Pervasives.ref -><br> ?indent:int Pervasives.ref -><br> ?indent_increment:int -><br> ?max_help_position:int -><br> ?width:int -> ?short_first:bool -> unit -> <a href="OptParse.Formatter.html#TYPEt">t</a></code></pre><div class="info "> Create an "indented" formatter with the given options.<br> </div> <div class="param_info"><code class="code">level</code> : Reference to the current indentation level. Its value reflects changes in indentation level.</div> <div class="param_info"><code class="code">indent</code> : Reference to the current indentation amount. Its value reflects changes in indentation level.</div> <div class="param_info"><code class="code">indent_increment</code> : Number of columns to indent by when more indentation is required.</div> <div class="param_info"><code class="code">max_help_position</code> : Maximum starting column for the help messages relating to each option.</div> <div class="param_info"><code class="code">width</code> : Total with of the usage messages printed.</div> <div class="param_info"><code class="code">short_first</code> : List all the short option names first?</div> <pre><span id="VALtitled_formatter"><span class="keyword">val</span> titled_formatter</span> : <code class="type">?level:int Pervasives.ref -><br> ?indent:int Pervasives.ref -><br> ?indent_increment:int -><br> ?max_help_position:int -><br> ?width:int -> ?short_first:bool -> unit -> <a href="OptParse.Formatter.html#TYPEt">t</a></code></pre><div class="info "> Creates a titled formatter which is quite similar to the indented formatter. See <a href="OptParse.Formatter.html#VALindented_formatter"><code class="code">OptParse.Formatter.indented_formatter</code></a> for a description of the options.<br> </div> <br> <h6 id="6_Lowlevelformatting">Low-level formatting</h6><br> <pre><span id="VALwrap"><span class="keyword">val</span> wrap</span> : <code class="type">?initial_indent:int -> ?subsequent_indent:int -> string -> int -> string list</code></pre><div class="info "> <code class="code">wrap text width</code> reflows the given text paragraph into lines of width at most <code class="code">width</code> (lines may exceed this if the are single words that exceed this limit).<br> <b>Returns</b> a list of lines making up the reformatted paragraph.<br> </div> <div class="param_info"><code class="code">initial_indent</code> : Indentation of the first line.</div> <div class="param_info"><code class="code">subsequent_indent</code> : Indentation of the following lines.</div> <pre><span id="VALfill"><span class="keyword">val</span> fill</span> : <code class="type">?initial_indent:int -> ?subsequent_indent:int -> string -> int -> string</code></pre><div class="info "> See <a href="OptParse.Formatter.html#VALwrap"><code class="code">OptParse.Formatter.wrap</code></a>.<br> <b>Returns</b> a string containing the reformatted paragraph.<br> </div> </body></html>