~ubuntu-branches/ubuntu/hardy/ocaml-doc/hardy

« back to all changes in this revision

Viewing changes to ocaml.html/libref/Scanf.Scanning.html

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2007-09-08 01:49:22 UTC
  • mfrom: (0.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070908014922-lvihyehz0ndq7suu
Tags: 3.10-1
* New upstream release.
* Removed camlp4 documentation since it is not up-to-date.
* Updated to standards version 3.7.2, no changes needed.
* Updated my email address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
1
2
<html>
2
3
<head>
3
4
<link rel="stylesheet" href="style.css" type="text/css">
 
5
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
4
6
<link rel="Start" href="index.html">
5
7
<link rel="Up" href="Scanf.html">
6
8
<link title="Index of types" rel=Appendix href="index_types.html">
64
66
<link title="Sys" rel="Chapter" href="Sys.html">
65
67
<link title="Thread" rel="Chapter" href="Thread.html">
66
68
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
 
69
<link title="Tk" rel="Chapter" href="Tk.html">
67
70
<link title="Unix" rel="Chapter" href="Unix.html">
68
71
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
69
72
<link title="Weak" rel="Chapter" href="Weak.html"><title>Scanf.Scanning</title>
73
76
&nbsp;</div>
74
77
<center><h1>Module <a href="type_Scanf.Scanning.html">Scanf.Scanning</a></h1></center>
75
78
<br>
76
 
<pre><span class="keyword">module</span> Scanning: <code class="code"><span class="keyword">sig</span></code> <a href="Scanf.Scanning.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>Scanning buffers.<br>
 
79
<pre><span class="keyword">module</span> Scanning: <code class="code"><span class="keyword">sig</span></code> <a href="Scanf.Scanning.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><a name="6_Scanningbuffers"></a>
 
80
<h6>Scanning buffers</h6><br>
77
81
<hr width="100%">
78
82
<pre><span class="keyword">type</span> <a name="TYPEscanbuf"></a><code class="type"></code>scanbuf </pre>
79
83
<div class="info">
80
 
The type of scanning buffers. A scanning buffer is the argument passed
81
 
   to the scanning functions used by the <code class="code">scanf</code> family of functions.
82
 
   The scanning buffer holds the current state of the scan, plus
83
 
   a function to get the next char from the input, and a token buffer
84
 
   to store the string matched so far.<br>
 
84
The type of scanning buffers. A scanning buffer is the source from which a
 
85
    formatted input function gets characters. The scanning buffer holds the
 
86
    current state of the scan, plus a function to get the next char from the
 
87
    input, and a token buffer to store the string matched so far.
 
88
<p>
 
89
 
 
90
    Note: a scan may often require to examine one character in advance;
 
91
    when this ``lookahead'' character does not belong to the token read,
 
92
    it is stored back in the scanning buffer and becomes the next
 
93
    character read.<br>
85
94
</div>
86
95
 
87
96
<pre><span class="keyword">val</span> <a name="VALstdib"></a>stdib : <code class="type"><a href="Scanf.Scanning.html#TYPEscanbuf">scanbuf</a></code></pre><div class="info">
88
97
The scanning buffer reading from <code class="code">stdin</code>.
89
 
    <code class="code">stdib</code> is equivalent to <code class="code"><span class="constructor">Scanning</span>.from_channel stdin</code>.<br>
 
98
    <code class="code">stdib</code> is equivalent to <code class="code"><span class="constructor">Scanning</span>.from_channel stdin</code>.
 
99
<p>
 
100
 
 
101
    Note: when input is read interactively from <code class="code">stdin</code>, the newline character
 
102
    that triggers the evaluation is incorporated in the input; thus, scanning
 
103
    specifications must properly skip this character (simply add a <code class="code"><span class="string">'\n'</span></code>
 
104
    as the last character of the format string).<br>
90
105
</div>
91
106
<pre><span class="keyword">val</span> <a name="VALfrom_string"></a>from_string : <code class="type">string -> <a href="Scanf.Scanning.html#TYPEscanbuf">scanbuf</a></code></pre><div class="info">
92
 
<code class="code"><span class="constructor">Scanning</span>.from_string s</code> returns a scanning buffer which reads
93
 
    from the given string.
 
107
<code class="code"><span class="constructor">Scanning</span>.from_string s</code> returns a scanning buffer which reads from the
 
108
    given string.
94
109
    Reading starts from the first character in the string.
95
110
    The end-of-input condition is set when the end of the string is reached.<br>
96
111
</div>
97
112
<pre><span class="keyword">val</span> <a name="VALfrom_file"></a>from_file : <code class="type">string -> <a href="Scanf.Scanning.html#TYPEscanbuf">scanbuf</a></code></pre><div class="info">
98
113
Bufferized file reading in text mode. The efficient and usual
99
114
    way to scan text mode files (in effect, <code class="code">from_file</code> returns a
100
 
    buffer that reads characters in large chunks, rather than one
 
115
    scanning buffer that reads characters in large chunks, rather than one
101
116
    character at a time as buffers returned by <code class="code">from_channel</code> do).
102
117
    <code class="code"><span class="constructor">Scanning</span>.from_file fname</code> returns a scanning buffer which reads
103
118
    from the given file <code class="code">fname</code> in text mode.<br>
106
121
Bufferized file reading in binary mode.<br>
107
122
</div>
108
123
<pre><span class="keyword">val</span> <a name="VALfrom_function"></a>from_function : <code class="type">(unit -> char) -> <a href="Scanf.Scanning.html#TYPEscanbuf">scanbuf</a></code></pre><div class="info">
109
 
<code class="code"><span class="constructor">Scanning</span>.from_function f</code> returns a scanning buffer with
110
 
    the given function as its reading method.
 
124
<code class="code"><span class="constructor">Scanning</span>.from_function f</code> returns a scanning buffer with the given
 
125
    function as its reading method.
 
126
<p>
 
127
 
111
128
    When scanning needs one more character, the given function is called.
112
 
    When the function has no more character to provide, it must signal
113
 
    an end-of-input condition by raising the exception <code class="code"><span class="constructor">End_of_file</span></code>.<br>
 
129
<p>
 
130
 
 
131
    When the function has no more character to provide, it must signal an
 
132
    end-of-input condition by raising the exception <code class="code"><span class="constructor">End_of_file</span></code>.<br>
114
133
</div>
115
134
<pre><span class="keyword">val</span> <a name="VALfrom_channel"></a>from_channel : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> <a href="Scanf.Scanning.html#TYPEscanbuf">scanbuf</a></code></pre><div class="info">
116
135
<code class="code"><span class="constructor">Scanning</span>.from_channel ic</code> returns a scanning buffer which reads
118
137
    current reading position.<br>
119
138
</div>
120
139
<pre><span class="keyword">val</span> <a name="VALend_of_input"></a>end_of_input : <code class="type"><a href="Scanf.Scanning.html#TYPEscanbuf">scanbuf</a> -> bool</code></pre><div class="info">
121
 
<code class="code"><span class="constructor">Scanning</span>.end_of_input ib</code> tests the end-of-input condition
122
 
    of the given buffer.<br>
 
140
<code class="code"><span class="constructor">Scanning</span>.end_of_input ib</code> tests the end-of-input condition of the given
 
141
    scanning buffer.<br>
123
142
</div>
124
143
<pre><span class="keyword">val</span> <a name="VALbeginning_of_input"></a>beginning_of_input : <code class="type"><a href="Scanf.Scanning.html#TYPEscanbuf">scanbuf</a> -> bool</code></pre><div class="info">
125
 
<code class="code"><span class="constructor">Scanning</span>.beginning_of_input ib</code> tests the beginning of input
126
 
    condition of the given buffer.<br>
 
144
<code class="code"><span class="constructor">Scanning</span>.beginning_of_input ib</code> tests the beginning of input condition of
 
145
    the given scanning buffer.<br>
127
146
</div>
128
147
<pre><span class="keyword">val</span> <a name="VALname_of_input"></a>name_of_input : <code class="type"><a href="Scanf.Scanning.html#TYPEscanbuf">scanbuf</a> -> string</code></pre><div class="info">
129
 
<code class="code"><span class="constructor">Scanning</span>.file_name_of_input ib</code> returns the name of the character
130
 
    source for the input buffer <code class="code">ib</code>.<br>
 
148
<code class="code"><span class="constructor">Scanning</span>.file_name_of_input ib</code> returns the name of the character source
 
149
    for the scanning buffer <code class="code">ib</code>.<br>
131
150
</div>
132
151
</body></html>
 
 
b'\\ No newline at end of file'