OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [doc/] [CrtChannel.3] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" RCS: @(#) $Id: CrtChannel.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
8
.so man.macros
9
.TH Tcl_CreateChannel 3 8.0 Tcl "Tcl Library Procedures"
10
.BS
11
'\" Note:  do not modify the .SH NAME line immediately below!
12
.SH NAME
13
Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChannelName, Tcl_GetChannelHandle, Tcl_GetChannelMode, Tcl_GetChannelBufferSize, Tcl_SetDefaultTranslation, Tcl_SetChannelBufferSize, Tcl_NotifyChannel, Tcl_BadChannelOption \- procedures for creating and manipulating channels
14
.SH SYNOPSIS
15
.nf
16
\fB#include \fR
17
.sp
18
Tcl_Channel
19
\fBTcl_CreateChannel\fR(\fItypePtr, channelName, instanceData, mask\fR)
20
.sp
21
ClientData
22
\fBTcl_GetChannelInstanceData\fR(\fIchannel\fR)
23
.sp
24
Tcl_ChannelType *
25
\fBTcl_GetChannelType\fR(\fIchannel\fR)
26
.sp
27
char *
28
\fBTcl_GetChannelName\fR(\fIchannel\fR)
29
.VS
30
.sp
31
int
32
\fBTcl_GetChannelHandle\fR(\fIchannel, direction, handlePtr\fR)
33
.VE
34
.sp
35
int
36
\fBTcl_GetChannelFlags\fR(\fIchannel\fR)
37
.sp
38
\fBTcl_SetDefaultTranslation\fR(\fIchannel, transMode\fR)
39
.sp
40
int
41
\fBTcl_GetChannelBufferSize\fR(\fIchannel\fR)
42
.sp
43
\fBTcl_SetChannelBufferSize\fR(\fIchannel, size\fR)
44
.sp
45
.VS
46
\fBTcl_NotifyChannel\fR(\fIchannel, mask\fR)
47
.sp
48
int
49
\fBTcl_BadChannelOption\fR(\fIinterp, optionName, optionList\fR)
50
.VE
51
.sp
52
.SH ARGUMENTS
53
.AS Tcl_EolTranslation *channelName in
54
.AP Tcl_ChannelType *typePtr in
55
Points to a structure containing the addresses of procedures that
56
can be called to perform I/O and other functions on the channel.
57
.AP char *channelName in
58
The name of this channel, such as \fBfile3\fR; must not be in use
59
by any other channel. Can be NULL, in which case the channel is
60
created without a name.
61
.AP ClientData instanceData in
62
Arbitrary one-word value to be associated with this channel.  This
63
value is passed to procedures in \fItypePtr\fR when they are invoked.
64
.AP int mask in
65
OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate
66
whether a channel is readable and writable.
67
.AP Tcl_Channel channel in
68
The channel to operate on.
69
.VS
70
.AP int direction in
71
\fBTCL_READABLE\fR means the input handle is wanted; \fBTCL_WRITABLE\fR
72
means the output handle is wanted.
73
.AP ClientData *handlePtr out
74
Points to the location where the desired OS-specific handle should be
75
stored.
76
.VE
77
.AP Tcl_EolTranslation transMode in
78
The translation mode; one of the constants \fBTCL_TRANSLATE_AUTO\fR,
79
\fBTCL_TRANSLATE_CR\fR, \fBTCL_TRANSLATE_LF\fR and \fBTCL_TRANSLATE_CRLF\fR.
80
.AP int size in
81
The size, in bytes, of buffers to allocate in this channel.
82
.VS
83
.AP int mask in
84
An OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR
85
and \fBTCL_EXCEPTION\fR that indicates events that have occurred on
86
this channel.
87
.AP Tcl_Interp *interp in
88
Current interpreter. (can be NULL)
89
.AP char *optionName in
90
Name of the invalid option.
91
.AP char *optionList in
92
Specific options list (space separated words, without "-")
93
to append to the standard generic options list.
94
Can be NULL for generic options error message only.
95
.VE
96
 
97
.BE
98
 
