rem: ISaveIdx, IUpdateIdx, IOnCreateIdx, IOnCleanupIdx, IOnInitIdx
add: ISaveIdx, IUpdateIdx, IOnCreateIdx, IOnCleanupIdx, IOnInitIdx, IOnDeleteIdx
context: NsTclICtlObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj **objv){    Defer    	*deferPtr;    NsInterp *itPtr = arg;    static CONST char *opts[] = {	"addmodule", "cleanup", "epoch", "get", "getmodules", "save",	"update", "oncreate", "oncleanup", "oninit", NULL    };    enum {	IAddModuleIdx, ICleanupIdx, IEpochIdx, IGetIdx, IGetModulesIdx,	ISaveIdx, IUpdateIdx, IOnCreateIdx, IOnCleanupIdx, IOnInitIdx    } opt;    char *script;    int length, result;    int status;    Tcl_Obj   *objPtr;    if (objc < 2) {        Tcl_WrongNumArgs(interp, 1, objv, "option ?arg?");	return TCL_ERROR;    }    if (Tcl_GetIndexFromObj(interp, objv[1], opts, "option", 0,			    (int *) &opt) != TCL_OK) {	return TCL_ERROR;    }    result = TCL_OK;    switch (opt) {    case IAddModuleIdx:	if (objc != 3) {            Tcl_WrongNumArgs(interp, 2, objv, "module");	    return TCL_ERROR;	}	if (Tcl_ListObjAppendElement(interp, itPtr->servPtr->tcl.modules,				     objv[2]) != TCL_OK) {	    return TCL_ERROR;	}	Tcl_SetObjResult(interp, itPtr->servPtr->tcl.modules);	break;    case IGetModulesIdx:	if (objc != 2) {            Tcl_WrongNumArgs(interp, 2, objv, NULL);	    return TCL_ERROR;	}	Tcl_SetObjResult(interp, itPtr->servPtr->tcl.modules);	break;    case IGetIdx:	if (objc != 2) {            Tcl_WrongNumArgs(interp, 2, objv, NULL);	    return TCL_ERROR;	}	Ns_RWLockRdLock(&itPtr->servPtr->tcl.lock);	Tcl_SetResult(interp, itPtr->servPtr->tcl.script, TCL_VOLATILE);	Ns_RWLockUnlock(&itPtr->servPtr->tcl.lock);	break;    case IEpochIdx:	if (objc != 2) {            Tcl_WrongNumArgs(interp, 2, objv, NULL);	    return TCL_ERROR;	}	Ns_RWLockRdLock(&itPtr->servPtr->tcl.lock);	Tcl_SetIntObj(Tcl_GetObjResult(interp), itPtr->servPtr->tcl.epoch);	Ns_RWLockUnlock(&itPtr->servPtr->tcl.lock);	break;       case ISaveIdx:	if (objc != 3) {            Tcl_WrongNumArgs(interp, 2, objv, "script");	    return TCL_ERROR;    	}	script = ns_strdup(Tcl_GetStringFromObj(objv[2], &length));	Ns_RWLockWrLock(&itPtr->servPtr->tcl.lock);	ns_free(itPtr->servPtr->tcl.script);	itPtr->servPtr->tcl.script = script;	itPtr->servPtr->tcl.length = length;	if (++itPtr->servPtr->tcl.epoch == 0) {	    /* NB: Epoch zero reserved for new interps. */	    ++itPtr->servPtr->tcl.epoch;	}	Ns_RWLockUnlock(&itPtr->servPtr->tcl.lock);	break;    case IUpdateIdx:	if (objc != 2) {            Tcl_WrongNumArgs(interp, 2, objv, NULL);	    return TCL_ERROR;	}	result = UpdateInterp(itPtr);	break;    case ICleanupIdx:	if (objc != 2) {            Tcl_WrongNumArgs(interp, 2, objv, NULL);	    return TCL_ERROR;	}	RunTraces(itPtr, TRACE_CLEANUP);    	while ((deferPtr = itPtr->firstDeferPtr) != NULL) {	    itPtr->firstDeferPtr = deferPtr->nextPtr;	    (*deferPtr->proc)(interp, deferPtr->arg);	    ns_free(deferPtr);	}    	NsFreeAtClose(itPtr);	break;    case IOnCreateIdx:    case IOnCleanupIdx:    case IOnInitIdx:        if (objc != 3) {            Tcl_WrongNumArgs(interp, 1, objv, "when script");	    return TCL_ERROR;        }        objPtr = objv[2];        Tcl_IncrRefCount(objPtr);        switch (opt) {        case IOnCreateIdx:            status = Ns_TclRegisterAtCreate(TclScriptTraceCB, objPtr);            break;        case IOnCleanupIdx:            status = Ns_TclRegisterAtCreate(TclScriptTraceCB, objPtr);            break;        case IOnInitIdx:            status = Ns_TclInitInterps(itPtr->servPtr->server,                                        TclInitScriptCB, objPtr);            break;        default:            status = NS_ERROR;            break;        }        if( status != NS_OK ) {            Tcl_AppendResult(interp, "Failed ", opts[opt], "-time registration", NULL );            /*             * There is a restriction imposed from the Ns_TclRegisterAtxx             * funcs that this can only be called during server init.             * Check for this case, so that I can produce a reasonable              * diagnostic.             */            if( (opt != IOnInitIdx) && (NsGetInitServer() == NULL) ) {                Tcl_AppendResult(interp,                                 ", this can only be used during server init.",                                 NULL );            }            Tcl_DecrRefCount(objPtr);            result = TCL_ERROR;        } else {            result = TCL_OK;        }        break;    }    return result;}