01: /*
02: * ImportedCmdData.java
03: *
04: * An ImportedCmdData instance is used as the Command implementation
05: * (the cmd member of the WrappedCommand class).
06: *
07: * Copyright (c) 1999 Mo DeJong.
08: *
09: * See the file "license.terms" for information on usage and
10: * redistribution of this file, and for a DISCLAIMER OF ALL
11: * WARRANTIES.
12: *
13: * RCS: @(#) $Id: ImportedCmdData.java,v 1.2 2005/09/12 00:00:50 mdejong Exp $
14: */
15:
16: package tcl.lang;
17:
18: /**
19: * Class which is used as the Command implementation inside a WrappedCommand
20: * that has been imported into another namespace. The cmd member of a Wrapped
21: * command will be set to an instance of this class when a command is imported.
22: * From this ImportedCmdData reference, we can find the "real" command from
23: * another namespace.
24: */
25:
26: class ImportedCmdData implements Command, CommandWithDispose {
27: WrappedCommand realCmd; // "Real" command that this imported command
28: // refers to.
29: WrappedCommand self; // Pointer to this imported WrappedCommand. Needed
30:
31: // only when deleting it in order to remove
32: // it from the real command's linked list of
33: // imported commands that refer to it.
34:
35: public String toString() {
36: return "ImportedCmd for " + realCmd;
37: }
38:
39: /**
40: * Called when the command is invoked in the interp.
41: */
42:
43: public void cmdProc(Interp interp, // The interpreter for setting result etc.
44: TclObject[] objv) // The argument list for the command.
45: throws TclException {
46: Namespace.invokeImportedCmd(interp, this , objv);
47: }
48:
49: /**
50: * Called when the command is deleted from the interp.
51: */
52:
53: public void disposeCmd() {
54: Namespace.deleteImportedCmd(this);
55: }
56: }
|