99
.SH DESCRIPTION
100
.PP
101
Tcl uses a two-layered channel architecture. It provides a generic upper
102
layer to enable C and Tcl programs to perform input and output using the
103
same APIs for a variety of files, devices, sockets etc. The generic C APIs
104
are described in the manual entry for \fBTcl_OpenFileChannel\fR.
105
.PP
106
The lower layer provides type-specific channel drivers for each type
107
of device supported on each platform.  This manual entry describes the
108
C APIs used to communicate between the generic layer and the
109
type-specific channel drivers.  It also explains how new types of
110
channels can be added by providing new channel drivers.
111
.PP
112
Channel drivers consist of a number of components: First, each channel
113
driver provides a \fBTcl_ChannelType\fR structure containing pointers to
114
functions implementing the various operations used by the generic layer to
115
communicate with the channel driver. The \fBTcl_ChannelType\fR structure
116
and the functions referenced by it are described in the section
117
TCL_CHANNELTYPE, below.
118
.PP
119
Second, channel drivers usually provide a Tcl command to create
120
instances of that type of channel. For example, the Tcl \fBopen\fR
121
command creates channels that use the file and command channel
122
drivers, and the Tcl \fBsocket\fR command creates channels that use
123
TCP sockets for network communication.
124
.PP
125
Third, a channel driver optionally provides a C function to open
126
channel instances of that type. For example, \fBTcl_OpenFileChannel\fR
127
opens a channel that uses the file channel driver, and
128
\fBTcl_OpenTcpClient\fR opens a channel that uses the TCP network
129
protocol.  These creation functions typically use
130
\fBTcl_CreateChannel\fR internally to open the channel.
131
.PP
132
To add a new type of channel you must implement a C API or a Tcl command
133
that opens a channel by invoking \fBTcl_CreateChannel\fR.
134
When your driver calls \fBTcl_CreateChannel\fR it passes in
135
a \fBTcl_ChannelType\fR structure describing the driver's I/O
136
procedures.
137
The generic layer will then invoke the functions referenced in that
138
structure to perform operations on the channel.
139
.PP
140
\fBTcl_CreateChannel\fR opens a new channel and associates the supplied
141
\fItypePtr\fR and \fIinstanceData\fR with it. The channel is opened in the
142
mode indicated by \fImask\fR.
143
For a discussion of channel drivers, their operations and the
144
\fBTcl_ChannelType\fR structure, see the section TCL_CHANNELTYPE, below.
145
.PP
146
\fBTcl_GetChannelInstanceData\fR returns the instance data associated with
147
the channel in \fIchannel\fR. This is the same as the \fIinstanceData\fR
148
argument in the call to \fBTcl_CreateChannel\fR that created this channel.
149
.PP
150
\fBTcl_GetChannelType\fR returns a pointer to the \fBTcl_ChannelType\fR
151
structure used by the channel in the \fIchannel\fR argument. This is
152
the same as the \fItypePtr\fR argument in the call to
153
\fBTcl_CreateChannel\fR that created this channel.
154
.PP
155
\fBTcl_GetChannelName\fR returns a string containing the name associated
156
with the channel, or NULL if the \fIchannelName\fR argument to
157
\fBTcl_CreateChannel\fR was NULL.
158
.PP
159
.VS
160
\fBTcl_GetChannelHandle\fR places the OS-specific device handle
161
associated with \fIchannel\fR for the given \fIdirection\fR in the
162
location specified by \fIhandlePtr\fR and returns \fBTCL_OK\fR.  If
163
the channel does not have a device handle for the specified direction,
164
then \fBTCL_ERROR\fR is returned instead.  Different channel drivers
165
will return different types of handle.  Refer to the manual entries
166
for each driver to determine what type of handle is returned.
167
.VE
168
.PP
169
\fBTcl_GetChannelMode\fR returns an OR-ed combination of \fBTCL_READABLE\fR
170
and \fBTCL_WRITABLE\fR, indicating whether the channel is open for input
171
and output.
172
.PP
173
\fBTcl_SetDefaultTranslation\fR sets the default end of line translation
174
mode. This mode will be installed as the translation mode for the channel
175
if an attempt is made to output on the channel while it is still in
176
\fBTCL_TRANSLATE_AUTO\fR mode. For a description of end of line translation
177
modes, see the manual entry for \fBfconfigure\fR.
178
.PP
179
\fBTcl_GetChannelBufferSize\fR returns the size, in bytes, of buffers
180
allocated to store input or output in \fIchan\fR. If the value was not set
181
by a previous call to \fBTcl_SetChannelBufferSize\fR, described below, then
182
the default value of 4096 is returned.
183
.PP
184
\fBTcl_SetChannelBufferSize\fR sets the size, in bytes, of buffers that
185
will be allocated in subsequent operations on the channel to store input or
186
output. The \fIsize\fR argument should be between ten and one million,
187
allowing buffers of ten bytes to one million bytes. If \fIsize\fR is
188
outside this range, \fBTcl_SetChannelBufferSize\fR sets the buffer size to
189
4096.
190
.PP
191
.VS
192
\fBTcl_NotifyChannel\fR is called by a channel driver to indicate to
193
the generic layer that the events specified by \fImask\fR have
194
occurred on the channel.  Channel drivers are responsible for invoking
195
this function whenever the channel handlers need to be called for the
196
channel.  See \fBWATCHPROC\fR below for more details.
197
.VE
198
.PP
199
.VS
200
\fBTcl_BadChannelOption\fR is called from driver specific set or get option
201
procs to generate a complete error message.
202
.VE
203
 
