01: /*
02: * ListCmd.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: ListCmd.java,v 1.2 2006/01/13 03:40:11 mdejong Exp $
12: *
13: */
14:
15: package tcl.lang;
16:
17: /**
18: * This class implements the built-in "list" command in Tcl.
19: */
20: class ListCmd implements Command {
21:
22: /**
23: * See Tcl user documentation for details.
24: */
25: public void cmdProc(Interp interp, TclObject argv[])
26: throws TclException {
27: TclObject list = TclList.newInstance();
28:
29: try {
30: for (int i = 1; i < argv.length; i++) {
31: TclList.append(interp, list, argv[i]);
32: }
33: interp.setResult(list);
34: } catch (TclException te) {
35: list.release();
36: throw te;
37: }
38: }
39: }
|