Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 19bb6433bb07a8b16410504336791904 > files > 73

ocaml-doc-3.06-5mdk.ppc.rpm

<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="Start" href="index.html">
<link rel="previous" href="Random.html">
<link rel="next" href="Set.html">
<link rel="Up" href="index.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 modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Big_int" rel="Chapter" href="Big_int.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Dbm" rel="Chapter" href="Dbm.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Graphics" rel="Chapter" href="Graphics.html">
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Num" rel="Chapter" href="Num.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Sort" rel="Chapter" href="Sort.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Tk" rel="Chapter" href="Tk.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><title>Scanf</title>
</head>
<body>
<div class="navbar"><a href="Random.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="Set.html">Next</a>
</div>
<center><h1>Module <a href="type_Scanf.html">Scanf</a></h1></center>
<br>
<pre><span class="keyword">module</span> Scanf: <code class="type">sig  end</code></pre><div class="info">
Formatted input functions.<br>
</div>
<hr width="100%">
<pre><span class="keyword">module</span> <a href="Scanf.Scanning.html">Scanning</a>: <code class="type">sig  end</code></pre><div class="info">
Scanning buffers.
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONScan_failure"></a>Scan_failure <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info">
The exception that formatted input functions raise when the input
   cannot be read according to the given format.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALbscanf"></a>bscanf : <code class="type"><a href="Scanf.Scanning.html#TYPEscanbuf">Scanning.scanbuf</a> -> ('a, <a href="Scanf.Scanning.html#TYPEscanbuf">Scanning.scanbuf</a>, 'b) format -> 'a -> 'b</code></pre><div class="info">
<code class="code">bscanf ib format f</code> reads tokens from the scanning buffer <code class="code">ib</code> according
   to the format string <code class="code">format</code>, converts these tokens to values, and
   applies the function <code class="code">f</code> to these values.
   The result of this application of <code class="code">f</code> is the result of the whole construct.
<p>

   Raise <code class="code"><span class="constructor">Scanf</span>.<span class="constructor">Scan_failure</span></code> if the given input does not match the format.
<p>

   Raise <code class="code"><span class="constructor">Failure</span></code> if a conversion to a number is not possible.
<p>

   Raise <code class="code"><span class="constructor">End_of_file</span></code> if the end of input is encountered while scanning
   and the input matches the given format so far.
<p>

   The format is a character string which contains three types of
   objects:<ul>
<li>plain characters, which are simply matched with the
   characters of the input,</li>
<li>conversion specifications, each of which causes reading and
   conversion of one argument for <code class="code">f</code>,</li>
<li>scanning indications to specify boundaries of tokens.</li>
</ul>

   Among plain characters the space character (ASCII code 32) has a
   special meaning: it matches ``whitespace'', that is any number of tab,
   space, newline and carriage return characters. Hence, a space in the format
   matches any amount of whitespace in the input.
<p>

   Conversion specifications consist in the <code class="code">%</code> character, followed
   by optional field width, followed by one or two conversion
   characters. The conversion characters and their meanings are:<ul>
<li><code class="code">d</code>: reads an optionally signed decimal integer.</li>
<li><code class="code">i</code>: reads an optionally signed integer
     (usual input formats for hexadecimal (<code class="code">0x[d]+</code> and <code class="code">0<span class="constructor">X</span>[d]+</code>),
      octal (<code class="code">0o[d]+</code>), and binary <code class="code">0b[d]+</code> notations are understood).</li>
<li><code class="code">u</code>: reads an unsigned decimal integer.</li>
<li><code class="code">x</code> or <code class="code"><span class="constructor">X</span></code>: reads an unsigned hexadecimal integer.</li>
<li><code class="code">o</code>: reads an unsigned octal integer.</li>
<li><code class="code">s</code>: reads a string argument (by default strings end with a space).</li>
<li><code class="code"><span class="constructor">S</span></code>: reads a delimited string argument (delimiters and special
     escaped characters follow the lexical conventions of Caml).</li>
<li><code class="code">c</code>: reads a single character.</li>
<li><code class="code"><span class="constructor">C</span></code>: reads a single delimited character (delimiters and special
     escaped characters follow the lexical conventions of Caml).</li>
<li><code class="code">f</code>, <code class="code">e</code>, <code class="code"><span class="constructor">E</span></code>, <code class="code">g</code>, <code class="code"><span class="constructor">G</span></code>: reads an optionally signed floating-point number
     in decimal notation, in the style <code class="code">dddd.ddd e/<span class="constructor">E</span>+-dd</code>.</li>
<li><code class="code">b</code>: reads a boolean argument (<code class="code"><span class="keyword">true</span></code> or <code class="code"><span class="keyword">false</span></code>).</li>
<li><code class="code">ld</code>, <code class="code">li</code>, <code class="code">lu</code>, <code class="code">lx</code>, <code class="code">lX</code>, <code class="code">lo</code>: reads an <code class="code">int32</code> argument to
     the format specified by the second letter (decimal, hexadecimal, etc).</li>