204
.SH TCL_CHANNELTYPE
205
.PP
206
A channel driver provides a \fBTcl_ChannelType\fR structure that contains
207
pointers to functions that implement the various operations on a channel;
208
these operations are invoked as needed by the generic layer. The
209
\fBTcl_ChannelType\fR structure contains the following fields:
210
.PP
211
.VS
212
.CS
213
typedef struct Tcl_ChannelType {
214
        char *\fItypeName\fR;
215
        Tcl_DriverBlockModeProc *\fIblockModeProc\fR;
216
        Tcl_DriverCloseProc *\fIcloseProc\fR;
217
        Tcl_DriverInputProc *\fIinputProc\fR;
218
        Tcl_DriverOutputProc *\fIoutputProc\fR;
219
        Tcl_DriverSeekProc *\fIseekProc\fR;
220
        Tcl_DriverSetOptionProc *\fIsetOptionProc\fR;
221
        Tcl_DriverGetOptionProc *\fIgetOptionProc\fR;
222
        Tcl_DriverWatchProc *\fIwatchProc\fR;
223
        Tcl_DriverGetHandleProc *\fIgetHandleProc\fR;
224
} Tcl_ChannelType;
225
.CE
226
.VE
227
.PP
228
The driver must provide implementations for all functions except
229
\fIblockModeProc\fR, \fIseekProc\fR, \fIsetOptionProc\fR, and
230
\fIgetOptionProc\fR, which may be specified as NULL to indicate that the
231
channel does not support seeking.  Other functions that can not be
232
implemented for this type of device should return \fBEINVAL\fR when invoked
233
to indicate that they are not implemented.
234
 
235
.SH TYPENAME
236
.PP
237
The \fItypeName\fR field contains a null-terminated string that
238
identifies the type of the device implemented by this driver, e.g.
239
\fBfile\fR or \fBsocket\fR.
240
 
241
.SH BLOCKMODEPROC
242
.PP
243
The \fIblockModeProc\fR field contains the address of a function called by
244
the generic layer to set blocking and nonblocking mode on the device.
245
\fIBlockModeProc\fR should match the following prototype:
246
.PP
247
.CS
248
typedef int Tcl_DriverBlockModeProc(
249
        ClientData \fIinstanceData\fR,
250
        int \fImode\fR);
251
.CE
252
.PP
253
The \fIinstanceData\fR is the same as the value passed to
254
\fBTcl_CreateChannel\fR when this channel was created.  The \fImode\fR
255
argument is either \fBTCL_MODE_BLOCKING\fR or \fBTCL_MODE_NONBLOCKING\fR to
256
set the device into blocking or nonblocking mode. The function should
257
return zero if the operation was successful, or a nonzero POSIX error code
258
if the operation failed.
259
.PP
260
If the operation is successful, the function can modify the supplied
261
\fIinstanceData\fR to record that the channel entered blocking or
262
nonblocking mode and to implement the blocking or nonblocking behavior.
263
For some device types, the blocking and nonblocking behavior can be
264
implemented by the underlying operating system; for other device types, the
265
behavior must be emulated in the channel driver.
266
 
267
.SH CLOSEPROC
268
.PP
269
The \fIcloseProc\fR field contains the address of a function called by the
270
generic layer to clean up driver-related information when the channel is
271
closed. \fICloseProc\fR must match the following prototype:
272
.PP
273
.CS
274
typedef int Tcl_DriverCloseProc(
275
        ClientData \fIinstanceData\fR,
276
        Tcl_Interp *\fIinterp\fR);
