01: /*
02: * UnsetCmd.java
03: *
04: * Copyright (c) 1997 Cornell University.
05: * Copyright (c) 1997 Sun Microsystems, Inc.
06: *
07: * See the file "license.terms" for information on usage and
08: * redistribution of this file, and for a DISCLAIMER OF ALL
09: * WARRANTIES.
10: *
11: * RCS: @(#) $Id: UnsetCmd.java,v 1.2 1999/07/28 03:28:52 mo Exp $
12: *
13: */
14:
15: package tcl.lang;
16:
17: import java.util.*;
18:
19: /**
20: * This class implements the built-in "unset" command in Tcl.
21: */
22:
23: class UnsetCmd implements Command {
24: /**
25: * Tcl_UnsetObjCmd -> UnsetCmd.cmdProc
26: *
27: * Unsets Tcl variable (s). See Tcl user documentation * for
28: * details.
29: * @exception TclException If tries to unset a variable that does
30: * not exist.
31: */
32:
33: public void cmdProc(Interp interp, TclObject[] objv)
34: throws TclException {
35: if (objv.length < 2) {
36: throw new TclNumArgsException(interp, 1, objv,
37: "varName ?varName ...?");
38: }
39:
40: for (int i = 1; i < objv.length; i++) {
41: interp.unsetVar(objv[i], 0);
42: }
43:
44: return;
45: }
46: }
|