<li><code class="code">nd</code>, <code class="code">ni</code>, <code class="code">nu</code>, <code class="code">nx</code>, <code class="code">nX</code>, <code class="code">no</code>: reads a <code class="code">nativeint</code> argument to
     the format specified by the second letter.</li>
<li><code class="code"><span class="constructor">Ld</span></code>, <code class="code"><span class="constructor">Li</span></code>, <code class="code"><span class="constructor">Lu</span></code>, <code class="code"><span class="constructor">Lx</span></code>, <code class="code"><span class="constructor">LX</span></code>, <code class="code"><span class="constructor">Lo</span></code>: reads an <code class="code">int64</code> argument to
     the format specified by the second letter.</li>
<li><code class="code">[ range ]</code>: reads characters that matches one of the characters
     mentioned in the range of characters <code class="code">range</code> (or not mentioned in
     it, if the range starts with <code class="code">^</code>). Returns a <code class="code">string</code> that can be
     empty, if no character in the input matches the range.</li>
<li><code class="code"><span class="constructor">N</span></code>: applies <code class="code">f</code> to the number of characters read so far.</li>
<li><code class="code">%</code>: matches one <code class="code">%</code> character in the input.</li>
</ul>

   The field widths are composed of an optional integer literal
   indicating the maximal width of the token to read.
   For instance, <code class="code">%6d</code> reads an integer, having at most 6 decimal digits;
   and <code class="code">%4f</code> reads a float with 4 characters.
<p>

   Scanning indications appear just after string conversions <code class="code">s</code> and
   <code class="code">[ range ]</code> to delimit the end of the token. A scanning
   indication is introduced by a <code class="code">@</code> character, followed by some
   constant character <code class="code">c</code>. It means that the string token should end
   just before the next matching <code class="code">c</code>. If no <code class="code">c</code> character is
   encountered, the string token spreads as much as possible.
   For instance, <code class="code"><span class="string">"%s@\t"</span></code> reads a string up to the next tabulation
   character. If a scanning indication <code class="code">@c</code> does not follow a
   string conversion, it is ignored and treated as a plain <code class="code">c</code>
   character.
<p>

   Note: the <code class="code">scanf</code> facility is not intended for heavy duty
   lexical analysis and parsing. If it appears not expressive
   enough for your needs, several alternative exists: regular expressions
   (module <code class="code"><span class="constructor">Str</span></code>), stream parsers, <code class="code">ocamllex</code>-generated lexers,
   <code class="code">ocamlyacc</code>-generated parsers.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfscanf"></a>fscanf : <code class="type"><a href="Pervasives.html#TYPEin_channel">Pervasives.in_channel</a> -> ('a, <a href="Scanf.Scanning.html#TYPEscanbuf">Scanning.scanbuf</a>, 'b) format -> 'a -> 'b</code></pre><div class="info">
Same as <a href="Scanf.html#VALbscanf"><code class="code"><span class="constructor">Scanf</span>.bscanf</code></a>, but inputs from the given channel.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsscanf"></a>sscanf : <code class="type">string -> ('a, <a href="Scanf.Scanning.html#TYPEscanbuf">Scanning.scanbuf</a>, 'b) format -> 'a -> 'b</code></pre><div class="info">
Same as <a href="Scanf.html#VALbscanf"><code class="code"><span class="constructor">Scanf</span>.bscanf</code></a>, but inputs from the given string.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALscanf"></a>scanf : <code class="type">('a, <a href="Scanf.Scanning.html#TYPEscanbuf">Scanning.scanbuf</a>, 'b) format -> 'a -> 'b</code></pre><div class="info">
Same as <a href="Scanf.html#VALbscanf"><code class="code"><span class="constructor">Scanf</span>.bscanf</code></a>, but inputs from <code class="code">stdin</code>
    (the standard input channel).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALkscanf"></a>kscanf : <code class="type"><a href="Scanf.Scanning.html#TYPEscanbuf">Scanning.scanbuf</a> -><br>       (<a href="Scanf.Scanning.html#TYPEscanbuf">Scanning.scanbuf</a> -> exn -> 'a) -><br>       ('b, <a href="Scanf.Scanning.html#TYPEscanbuf">Scanning.scanbuf</a>, 'a) format -> 'b -> 'a</code></pre><div class="info">
Same as <a href="Scanf.html#VALbscanf"><code class="code"><span class="constructor">Scanf</span>.bscanf</code></a>, but takes an additional function argument
  <code class="code">ef</code> that is called in case of error: if the scanning process or
  some conversion fails, the scanning function aborts and applies the
  error handling function <code class="code">ef</code> to the scanning buffer and the
  exception that aborted evaluation.<br>
</div>
</body></html>