diff options
-rw-r--r-- | ChangeLog | 44 | ||||
-rw-r--r-- | generic/tcl.h | 8 | ||||
-rw-r--r-- | generic/tclBasic.c | 14 | ||||
-rw-r--r-- | generic/tclCmdAH.c | 8 | ||||
-rw-r--r-- | generic/tclCmdIL.c | 4 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 14 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 24 | ||||
-rw-r--r-- | generic/tclCompExpr.c | 34 | ||||
-rw-r--r-- | generic/tclCompile.c | 6 | ||||
-rw-r--r-- | generic/tclCompile.h | 4 | ||||
-rw-r--r-- | generic/tclExecute.c | 60 | ||||
-rw-r--r-- | generic/tclFCmd.c | 4 | ||||
-rw-r--r-- | generic/tclFileName.c | 4 | ||||
-rw-r--r-- | generic/tclIOCmd.c | 4 | ||||
-rw-r--r-- | generic/tclIndexObj.c | 6 | ||||
-rw-r--r-- | generic/tclInt.decls | 6 | ||||
-rw-r--r-- | generic/tclIntDecls.h | 10 | ||||
-rw-r--r-- | generic/tclInterp.c | 6 | ||||
-rw-r--r-- | generic/tclNamesp.c | 10 | ||||
-rw-r--r-- | generic/tclProc.c | 15 | ||||
-rw-r--r-- | generic/tclTrace.c | 6 | ||||
-rw-r--r-- | generic/tclVar.c | 57 | ||||
-rwxr-xr-x | tools/tcltk-man2html.tcl | 412 | ||||
-rw-r--r-- | unix/tclUnixPipe.c | 6 |
24 files changed, 493 insertions, 273 deletions
@@ -1,3 +1,47 @@ +2007-06-21 Donal K. Fellows <donal.k.fellows@man.ac.uk> + + * generic/tcl.h, generic/tclCompile.h, generic/tclCompile.c: Remove + references in comments to obsolete {expand} notation. [Bug 1740859] + +2007-06-20 Miguel Sofer <msofer@users.sf.net> + + * generic/tclVar.c: streamline namespace vars deletion: only compute + the variable's full name if the variable is traced. + +2007-06-20 Don Porter <dgp@users.sourceforge.net> + + * generic/tclInt.decls: Revised the interfaces of the routines + * generic/tclExecute.c: TclStackAlloc and TclStackFree to make them + easier for callers to use (or more precisely, harder to misuse). + TclStackFree now takes a (void *) argument which is the pointer + intended to be freed. TclStackFree will panic if that's not actually + the memory the call will free. TSA/TSF also now tolerate receiving + (interp == NULL), in which case they simply fall back to be calls to + Tcl_Alloc/Tcl_Free. + + * generic/tclIntDecls.h: make genstubs + + * generic/tclBasic.c: Updated callers + * generic/tclCmdAH.c: + * generic/tclCmdIL.c: + * generic/tclCompCmds.c: + * generic/tclCompExpr.c: + * generic/tclCompile.c: + * generic/tclFCmd.c: + * generic/tclFileName.c: + * generic/tclIOCmd.c: + * generic/tclIndexObj.c: + * generic/tclInterp.c: + * generic/tclNamesp.c: + * generic/tclProc.c: + * generic/tclTrace.c: + * unix/tclUnixPipe.c: + +2007-06-20 Jeff Hobbs <jeffh@ActiveState.com> + + * tools/tcltk-man2html.tcl: revamp of html doc output to use CSS, + standardized headers, subheaders, dictionary sorting of names. + 2007-06-18 Jeff Hobbs <jeffh@ActiveState.com> * tools/tcltk-man2html.tcl: clean up copyright merging and output. diff --git a/generic/tcl.h b/generic/tcl.h index 86fd634..e16fe87 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.231.2.1 2007/05/22 20:34:27 dgp Exp $ + * RCS: @(#) $Id: tcl.h,v 1.231.2.2 2007/06/21 16:04:54 dgp Exp $ */ #ifndef _TCL @@ -2010,9 +2010,9 @@ typedef struct Tcl_Token { * operands. NumComponents is always 0. * TCL_TOKEN_EXPAND_WORD - This token is just like TCL_TOKEN_WORD except * that it marks a word that began with the - * literal character prefix "{expand}". This word - * is marked to be expanded - that is, broken - * into words after substitution is complete. + * literal character prefix "{*}". This word is + * marked to be expanded - that is, broken into + * words after substitution is complete. */ #define TCL_TOKEN_WORD 1 diff --git a/generic/tclBasic.c b/generic/tclBasic.c index bac0f86..dcfeef0 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,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.5 2007/06/19 02:48:02 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.244.2.6 2007/06/21 16:04:54 dgp Exp $ */ #include "tclInt.h" @@ -2021,7 +2021,7 @@ TclInvokeStringCommand( result = (*cmdPtr->proc)(cmdPtr->clientData, interp, objc, argv); - TclStackFree(interp); /* argv */ + TclStackFree(interp, argv); return result; } @@ -2088,7 +2088,7 @@ TclInvokeObjectCommand( objPtr = objv[i]; Tcl_DecrRefCount(objPtr); } - TclStackFree(interp); /* objv */ + TclStackFree(interp, objv); return result; } @@ -3556,7 +3556,7 @@ TclEvalObjvInternal( for (i = 0; i < handlerObjc; ++i) { Tcl_DecrRefCount(newObjv[i]); } - TclStackFree(interp); + TclStackFree(interp, newObjv); if (savedNsPtr) { varFramePtr->nsPtr = savedNsPtr; } @@ -4269,7 +4269,7 @@ TclEvalEx( if (eeFramePtr->type == TCL_LOCATION_SOURCE) { Tcl_DecrRefCount(eeFramePtr->data.eval.path); } - TclStackFree(interp); /* eeFramePtr */ + TclStackFree(interp, eeFramePtr); return code; } @@ -4511,7 +4511,7 @@ TclEvalObjEx( ckfree((char *) eoFramePtr->line); eoFramePtr->line = NULL; eoFramePtr->nline = 0; - TclStackFree(interp); /* eoFramePtr */ + TclStackFree(interp, eoFramePtr); goto done; } @@ -4606,7 +4606,7 @@ TclEvalObjEx( result = Tcl_EvalEx(interp, script, numSrcBytes, flags); } - TclStackFree(interp); /* ctxPtr */ + TclStackFree(interp, ctxPtr); } } } else { diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 452bdce..92f0179 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.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: tclCmdAH.c,v 1.88 2007/04/10 14:47:09 dkf Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.88.2.1 2007/06/21 16:04:55 dgp Exp $ */ #include "tclInt.h" @@ -1838,9 +1838,9 @@ Tcl_ForeachObjCmd( Tcl_DecrRefCount(aCopyList[i]); } } - TclStackFree(interp); /* Tcl_Obj * arrays */ - TclStackFree(interp); /* Tcl_Obj ** arrays */ - TclStackFree(interp); /* int arrays */ + TclStackFree(interp, vCopyList); /* Tcl_Obj * arrays */ + TclStackFree(interp, varvList); /* Tcl_Obj ** arrays */ + TclStackFree(interp, index); /* int arrays */ return result; } diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 5eac76c..d8c37eb 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.115.2.2 2007/06/19 02:48:03 dgp Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.115.2.3 2007/06/21 16:04:55 dgp Exp $ */ #include "tclInt.h" @@ -1260,7 +1260,7 @@ InfoFrameCmd( } } } - TclStackFree(interp); /* fPtr */ + TclStackFree(interp, fPtr); break; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 76475ca..9260723 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.150.2.2 2007/06/19 02:48:03 dgp Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.150.2.3 2007/06/21 16:04:55 dgp Exp $ */ #include "tclInt.h" @@ -1930,7 +1930,7 @@ Tcl_StringObjCmd( */ if (mapWithDict) { - TclStackFree(interp); + TclStackFree(interp, mapElemv); } if (copySource) { Tcl_DecrRefCount(sourceObj); @@ -2054,10 +2054,10 @@ Tcl_StringObjCmd( } } if (nocase) { - TclStackFree(interp); /* u2lc */ + TclStackFree(interp, u2lc); } - TclStackFree(interp); /* mapLens */ - TclStackFree(interp); /* mapStrings */ + TclStackFree(interp, mapLens); + TclStackFree(interp, mapStrings); } if (p != ustring1) { /* @@ -2067,7 +2067,7 @@ Tcl_StringObjCmd( Tcl_AppendUnicodeToObj(resultPtr, p, ustring1 - p); } if (mapWithDict) { - TclStackFree(interp); + TclStackFree(interp, mapElemv); } if (copySource) { Tcl_DecrRefCount(sourceObj); @@ -3025,7 +3025,7 @@ Tcl_SwitchObjCmd( (overflow ? limit : patternLength), pattern, (overflow ? "..." : ""), interp->errorLine)); } - TclStackFree(interp); /* ctxPtr */ + TclStackFree(interp, ctxPtr); return result; } diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 18b6add..a131b7c 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompCmds.c,v 1.109.2.1 2007/06/16 06:13:56 dgp Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.109.2.2 2007/06/21 16:04:55 dgp Exp $ */ #include "tclInt.h" @@ -948,14 +948,14 @@ TclCompileDictCmd( tokenPtr = TokenAfter(tokenPtr); if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { ckfree((char *) duiPtr); - TclStackFree(interp); /* keyTokenPtrs */ + TclStackFree(interp, keyTokenPtrs); return TCL_ERROR; } name = tokenPtr[1].start; nameChars = tokenPtr[1].size; if (!TclIsLocalScalar(name, nameChars)) { ckfree((char *) duiPtr); - TclStackFree(interp); /* keyTokenPtrs */ + TclStackFree(interp, keyTokenPtrs); return TCL_ERROR; } duiPtr->varIndices[i] = TclFindCompiledLocal(name, nameChars, 1, @@ -964,7 +964,7 @@ TclCompileDictCmd( } if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { ckfree((char *) duiPtr); - TclStackFree(interp); /* keyTokenPtrs */ + TclStackFree(interp, keyTokenPtrs); return TCL_ERROR; } bodyTokenPtr = tokenPtr; @@ -1015,7 +1015,7 @@ TclCompileDictCmd( TclEmitInt4( infoIndex, envPtr); TclEmitOpcode( INST_RETURN_STK, envPtr); - TclStackFree(interp); /* keyTokenPtrs */ + TclStackFree(interp, keyTokenPtrs); return TCL_OK; } else if (size==6 && strncmp(cmd, "append", 6) == 0) { Tcl_Token *varTokenPtr; @@ -1665,8 +1665,8 @@ TclCompileForeachCmd( ckfree((char *) varvList[loopIndex]); } } - TclStackFree(interp); /* varvList */ - TclStackFree(interp); /* varcList */ + TclStackFree(interp, varvList); + TclStackFree(interp, varcList); return code; } @@ -2995,7 +2995,7 @@ TclCompileRegexpCmd( if ((strpbrk(str + start, "*+?{}()[].\\|^$") != NULL) || (Tcl_RegExpCompile(NULL, str) == NULL)) { - TclStackFree(interp); /* str */ + TclStackFree(interp, str); return TCL_ERROR; } @@ -3021,9 +3021,9 @@ TclCompileRegexpCmd( } newStr[len] = '\0'; PushLiteral(envPtr, newStr, len); - TclStackFree(interp); /* newStr */ + TclStackFree(interp, newStr); } - TclStackFree(interp); /* str */ + TclStackFree(interp, str); /* * Push the string arg. @@ -3128,7 +3128,7 @@ TclCompileReturnCmd( while (--objc >= 0) { TclDecrRefCount(objv[objc]); } - TclStackFree(interp); /* objv */ + TclStackFree(interp, objv); if (TCL_ERROR == status) { /* * Something was bogus in the return options. Clear the error message, @@ -4696,7 +4696,7 @@ PushVarName( ++varTokenPtr[removedParen].size; } if (allocedTokens) { - TclStackFree(interp); /* elemTokenPtr */ + TclStackFree(interp, elemTokenPtr); } *localIndexPtr = localIndex; *simpleVarNamePtr = simpleVarName; diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index f24c505..f1f4645 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.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: tclCompExpr.c,v 1.53 2007/04/25 19:07:07 dgp Exp $ + * RCS: @(#) $Id: tclCompExpr.c,v 1.53.2.1 2007/06/21 16:04:55 dgp Exp $ */ #include "tclInt.h" @@ -2460,7 +2460,7 @@ CompileExprTree( { OpNode *nodePtr = nodes; int nextFunc = 0; - JumpList *jumpPtr = NULL; + JumpList *freePtr, *jumpPtr = NULL; static const int instruction[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2642,9 +2642,12 @@ CompileExprTree( jumpPtr->offset - jumpPtr->jump.codeOffset, 127); *convertPtr |= jumpPtr->convert; envPtr->currStackDepth = jumpPtr->depth + 1; - jumpPtr = jumpPtr->next->next; - TclStackFree(interp); - TclStackFree(interp); + freePtr = jumpPtr; + jumpPtr = jumpPtr->next; + TclStackFree(interp, freePtr); + freePtr = jumpPtr; + jumpPtr = jumpPtr->next; + TclStackFree(interp, freePtr); } else if (nodePtr->lexeme == AND) { TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &(jumpPtr->next->jump)); @@ -2672,10 +2675,15 @@ CompileExprTree( &(jumpPtr->next->next->jump), 127); *convertPtr = 0; envPtr->currStackDepth = jumpPtr->depth + 1; - jumpPtr = jumpPtr->next->next->next; - TclStackFree(interp); - TclStackFree(interp); - TclStackFree(interp); + freePtr = jumpPtr; + jumpPtr = jumpPtr->next; + TclStackFree(interp, freePtr); + freePtr = jumpPtr; + jumpPtr = jumpPtr->next; + TclStackFree(interp, freePtr); + freePtr = jumpPtr; + jumpPtr = jumpPtr->next; + TclStackFree(interp, freePtr); } nodePtr = nodes + nodePtr->parent; } @@ -2708,7 +2716,7 @@ OpCmd( Tcl_IncrRefCount(byteCodeObj); TclInitByteCodeObj(byteCodeObj, compEnvPtr); TclFreeCompileEnv(compEnvPtr); - TclStackFree(interp); /* compEnvPtr */ + TclStackFree(interp, compEnvPtr); byteCodePtr = (ByteCode *) byteCodeObj->internalRep.otherValuePtr; code = TclExecuteByteCode(interp, byteCodePtr); Tcl_DecrRefCount(byteCodeObj); @@ -2794,8 +2802,8 @@ TclSortingOpCmd( code = OpCmd(interp, nodes, litObjv); - TclStackFree(interp); /* nodes */ - TclStackFree(interp); /* litObjv */ + TclStackFree(interp, nodes); + TclStackFree(interp, litObjv); } return code; } @@ -2887,7 +2895,7 @@ TclVariadicOpCmd( code = OpCmd(interp, nodes, objv+1); - TclStackFree(interp); /* nodes */ + TclStackFree(interp, nodes); return code; } diff --git a/generic/tclCompile.c b/generic/tclCompile.c index b8fa3a9..a946f86 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.117.2.3 2007/06/19 02:48:03 dgp Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.117.2.4 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -289,7 +289,7 @@ InstructionDesc tclInstructionTable[] = { * is emitted. */ {"expandStart", 1, 0, 0, {OPERAND_NONE}}, - /* Start of command with {expand}ed arguments */ + /* Start of command with {*} (expanded) arguments */ {"expandStkTop", 5, 0, 1, {OPERAND_UINT4}}, /* Expand the list at stacktop: push its elements on the stack */ {"invokeExpanded", 1, 0, 0, {OPERAND_NONE}}, @@ -948,7 +948,7 @@ TclInitCompileEnv( Tcl_IncrRefCount(envPtr->extCmdMapPtr->path); } } - TclStackFree(interp); + TclStackFree(interp, ctxPtr); } } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 02fdc28..f2f7814 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.h,v 1.70.2.3 2007/06/15 20:30:19 dgp Exp $ + * RCS: @(#) $Id: tclCompile.h,v 1.70.2.4 2007/06/21 16:04:56 dgp Exp $ */ #ifndef _TCLCOMPILATION @@ -569,7 +569,7 @@ typedef struct ByteCode { #define INST_EXPON 99 -/* TIP #157 - {expand}... language syntax support. */ +/* TIP #157 - {*}... (word expansion) language syntax support. */ #define INST_EXPAND_START 100 #define INST_EXPAND_STKTOP 101 diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ec5140d..32a0160 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.285.2.7 2007/06/19 02:48:03 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.285.2.8 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -669,6 +669,12 @@ GrowEvaluationStack( return markerPtr + 1; } } else if (needed < 0) { + /* + * Put a marker pointing to the previous marker in this stack, and + * store it in esPtr as the current marker. Return a pointer to one + * word past the marker. + */ + esPtr->markerPtr = ++esPtr->tosPtr; *esPtr->markerPtr = (Tcl_Obj *) markerPtr; return esPtr->markerPtr + 1; @@ -730,6 +736,12 @@ GrowEvaluationStack( newStackReady: eePtr->execStackPtr = esPtr; + /* + * Store a NULL marker at the beginning of the stack, to indicate that + * this is the first marker in this stack and that rewinding to here + * should actually be a return to the previous stack. + */ + esPtr->stackWords[0] = NULL; esPtr->markerPtr = esPtr->tosPtr = &esPtr->stackWords[0]; @@ -774,6 +786,11 @@ StackAllocWords( Tcl_Interp *interp, int numWords) { + /* + * Note that GrowEvaluationStack sets a marker in the stack. This marker + * is read when rewinding, e.g., by TclStackFree. + */ + Interp *iPtr = (Interp *) interp; ExecEnv *eePtr = iPtr->execEnvPtr; Tcl_Obj **resPtr = GrowEvaluationStack(eePtr, numWords, 0); @@ -797,12 +814,33 @@ StackReallocWords( void TclStackFree( - Tcl_Interp *interp) + Tcl_Interp *interp, + void *freePtr) { - Interp *iPtr = (Interp *) interp; - ExecEnv *eePtr = iPtr->execEnvPtr; - ExecStack *esPtr = eePtr->execStackPtr; - Tcl_Obj **markerPtr = esPtr->markerPtr; + Interp *iPtr; + ExecEnv *eePtr; + ExecStack *esPtr; + Tcl_Obj **markerPtr; + + if (interp == NULL) { + Tcl_Free((char *) freePtr); + return; + } + + /* + * Rewind the stack to the previous marker position. The current marker, + * as set in the last call to GrowEvaluationStack, contains a pointer to + * the previous marker. + */ + + iPtr = (Interp *) interp; + eePtr = iPtr->execEnvPtr; + esPtr = eePtr->execStackPtr; + markerPtr = esPtr->markerPtr; + + if ((markerPtr+1) != (Tcl_Obj **)freePtr) { + Tcl_Panic("TclStackFree: incorrect freePtr. Call out of sequence?"); + } esPtr->tosPtr = markerPtr-1; esPtr->markerPtr = (Tcl_Obj **) *markerPtr; @@ -826,14 +864,18 @@ TclStackFree( } } -char * +void * TclStackAlloc( Tcl_Interp *interp, int numBytes) { int numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); - return (char *) StackAllocWords(interp, numWords); + if (interp == NULL) { + return (void *) Tcl_Alloc(numBytes); + } + + return (void *) StackAllocWords(interp, numWords); } char * @@ -6819,7 +6861,7 @@ TclExecuteByteCode( * Restore the stack to the state it had previous to this bytecode. */ - TclStackFree(interp); + TclStackFree(interp, initCatchTop+1); return result; #undef iPtr } diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 198f9af..f6dfa26 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.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: tclFCmd.c,v 1.39 2007/04/20 05:51:10 kennykb Exp $ + * RCS: @(#) $Id: tclFCmd.c,v 1.39.2.1 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -1112,7 +1112,7 @@ TclFileAttrsCmd( * Free up the array we allocated. */ - TclStackFree(interp); /* attributeStrings */ + TclStackFree(interp, attributeStrings); /* * We don't need this object that was passed to us any more. diff --git a/generic/tclFileName.c b/generic/tclFileName.c index fad9f72..56c0435 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.83 2007/04/20 05:51:10 kennykb Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.83.2.1 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -1629,7 +1629,7 @@ Tcl_GlobObjCmd( if (globTypes->macCreator != NULL) { Tcl_DecrRefCount(globTypes->macCreator); } - TclStackFree(interp); /* globTypes */ + TclStackFree(interp, globTypes); } return result; } diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 97d11ff..be23aa4 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOCmd.c,v 1.40 2007/04/24 02:42:18 kennykb Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.40.2.1 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -872,7 +872,7 @@ Tcl_ExecObjCmd( * Free the argv array. */ - TclStackFree(interp); /* argv */ + TclStackFree(interp, argv); if (chan == (Tcl_Channel) NULL) { return TCL_ERROR; diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index c601ea0..f5b4001 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.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: tclIndexObj.c,v 1.32.2.1 2007/06/12 15:56:42 dgp Exp $ + * RCS: @(#) $Id: tclIndexObj.c,v 1.32.2.2 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -543,7 +543,7 @@ Tcl_WrongNumArgs( len = Tcl_ConvertCountedElement(elementStr, elemLen, quotedElementStr, flags); Tcl_AppendToObj(objPtr, quotedElementStr, len); - TclStackFree(interp); /* quotedElementStr */ + TclStackFree(interp, quotedElementStr); } else { Tcl_AppendToObj(objPtr, elementStr, elemLen); } @@ -597,7 +597,7 @@ Tcl_WrongNumArgs( len = Tcl_ConvertCountedElement(elementStr, elemLen, quotedElementStr, flags); Tcl_AppendToObj(objPtr, quotedElementStr, len); - TclStackFree(interp); /* quotedElementStr */ + TclStackFree(interp, quotedElementStr); } else { Tcl_AppendToObj(objPtr, elementStr, elemLen); } diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 728def9..0f666c7 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tclInt.decls,v 1.108.2.1 2007/06/15 16:37:45 dgp Exp $ +# RCS: @(#) $Id: tclInt.decls,v 1.108.2.2 2007/06/21 16:04:56 dgp Exp $ library tcl @@ -868,10 +868,10 @@ declare 214 generic { void TclSetObjNameOfExecutable(Tcl_Obj *name, Tcl_Encoding encoding) } declare 215 generic { - char * TclStackAlloc(Tcl_Interp *interp, int numBytes) + void * TclStackAlloc(Tcl_Interp *interp, int numBytes) } declare 216 generic { - void TclStackFree(Tcl_Interp *interp) + void TclStackFree(Tcl_Interp *interp, void *freePtr) } declare 217 generic { int TclPushStackFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr, diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 42f6c66..3ffca4b 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIntDecls.h,v 1.99.2.1 2007/06/15 16:37:46 dgp Exp $ + * RCS: @(#) $Id: tclIntDecls.h,v 1.99.2.2 2007/06/21 16:04:56 dgp Exp $ */ #ifndef _TCLINTDECLS @@ -950,12 +950,12 @@ EXTERN void TclSetObjNameOfExecutable (Tcl_Obj * name, #ifndef TclStackAlloc_TCL_DECLARED #define TclStackAlloc_TCL_DECLARED /* 215 */ -EXTERN char * TclStackAlloc (Tcl_Interp * interp, int numBytes); +EXTERN void * TclStackAlloc (Tcl_Interp * interp, int numBytes); #endif #ifndef TclStackFree_TCL_DECLARED #define TclStackFree_TCL_DECLARED /* 216 */ -EXTERN void TclStackFree (Tcl_Interp * interp); +EXTERN void TclStackFree (Tcl_Interp * interp, void * freePtr); #endif #ifndef TclPushStackFrame_TCL_DECLARED #define TclPushStackFrame_TCL_DECLARED @@ -1274,8 +1274,8 @@ typedef struct TclIntStubs { void (*tclpFindExecutable) (CONST char * argv0); /* 212 */ Tcl_Obj * (*tclGetObjNameOfExecutable) (void); /* 213 */ void (*tclSetObjNameOfExecutable) (Tcl_Obj * name, Tcl_Encoding encoding); /* 214 */ - char * (*tclStackAlloc) (Tcl_Interp * interp, int numBytes); /* 215 */ - void (*tclStackFree) (Tcl_Interp * interp); /* 216 */ + void * (*tclStackAlloc) (Tcl_Interp * interp, int numBytes); /* 215 */ + void (*tclStackFree) (Tcl_Interp * interp, void * freePtr); /* 216 */ int (*tclPushStackFrame) (Tcl_Interp * interp, Tcl_CallFrame ** framePtrPtr, Tcl_Namespace * namespacePtr, int isProcCallFrame); /* 217 */ void (*tclPopStackFrame) (Tcl_Interp * interp); /* 218 */ void *reserved219; diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 68c7bd4..74b21c4 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.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: tclInterp.c,v 1.74.2.1 2007/06/12 15:56:43 dgp Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.74.2.2 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -1104,7 +1104,7 @@ Tcl_CreateAlias( for (i = 0; i < argc; i++) { Tcl_DecrRefCount(objv[i]); } - TclStackFree(slaveInterp); /* objv */ + TclStackFree(slaveInterp, objv); Tcl_DecrRefCount(targetObjPtr); Tcl_DecrRefCount(slaveObjPtr); @@ -1778,7 +1778,7 @@ AliasObjCmd( Tcl_DecrRefCount(cmdv[i]); } if (cmdv != cmdArr) { - TclStackFree(interp); + TclStackFree(interp, cmdv); } return result; #undef ALIAS_CMDV_PREALLOC diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index d2ba828..dd93a8b 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -22,7 +22,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.2 2007/06/12 15:56:43 dgp Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.134.2.3 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -533,8 +533,10 @@ void TclPopStackFrame( Tcl_Interp *interp) /* Interpreter with call frame to pop. */ { + CallFrame *freePtr = ((Interp *)interp)->framePtr; + Tcl_PopCallFrame(interp); - TclStackFree(interp); + TclStackFree(interp, freePtr); } /* @@ -4119,7 +4121,7 @@ NamespacePathCmd( result = TCL_OK; badNamespace: if (namespaceList != NULL) { - TclStackFree(interp); /* namespaceList */ + TclStackFree(interp, namespaceList); } return result; } @@ -6196,7 +6198,7 @@ NsEnsembleImplementationCmd( TCL_EVAL_INVOKE); Tcl_DecrRefCount(copyObj); Tcl_DecrRefCount(prefixObj); - TclStackFree(interp); + TclStackFree(interp, tempObjv); if (isRootEnsemble) { iPtr->ensembleRewrite.sourceObjs = NULL; iPtr->ensembleRewrite.numRemovedObjs = 0; diff --git a/generic/tclProc.c b/generic/tclProc.c index b0f4d7d..662b9f8 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.115.2.7 2007/06/19 02:48:04 dgp Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.115.2.8 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -270,7 +270,7 @@ Tcl_ProcObjCmd( Tcl_DecrRefCount(contextPtr->data.eval.path); contextPtr->data.eval.path = NULL; } - TclStackFree(interp); /* contextPtr */ + TclStackFree(interp, contextPtr); } /* @@ -1222,7 +1222,7 @@ InitArgsAndLocals( for (i=0 ; i<=numArgs ; i++) { Tcl_DecrRefCount(desiredObjs[i]); } - TclStackFree(interp); + TclStackFree(interp, desiredObjs); return TCL_ERROR; } @@ -1565,6 +1565,7 @@ TclObjInterpProcCore( { register Proc *procPtr = ((Interp *)interp)->varFramePtr->procPtr; int result; + CallFrame *freePtr; result = InitArgsAndLocals(interp, procNameObj, skip); if (result != TCL_OK) { @@ -1680,9 +1681,11 @@ TclObjInterpProcCore( * allocated later on the stack. */ + freePtr = ((Interp *)interp)->framePtr; Tcl_PopCallFrame(interp); /* Pop but do not free. */ - TclStackFree(interp); /* Free compiledLocals. */ - TclStackFree(interp); /* Free CallFrame. */ + TclStackFree(interp, freePtr->compiledLocals); + /* Free compiledLocals. */ + TclStackFree(interp, freePtr); /* Free CallFrame. */ return result; } @@ -2401,7 +2404,7 @@ SetLambdaFromAny( Tcl_DecrRefCount(contextPtr->data.eval.path); } - TclStackFree(interp); /* contextPtr */ + TclStackFree(interp, contextPtr); } /* diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 90eb032..9f793ff 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTrace.c,v 1.37.2.1 2007/06/12 15:56:44 dgp Exp $ + * RCS: @(#) $Id: tclTrace.c,v 1.37.2.2 2007/06/21 16:04:56 dgp Exp $ */ #include "tclInt.h" @@ -1704,7 +1704,7 @@ CallTraceFunction( traceCode = (tracePtr->proc)(tracePtr->clientData, (Tcl_Interp*) iPtr, iPtr->numLevels, commandCopy, (Tcl_Command) cmdPtr, objc, objv); - TclStackFree(interp); /* commandCopy */ + TclStackFree(interp, commandCopy); return traceCode; } @@ -2281,7 +2281,7 @@ StringTraceProc( (data->proc)(data->clientData, interp, level, (char *) command, cmdPtr->proc, cmdPtr->clientData, objc, argv); - TclStackFree(interp); /* argv */ + TclStackFree(interp, argv); return TCL_OK; } diff --git a/generic/tclVar.c b/generic/tclVar.c index e32e866..b42808f 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.135.2.1 2007/06/12 15:56:44 dgp Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.135.2.2 2007/06/21 16:04:57 dgp Exp $ */ #include "tclInt.h" @@ -2059,13 +2059,15 @@ UnsetVarStruct( Var *varPtr, Var *arrayPtr, Interp *iPtr, - const char *part1, + const char *part1, /* NULL if it is to be computed on demand, only for + * namespace vars */ const char *part2, int flags) { Var dummyVar; Var *dummyVarPtr; ActiveVarTrace *activePtr; + Tcl_Obj *part1Ptr = NULL; if ((arrayPtr != NULL) && (arrayPtr->searchPtr != NULL)) { DeleteSearches(arrayPtr); @@ -2103,6 +2105,7 @@ UnsetVarStruct( */ dummyVar = *varPtr; + dummyVarPtr = &dummyVar; TclSetVarUndefined(varPtr); TclSetVarScalar(varPtr); varPtr->value.objPtr = NULL; /* dummyVar points to any value object */ @@ -2121,8 +2124,20 @@ UnsetVarStruct( if ((dummyVar.tracePtr != NULL) || ((arrayPtr != NULL) && (arrayPtr->tracePtr != NULL))) { + /* + * Get the variable's name if NULL was passed; + */ + + if (part1 == NULL) { + Tcl_Interp *interp = dummyVar.nsPtr->interp; + TclNewObj(part1Ptr); + Tcl_IncrRefCount(part1Ptr); + Tcl_GetVariableFullName(interp, (Tcl_Var) dummyVarPtr, part1Ptr); + part1 = TclGetString(part1Ptr); + } + dummyVar.flags &= ~VAR_TRACE_ACTIVE; - TclCallVarTraces(iPtr, arrayPtr, &dummyVar, part1, part2, (flags + TclCallVarTraces(iPtr, arrayPtr, dummyVarPtr, part1, part2, (flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY)) | TCL_TRACE_UNSETS, /* leaveErrMsg */ 0); while (dummyVar.tracePtr != NULL) { @@ -2145,8 +2160,13 @@ UnsetVarStruct( * the ref count of its object, if any). */ - dummyVarPtr = &dummyVar; if (TclIsVarArray(dummyVarPtr) && !TclIsVarUndefined(dummyVarPtr)) { + /* + * If the array is traced, its name is already in part1. If not, and + * the name is required for some element, it will be computed at + * DeleteArray. + */ + DeleteArray(iPtr, part1, dummyVarPtr, (flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY)) | TCL_TRACE_UNSETS); @@ -2171,6 +2191,9 @@ UnsetVarStruct( TclClearVarNamespaceVar(varPtr); varPtr->refCount--; } + if (part1Ptr) { + Tcl_DecrRefCount(part1Ptr); + } } /* @@ -4070,12 +4093,8 @@ TclDeleteNamespaceVars( for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr != NULL; hPtr = Tcl_FirstHashEntry(tablePtr, &search)) { register Var *varPtr = (Var *) Tcl_GetHashValue(hPtr); - Tcl_Obj *objPtr = Tcl_NewObj(); varPtr->refCount++; /* Make sure we get to remove from hash */ - Tcl_IncrRefCount(objPtr); - Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, objPtr); - UnsetVarStruct(varPtr, NULL, iPtr, Tcl_GetString(objPtr), NULL, flags); - Tcl_DecrRefCount(objPtr); /* free no longer needed obj */ + UnsetVarStruct(varPtr, NULL, iPtr, /* part1 */ NULL, NULL, flags); varPtr->refCount--; /* @@ -4367,7 +4386,8 @@ TclDeleteCompiledLocalVars( static void DeleteArray( Interp *iPtr, /* Interpreter containing array. */ - const char *arrayName, /* Name of array (used for trace callbacks) */ + const char *arrayName, /* Name of array (used for trace callbacks), + * or NULL if it is to be computed on demand */ Var *varPtr, /* Pointer to variable structure. */ int flags) /* Flags to pass to TclCallVarTraces: * TCL_TRACE_UNSETS and sometimes @@ -4377,7 +4397,7 @@ DeleteArray( register Tcl_HashEntry *hPtr; register Var *elPtr; ActiveVarTrace *activePtr; - Tcl_Obj *objPtr; + Tcl_Obj *objPtr, *arrayNamePtr = NULL; DeleteSearches(varPtr); for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search); @@ -4390,6 +4410,18 @@ DeleteArray( } elPtr->hPtr = NULL; if (elPtr->tracePtr != NULL) { + /* + * Compute the array name if it was not supplied + */ + + if (arrayName == NULL) { + Tcl_Interp *interp = varPtr->nsPtr->interp; + TclNewObj(arrayNamePtr); + Tcl_IncrRefCount(arrayNamePtr); + Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, arrayNamePtr); + arrayName = TclGetString(arrayNamePtr); + } + elPtr->flags &= ~VAR_TRACE_ACTIVE; TclCallVarTraces(iPtr, NULL, elPtr, arrayName, Tcl_GetHashKey(varPtr->value.tablePtr, hPtr), flags, @@ -4425,6 +4457,9 @@ DeleteArray( ckfree((char *) elPtr); /* element Vars are VAR_IN_HASHTABLE */ } } + if (arrayNamePtr) { + Tcl_DecrRefCount(arrayNamePtr); + } Tcl_DeleteHashTable(varPtr->value.tablePtr); ckfree((char *) varPtr->value.tablePtr); } diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index 58e8ec9..a107067 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -4,11 +4,9 @@ exec tclsh8.4 "$0" ${1+"$@"} package require Tcl 8.4 -# Convert Ousterhout format man pages into highly crosslinked -# hypertext. +# Convert Ousterhout format man pages into highly crosslinked hypertext. # -# Along the way detect many unmatched font changes and other odd -# things. +# Along the way detect many unmatched font changes and other odd things. # # Note well, this program is a hack rather than a piece of software # engineering. In that sense it's probably a good example of things @@ -18,55 +16,11 @@ package require Tcl 8.4 # try to use this, you'll be very much on your own. # # Copyright (c) 1995-1997 Roger E. Critchlow Jr -# -# The authors hereby grant permission to use, copy, modify, distribute, -# and license this software and its documentation for any purpose, provided -# that existing copyright notices are retained in all copies and that this -# notice is included verbatim in any distributions. No written agreement, -# license, or royalty fee is required for any of the authorized uses. -# Modifications to this software may be copyrighted by their authors -# and need not follow the licensing terms described here, provided that -# the new terms are clearly indicated on the first page of each file where -# they apply. -# -# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY -# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY -# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE -# IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE -# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR -# MODIFICATIONS. -# -# Revisions: -# May 15, 1995 - initial release -# May 16, 1995 - added a back to home link to toplevel table of -# contents. -# May 18, 1995 - broke toplevel table of contents into separate -# pages for each section, and broke long table of contents -# into a one page for each man page. -# Mar 10, 1996 - updated for tcl7.5b3/tk4.1b3 -# Apr 14, 1996 - incorporated command line parsing from Tom Tromey, -# <tromey@creche.cygnus.com> -- thanks Tom. -# - updated for tcl7.5/tk4.1 final release. -# - converted to same copyright as the man pages. -# Sep 14, 1996 - made various modifications for tcl7.6b1/tk4.2b1 -# Oct 18, 1996 - added tcl7.6/tk4.2 to the list of distributions. -# Oct 22, 1996 - major hacking on indentation code and elsewhere. -# Mar 4, 1997 - -# May 28, 1997 - added tcl8.0b1/tk8.0b1 to the list of distributions -# - cleaned source for tclsh8.0 execution -# - renamed output files for windoze installation -# - added spaces to tables -# Oct 24, 1997 - moved from 8.0b1 to 8.0 release -# set Version "0.40" +set ::CSSFILE "docs.css" + proc parse_command_line {} { global argv Version @@ -170,7 +124,7 @@ proc parse_command_line {} { if {$build_tcl} {append overall_title "[capitalize $tcldir]"} if {$build_tcl && $build_tk} {append overall_title "/"} if {$build_tk} {append overall_title "[capitalize $tkdir]"} - append overall_title " Manual" + append overall_title " Documentation" } proc capitalize {string} { @@ -212,9 +166,139 @@ proc fatal {msg} { ## ## templating ## +proc indexfile {} { + if {[info exists ::TARGET] && $::TARGET eq "devsite"} { + return "index.tml" + } else { + return "contents.htm" + } +} proc copyright {copyright {level {}}} { - set page "${level}copyright.htm" - return "<A HREF=\"$page\">Copyright</A> © [htmlize-text [lrange $copyright 2 end]]" + # We don't actually generate a separate copyright page anymore + #set page "${level}copyright.htm" + #return "<A HREF=\"$page\">Copyright</A> © [htmlize-text [lrange $copyright 2 end]]" + # obfuscate any email addresses that may appear in name + set who [string map {@ (at)} [lrange $copyright 2 end]] + return "Copyright © [htmlize-text $who]" +} +proc copyout {copyrights {level {}}} { + set out "<div class=\"copy\">" + foreach c $copyrights { + append out "[copyright $c $level]\n" + } + append out "</div>" + return $out +} +proc CSS {{level ""}} { + return "<link rel=\"stylesheet\" href=\"${level}$::CSSFILE\" type=\"text/css\" media=\"all\">\n" +} +proc DOCTYPE {} { + return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" +} +proc htmlhead {title header args} { + set level "" + if {[lindex $args end] eq "../[indexfile]"} { + # XXX hack - assume same level for CSS file + set level "../" + } + set out "[DOCTYPE]\n<HTML>\n<HEAD><TITLE>$title</TITLE>\n[CSS $level]</HEAD>\n" + foreach {uptitle url} $args { + set header "<a href=\"$url\">$uptitle</a> <small>></small> $header" + } + append out "<BODY><H2>$header</H2>" + global manual + if {[info exists manual(subheader)]} { + set subs {} + foreach {name subdir} $manual(subheader) { + if {$name eq $title} { + lappend subs $name + } else { + lappend subs "<A HREF=\"${level}$subdir/[indexfile]\">$name</A>" + } + } + append out "\n<H3>[join $subs { | }]</H3>" + } + return $out +} +proc gencss {} { + set hBd "1px dotted #11577b" + return " +body, div, p, th, td, li, dd, ul, ol, dl, dt, blockquote { + font-family: Verdana, sans-serif; +} + +pre, code { font-family: 'Courier New', Courier, monospace; } + +pre { + background-color: #f6fcec; + border-top: 1px solid #6A6A6A; + border-bottom: 1px solid #6A6A6A; + padding: 1em; + overflow: auto; +} + +body { + background-color: #FFFFFF; + font-size: 12px; + line-height: 1.25; + letter-spacing: .2px; + padding-left: .5em; +} + +h1, h2, h3, h4 { + font-family: Georgia, serif; + padding-left: 1em; + margin-top: 1em; +} + +h1 { + font-size: 18px; + color: #11577b; + border-bottom: $hBd; + margin-top: 0px; +} + +h2 { + font-size: 14px; + color: #11577b; + background-color: #c5dce8; + padding-left: 1em; + border: 1px solid #6A6A6A; +} + +h3, h4 { + color: #1674A4; + background-color: #e8f2f6; + border-bottom: $hBd; + border-top: $hBd; +} + +h3 { font-size: 12px; } +h4 { font-size: 11px; } + +.keylist dt, .arguments dt { + width: 20em; + float: left; + padding: 2px; + border-top: 1px solid #999; +} + +.keylist dt { font-weight: bold; } + +.keylist dd, .arguments dd { + margin-left: 20em; + padding: 2px; + border-top: 1px solid #999; +} + +.copy { + background-color: #f6fcfc; + white-space: pre; + font-size: 80%; + border-top: 1px solid #6A6A6A; + margin-top: 2em; +} +" } ## @@ -526,7 +610,7 @@ proc output-RS-list {} { } else { man-puts $line } - } + } man-puts </DL> } @@ -543,7 +627,7 @@ proc output-IP-list {context code rest} { set line [next-text] if {[is-a-directive $line]} { split-directive $line code rest - if {[string equal $code ".IP"] && [string equal $rest {}]} { + if {$code eq ".IP" && $rest eq {}} { man-puts "<P>" continue } @@ -560,14 +644,12 @@ proc output-IP-list {context code rest} { man-puts </DL> } else { # labelled list, make contents - if { - [string compare $context ".SH"] && - [string compare $context ".SS"] - } then { + if {$context ne ".SH" && $context ne ".SS"} { man-puts <P> } - man-puts <DL> - lappend manual(section-toc) <DL> + set dl "<DL class=\"[string tolower $manual(section)]\">" + man-puts $dl + lappend manual(section-toc) $dl backup-text 1 set accept_RE 0 set para {} @@ -581,16 +663,16 @@ proc output-IP-list {context code rest} { output-IP-list .IP $code $rest continue } - if {[string equal $manual(section) "ARGUMENTS"] || \ + if {$manual(section) eq "ARGUMENTS" || \ [regexp {^\[\d+\]$} $rest]} { man-puts "$para<DT>$rest<DD>" - } elseif {[string equal {•} $rest]} { - man-puts "$para<DT><DD>$rest " + } elseif {"•" eq $rest} { + man-puts "$para<DT><DD>$rest " } else { man-puts "$para<DT>[long-toc $rest]<DD>" } - if {[string equal $manual(name):$manual(section) \ - "selection:DESCRIPTION"]} { + if {"$manual(name):$manual(section)" eq \ + "selection:DESCRIPTION"} { if {[match-text .RE @rest .RS .RS]} { man-puts <DT>[long-toc $rest]<DD> } @@ -680,7 +762,7 @@ proc output-name {line} { # output line to manual page untouched man-puts $line # output line to long table of contents - lappend manual(section-toc) <DL><DD>$line</DL> + lappend manual(section-toc) <DL><DD>$line</DD></DL> # separate out the names for future reference foreach name [split $head ,] { set name [string trim $name] @@ -696,11 +778,11 @@ proc output-name {line} { ## proc cross-reference {ref} { global manual - if {[string match Tcl_* $ref]} { + if {[string match "Tcl_*" $ref]} { set lref $ref - } elseif {[string match Tk_* $ref]} { + } elseif {[string match "Tk_*" $ref]} { set lref $ref - } elseif {[string equal $ref "Tcl"]} { + } elseif {$ref eq "Tcl"} { set lref $ref } else { set lref [string tolower $ref] @@ -713,7 +795,7 @@ proc cross-reference {ref} { after clipboard grab image option pack place selection tk tkwait update winfo wm} { if {[regexp "^$name \[a-z0-9]*\$" $lref] && \ [info exists manual(name-$name)] && \ - [string compare $manual(tail) "$name.n"]} { + $manual(tail) ne "$name.n"} { return "<A HREF=\"../$manual(name-$name).htm\">$ref</A>" } } @@ -740,15 +822,15 @@ proc cross-reference {ref} { set tcl_ref [lindex $manual(name-$lref) $tcl_i] set tk_i [lsearch -glob $manual(name-$lref) *TkCmd*] set tk_ref [lindex $manual(name-$lref) $tk_i] - if {$tcl_i >= 0 && "$manual(wing-file)" == {TclCmd} \ - || "$manual(wing-file)" == {TclLib}} { + if {$tcl_i >= 0 && $manual(wing-file) eq "TclCmd" + || $manual(wing-file) eq "TclLib"} { return "<A HREF=\"../$tcl_ref.htm\">$ref</A>" } - if {$tk_i >= 0 && "$manual(wing-file)" == {TkCmd} \ - || "$manual(wing-file)" == {TkLib}} { + if {$tk_i >= 0 && $manual(wing-file) eq "TkCmd" + || $manual(wing-file) eq "TkLib"} { return "<A HREF=\"../$tk_ref.htm\">$ref</A>" } - if {"$lref" == {exit} && "$manual(tail)" == {tclsh.1} && $tcl_i >= 0} { + if {$lref eq "exit" && $manual(tail) eq "tclsh.1" && $tcl_i >= 0} { return "<A HREF=\"../$tcl_ref.htm\">$ref</A>" } puts stderr "multiple cross reference to $ref in $manual(name-$lref) from $manual(wing-file)/$manual(tail)" @@ -992,7 +1074,7 @@ proc output-directive {line} { # start our own stack of stuff set manual($manual(name)-$manual(section)) {} lappend manual(has-$manual(section)) $manual(name) - if {[string compare .SS $code]} { + if {$code ne ".SS"} { man-puts "<H3>[long-toc $manual(section)]</H3>" } else { man-puts "<H4>[long-toc $manual(section)]</H4>" @@ -1127,7 +1209,7 @@ proc output-directive {line} { } man-puts <DL> lappend manual(section-toc) <DL> - foreach option [lsort $opts] { + foreach option [lsort -dictionary $opts] { man-puts "<DT><B>[std-option-toc $option]</B>" } man-puts </DL> @@ -1309,7 +1391,7 @@ proc merge-copyrights {l1 l2} { puts "oops: $copyright" } foreach who [array names dates] { - set list [lsort $dates($who)] + set list [lsort -dictionary $dates($who)] if {[llength $list] == 1 || [lindex $list 0] == [lrange $list end end]} { lappend merge "Copyright (c) [lindex $list 0] $who" } else { @@ -1332,29 +1414,40 @@ proc makedirhier {dir} { ## specified by html. ## proc make-man-pages {html args} { - global env manual overall_title tcltkdesc + global manual overall_title tcltkdesc makedirhier $html + set cssfd [open $html/$::CSSFILE w] + puts $cssfd [gencss] + close $cssfd set manual(short-toc-n) 1 - set manual(short-toc-fp) [open $html/contents.htm w] - puts $manual(short-toc-fp) "<HTML><HEAD><TITLE>$overall_title</TITLE></HEAD>" - puts $manual(short-toc-fp) "<BODY><HR><H3>$overall_title</H3><HR><DL>" + set manual(short-toc-fp) [open $html/[indexfile] w] + puts $manual(short-toc-fp) [htmlhead $overall_title $overall_title] + puts $manual(short-toc-fp) "<DL class=\"keylist\">" set manual(merge-copyrights) {} foreach arg $args { - if {$arg == ""} {continue} + # preprocess to set up subheader for the rest of the files + if {![llength $arg]} { continue } + set name [lindex $arg 1] + set file [lindex $arg 2] + lappend manual(subheader) $name $file + } + foreach arg $args { + if {![llength $arg]} { continue } set manual(wing-glob) [lindex $arg 0] set manual(wing-name) [lindex $arg 1] set manual(wing-file) [lindex $arg 2] set manual(wing-description) [lindex $arg 3] set manual(wing-copyrights) {} makedirhier $html/$manual(wing-file) - set manual(wing-toc-fp) [open $html/$manual(wing-file)/contents.htm w] + set manual(wing-toc-fp) [open $html/$manual(wing-file)/[indexfile] w] # whistle puts stderr "scanning section $manual(wing-name)" # put the entry for this section into the short table of contents - puts $manual(short-toc-fp) "<DT><A HREF=\"$manual(wing-file)/contents.htm\">$manual(wing-name)</A><DD>$manual(wing-description)" + puts $manual(short-toc-fp) "<DT><A HREF=\"$manual(wing-file)/[indexfile]\">$manual(wing-name)</A></DT><DD>$manual(wing-description)</DD>" # initialize the wing table of contents - puts $manual(wing-toc-fp) "<HTML><HEAD><TITLE>$manual(wing-name) Manual</TITLE></HEAD>" - puts $manual(wing-toc-fp) "<BODY><HR><H3>$manual(wing-name)</H3><HR>" + puts $manual(wing-toc-fp) [htmlhead $manual(wing-name) \ + $manual(wing-name) \ + $overall_title "../[indexfile]"] # initialize the short table of contents for this section set manual(wing-toc) {} # initialize the man directory for this section @@ -1362,7 +1455,7 @@ proc make-man-pages {html args} { # initialize the long table of contents for this section set manual(long-toc-n) 1 # get the manual pages for this section - set manual(pages) [lsort [glob $manual(wing-glob)]] + set manual(pages) [lsort -dictionary [glob $manual(wing-glob)]] if {[set n [lsearch -glob $manual(pages) */options.n]] >= 0} { set manual(pages) "[lindex $manual(pages) $n] [lreplace $manual(pages) $n $n]" } @@ -1536,20 +1629,17 @@ proc make-man-pages {html args} { } # output conversion open-text - set addcopy 1 + set haserror 0 if {[next-op-is .HS rest]} { set manual($manual(name)-title) \ "[lrange $rest 1 end] [lindex $rest 0] manual page" - while {[more-text]} { - set line [next-text] - if {[is-a-directive $line]} { - output-directive $line - } else { - man-puts $line - } - } } elseif {[next-op-is .TH rest]} { set manual($manual(name)-title) "[lrange $rest 4 end] - [lindex $rest 0] manual page" + } else { + set haserror 1 + manerror "no .HS or .TH record found" + } + if {!$haserror} { while {[more-text]} { set line [next-text] if {[is-a-directive $line]} { @@ -1558,21 +1648,13 @@ proc make-man-pages {html args} { man-puts $line } } - } else { - set addcopy 0 - manerror "no .HS or .TH record found" - } - if {$addcopy} { - man-puts "<HR><PRE>" - foreach copyright $manual(copyrights) { - man-puts [copyright $copyright "../"] - } + man-puts [copyout $manual(copyrights) "../"] set manual(wing-copyrights) [merge-copyrights $manual(wing-copyrights) $manual(copyrights)] } # # make the long table of contents for this page # - set manual(toc-$manual(wing-file)-$manual(name)) [concat <DL> $manual(section-toc) </DL><HR>] + set manual(toc-$manual(wing-file)-$manual(name)) [concat <DL> $manual(section-toc) </DL>] } # @@ -1588,7 +1670,7 @@ proc make-man-pages {html args} { set nrows [expr {([llength $manual(wing-toc)]+$perline)/$perline}] set n 0 catch {unset rows} - foreach name [lsort $manual(wing-toc)] { + foreach name [lsort -dictionary $manual(wing-toc)] { set tail $manual(name-$name) if {[llength $tail] > 1} { manerror "$name is defined in more than one file: $tail" @@ -1608,11 +1690,8 @@ proc make-man-pages {html args} { # # insert wing copyrights # - puts $manual(wing-toc-fp) "<HR><PRE>" - foreach copyright $manual(wing-copyrights) { - puts $manual(wing-toc-fp) [copyright $copyright "../"] - } - puts $manual(wing-toc-fp) "</PRE></BODY></HTML>" + puts $manual(wing-toc-fp) [copyout $manual(wing-copyrights) "../"] + puts $manual(wing-toc-fp) "</BODY></HTML>" close $manual(wing-toc-fp) set manual(merge-copyrights) [merge-copyrights $manual(merge-copyrights) $manual(wing-copyrights)] } @@ -1620,62 +1699,66 @@ proc make-man-pages {html args} { ## ## build the keyword index. ## - set keys [lsort -dictionary [array names manual keyword-*]] + file delete -force -- $html/Keywords makedirhier $html/Keywords - catch {eval file delete -- [glob $html/Keywords/*]} - puts $manual(short-toc-fp) "<DT><A HREF=\"Keywords/contents.htm\">Keywords</A><DD>The keywords from the $tcltkdesc man pages." - set keyfp [open $html/Keywords/contents.htm w] - puts $keyfp "<HTML><HEAD><TITLE>$tcltkdesc Keywords</TITLE></HEAD>" - puts $keyfp "<BODY><HR><H3>$tcltkdesc Keywords</H3><HR><H2>" - foreach a {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} { - puts $keyfp "<A HREF=\"$a.htm\">$a</A>" + set keyfp [open $html/Keywords/[indexfile] w] + puts $keyfp [htmlhead "$tcltkdesc Keywords" "$tcltkdesc Keywords" \ + $overall_title "../[indexfile]"] + set letters {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} + # Create header first + set keyheader {} + foreach a $letters { + set keys [array names manual "keyword-\[[string totitle $a$a]\]*"] + if {[llength $keys]} { + lappend keyheader "<A HREF=\"$a.htm\">$a</A>" + } else { + # No keywords for this letter + lappend keyheader $a + } + } + set keyheader "<H3>[join $keyheader " |\n"]</H3>" + puts $keyfp $keyheader + foreach a $letters { + set keys [array names manual "keyword-\[[string totitle $a$a]\]*"] + if {![llength $keys]} { continue } + # Per-keyword page set afp [open $html/Keywords/$a.htm w] - puts $afp "<HTML><HEAD><TITLE>$tcltkdesc Keywords - $a</TITLE></HEAD>" - puts $afp "<BODY><HR><H3>$tcltkdesc Keywords - $a</H3><HR><H2>" - foreach b {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} { - puts $afp "<A HREF=\"$b.htm\">$b</A>" - } - puts $afp "</H2><HR><DL>" - foreach k $keys { - if {[string match -nocase "keyword-${a}*" $k]} { - set k [string range $k 8 end] - puts $afp "<DT><A NAME=\"$k\">$k</A><DD>" - set refs {} - foreach man $manual(keyword-$k) { - set name [lindex $man 0] - set file [lindex $man 1] - lappend refs "<A HREF=\"../$file\">$name</A>" - } - puts $afp [join $refs {, }] + puts $afp [htmlhead "$tcltkdesc Keywords - $a" \ + "$tcltkdesc Keywords - $a" \ + $overall_title "../[indexfile]"] + puts $afp $keyheader + puts $afp "<DL class=\"keylist\">" + foreach k [lsort -dictionary $keys] { + set k [string range $k 8 end] + puts $afp "<DT><A NAME=\"$k\">$k</A></DT>" + puts $afp "<DD>" + set refs {} + foreach man $manual(keyword-$k) { + set name [lindex $man 0] + set file [lindex $man 1] + lappend refs "<A HREF=\"../$file\">$name</A>" } + puts $afp "[join $refs {, }]</DD>" } - puts $afp "</DL><HR><PRE>" + puts $afp "</DL>" # insert merged copyrights - foreach copyright $manual(merge-copyrights) { - puts $afp [copyright $copyright] - } - puts $afp "</PRE></BODY></HTML>" + puts $afp [copyout $manual(merge-copyrights)] + puts $afp "</BODY></HTML>" close $afp } - puts $keyfp "</H2><HR><PRE>" - # insert merged copyrights - foreach copyright $manual(merge-copyrights) { - puts $keyfp [copyright $copyright] - } - puts $keyfp "</PRE><HR></BODY></HTML>" + puts $keyfp [copyout $manual(merge-copyrights)] + puts $keyfp "</BODY></HTML>" close $keyfp ## ## finish off short table of contents ## - puts $manual(short-toc-fp) {<DT><A HREF="http://www.elf.org">Source</A><DD>More information about these man pages.} - puts $manual(short-toc-fp) "</DL><HR><PRE>" + puts $manual(short-toc-fp) "<DT><A HREF=\"Keywords/[indexfile]\">Keywords</A><DD>The keywords from the $tcltkdesc man pages." + puts $manual(short-toc-fp) "</DL>" # insert merged copyrights - foreach copyright $manual(merge-copyrights) { - puts $manual(short-toc-fp) [copyright $copyright] - } - puts $manual(short-toc-fp) "</PRE></BODY></HTML>" + puts $manual(short-toc-fp) [copyout $manual(merge-copyrights)] + puts $manual(short-toc-fp) "</BODY></HTML>" close $manual(short-toc-fp) ## @@ -1699,22 +1782,25 @@ proc make-man-pages {html args} { incr ntoc } puts stderr "rescanning page $manual(name) $ntoc/$ntext" - set manual(outfp) [open $html/$manual(wing-file)/$manual(name).htm w] - puts $manual(outfp) "<HTML><HEAD><TITLE>$manual($manual(name)-title)</TITLE></HEAD><BODY>" - if {($ntext > 60) && ($ntoc > 32) || [lsearch -exact { + set outfd [open $html/$manual(wing-file)/$manual(name).htm w] + puts $outfd [htmlhead "$manual($manual(name)-title)" \ + $manual(name) \ + $manual(wing-file) "[indexfile]" \ + $overall_title "../[indexfile]"] + if {(($ntext > 60) && ($ntoc > 32)) || [lsearch -exact { Hash LinkVar SetVar TraceVar ConfigWidg CrtImgType CrtItemType CrtPhImgFmt DoOneEvent GetBitmap GetColor GetCursor GetDash GetJustify GetPixels GetVisual ParseArgv QueueEvent } $manual(tail)] >= 0} { foreach item $toc { - puts $manual(outfp) $item + puts $outfd $item } } foreach item $text { - puts $manual(outfp) [insert-cross-references $item] + puts $outfd [insert-cross-references $item] } - puts $manual(outfp) "</BODY></HTML>" - close $manual(outfp) + puts $outfd "</BODY></HTML>" + close $outfd } return {} } diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index a6ec0e4..383034a 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.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: tclUnixPipe.c,v 1.38 2007/04/02 18:48:04 dgp Exp $ + * RCS: @(#) $Id: tclUnixPipe.c,v 1.38.2.1 2007/06/21 16:04:57 dgp Exp $ */ #include "tclInt.h" @@ -485,8 +485,8 @@ TclpCreateProcess( for (i = 0; i < argc; i++) { Tcl_DStringFree(&dsArray[i]); } - TclStackFree(interp); /* newArgv */ - TclStackFree(interp); /* dsArray */ + TclStackFree(interp, newArgv); + TclStackFree(interp, dsArray); if (pid == -1) { Tcl_AppendResult(interp, "couldn't fork child process: ", |