summaryrefslogtreecommitdiff
path: root/fpcdocs/pipes.xml
blob: d8fe9709f77751ac6a4480ef2f0903ec331a54d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<?xml version="1.0" encoding="ISO-8859-1"?>
<fpdoc-descriptions>
<package name="fcl">

<!--
  ====================================================================
    Pipes
  ====================================================================
-->

<module name="Pipes">
<short>Unit implementing pipe streams.</short>
<descr>
<p>The <file>Pipes</file> unit implements streams that are wrappers around the
OS's pipe functionality. It creates a pair of streams, and what is written
to one stream can be read from another.</p>
</descr>

<!-- unresolved type reference Visibility: default -->
<element name="sysutils">
<short>uses for exception support.</short>
</element>

<!-- unresolved type reference Visibility: default -->
<element name="Classes">
<short>Used for the <var>TSTream</var> class definition.</short>
</element>

<!-- object Visibility: default -->
<element name="EPipeError">
<short>Exception raised when an invalid operation is performed on a pipe stream.</short>
</element>

<!-- object Visibility: default -->
<element name="EPipeSeek">
<short>Exception raised when an invalid seek operation is attempted on a pipe.</short>
</element>

<!-- object Visibility: default -->
<element name="EPipeCreation">
<short>Exception raised when an error occurred during the creation of a pipe pair.</short>
</element>

<!-- object Visibility: default -->
<element name="TInputPipeStream">
<short><var>TStream</var> descendent which wraps the read end of a pipe.</short>
<descr>
<var>TInputPipeStream</var> is created by the <link id="CreatePipeStreams"/>
call to represent the reading end of a pipe. 
It is a <link id="#rtl.classes.TStream">TStream</link> descendent which does
not allow writing, and which mimics the seek operation.
</descr>
<seealso>
<link id="#rtl.classes.TStream">TStream</link>
<link id="CreatePipeStreams"/>
<link id="TOutputPipeStream"/>
</seealso>
</element>

<!-- function Visibility: public -->
<element name="TInputPipeStream.Write">
<short>Write data to the stream.</short>
<descr>
<var>Write</var> overrides the parent implementation of <var>Write</var>.
On a <var>TInputPipeStream</var> will always raise an
exception, as the pipe is read-only.
</descr>
<errors>
An <link id="#rtl.classes.EStreamError">EStreamError</link> exception is raised when this function is
called.
</errors>
<seealso>
<link id="TInputPipeStream.Read">Read</link>
<link id="TInputPipeStream.Seek">Seek</link>
</seealso>
</element>

<!-- function result Visibility: default -->
<element name="TInputPipeStream.Write.Result">
<short>Number of bytes actually written.</short>
</element>

<!-- argument Visibility: default -->
<element name="TInputPipeStream.Write.Buffer">
<short>Memory buffer containing the data to be written.</short>
</element>

<!-- argument Visibility: default -->
<element name="TInputPipeStream.Write.Count">
<short>Number of bytes that must be written.</short>
</element>

<!-- function Visibility: public -->
<element name="TInputPipeStream.Seek">
<short>Set the current position of the stream</short>
<descr>
<p>
<var>Seek</var> overrides the standard <var>Seek</var> implementation.
Normally, pipe streams stderr are not seekable.
The <var>TInputPipeStream</var> stream tries to provide seek capabilities for the
following limited number of cases:
</p>
<dl>
<dt>Origin=soFromBeginning</dt>
<dd>If <var>Offset</var> is larger than the current position,
then the remaining bytes are skipped by reading them from the
stream and discarding them.
</dd>
<dt>Origin=soFromCurrent</dt>
<dd>If <var>Offset</var> is zero, the current position is returned. If
it is positive, then <var>Offset</var> bytes are skipped by reading them
from the stream and discarding them, if the stream is of type
<var>iosInput</var>.
</dd>
</dl>
<p>
All other cases will result in a <var>EPipeSeek</var> exception.
</p>
</descr>
<errors>
An <link id="EPipeSeek"/> exception is raised if the stream does not
allow the requested seek operation.
</errors>
<seealso>
<link id="EPipeSeek"/>
<link id="#rtl.classes.tstream.seek">Seek</link>
</seealso>
</element>

