Tcl_SetChannelError
NAMESYNOPSIS
ARGUMENTS
DESCRIPTION
SEE ALSO
KEYWORDS
___________________________
NAME
Tcl_SetChannelError, Tcl_SetChannelErrorInterp, Tcl_GetChannelError, Tcl_GetChannelErrorInterp − functions to create/intercept Tcl errors by channel drivers.
SYNOPSIS
#include <tcl.h>
void
Tcl_SetChannelError(chan, msg)
void
Tcl_SetChannelErrorInterp(interp, msg)
void
Tcl_GetChannelError(chan, msgPtr)
void
Tcl_GetChannelErrorInterp(interp, msgPtr)
ARGUMENTS
Tcl_Channel chan (in) |
Refers to the Tcl channel whose bypass area is accessed. | ||
Tcl_Interp* interp (in) |
Refers to the Tcl interpreter whose bypass area is accessed. | ||
Tcl_Obj* msg (in) |
Error message put into a bypass area. A list of return options and values, followed by a string message. Both message and the option/value information are optional. | ||
Tcl_Obj** msgPtr (out) |
Reference to a place where the message stored in the accessed bypass area can be stored in. |
______________
DESCRIPTION
The current definition of a Tcl channel driver does not permit the direct return of arbitrary error messages, except for the setting and retrieval of channel options. All other functions are restricted to POSIX error codes.
The functions described here overcome this limitation. Channel drivers are allowed to use Tcl_SetChannelError and Tcl_SetChannelErrorInterp to place arbitrary error messages in bypass areas defined for channels and interpreters. And the generic I/O layer uses Tcl_GetChannelError and Tcl_GetChannelErrorInterp to look for messages in the bypass areas and arrange for their return as errors. The posix error codes set by a driver are used now if and only if no messages are present.
Tcl_SetChannelError stores error information in the bypass area of the specified channel. The number of references to the msg object goes up by one. Previously stored information will be discarded, by releasing the reference held by the channel. The channel reference must not be NULL.
Tcl_SetChannelErrorInterp stores error information in the bypass area of the specified interpreter. The number of references to the msg object goes up by one. Previously stored information will be discarded, by releasing the reference held by the interpreter. The interpreter reference must not be NULL.
Tcl_GetChannelError places either the error message held in the bypass area of the specified channel into msgPtr, or NULL; and resets the bypass. I.e. after an invocation all following invocations will return NULL, until an intervening invocation of Tcl_SetChannelError with a non-NULL message. The msgPtr must not be NULL. The reference count of the message is not touched. The reference previously held by the channel is now held by the caller of the function and it is its responsibility to release that reference when it is done with the object.
Tcl_GetChannelErrorInterp places either the error message held in the bypass area of the specified interpreter into msgPtr, or NULL; and resets the bypass. I.e. after an invocation all following invocations will return NULL, until an intervening invocation of Tcl_SetChannelErrorInterp with a non-NULL message. The msgPtr must not be NULL. The reference count of the message is not touched. The reference previously held by the interpreter is now held by the caller of the function and it is its responsibility to release that reference when it is done with the object.
Which functions
of a channel driver are allowed to use which bypass function
is listed below, as is which functions of the public channel
API may leave a messages in the bypass areas.
Tcl_DriverCloseProc
May use Tcl_SetChannelErrorInterp, and only this function.
Tcl_DriverInputProc
May use Tcl_SetChannelError, and only this function.
Tcl_DriverOutputProc
May use Tcl_SetChannelError, and only this function.
Tcl_DriverSeekProc
May use Tcl_SetChannelError, and only this function.
Tcl_DriverWideSeekProc
May use Tcl_SetChannelError, and only this function.
Tcl_DriverSetOptionProc
Has already the ability to pass arbitrary error messages. Must not use any of the new functions.
Tcl_DriverGetOptionProc
Has already the ability to pass arbitrary error messages. Must not use any of the new functions.
Tcl_DriverWatchProc
Must not use any of the new functions. Is internally called and has no ability to return any type of error whatsoever.
Tcl_DriverBlockModeProc
May use Tcl_SetChannelError, and only this function.
Tcl_DriverGetHandleProc
Must not use any of the new functions. It is only a low-level function, and not used by Tcl commands.
Tcl_DriverHandlerProc
Must not use any of the new functions. Is internally called and has no ability to return any type of error whatsoever.
Given the
information above the following public functions of the Tcl
C API are affected by these changes. I.e. when these
functions are called the channel may now contain a stored
arbitrary error message requiring processing by the caller.
Tcl_StackChannel
Tcl_Seek
Tcl_Tell
Tcl_ReadRaw
Tcl_Read
Tcl_ReadChars
Tcl_Gets
Tcl_GetsObj
Tcl_Flush
Tcl_WriteRaw
Tcl_WriteObj
Tcl_Write
Tcl_WriteChars
All other API
functions are unchanged. Especially the functions below
leave all their error information in the interpreter result.
Tcl_Close
Tcl_UnregisterChannel
Tcl_UnstackChannel
SEE ALSO
Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3)
KEYWORDS
channel driver, error messages, channel type
More Linux Commands
manpages/set_mempolicy.2.html
set_mempolicy(2) - set default NUMA memory policy for a proc
set_mempolicy() sets the NUMA memory policy of the calling process, which consists of a policy mode and zero or more nodes, to the values specified by the mode,
manpages/acl_get_qualifier.3.html
acl_get_qualifier(3) - retrieve the qualifier from an ACL en
The acl_get_qualifier() function retrieves the qualifier from the ACL entry indicated by the argument entry_d into working storage and returns a pointer to that
manpages/nmcli.1.html
nmcli(1) - command-line tool for controlling NetworkManager
nmcli is a command-line tool for controlling NetworkManager and reporting network status. It can be utilized as a replacement for nm-applet or other graphical c
manpages/mvwaddnstr.3ncurses.html
mvwaddstr(3ncurses) - add a string of characters to a curses
These functions write the (null-terminated) character string str on the given window. It is similar to calling waddch once for each character in the string. The
manpages/Tcl_Gets.3.html
Tcl_Gets(3) - buffered I/O facilities using channels........
The Tcl channel mechanism provides a device-independent and platform-independent mechanism for performing buffered input and output operations on a variety of f
manpages/pam_acct_mgmt.3.html
pam_acct_mgmt(3) - PAM account validation management........
The pam_acct_mgmt function is used to determine if the users account is valid. It checks for authentication token and account expiration and verifies access res
manpages/autoconf.1.html
autoconf(1) - Generate configuration scripts (Man Page).....
Generate a configuration script from a TEMPLATE-FILE if given, or configure.ac if present, or else configure.in. Output is sent to the standard output if TEMPLA
manpages/systemd-localed.service.8.html
systemd-localed.service(8) Locale bus mechanism (Man Page)
systemd-localed is a system service that may be used as mechanism to change the system locale settings, as well as the console key mapping and default X11 key m
manpages/pthread_attr_init.3.html
pthread_attr_init(3) - initialize and destroy thread attribu
The pthread_attr_init() function initializes the thread attributes object pointed to by attr with default attribute values. After this call, individual attribut
manpages/clnt_call.3.html
clnt_call(3) - library routines for remote procedure calls
These routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a data packet to the s
manpages/setup.2.html
setup(2) - setup devices and file systems, mount root file s
setup() is called once from within linux/init/main.c. It calls initialization functions for devices and filesystems configured into the kernel and then mounts t
manpages/Tcl_UniCharToLower.3.html
Tcl_UniCharToLower(3) - routines for manipulating the case o
The first three routines convert the case of individual Unicode characters: If ch represents a lower-case character, Tcl_UniCharToUpper returns the correspondin
