summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-09-29 14:37:13 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-09-29 14:37:13 (GMT)
commitda7765230338186675e0f6ccbfba67efa4b88625 (patch)
treef06c23ff0f1c69d9401df1b4a24919018fc717a6 /generic/tclBasic.c
parentc5c73ec317fce63210aedd53ebda27ebef52bcc3 (diff)
downloadtcl-da7765230338186675e0f6ccbfba67efa4b88625.zip
tcl-da7765230338186675e0f6ccbfba67efa4b88625.tar.gz
tcl-da7765230338186675e0f6ccbfba67efa4b88625.tar.bz2
TIP#112 ([namespace ensemble] command) implementation.
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 30e2165..8c1b739 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.86 2003/08/11 13:26:13 dkf Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.87 2003/09/29 14:37:14 dkf Exp $
*/
#include "tclInt.h"
@@ -1252,6 +1252,14 @@ Tcl_HideCommand(interp, cmdName, hiddenCmdToken)
}
/*
+ * The list of command exported from the namespace might have
+ * changed. However, we do not need to recompute this just yet;
+ * next time we need the info will be soon enough.
+ */
+
+ TclInvalidateNsCmdLookup(cmdPtr->nsPtr);
+
+ /*
* Now link the hash table entry with the command structure.
* We ensured above that the nsPtr was right.
*/
@@ -1381,6 +1389,14 @@ Tcl_ExposeCommand(interp, hiddenCmdToken, cmdName)
}
/*
+ * The list of command exported from the namespace might have
+ * changed. However, we do not need to recompute this just yet;
+ * next time we need the info will be soon enough.
+ */
+
+ TclInvalidateNsCmdLookup(nsPtr);
+
+ /*
* Remove the hash entry for the command from the interpreter hidden
* command table.
*/
@@ -1519,6 +1535,14 @@ Tcl_CreateCommand(interp, cmdName, proc, clientData, deleteProc)
ckfree((char*) Tcl_GetHashValue(hPtr));
}
+ } else {
+ /*
+ * The list of command exported from the namespace might have
+ * changed. However, we do not need to recompute this just
+ * yet; next time we need the info will be soon enough.
+ */
+
+ TclInvalidateNsCmdLookup(nsPtr);
}
cmdPtr = (Command *) ckalloc(sizeof(Command));
Tcl_SetHashValue(hPtr, cmdPtr);
@@ -1681,6 +1705,14 @@ Tcl_CreateObjCommand(interp, cmdName, proc, clientData, deleteProc)
ckfree((char *) Tcl_GetHashValue(hPtr));
}
+ } else {
+ /*
+ * The list of command exported from the namespace might have
+ * changed. However, we do not need to recompute this just
+ * yet; next time we need the info will be soon enough.
+ */
+
+ TclInvalidateNsCmdLookup(nsPtr);
}
cmdPtr = (Command *) ckalloc(sizeof(Command));
Tcl_SetHashValue(hPtr, cmdPtr);
@@ -2019,6 +2051,16 @@ TclRenameCommand(interp, oldName, newName)
}
/*
+ * The list of command exported from the namespace might have
+ * changed. However, we do not need to recompute this just yet;
+ * next time we need the info will be soon enough. These might
+ * refer to the same variable, but that's no big deal.
+ */
+
+ TclInvalidateNsCmdLookup(cmdNsPtr);
+ TclInvalidateNsCmdLookup(cmdPtr->nsPtr);
+
+ /*
* Script for rename traces can delete the command "oldName".
* Therefore increment the reference count for cmdPtr so that
* it's Command structure is freed only towards the end of this
@@ -2463,7 +2505,15 @@ Tcl_DeleteCommandFromToken(interp, cmd)
}
cmdPtr->tracePtr = NULL;
}
-
+
+ /*
+ * The list of command exported from the namespace might have
+ * changed. However, we do not need to recompute this just yet;
+ * next time we need the info will be soon enough.
+ */
+
+ TclInvalidateNsCmdLookup(cmdPtr->nsPtr);
+
/*
* If the command being deleted has a compile procedure, increment the
* interpreter's compileEpoch to invalidate its compiled code. This