<!-- function result Visibility: default -->
<element name="TInputPipeStream.Seek.Result">
<short>New position of the stream.</short>
</element>

<!-- argument Visibility: default -->
<element name="TInputPipeStream.Seek.Offset">
<short>Offset, in bytes, starting at <var>Origin</var></short>
</element>

<!-- argument Visibility: default -->
<element name="TInputPipeStream.Seek.Origin">
<short>Where to start counting <var>Offset</var> bytes.</short>
</element>

<!-- function Visibility: public -->
<element name="TInputPipeStream.Read">
<short>Read data from the stream to a buffer.</short>
<descr>
<var>Read</var> calls the inherited read and adjusts the 
internal position pointer of the stream.
</descr>
<errors>
None.
</errors>
<seealso>
<link id="TInputPipeStream.Write">Write</link>
<link id="TInputPipeStream.Seek">Seek</link>
</seealso>
</element>

<!-- function result Visibility: default -->
<element name="TInputPipeStream.Read.Result">
<short>Number of bytes actually read from the stream.</short>
</element>

<!-- argument Visibility: default -->
<element name="TInputPipeStream.Read.Buffer">
<short>Memory buffer where to write the data read from the stream.</short>
</element>

<!-- argument Visibility: default -->
<element name="TInputPipeStream.Read.Count">
<short>Number of bytes to read from the stream.</short>
</element>

<element name="TInputPipeStream.NumBytesAvailable">
<short>Number of bytes available for reading.</short>
<descr>
<p>
<var>NumBytesAvailable</var> is the number of bytes available for reading.
This is the number of bytes in the OS buffer for the pipe. It is not a
number of bytes in an internal buffer.
</p>
<p>
If this number is nonzero, then reading <var>NumBytesAvailable</var> bytes
from the stream will not block the process. Reading more than
<var>NumBytesAvailable</var> bytes will block the process, while it waits
for the requested number of bytes to become available.
</p>
</descr>
<seealso>
<link id="TInputPipeStream.Read"/>
</seealso>
</element>

<!-- object Visibility: default -->
<element name="TOutputPipeStream">
<short></short>
<short><var>TStream</var> descendent which wraps the write end of a pipe.</short>
<descr>
<var>TOutputPipeStream</var> is created by the <link id="CreatePipeStreams"/>
call to represent the writing end of a pipe. 
It is a <link id="#rtl.classes.TStream">TStream</link> descendent which does
not allow reading.
</descr>
<seealso>
<link id="#rtl.classes.TStream">TStream</link>
<link id="CreatePipeStreams"/>
<link id="TInputPipeStream"/>
</seealso>
</element>

<!-- function Visibility: public -->
<element name="TOutputPipeStream.Seek">
<short>Sets the position in the stream</short>
<descr>
<var>Seek</var> is overridden in <var>TOutputPipeStream</var>. Calling this
method will always raise an exception: an output pipe is not seekable.
</descr>
<errors>
An <link id="EPipeSeek"/> exception is raised if this method is called.
</errors>
<seealso>
</seealso>
</element>

<!-- function result Visibility: default -->
<element name="TOutputPipeStream.Seek.Result">
<short>New position of the stream.</short>
</element>

<!-- argument Visibility: default -->
<element name="TOutputPipeStream.Seek.Offset">
<short>Offset, in bytes, starting at <var>Origin</var></short>
</element>

<!-- argument Visibility: default -->
<element name="TOutputPipeStream.Seek.Origin">
<short>Where to start counting <var>Offset</var> bytes.</short>
</element>

<!-- function Visibility: public -->
<element name="TOutputPipeStream.Read">
<short>Read data from the stream.</short>
<descr>
<var>Read</var> overrides the parent <var>Read</var> implementation. It
always raises an exception, because a output pipe is write-only.
</descr>
<errors>
An <link id="#rtl.classes.EStreamError">EStreamError</link> exception is raised when this function is
called.
</errors>
<seealso>
<link id="TOutputPipeStream.Seek">Seek</link>
</seealso>
</element>

<!-- function result Visibility: default -->
<element name="TOutputPipeStream.Read.Result">
<short>Number of bytes actually read from the stream.</short>
</element>

