diff options
author | dgp <dgp@users.sourceforge.net> | 2007-11-28 20:30:14 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-11-28 20:30:14 (GMT) |
commit | fdac2b39fea8099117e984579453fdf0d129ae07 (patch) | |
tree | 145610b3ffd3fd9129e9514c6af102ecbab55499 /generic | |
parent | 325853d22a554d03e6347953724621db7e41e891 (diff) | |
download | tcl-fdac2b39fea8099117e984579453fdf0d129ae07.zip tcl-fdac2b39fea8099117e984579453fdf0d129ae07.tar.gz tcl-fdac2b39fea8099117e984579453fdf0d129ae07.tar.bz2 |
merge updates from HEAD
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 14 | ||||
-rw-r--r-- | generic/tclConfig.c | 37 | ||||
-rw-r--r-- | generic/tclIO.c | 30 | ||||
-rw-r--r-- | generic/tclNamesp.c | 26 |
4 files changed, 74 insertions, 33 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 5cd1f18..a866f66 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.244.2.17 2007/11/26 19:43:16 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.244.2.18 2007/11/28 20:30:23 dgp Exp $ */ #include "tclInt.h" @@ -609,6 +609,11 @@ Tcl_CreateInterp(void) iPtr->pendingObjDataPtr = NULL; iPtr->asyncReadyPtr = TclGetAsyncReadyPtr(); + /* + * Insure that the stack checking mechanism for this interp is + * initialized. + */ + GetCStackParams(iPtr); /* @@ -831,13 +836,6 @@ Tcl_CreateInterp(void) Tcl_Panic(Tcl_GetString(Tcl_GetObjResult(interp))); } - /* - * Insure that the stack checking mechanism for this interp is - * initialized. - */ - - TclInterpReady(interp); - return interp; } diff --git a/generic/tclConfig.c b/generic/tclConfig.c index 2fd6ea1..ad2e881 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclConfig.c,v 1.14.2.2 2007/11/21 06:44:31 dgp Exp $ + * RCS: @(#) $Id: tclConfig.c,v 1.14.2.3 2007/11/28 20:30:25 dgp Exp $ */ #include "tclInt.h" @@ -28,6 +28,17 @@ #define ASSOC_KEY "tclPackageAboutDict" /* + * A ClientData struct for the QueryConfig command. Store the two bits + * of data we need; the package name for which we store a config dict, + * and the (Tcl_Interp *) in which it is stored. + */ + +typedef struct QCCD { + Tcl_Obj *pkg; + Tcl_Interp *interp; +} QCCD; + +/* * Static functions in this file: */ @@ -66,12 +77,14 @@ Tcl_RegisterConfig( CONST char *valEncoding) /* Name of the encoding used to store the * configuration values, ASCII, thus UTF-8. */ { - Tcl_Obj *pDB, *pkg, *pkgDict; + Tcl_Obj *pDB, *pkgDict; Tcl_DString cmdName; Tcl_Config *cfg; Tcl_Encoding venc = Tcl_GetEncoding(NULL, valEncoding); + QCCD *cdPtr = (QCCD *)ckalloc(sizeof(QCCD)); - pkg = Tcl_NewStringObj(pkgName, -1); + cdPtr->interp = interp; + cdPtr->pkg = Tcl_NewStringObj(pkgName, -1); /* * Phase I: Adding the provided information to the internal database of @@ -86,7 +99,7 @@ Tcl_RegisterConfig( * Note, the created command will have a reference through its clientdata. */ - Tcl_IncrRefCount(pkg); + Tcl_IncrRefCount(cdPtr->pkg); /* * For venc == NULL aka bogus encoding we skip the step setting up the @@ -100,7 +113,7 @@ Tcl_RegisterConfig( pDB = GetConfigDict(interp); - if (Tcl_DictObjGet(interp, pDB, pkg, &pkgDict) != TCL_OK + if (Tcl_DictObjGet(interp, pDB, cdPtr->pkg, &pkgDict) != TCL_OK || (pkgDict == NULL)) { pkgDict = Tcl_NewDictObj(); } else if (Tcl_IsShared(pkgDict)) { @@ -136,7 +149,7 @@ Tcl_RegisterConfig( * Write the changes back into the overall database. */ - Tcl_DictObjPut(interp, pDB, pkg, pkgDict); + Tcl_DictObjPut(interp, pDB, cdPtr->pkg, pkgDict); } /* @@ -166,7 +179,7 @@ Tcl_RegisterConfig( Tcl_DStringAppend(&cmdName, "::pkgconfig", -1); if (Tcl_CreateObjCommand(interp, Tcl_DStringValue(&cmdName), - QueryConfigObjCmd, (ClientData) pkg, QueryConfigDelete) == NULL) { + QueryConfigObjCmd, (ClientData) cdPtr, QueryConfigDelete) == NULL) { Tcl_Panic("%s: %s", "Tcl_RegisterConfig", "Unable to create query command for package configuration"); } @@ -198,7 +211,8 @@ QueryConfigObjCmd( int objc, struct Tcl_Obj *CONST *objv) { - Tcl_Obj *pkgName = (Tcl_Obj *) clientData; + QCCD *cdPtr = (QCCD *) clientData; + Tcl_Obj *pkgName = cdPtr->pkg; Tcl_Obj *pDB, *pkgDict, *val, *listPtr; int n, index; static CONST char *subcmdStrings[] = { @@ -308,9 +322,12 @@ static void QueryConfigDelete( ClientData clientData) { - Tcl_Obj *pkgName = (Tcl_Obj *) clientData; - + QCCD *cdPtr = (QCCD *) clientData; + Tcl_Obj *pkgName = cdPtr->pkg; + Tcl_Obj *pDB = GetConfigDict(cdPtr->interp); + Tcl_DictObjRemove(NULL, pDB, pkgName); Tcl_DecrRefCount(pkgName); + ckfree((char *)cdPtr); } /* diff --git a/generic/tclIO.c b/generic/tclIO.c index c65a192..21e164a 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.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: tclIO.c,v 1.121.2.5 2007/11/21 06:30:51 dgp Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.121.2.6 2007/11/28 20:30:25 dgp Exp $ */ #include "tclInt.h" @@ -7314,14 +7314,25 @@ Tcl_SetChannelOption( if (argc == 0) { statePtr->inEofChar = 0; statePtr->outEofChar = 0; - } else if (argc == 1) { - if (statePtr->flags & TCL_WRITABLE) { - statePtr->outEofChar = (int) argv[0][0]; + } else if (argc == 1 || argc == 2) { + int outIndex = (argc - 1); + int inValue = (int) argv[0][0]; + int outValue = (int) argv[outIndex][0]; + if (inValue & 0x80 || outValue & 0x80) { + if (interp) { + Tcl_AppendResult(interp, "bad value for -eofchar: ", + "must be non-NUL ASCII character", NULL); + } + ckfree((char *) argv); + return TCL_ERROR; } if (statePtr->flags & TCL_READABLE) { - statePtr->inEofChar = (int) argv[0][0]; + statePtr->inEofChar = inValue; + } + if (statePtr->flags & TCL_WRITABLE) { + statePtr->outEofChar = outValue; } - } else if (argc != 2) { + } else { if (interp) { Tcl_AppendResult(interp, "bad value for -eofchar: should be a list of zero," @@ -7329,13 +7340,6 @@ Tcl_SetChannelOption( } ckfree((char *) argv); return TCL_ERROR; - } else { - if (statePtr->flags & TCL_READABLE) { - statePtr->inEofChar = (int) argv[0][0]; - } - if (statePtr->flags & TCL_WRITABLE) { - statePtr->outEofChar = (int) argv[1][0]; - } } if (argv != NULL) { ckfree((char *) argv); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 37ac553..2c53562 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -23,7 +23,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.134.2.13 2007/11/21 16:27:00 dgp Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.134.2.14 2007/11/28 20:30:32 dgp Exp $ */ #include "tclInt.h" @@ -5407,11 +5407,33 @@ Tcl_SetEnsembleMappingDict( return TCL_ERROR; } if (mapDict != NULL) { - int size; + int size, done; + Tcl_DictSearch search; + Tcl_Obj *valuePtr; if (Tcl_DictObjSize(interp, mapDict, &size) != TCL_OK) { return TCL_ERROR; } + + for (Tcl_DictObjFirst(NULL, mapDict, &search, NULL, &valuePtr, &done); + !done; Tcl_DictObjNext(&search, NULL, &valuePtr, &done)) { + Tcl_Obj *cmdPtr; + const char *bytes; + + if (Tcl_ListObjIndex(interp, valuePtr, 0, &cmdPtr) != TCL_OK) { + Tcl_DictObjDone(&search); + return TCL_ERROR; + } + bytes = TclGetString(cmdPtr); + if (bytes[0] != ':' || bytes[1] != ':') { + Tcl_AppendResult(interp, + "ensemble target is not a fully-qualified command", + NULL); + Tcl_DictObjDone(&search); + return TCL_ERROR; + } + } + if (size < 1) { mapDict = NULL; } |