From 637deeb6b06d8537fad1a71b97388b126b6d8cf6 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 2 Nov 2005 00:59:11 +0000 Subject: Partial ANSIfy --- generic/tclVar.c | 422 +++++++++++++++++++++++++++---------------------------- 1 file changed, 209 insertions(+), 213 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index 306ecd1..be81616 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.111 2005/10/19 18:39:58 dgp Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.112 2005/11/02 00:59:11 dkf Exp $ */ #include "tclInt.h" @@ -39,33 +39,31 @@ static CONST char *isArrayElement = "name refers to an element in an array"; /* - * Forward references to procedures defined later in this file: + * Forward references to functions defined later in this file: */ -static void DeleteSearches _ANSI_ARGS_((Var *arrayVarPtr)); -static void DeleteArray _ANSI_ARGS_((Interp *iPtr, - CONST char *arrayName, Var *varPtr, int flags)); -static int ObjMakeUpvar _ANSI_ARGS_((Tcl_Interp *interp, +static void DeleteSearches(Var *arrayVarPtr); +static void DeleteArray(Interp *iPtr, CONST char *arrayName, + Var *varPtr, int flags); +static int ObjMakeUpvar(Tcl_Interp *interp, CallFrame *framePtr, Tcl_Obj *otherP1Ptr, CONST char *otherP2, CONST int otherFlags, - CONST char *myName, int myFlags, int index)); -static Var * NewVar _ANSI_ARGS_((void)); -static ArraySearch * ParseSearchId _ANSI_ARGS_((Tcl_Interp *interp, - CONST Var *varPtr, CONST char *varName, - Tcl_Obj *handleObj)); -static int SetArraySearchObj _ANSI_ARGS_((Tcl_Interp *interp, - Tcl_Obj *objPtr)); + CONST char *myName, int myFlags, int index); +static Var * NewVar(void); +static ArraySearch * ParseSearchId(Tcl_Interp *interp, CONST Var *varPtr, + CONST char *varName, Tcl_Obj *handleObj); +static int SetArraySearchObj(Tcl_Interp *interp, Tcl_Obj *objPtr); /* * Functions defined in this file that may be exported in the future for use * by the bytecode compiler and engine or to the public interface. */ -Var * TclLookupSimpleVar _ANSI_ARGS_((Tcl_Interp *interp, - CONST char *varName, int flags, CONST int create, - CONST char **errMsgPtr, int *indexPtr)); -int TclObjUnsetVar2 _ANSI_ARGS_((Tcl_Interp *interp, - Tcl_Obj *part1Ptr, CONST char *part2, int flags)); +Var * TclLookupSimpleVar(Tcl_Interp *interp, + CONST char *varName, int flags, CONST int create, + CONST char **errMsgPtr, int *indexPtr); +int TclObjUnsetVar2(Tcl_Interp *interp, + Tcl_Obj *part1Ptr, CONST char *part2, int flags); static Tcl_DupInternalRepProc DupLocalVarName; static Tcl_FreeInternalRepProc FreeParsedVarName; @@ -143,7 +141,7 @@ Tcl_ObjType tclArraySearchType = { * * TclLookupVar -- * - * This procedure is used to locate a variable given its name(s). It has + * This function is used to locate a variable given its name(s). It has * been mostly superseded by TclObjLookupVar, it is now only used by the * string-based interfaces. It is kept in tcl8.4 mainly because it is in * the internal stubs table, so that some extension may be calling it. @@ -177,26 +175,25 @@ Tcl_ObjType tclArraySearchType = { */ Var * -TclLookupVar(interp, part1, part2, flags, msg, createPart1, createPart2, - arrayPtrPtr) - Tcl_Interp *interp; /* Interpreter to use for lookup. */ - CONST char *part1; /* If part2 isn't NULL, this is the name of an +TclLookupVar( + Tcl_Interp *interp, /* Interpreter to use for lookup. */ + CONST char *part1, /* If part2 isn't NULL, this is the name of an * array. Otherwise, this is a full variable * name that could include a parenthesized * array element. */ - CONST char *part2; /* Name of element within array, or NULL. */ - int flags; /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, + CONST char *part2, /* Name of element within array, or NULL. */ + int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * and TCL_LEAVE_ERR_MSG bits matter. */ - CONST char *msg; /* Verb to use in error messages, e.g. "read" + CONST char *msg, /* Verb to use in error messages, e.g. "read" * or "set". Only needed if TCL_LEAVE_ERR_MSG * is set in flags. */ - int createPart1; /* If 1, create hash table entry for part 1 of + int createPart1, /* If 1, create hash table entry for part 1 of * name, if it doesn't already exist. If 0, * return error if it doesn't exist. */ - int createPart2; /* If 1, create hash table entry for part 2 of + int createPart2, /* If 1, create hash table entry for part 2 of * name, if it doesn't already exist. If 0, * return error if it doesn't exist. */ - Var **arrayPtrPtr; /* If the name refers to an element of an + Var **arrayPtrPtr) /* If the name refers to an element of an * array, *arrayPtrPtr gets filled in with * address of array variable. Otherwise this * is set to NULL. */ @@ -204,10 +201,10 @@ TclLookupVar(interp, part1, part2, flags, msg, createPart1, createPart2, Var *varPtr; CONST char *elName; /* Name of array element or NULL; may be same * as part2, or may be openParen+1. */ - int openParen, closeParen; /* If this procedure parses a name into array + int openParen, closeParen; /* If this function parses a name into array * and index, these are the offsets to the - * parens around the index. Otherwise they - * are -1. */ + * parens around the index. Otherwise they are + * -1. */ register CONST char *p; CONST char *errMsg = NULL; int index; @@ -291,7 +288,7 @@ TclLookupVar(interp, part1, part2, flags, msg, createPart1, createPart2, * * TclObjLookupVar -- * - * This procedure is used by virtually all of the variable code to locate + * This function is used by virtually all of the variable code to locate * a variable given its name(s). The parsing into array/element * components and (if possible) the lookup results are cached in * part1Ptr, which is converted to one of the varNameTypes. @@ -327,26 +324,25 @@ TclLookupVar(interp, part1, part2, flags, msg, createPart1, createPart2, */ Var * -TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, - arrayPtrPtr) - Tcl_Interp *interp; /* Interpreter to use for lookup. */ - register Tcl_Obj *part1Ptr; /* If part2 isn't NULL, this is the name of an +TclObjLookupVar( + Tcl_Interp *interp, /* Interpreter to use for lookup. */ + register Tcl_Obj *part1Ptr, /* If part2 isn't NULL, this is the name of an * array. Otherwise, this is a full variable * name that could include a parenthesized * array element. */ - CONST char *part2; /* Name of element within array, or NULL. */ - int flags; /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, + CONST char *part2, /* Name of element within array, or NULL. */ + int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * and TCL_LEAVE_ERR_MSG bits matter. */ - CONST char *msg; /* Verb to use in error messages, e.g. "read" + CONST char *msg, /* Verb to use in error messages, e.g. "read" * or "set". Only needed if TCL_LEAVE_ERR_MSG * is set in flags. */ - CONST int createPart1; /* If 1, create hash table entry for part 1 of + CONST int createPart1, /* If 1, create hash table entry for part 1 of * name, if it doesn't already exist. If 0, * return error if it doesn't exist. */ - CONST int createPart2; /* If 1, create hash table entry for part 2 of + CONST int createPart2, /* If 1, create hash table entry for part 2 of * name, if it doesn't already exist. If 0, * return error if it doesn't exist. */ - Var **arrayPtrPtr; /* If the name refers to an element of an + Var **arrayPtrPtr) /* If the name refers to an element of an * array, *arrayPtrPtr gets filled in with * address of array variable. Otherwise this * is set to NULL. */ @@ -432,8 +428,10 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, (varFramePtr && !(varFramePtr->isProcCallFrame & FRAME_IS_PROC) && !(flags & TCL_GLOBAL_ONLY) && - /* Careful: an undefined ns variable could be hiding a valid - * global reference. */ + /* + * Careful: an undefined ns variable could be hiding a valid + * global reference. + */ !TclIsVarUndefined(varPtr)))); if (useReference && (varPtr->hPtr != NULL)) { @@ -507,8 +505,8 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, TclNewStringObj(part1Ptr, part1, len1); Tcl_IncrRefCount(part1Ptr); - objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) part1Ptr; - objPtr->internalRep.twoPtrValue.ptr2 = (VOID *) part2; + objPtr->internalRep.twoPtrValue.ptr1 = (void *) part1Ptr; + objPtr->internalRep.twoPtrValue.ptr2 = (void *) part2; typePtr = part1Ptr->typePtr; part1 = TclGetString(part1Ptr); @@ -557,8 +555,8 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, nsPtr = ((index == -1)? iPtr->globalNsPtr : varFramePtr->nsPtr); varPtr->refCount++; part1Ptr->typePtr = &tclNsVarNameType; - part1Ptr->internalRep.twoPtrValue.ptr1 = (VOID *) nsPtr; - part1Ptr->internalRep.twoPtrValue.ptr2 = (VOID *) varPtr; + part1Ptr->internalRep.twoPtrValue.ptr1 = (void *) nsPtr; + part1Ptr->internalRep.twoPtrValue.ptr2 = (void *) varPtr; #endif } else { /* @@ -617,7 +615,7 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, * * TclLookupSimpleVar -- * - * This procedure is used by to locate a simple variable (i.e., not an + * This function is used by to locate a simple variable (i.e., not an * array element) given its name. * * Results: @@ -655,18 +653,18 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, */ Var * -TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) - Tcl_Interp *interp; /* Interpreter to use for lookup. */ - CONST char *varName; /* This is a simple variable name that could +TclLookupSimpleVar( + Tcl_Interp *interp, /* Interpreter to use for lookup. */ + CONST char *varName, /* This is a simple variable name that could * represent a scalar or an array. */ - int flags; /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, + int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * LOOKUP_FOR_UPVAR and TCL_LEAVE_ERR_MSG bits * matter. */ - CONST int create; /* If 1, create hash table entry for varname, + CONST int create, /* If 1, create hash table entry for varname, * if it doesn't already exist. If 0, return * error if it doesn't exist. */ - CONST char **errMsgPtr; - int *indexPtr; + CONST char **errMsgPtr, + int *indexPtr) { Interp *iPtr = (Interp *) interp; CallFrame *varFramePtr = iPtr->varFramePtr; @@ -696,7 +694,7 @@ TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) /* * If this namespace has a variable resolver, then give it first crack at - * the variable resolution. It may return a Tcl_Var value, it may signal + * the variable resolution. It may return a Tcl_Var value, it may signal * to continue onward, or it may signal an error. */ @@ -727,7 +725,7 @@ TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) /* * Look up varName. Look it up as either a namespace variable or as a - * local variable in a procedure call frame (varFramePtr). Interpret + * local variable in a procedure call frame (varFramePtr). Interpret * varName as a namespace variable if: * 1) so requested by a TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY flag, * 2) there is no active frame (we're at the global :: scope), @@ -778,7 +776,7 @@ TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) } if (varPtr == NULL) { - if (create) { /* var wasn't found so create it */ + if (create) { /* var wasn't found so create it */ TclGetNamespaceForQualName(interp, varName, cxtNsPtr, flags, &varNsPtr, &dummy1Ptr, &dummy2Ptr, &tail); if (varNsPtr == NULL) { @@ -817,7 +815,7 @@ TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) Var *localVarPtr = varFramePtr->compiledLocals; int varNameLen = strlen(varName); - for (i = 0; i < localCt; i++) { + for (i=0 ; iname; if ((varName[0] == localName[0]) @@ -867,7 +865,7 @@ TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) * * TclLookupArrayElement -- * - * This procedure is used to locate a variable which is in an array's + * This function is used to locate a variable which is in an array's * hashtable given a pointer to the array's Var structure and the * element's name. * @@ -900,22 +898,22 @@ TclLookupSimpleVar(interp, varName, flags, create, errMsgPtr, indexPtr) */ Var * -TclLookupArrayElement(interp, arrayName, elName, flags, msg, createArray, createElem, arrayPtr) - Tcl_Interp *interp; /* Interpreter to use for lookup. */ - CONST char *arrayName; /* This is the name of the array. */ - CONST char *elName; /* Name of element within array. */ - CONST int flags; /* Only TCL_LEAVE_ERR_MSG bit matters. */ - CONST char *msg; /* Verb to use in error messages, e.g. "read" +TclLookupArrayElement( + Tcl_Interp *interp, /* Interpreter to use for lookup. */ + CONST char *arrayName, /* This is the name of the array. */ + CONST char *elName, /* Name of element within array. */ + CONST int flags, /* Only TCL_LEAVE_ERR_MSG bit matters. */ + CONST char *msg, /* Verb to use in error messages, e.g. "read" * or "set". Only needed if TCL_LEAVE_ERR_MSG * is set in flags. */ - CONST int createArray; /* If 1, transform arrayName to be an array if + CONST int createArray, /* If 1, transform arrayName to be an array if * it isn't one yet and the transformation is * possible. If 0, return error if it isn't * already an array. */ - CONST int createElem; /* If 1, create hash table entry for the + CONST int createElem, /* If 1, create hash table entry for the * element, if it doesn't already exist. If 0, * return error if it doesn't exist. */ - Var *arrayPtr; /* Pointer to the array's Var structure. */ + Var *arrayPtr) /* Pointer to the array's Var structure. */ { Tcl_HashEntry *hPtr; int new; @@ -1013,7 +1011,7 @@ Tcl_GetVar(interp, varName, flags) * TCL_NAMESPACE_ONLY or TCL_LEAVE_ERR_MSG * bits. */ { - return Tcl_GetVar2(interp, varName, (char *) NULL, flags); + return Tcl_GetVar2(interp, varName, NULL, flags); } /* @@ -1259,7 +1257,7 @@ TclPtrGetVar(interp, varPtr, arrayPtr, part1, part2, flags) * * Tcl_SetObjCmd -- * - * This procedure is invoked to process the "set" Tcl command. See the + * This function is invoked to process the "set" Tcl command. See the * user documentation for details on what it does. * * Results: @@ -1337,7 +1335,7 @@ Tcl_SetVar(interp, varName, newValue, flags) * TCL_APPEND_VALUE, TCL_LIST_ELEMENT, * TCL_LEAVE_ERR_MSG. */ { - return Tcl_SetVar2(interp, varName, (char *) NULL, newValue, flags); + return Tcl_SetVar2(interp, varName, NULL, newValue, flags); } /* @@ -1568,7 +1566,7 @@ TclPtrSetVar(interp, varPtr, arrayPtr, part1, part2, newValuePtr, flags) /* * If the variable is in a hashtable and its hPtr field is NULL, then we * may have an upvar to an array element where the array was deleted or an - * upvar to a namespace variable whose namespace was deleted. Generate an + * upvar to a namespace variable whose namespace was deleted. Generate an * error (allowing the variable to be reset would screw up our storage * allocation and is meaningless anyway). */ @@ -1730,10 +1728,10 @@ TclPtrSetVar(interp, varPtr, arrayPtr, part1, part2, newValuePtr, flags) * * Results: * Returns a pointer to the Tcl_Obj holding the new value of the - * variable. If the specified variable doesn't exist, or there is a - * clash in array usage, or an error occurs while executing variable - * traces, then NULL is returned and a message will be left in the - * interpreter's result. + * variable. If the specified variable doesn't exist, or there is a clash + * in array usage, or an error occurs while executing variable traces, + * then NULL is returned and a message will be left in the interpreter's + * result. * * Side effects: * The value of the given variable is incremented by the specified @@ -1788,10 +1786,10 @@ TclIncrObjVar2(interp, part1Ptr, part2Ptr, incrPtr, flags) * * Results: * Returns a pointer to the Tcl_Obj holding the new value of the - * variable. If the specified variable doesn't exist, or there is a - * clash in array usage, or an error occurs while executing variable - * traces, then NULL is returned and a message will be left in the - * interpreter's result. + * variable. If the specified variable doesn't exist, or there is a clash + * in array usage, or an error occurs while executing variable traces, + * then NULL is returned and a message will be left in the interpreter's + * result. * * Side effects: * The value of the given variable is incremented by the specified @@ -1853,7 +1851,7 @@ TclPtrIncrObjVar(interp, varPtr, arrayPtr, part1, part2, incrPtr, flags) * * Results: * Returns TCL_OK if the variable was successfully deleted, TCL_ERROR if - * the variable can't be unset. In the event of an error, if the + * the variable can't be unset. In the event of an error, if the * TCL_LEAVE_ERR_MSG flag is set then an error message is left in the * interp's result. * @@ -1875,7 +1873,7 @@ Tcl_UnsetVar(interp, varName, flags) * TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY or * TCL_LEAVE_ERR_MSG. */ { - return Tcl_UnsetVar2(interp, varName, (char *) NULL, flags); + return Tcl_UnsetVar2(interp, varName, NULL, flags); } /* @@ -1887,13 +1885,13 @@ Tcl_UnsetVar(interp, varName, flags) * * Results: * Returns TCL_OK if the variable was successfully deleted, TCL_ERROR if - * the variable can't be unset. In the event of an error, if the + * the variable can't be unset. In the event of an error, if the * TCL_LEAVE_ERR_MSG flag is set then an error message is left in the * interp's result. * * Side effects: * If part1 and part2 indicate a local or global variable in interp, it - * is deleted. If part1 is an array name and part2 is NULL, then the + * is deleted. If part1 is an array name and part2 is NULL, then the * whole array is deleted. * *---------------------------------------------------------------------- @@ -1929,13 +1927,13 @@ Tcl_UnsetVar2(interp, part1, part2, flags) * * Results: * Returns TCL_OK if the variable was successfully deleted, TCL_ERROR if - * the variable can't be unset. In the event of an error, if the + * the variable can't be unset. In the event of an error, if the * TCL_LEAVE_ERR_MSG flag is set then an error message is left in the * interp's result. * * Side effects: * If part1ptr and part2Ptr indicate a local or global variable in - * interp, it is deleted. If part1Ptr is an array name and part2Ptr is + * interp, it is deleted. If part1Ptr is an array name and part2Ptr is * NULL, then the whole array is deleted. * *---------------------------------------------------------------------- @@ -1975,7 +1973,7 @@ TclObjUnsetVar2(interp, part1Ptr, part2, flags) /* * The code below is tricky, because of the possibility that a trace - * procedure might try to access a variable being deleted. To handle this + * function might try to access a variable being deleted. To handle this * situation gracefully, do things in three steps: * 1. Copy the contents of the variable to a dummy variable structure, and * mark the original Var structure as undefined. @@ -2002,7 +2000,7 @@ TclObjUnsetVar2(interp, part1Ptr, part2, flags) varPtr->refCount++; /* - * Call trace procedures for the variable being deleted. Then delete its + * Call trace functions for the variable being deleted. Then delete its * traces. Be sure to abort any other traces for the variable that are * still pending. Special tricks: * 1. We need to increment varPtr's refCount around this: TclCallVarTraces @@ -2022,7 +2020,7 @@ TclObjUnsetVar2(interp, part1Ptr, part2, flags) dummyVar.tracePtr = tracePtr->nextPtr; Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC); } - for (activePtr = iPtr->activeVarTracePtr; activePtr != NULL; + for (activePtr = iPtr->activeVarTracePtr; activePtr != NULL; activePtr = activePtr->nextPtr) { if (activePtr->varPtr == varPtr) { activePtr->nextTracePtr = NULL; @@ -2041,7 +2039,7 @@ TclObjUnsetVar2(interp, part1Ptr, part2, flags) if (TclIsVarArray(dummyVarPtr) && !TclIsVarUndefined(dummyVarPtr)) { /* * Deleting the elements of the array may cause traces to be fired on - * those elements. Before deleting them, bump the reference count of + * those elements. Before deleting them, bump the reference count of * the array, so that if those trace procs make a global or upvar link * to the array, the array is not deleted when the call stack gets * popped (we will delete the array ourselves later in this function). @@ -2055,7 +2053,10 @@ TclObjUnsetVar2(interp, part1Ptr, part2, flags) DeleteArray(iPtr, part1, dummyVarPtr, (flags & (TCL_GLOBAL_ONLY|TCL_NAMESPACE_ONLY)) | TCL_TRACE_UNSETS); - /* Decr ref count */ + + /* + * Decr ref count + */ } if (TclIsVarScalar(dummyVarPtr) && (dummyVarPtr->value.objPtr != NULL)) { @@ -2114,7 +2115,7 @@ TclObjUnsetVar2(interp, part1Ptr, part2, flags) * * Tcl_UnsetObjCmd -- * - * This object-based procedure is invoked to process the "unset" Tcl + * This object-based function is invoked to process the "unset" Tcl * command. See the user documentation for details on what it does. * * Results: @@ -2151,7 +2152,7 @@ Tcl_UnsetObjCmd(dummy, interp, objc, objv) } /* - * Simple, restrictive argument parsing. The only options are -- and + * Simple, restrictive argument parsing. The only options are -- and * -nocomplain (which must come first and be given exactly to be an * option). */ @@ -2172,7 +2173,7 @@ Tcl_UnsetObjCmd(dummy, interp, objc, objv) } } - for (; i < objc; i++) { + for (; i < objc; i++) { if ((TclObjUnsetVar2(interp, objv[i], NULL, flags) != TCL_OK) && (flags == TCL_LEAVE_ERR_MSG)) { return TCL_ERROR; @@ -2186,7 +2187,7 @@ Tcl_UnsetObjCmd(dummy, interp, objc, objv) * * Tcl_AppendObjCmd -- * - * This object-based procedure is invoked to process the "append" Tcl + * This object-based function is invoked to process the "append" Tcl * command. See the user documentation for details on what it does. * * Results: @@ -2231,7 +2232,7 @@ Tcl_AppendObjCmd(dummy, interp, objc, objv) if (varPtr == NULL) { return TCL_ERROR; } - for (i = 2; i < objc; i++) { + for (i=2 ; itracePtr != NULL) { Tcl_AppendResult((Tcl_Interp *) iPtr, "variable \"", myName, - "\" has traces: can't use for upvar", (char *) NULL); + "\" has traces: can't use for upvar", NULL); return TCL_ERROR; } else if (!TclIsVarUndefined(varPtr)) { /* @@ -3256,7 +3258,7 @@ ObjMakeUpvar(interp, framePtr, otherP1Ptr, otherP2, otherFlags, myName, } } else { Tcl_AppendResult((Tcl_Interp *) iPtr, "variable \"", myName, - "\" already exists", (char *) NULL); + "\" already exists", NULL); return TCL_ERROR; } } @@ -3272,11 +3274,11 @@ ObjMakeUpvar(interp, framePtr, otherP1Ptr, otherP2, otherFlags, myName, * * Tcl_UpVar -- * - * This procedure links one variable to another, just like the "upvar" + * This function links one variable to another, just like the "upvar" * command. * * Results: - * A standard Tcl completion code. If an error occurs then an error + * A standard Tcl completion code. If an error occurs then an error * message is left in the interp's result. * * Side effects: @@ -3308,11 +3310,11 @@ Tcl_UpVar(interp, frameName, varName, localName, flags) * * Tcl_UpVar2 -- * - * This procedure links one variable to another, just like the "upvar" + * This function links one variable to another, just like the "upvar" * command. * * Results: - * A standard Tcl completion code. If an error occurs then an error + * A standard Tcl completion code. If an error occurs then an error * message is left in the interp's result. * * Side effects: @@ -3325,7 +3327,7 @@ Tcl_UpVar(interp, frameName, varName, localName, flags) int Tcl_UpVar2(interp, frameName, part1, part2, localName, flags) - Tcl_Interp *interp; /* Interpreter containing variables. Used for + Tcl_Interp *interp; /* Interpreter containing variables. Used for * error messages too. */ CONST char *frameName; /* Name of the frame containing the source * variable, such as "1" or "#0". */ @@ -3358,7 +3360,7 @@ Tcl_UpVar2(interp, frameName, part1, part2, localName, flags) * * Tcl_GetVariableFullName -- * - * Given a Tcl_Var token returned by Tcl_FindNamespaceVar, this procedure + * Given a Tcl_Var token returned by Tcl_FindNamespaceVar, this function * appends to an object the namespace variable's full name, qualified by * a sequence of parent namespace names. * @@ -3412,7 +3414,7 @@ Tcl_GetVariableFullName(interp, variable, objPtr) * * Tcl_GlobalObjCmd -- * - * This object-based procedure is invoked to process the "global" Tcl + * This object-based function is invoked to process the "global" Tcl * command. See the user documentation for details on what it does. * * Results: @@ -3451,7 +3453,7 @@ Tcl_GlobalObjCmd(dummy, interp, objc, objv) return TCL_OK; } - for (i = 1; i < objc; i++) { + for (i=1 ; i varName) && ((*tail != ':') || (*(tail-1) != ':'))) { @@ -3479,9 +3481,8 @@ Tcl_GlobalObjCmd(dummy, interp, objc, objv) * Link to the variable "varName" in the global :: namespace. */ - result = ObjMakeUpvar(interp, (CallFrame *) NULL, - objPtr, NULL, /*otherFlags*/ TCL_GLOBAL_ONLY, - /*myName*/ tail, /*myFlags*/ 0, -1); + result = ObjMakeUpvar(interp, (CallFrame *) NULL, objPtr, NULL, + TCL_GLOBAL_ONLY, /*myName*/ tail, /*myFlags*/ 0, -1); if (result != TCL_OK) { return result; } @@ -3517,7 +3518,7 @@ Tcl_GlobalObjCmd(dummy, interp, objc, objv) * if anything goes wrong. * * Side effects: - * If anything goes wrong, this procedure returns an error message as the + * If anything goes wrong, this function returns an error message as the * result in the interpreter's result object. * *---------------------------------------------------------------------- @@ -3542,7 +3543,7 @@ Tcl_VariableObjCmd(dummy, interp, objc, objv) return TCL_ERROR; } - for (i = 1; i < objc; i = i+2) { + for (i=1 ; itypePtr = &tclArraySearchType; - objPtr->internalRep.twoPtrValue.ptr1 = (VOID *)(((char *)NULL) + id); - objPtr->internalRep.twoPtrValue.ptr2 = (VOID *)(((char *)NULL) + offset); + objPtr->internalRep.twoPtrValue.ptr1 = (void *)(((char *)NULL) + id); + objPtr->internalRep.twoPtrValue.ptr2 = (void *)(((char *)NULL) + offset); return TCL_OK; syntax: - Tcl_AppendResult(interp, "illegal search identifier \"", string, "\"", - (char *) NULL); + Tcl_AppendResult(interp, "illegal search identifier \"",string,"\"", NULL); return TCL_ERROR; } @@ -3813,12 +3812,12 @@ SetArraySearchObj(interp, objPtr) * * ParseSearchId -- * - * This procedure translates from a tcl object to a pointer to an active + * This function translates from a tcl object to a pointer to an active * array search (if there is one that matches the string). * * Results: * The return value is a pointer to the array search indicated by string, - * or NULL if there isn't one. If NULL is returned, the interp's result + * or NULL if there isn't one. If NULL is returned, the interp's result * contains an error message. * * Side effects: @@ -3829,12 +3828,12 @@ SetArraySearchObj(interp, objPtr) */ static ArraySearch * -ParseSearchId(interp, varPtr, varName, handleObj) - Tcl_Interp *interp; /* Interpreter containing variable. */ - CONST Var *varPtr; /* Array variable search is for. */ - CONST char *varName; /* Name of array variable that search is +ParseSearchId( + Tcl_Interp *interp, /* Interpreter containing variable. */ + CONST Var *varPtr, /* Array variable search is for. */ + CONST char *varName, /* Name of array variable that search is * supposed to be for. */ - Tcl_Obj *handleObj; /* Object containing id of search. Must have + Tcl_Obj *handleObj) /* Object containing id of search. Must have * form "search-num-var" where "num" is a * decimal number and "var" is a variable * name. */ @@ -3869,7 +3868,7 @@ ParseSearchId(interp, varPtr, varName, handleObj) if (strcmp(string+offset, varName) != 0) { Tcl_AppendResult(interp, "search identifier \"", string, - "\" isn't for variable \"", varName, "\"", (char *) NULL); + "\" isn't for variable \"", varName, "\"", NULL); return NULL; } @@ -3888,8 +3887,7 @@ ParseSearchId(interp, varPtr, varName, handleObj) return searchPtr; } } - Tcl_AppendResult(interp, "couldn't find search \"", string, "\"", - (char *) NULL); + Tcl_AppendResult(interp, "couldn't find search \"", string, "\"", NULL); return NULL; } @@ -3898,7 +3896,7 @@ ParseSearchId(interp, varPtr, varName, handleObj) * * DeleteSearches -- * - * This procedure is called to free up all of the searches associated + * This function is called to free up all of the searches associated * with an array variable. * * Results: @@ -3911,8 +3909,8 @@ ParseSearchId(interp, varPtr, varName, handleObj) */ static void -DeleteSearches(arrayVarPtr) - register Var *arrayVarPtr; /* Variable whose searches are to be +DeleteSearches( + register Var *arrayVarPtr) /* Variable whose searches are to be * deleted. */ { ArraySearch *searchPtr; @@ -3929,16 +3927,16 @@ DeleteSearches(arrayVarPtr) * * TclDeleteVars -- * - * This procedure is called to recycle all the storage space associated - * with a table of variables. For this procedure to work correctly, it + * This function is called to recycle all the storage space associated + * with a table of variables. For this function to work correctly, it * must not be possible for any of the variables in the table to be - * accessed from Tcl commands (e.g. from trace procedures). + * accessed from Tcl commands (e.g. from trace functions). * * Results: * None. * * Side effects: - * Variables are deleted and trace procedures are invoked, if any are + * Variables are deleted and trace functions are invoked, if any are * declared. * *---------------------------------------------------------------------- @@ -3961,7 +3959,7 @@ TclDeleteVars(iPtr, tablePtr) Namespace *currNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp); /* - * Determine what flags to pass to the trace callback procedures. + * Determine what flags to pass to the trace callback functions. */ flags = TCL_TRACE_UNSETS; @@ -3974,7 +3972,7 @@ TclDeleteVars(iPtr, tablePtr) flags |= TCL_INTERP_DESTROYED; } - for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr != NULL; + for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { varPtr = (Var *) Tcl_GetHashValue(hPtr); @@ -4007,7 +4005,7 @@ TclDeleteVars(iPtr, tablePtr) * we're dealing with a global variable: the hash entries will be * deleted automatically when the whole table is deleted). Note that * we give TclCallVarTraces the variable's fully-qualified name so - * that any called trace procedures can refer to these variables being + * that any called trace functions can refer to these variables being * deleted. */ @@ -4015,8 +4013,8 @@ TclDeleteVars(iPtr, tablePtr) TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); /* until done with traces */ Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, objPtr); - TclCallVarTraces(iPtr, (Var *) NULL, varPtr, TclGetString(objPtr), - NULL, flags, /* leaveErrMsg */ 0); + TclCallVarTraces(iPtr, NULL, varPtr, TclGetString(objPtr), NULL, + flags, /* leaveErrMsg */ 0); TclDecrRefCount(objPtr); /* free no longer needed obj */ while (varPtr->tracePtr != NULL) { @@ -4075,18 +4073,18 @@ TclDeleteVars(iPtr, tablePtr) * * TclDeleteCompiledLocalVars -- * - * This procedure is called to recycle storage space associated with the + * This function is called to recycle storage space associated with the * compiler-allocated array of local variables in a procedure call frame. - * This procedure resembles TclDeleteVars above except that each variable - * is stored in a call frame and not a hash table. For this procedure to + * This function resembles TclDeleteVars above except that each variable + * is stored in a call frame and not a hash table. For this function to * work correctly, it must not be possible for any of the variable in the - * table to be accessed from Tcl commands (e.g. from trace procedures). + * table to be accessed from Tcl commands (e.g. from trace functions). * * Results: * None. * * Side effects: - * Variables are deleted and trace procedures are invoked, if any are + * Variables are deleted and trace functions are invoked, if any are * declared. * *---------------------------------------------------------------------- @@ -4099,7 +4097,7 @@ TclDeleteCompiledLocalVars(iPtr, framePtr) * assigned local variables to delete. */ { register Var *varPtr; - int flags; /* Flags passed to trace procedures. */ + int flags; /* Flags passed to trace functions. */ Var *linkPtr; ActiveVarTrace *activePtr; int numLocals, i; @@ -4107,7 +4105,7 @@ TclDeleteCompiledLocalVars(iPtr, framePtr) flags = TCL_TRACE_UNSETS; numLocals = framePtr->numCompiledLocals; varPtr = framePtr->compiledLocals; - for (i = 0; i < numLocals; i++) { + for (i=0 ; itracePtr != NULL) { - TclCallVarTraces(iPtr, (Var *) NULL, varPtr, varPtr->name, NULL, - flags, /* leaveErrMsg */ 0); + TclCallVarTraces(iPtr, NULL, varPtr, varPtr->name, NULL, flags, + /* leaveErrMsg */ 0); while (varPtr->tracePtr != NULL) { VarTrace *tracePtr = varPtr->tracePtr; varPtr->tracePtr = tracePtr->nextPtr; @@ -4178,16 +4176,16 @@ TclDeleteCompiledLocalVars(iPtr, framePtr) * * DeleteArray -- * - * This procedure is called to free up everything in an array variable. + * This function is called to free up everything in an array variable. * It's the caller's responsibility to make sure that the array is no - * longer accessible before this procedure is called. + * longer accessible before this function is called. * * Results: * None. * * Side effects: * All storage associated with varPtr's array elements is deleted - * (including the array's hash table). Deletion trace procedures for + * (including the array's hash table). Deletion trace functions for * array elements are invoked, then deleted. Any pending traces for array * elements are also deleted. * @@ -4195,12 +4193,11 @@ TclDeleteCompiledLocalVars(iPtr, framePtr) */ static void -DeleteArray(iPtr, arrayName, varPtr, flags) - Interp *iPtr; /* Interpreter containing array. */ - CONST char *arrayName; /* Name of array (used for trace - * callbacks). */ - Var *varPtr; /* Pointer to variable structure. */ - int flags; /* Flags to pass to TclCallVarTraces: +DeleteArray( + Interp *iPtr, /* Interpreter containing array. */ + CONST char *arrayName, /* Name of array (used for trace callbacks) */ + Var *varPtr, /* Pointer to variable structure. */ + int flags) /* Flags to pass to TclCallVarTraces: * TCL_TRACE_UNSETS and sometimes * TCL_INTERP_DESTROYED, TCL_NAMESPACE_ONLY, * or TCL_GLOBAL_ONLY. */ @@ -4223,7 +4220,7 @@ DeleteArray(iPtr, arrayName, varPtr, flags) elPtr->hPtr = NULL; if (elPtr->tracePtr != NULL) { elPtr->flags &= ~VAR_TRACE_ACTIVE; - TclCallVarTraces(iPtr, (Var *) NULL, elPtr, arrayName, + TclCallVarTraces(iPtr, NULL, elPtr, arrayName, Tcl_GetHashKey(varPtr->value.tablePtr, hPtr), flags, /* leaveErrMsg */ 0); while (elPtr->tracePtr != NULL) { @@ -4266,10 +4263,10 @@ DeleteArray(iPtr, arrayName, varPtr, flags) * * TclCleanupVar -- * - * This procedure is called when it looks like it may be OK to free up a + * This function is called when it looks like it may be OK to free up a * variable's storage. If the variable is in a hashtable, its Var * structure and hash table entry will be freed along with those of its - * containing array, if any. This procedure is called, for example, when + * containing array, if any. This function is called, for example, when * a trace on a variable deletes a variable. * * Results: @@ -4338,12 +4335,11 @@ TclVarErrMsg(interp, part1, part2, operation, reason) CONST char *reason; /* String describing why operation failed. */ { Tcl_ResetResult(interp); - Tcl_AppendResult(interp, "can't ", operation, " \"", part1, - (char *) NULL); + Tcl_AppendResult(interp, "can't ", operation, " \"", part1, NULL); if (part2 != NULL) { - Tcl_AppendResult(interp, "(", part2, ")", (char *) NULL); + Tcl_AppendResult(interp, "(", part2, ")", NULL); } - Tcl_AppendResult(interp, "\": ", reason, (char *) NULL); + Tcl_AppendResult(interp, "\": ", reason, NULL); } /* @@ -4421,8 +4417,8 @@ DupNsVarName(srcPtr, dupPtr) Namespace *nsPtr = (Namespace *) srcPtr->internalRep.twoPtrValue.ptr1; register Var *varPtr = (Var *) srcPtr->internalRep.twoPtrValue.ptr2; - dupPtr->internalRep.twoPtrValue.ptr1 = (VOID *) nsPtr; - dupPtr->internalRep.twoPtrValue.ptr2 = (VOID *) varPtr; + dupPtr->internalRep.twoPtrValue.ptr1 = (void *) nsPtr; + dupPtr->internalRep.twoPtrValue.ptr2 = (void *) varPtr; varPtr->refCount++; dupPtr->typePtr = &tclNsVarNameType; } @@ -4471,8 +4467,8 @@ DupParsedVarName(srcPtr, dupPtr) elem = elemCopy; } - dupPtr->internalRep.twoPtrValue.ptr1 = (VOID *) arrayPtr; - dupPtr->internalRep.twoPtrValue.ptr2 = (VOID *) elem; + dupPtr->internalRep.twoPtrValue.ptr1 = (void *) arrayPtr; + dupPtr->internalRep.twoPtrValue.ptr2 = (void *) elem; dupPtr->typePtr = &tclParsedVarNameType; } @@ -4507,7 +4503,7 @@ UpdateParsedVarName(objPtr) memcpy(p, part2, (unsigned int) len2); p += len2; *p++ = ')'; - *p = '\0'; + *p = '\0'; } /* -- cgit v0.12