277
.CE
278
.PP
279
The \fIinstanceData\fR argument is the same as the value provided to
280
\fBTcl_CreateChannel\fR when the channel was created. The function should
281
release any storage maintained by the channel driver for this channel, and
282
close the input and output devices encapsulated by this channel. All queued
283
output will have been flushed to the device before this function is called,
284
and no further driver operations will be invoked on this instance after
285
calling the \fIcloseProc\fR. If the close operation is successful, the
286
procedure should return zero; otherwise it should return a nonzero POSIX
287
error code. In addition, if an error occurs and \fIinterp\fR is not NULL,
288
the procedure should store an error message in \fIinterp->result\fR.
289
 
290
.SH INPUTPROC
291
.PP
292
The \fIinputProc\fR field contains the address of a function called by the
293
generic layer to read data from the file or device and store it in an
294
internal buffer. \fIInputProc\fR must match the following prototype:
295
.PP
296
.CS
297
typedef int Tcl_DriverInputProc(
298
        ClientData \fIinstanceData\fR,
299
        char *\fIbuf\fR,
300
        int \fIbufSize\fR,
301
        int *\fIerrorCodePtr\fR);
302
.CE
303
.PP
304
\fIInstanceData\fR is the same as the value passed to
305
\fBTcl_CreateChannel\fR when the channel was created.  The \fIbuf\fR
306
argument points to an array of bytes in which to store input from the
307
device, and the \fIbufSize\fR argument indicates how many bytes are
308
available at \fIbuf\fR.
309
.PP
310
The \fIerrorCodePtr\fR argument points to an integer variable provided by
311
the generic layer. If an error occurs, the function should set the variable
312
to a POSIX error code that identifies the error that occurred.
313
.PP
314
The function should read data from the input device encapsulated by the
315
channel and store it at \fIbuf\fR.  On success, the function should return
316
a nonnegative integer indicating how many bytes were read from the input
317
device and stored at \fIbuf\fR. On error, the function should return -1. If
318
an error occurs after some data has been read from the device, that data is
319
lost.
320
.PP
321
If \fIinputProc\fR can determine that the input device has some data
322
available but less than requested by the \fIbufSize\fR argument, the
323
function should only attempt to read as much data as is available and
324
return without blocking. If the input device has no data available
325
whatsoever and the channel is in nonblocking mode, the function should
326
return an \fBEAGAIN\fR error. If the input device has no data available
327
whatsoever and the channel is in blocking mode, the function should block
328
for the shortest possible time until at least one byte of data can be read
329
from the device; then, it should return as much data as it can read without
330
blocking.
331
 
332
.SH OUTPUTPROC
333
.PP
334
The \fIoutputProc\fR field contains the address of a function called by the
335
generic layer to transfer data from an internal buffer to the output device.
336
\fIOutputProc\fR must match the following prototype:
337
.PP
338
.CS
339
typedef int Tcl_DriverOutputProc(
340
        ClientData \fIinstanceData\fR,
341
        char *\fIbuf\fR,
342
        int \fItoWrite\fR,
343
        int *\fIerrorCodePtr\fR);
344
.CE
345
.PP
346
\fIInstanceData\fR is the same as the value passed to
347
\fBTcl_CreateChannel\fR when the channel was created. The \fIbuf\fR
348
argument contains an array of bytes to be written to the device, and the
349
\fItoWrite\fR argument indicates how many bytes are to be written from the
350
\fIbuf\fR argument.
351
.PP
352
The \fIerrorCodePtr\fR argument points to an integer variable provided by
353
the generic layer. If an error occurs, the function should set this
354
variable to a POSIX error code that identifies the error.
355
.PP
356
The function should write the data at \fIbuf\fR to the output device
357
encapsulated by the channel. On success, the function should return a
358
nonnegative integer indicating how many bytes were written to the output
359
device.  The return value is normally the same as \fItoWrite\fR, but may be
360
less in some cases such as if the output operation is interrupted by a
361
signal. If an error occurs the function should return -1.  In case of
362
error, some data may have been written to the device.
363
.PP
364
If the channel is nonblocking and the output device is unable to absorb any
365
data whatsoever, the function should return -1 with an \fBEAGAIN\fR error
366
without writing any data.
367
 
