summaryrefslogtreecommitdiffstats
path: root/mac
diff options
context:
space:
mode:
authorjingham <jingham>1999-08-10 04:21:35 (GMT)
committerjingham <jingham>1999-08-10 04:21:35 (GMT)
commit590454e7d5345613da4ee3318ed74001de85ba9b (patch)
tree0533635658f34f388349fc560bb1d0565a12ed25 /mac
parent24e9f11aa2c7e32ed6e8a0e6a2c7ae4f0ff12bac (diff)
downloadtcl-590454e7d5345613da4ee3318ed74001de85ba9b.zip
tcl-590454e7d5345613da4ee3318ed74001de85ba9b.tar.gz
tcl-590454e7d5345613da4ee3318ed74001de85ba9b.tar.bz2
Convert the directory name from Utf to External before passing it to the Toolbox.
Diffstat (limited to 'mac')
-rw-r--r--mac/tclMacFile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/mac/tclMacFile.c b/mac/tclMacFile.c
index 45e0181..b3175d9 100644
--- a/mac/tclMacFile.c
+++ b/mac/tclMacFile.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMacFile.c,v 1.7 1999/05/11 07:12:09 jingham Exp $
+ * RCS: @(#) $Id: tclMacFile.c,v 1.8 1999/08/10 04:21:35 jingham Exp $
*/
/*
@@ -129,7 +129,7 @@ TclpMatchFiles(
* point to a location in pattern and must
* not be static.*/
{
- char *dirName, *patternEnd = tail;
+ char *patternEnd = tail;
char savedChar;
int result = TCL_OK;
int baseLength = Tcl_DStringLength(dirPtr);
@@ -147,8 +147,11 @@ TclpMatchFiles(
* directory.
*/
- dirName = dirPtr->string;
- FSpLocationFromPath(strlen(dirName), dirName, &dirSpec);
+ Tcl_UtfToExternalDString(NULL, dirPtr->string, dirPtr->length, &fileString);
+
+ FSpLocationFromPath(fileString.length, fileString.string, &dirSpec);
+ Tcl_DStringFree(&fileString);
+
err = FSpGetDirectoryID(&dirSpec, &dirID, &isDirectory);
if ((err != noErr) || !isDirectory) {
return TCL_OK;
mit 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. .PP The functions described here overcome this limitation. Channel drivers are allowed to use \fBTcl_SetChannelError\fR and \fBTcl_SetChannelErrorInterp\fR to place arbitrary error messages in \fBbypass areas\fR defined for channels and interpreters. And the generic I/O layer uses \fBTcl_GetChannelError\fR and \fBTcl_GetChannelErrorInterp\fR 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. .PP \fBTcl_SetChannelError\fR stores error information in the bypass area of the specified channel. The number of references to the \fBmsg\fR value 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. .PP \fBTcl_SetChannelErrorInterp\fR stores error information in the bypass area of the specified interpreter. The number of references to the \fBmsg\fR value 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. .PP \fBTcl_GetChannelError\fR places either the error message held in the bypass area of the specified channel into \fImsgPtr\fR, or NULL; and resets the bypass, that is, after an invocation all following invocations will return NULL, until an intervening invocation of \fBTcl_SetChannelError\fR with a non-NULL message. The \fImsgPtr\fR 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 value. .PP \fBTcl_GetChannelErrorInterp\fR places either the error message held in the bypass area of the specified interpreter into \fImsgPtr\fR, or NULL; and resets the bypass, that is, after an invocation all following invocations will return NULL, until an intervening invocation of \fBTcl_SetChannelErrorInterp\fR with a non-NULL message. The \fImsgPtr\fR 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 value. .PP 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. .IP \fBTcl_DriverCloseProc\fR May use \fBTcl_SetChannelErrorInterp\fR, and only this function. .IP \fBTcl_DriverInputProc\fR May use \fBTcl_SetChannelError\fR, and only this function. .IP \fBTcl_DriverOutputProc\fR May use \fBTcl_SetChannelError\fR, and only this function. .IP \fBTcl_DriverSeekProc\fR May use \fBTcl_SetChannelError\fR, and only this function. .IP \fBTcl_DriverWideSeekProc\fR May use \fBTcl_SetChannelError\fR, and only this function. .IP \fBTcl_DriverSetOptionProc\fR Has already the ability to pass arbitrary error messages. Must \fInot\fR use any of the new functions. .IP \fBTcl_DriverGetOptionProc\fR Has already the ability to pass arbitrary error messages. Must \fInot\fR use any of the new functions. .IP \fBTcl_DriverWatchProc\fR Must \fInot\fR use any of the new functions. Is internally called and has no ability to return any type of error whatsoever. .IP \fBTcl_DriverBlockModeProc\fR May use \fBTcl_SetChannelError\fR, and only this function. .IP \fBTcl_DriverGetHandleProc\fR Must \fInot\fR use any of the new functions. It is only a low-level function, and not used by Tcl commands. .IP \fBTcl_DriverHandlerProc\fR Must \fInot\fR use any of the new functions. Is internally called and has no ability to return any type of error whatsoever. .PP Given the information above the following public functions of the Tcl C API are affected by these changes; when these functions are called, the channel may now contain a stored arbitrary error message requiring processing by the caller. .DS .ta 1.9i 4i \fBTcl_Flush\fR \fBTcl_GetsObj\fR \fBTcl_Gets\fR \fBTcl_ReadChars\fR \fBTcl_ReadRaw\fR \fBTcl_Read\fR \fBTcl_Seek\fR \fBTcl_StackChannel\fR \fBTcl_Tell\fR \fBTcl_WriteChars\fR \fBTcl_WriteObj\fR \fBTcl_WriteRaw\fR \fBTcl_Write\fR .DE .PP All other API functions are unchanged. In particular, the functions below leave all their error information in the interpreter result. .DS .ta 1.9i 4i \fBTcl_Close\fR \fBTcl_UnstackChannel\fR \fBTcl_UnregisterChannel\fR .DE .SH "SEE ALSO" Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3) .SH KEYWORDS channel driver, error messages, channel type