<!-- argument Visibility: default -->
<element name="TOutputPipeStream.Read.Buffer">
<short>Memory buffer where to write the data read from the stream.</short>
</element>

<!-- argument Visibility: default -->
<element name="TOutputPipeStream.Read.Count">
<short>Number of bytes to read from the stream.</short>
</element>


<!-- function Visibility: default -->
<element name="CreatePipeHandles">
<short>Function to create a set of pipe handles</short>
<descr>
<var>CreatePipeHandles</var> provides an OS-independent way to 
create a set of pipe filehandles. These handles are inheritable 
to child processes. The reading end of the pipe is returned in 
<var>InHandle</var>, the writing end in <var>OutHandle</var>.
</descr>
<errors>
On error, <var>False</var> is returned.
</errors>
<seealso>
<link id="CreatePipeStreams"/>
</seealso>
</element>

<!-- function result Visibility: default -->
<element name="CreatePipeHandles.Result">
<short><var>True</var> if the call was succesul, <var>False</var> if not.</short>
</element>

<!-- argument Visibility: default -->
<element name="CreatePipeHandles.Inhandle">
<short>File handle for reading end of the pipe</short>
</element>

<!-- argument Visibility: default -->
<element name="CreatePipeHandles.OutHandle">
<short>File handle for writing end of the pipe</short>
</element>

<!-- procedure Visibility: default -->
<element name="CreatePipeStreams">
<short>Create a pair of pipe stream.</short>
<descr>
<p>
<var>CreatePipeStreams</var> creates a set of pipe file
descriptors with <link id="CreatePipeHandles"/>, and if
that call is succesfull, a pair of streams is created: 
<var>InPipe</var> and <var>OutPipe</var>.
</p>
<p>
On some systems (notably: windows) the size of the buffer to be used for
communication between 2 ends of the buffer can be specified in 
the <link id="APipeBufferSize"/> parameter. This parameter is ignored on
systems that do not support setting the buffer size.
</p>
</descr>
<errors>
If no pipe handles could be created, an <link id="EPipeCreation"/> exception
is raised.
</errors>
<seealso>
<link id="CreatePipeHandles"/>
<link id="TInputPipeStream"/>
<link id="TOutputPipeStream"/>
</seealso>
</element>

<!-- argument Visibility: default -->
<element name="CreatePipeStreams.InPipe">
<short>Contains the read end of the pipe on return</short>
</element>

<!-- argument Visibility: default -->
<element name="CreatePipeStreams.OutPipe">
<short>Contains the write end of the pipe on return.</short>
</element>

<!-- constant Visibility: default -->
<element name="EPipeMsg">
<short>Constant used in <link id="#fcl.pipes.EPipeCreation">EPipeCreation</link> exception.</short>
</element>

<!-- constant Visibility: default -->
<element name="ENoSeekMsg">
<short>Constant used in <link id="#fcl.pipes.EPipeSeek">EPipeSeek</link> exception.</short>
</element>

<!-- unresolved type reference Visibility: default -->
<element name="sysutils">
<short>Exception support</short>
</element>

<!-- unresolved type reference Visibility: default -->
<element name="Classes">
<short>Stream definitions</short>
</element>

<!-- destructor Visibility: public -->
<element name="TInputPipeStream.Destroy">
<short>Destroy this instance of the input pipe stream</short>
<descr>
<var>Destroy</var> overrides the destructor to close the pipe handle, prior
to calling the inherited destructor.
</descr>
<errors>
None
</errors>
<seealso>
<link id="TInputPipeStream.Create"/>
</seealso>
</element>

<!-- destructor Visibility: public -->
<element name="TOutputPipeStream.Destroy">
<short>Destroy this instance of the output pipe stream</short>
<descr>
<var>Destroy</var> overrides the destructor to close the pipe handle, prior
to calling the inherited destructor.
</descr>
<errors>
None
</errors>
<seealso>
<link id="TOutputPipeStream.Create"/>
</seealso>
</element>

<!-- argument Visibility: default -->
<element name="CreatePipeHandles.APipeBufferSize">
<short>Buffer size to be used for the pipe</short>
</element>

</module> <!-- Pipes -->
</package>
</fpdoc-descriptions>