368
.SH SEEKPROC
369
.PP
370
The \fIseekProc\fR field contains the address of a function called by the
371
generic layer to move the access point at which subsequent input or output
372
operations will be applied. \fISeekProc\fR must match the following
373
prototype:
374
.PP
375
.CS
376
typedef int Tcl_DriverSeekProc(
377
        ClientData \fIinstanceData\fR,
378
        long \fIoffset\fR,
379
        int \fIseekMode\fR,
380
        int *\fIerrorCodePtr\fR);
381
.CE
382
.PP
383
The \fIinstanceData\fR argument is the same as the value given to
384
\fBTcl_CreateChannel\fR when this channel was created.  \fIOffset\fR and
385
\fIseekMode\fR have the same meaning as for the \fBTcl_SeekChannel\fR
386
procedure (described in the manual entry for \fBTcl_OpenFileChannel\fR).
387
.PP
388
The \fIerrorCodePtr\fR argument points to an integer variable provided by
389
the generic layer for returning \fBerrno\fR values from the function.  The
390
function should set this variable to a POSIX error code if an error occurs.
391
The function should store an \fBEINVAL\fR error code if the channel type
392
does not implement seeking.
393
.PP
394
The return value is the new access point or -1 in case of error. If an
395
error occurred, the function should not move the access point.
396
 
397
.SH SETOPTIONPROC
398
.PP
399
The \fIsetOptionProc\fR field contains the address of a function called by
400
the generic layer to set a channel type specific option on a channel.
401
\fIsetOptionProc\fR must match the following prototype:
402
.PP
403
.CS
404
typedef int Tcl_DriverSetOptionProc(
405
        ClientData \fIinstanceData\fR,
406
        Tcl_Interp *\fIinterp\fR,
407
        char *\fIoptionName\fR,
408
        char *\fIoptionValue\fR);
409
.CE
410
.PP
411
\fIoptionName\fR is the name of an option to set, and \fIoptionValue\fR is
412
the new value for that option, as a string. The \fIinstanceData\fR is the
413
same as the value given to \fBTcl_CreateChannel\fR when this channel was
414
created. The function should do whatever channel type specific action is
415
required to implement the new value of the option.
416
.PP
417
Some options are handled by the generic code and this function is never
418
called to set them, e.g. \fB-blockmode\fR. Other options are specific to
419
each channel type and the \fIsetOptionProc\fR procedure of the channel
420
driver will get called to implement them. The \fIsetOptionProc\fR field can
421
be NULL, which indicates that this channel type supports no type specific
422
options.
423
.PP
424
If the option value is successfully modified to the new value, the function
425
returns \fBTCL_OK\fR.
426
.VS
427
It should call \fBTcl_BadChannelOption\fR which itself returns
428
\fBTCL_ERROR\fR if the \fIoptionName\fR is
429
unrecognized.
430
.VE
431
If \fIoptionValue\fR specifies a value for the option that
432
is not supported or if a system call error occurs,
433
the function should leave an error message in the
434
\fIresult\fR field of \fIinterp\fR if \fIinterp\fR is not NULL. The
435
function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX
436
error code.
437
 
438
.SH GETOPTIONPROC
439
.PP
440
The \fIgetOptionProc\fR field contains the address of a function called by
441
the generic layer to get the value of a channel type specific option on a
442
channel. \fIgetOptionProc\fR must match the following prototype:
443
.PP
444
.CS
445
typedef int Tcl_DriverGetOptionProc(
446
        ClientData \fIinstanceData\fR,
447
.VS
448
        Tcl_Interp *\fIinterp\fR,
449
.VE
450
        char *\fIoptionName\fR,
451
        Tcl_DString *\fIdsPtr\fR);
452
.CE
453
.PP
454
\fIOptionName\fR is the name of an option supported by this type of
455
channel. If the option name is not NULL, the function stores its current
456
value, as a string, in the Tcl dynamic string \fIdsPtr\fR.
457
If \fIoptionName\fR is NULL, the function stores in \fIdsPtr\fR an
458
alternating list of all supported options and their current values.
459
On success, the function returns \fBTCL_OK\fR.
460
.VS
461
It should call \fBTcl_BadChannelOption\fR which itself returns
462
\fBTCL_ERROR\fR if the \fIoptionName\fR is
463
unrecognized. If a system call error occurs,
464
the function should leave an error message in the
465
\fIresult\fR field of \fIinterp\fR if \fIinterp\fR is not NULL. The
466
function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX
467
error code.
468
.VE
469
.PP
470
Some options are handled by the generic code and this function is never
471
called to retrieve their value, e.g. \fB-blockmode\fR. Other options are
472
specific to each channel type and the \fIgetOptionProc\fR procedure of the
473
channel driver will get called to implement them. The \fIgetOptionProc\fR
474
field can be NULL, which indicates that this channel type supports no type
475
specific options.
476
 
477
.SH WATCHPROC
478
.VS
479
.PP
480
The \fIwatchProc\fR field contains the address of a function called
481
by the generic layer to initialize the event notification mechanism to
482
notice events of interest on this channel.
483
\fIWatchProc\fR should match the following prototype:
484
.PP
485
.CS
486
typedef void Tcl_DriverWatchProc(
487
        ClientData \fIinstanceData\fR,
488
        int \fImask\fR);
489
.CE
490
.VE
491
.PP
492
The \fIinstanceData\fR is the same as the value passed to
493
\fBTcl_CreateChannel\fR when this channel was created. The \fImask\fR
494
argument is an OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR
495
and \fBTCL_EXCEPTION\fR; it indicates events the caller is interested in
496
noticing on this channel.
497
.PP
498
.VS
499
The function should initialize device type specific mechanisms to
500
notice when an event of interest is present on the channel.  When one
501
or more of the designated events occurs on the channel, the channel
502
driver is responsible for calling \fBTcl_NotifyChannel\fR to inform
503
the generic channel module.  The driver should take care not to starve
504
other channel drivers or sources of callbacks by invoking
505
Tcl_NotifyChannel too frequently.  Fairness can be insured by using
506
the Tcl event queue to allow the channel event to be scheduled in sequence
507
with other events.  See the description of \fBTcl_QueueEvent\fR for
508
details on how to queue an event.
509
 
510
.SH GETHANDLEPROC
511
.PP
512
The \fIgetHandleProc\fR field contains the address of a function called by
513
the generic layer to retrieve a device-specific handle from the channel.
514
\fIGetHandleProc\fR should match the following prototype:
515
.PP
516
.CS
517
typedef int Tcl_DriverGetHandleProc(
518
        ClientData \fIinstanceData\fR,
519
        int \fIdirection\fR,
520
        ClientData *\fIhandlePtr\fR);
521
.CE
522
.PP
523
\fIInstanceData is the same as the value passed to
524
\fBTcl_CreateChannel\fR when this channel was created. The \fIdirection\fR
525
argument is either \fBTCL_READABLE\fR to retrieve the handle used
526
for input, or \fBTCL_WRITABLE\fR to retrieve the handle used for
527
output.
528
.PP
529
If the channel implementation has device-specific handles, the
530
function should retrieve the appropriate handle associated with the
531
channel, according the \fIdirection\fR argument.  The handle should be
532
stored in the location referred to by \fIhandlePtr\fR, and
533
\fBTCL_OK\fR should be returned.  If the channel is not open for the
534
specified direction, or if the channel implementation does not use
535
device handles, the function should return \fBTCL_ERROR\fR.
536
.VE
537
 
538
.VS
539
.SH TCL_BADCHANNELOPTION
540
.PP
541
This procedure generates a "bad option" error message in an
542
(optional) interpreter.  It is used by channel drivers when
543
a invalid Set/Get option is requested. Its purpose is to concatenate
544
the generic options list to the specific ones and factorize
545
the generic options error message string.
546
.PP
547
It always return \fBTCL_ERROR\fR
548
.PP
549
An error message is generated in interp's result object to
550
indicate that a command was invoked with the a bad option
551
The message has the form
552
.CS
553
    bad option "blah": should be one of
554
    <...generic options...>+<...specific options...>
555
so you get for instance:
556
    bad option "-blah": should be one of -blocking,
557
    -buffering, -buffersize, -eofchar, -translation,
558
    -peername, or -sockname
559
when called with optionList="peername sockname"
560
.CE
561
"blah" is the optionName argument and ""
562
is a space separated list of specific option words.
563
The function takes good care of inserting minus signs before
564
each option, commas after, and an "or" before the last option.
565
.VE
566
 
567
.SH "SEE ALSO"
568
Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3), Tcl_QueueEvent(3)
569
 
570
.SH KEYWORDS
571
blocking, channel driver, channel registration, channel type, nonblocking

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.