wasCSharpSQLite – Blame information for rev 4

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /*
2 * LindexCmd.java - -
3 *
4 * Implements the built-in "lindex" Tcl command.
5 *
6 * Copyright (c) 1997 Cornell University.
7 * Copyright (c) 1997 Sun Microsystems, Inc.
8 *
9 * 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 * Included in SQLite3 port to C# for use in testharness only; 2008 Noah B Hart
14 *
15 * RCS @(#) $Id: LindexCmd.java,v 1.2 2000/03/17 23:31:30 mo Exp $
16 *
17 */
18 using System;
19 namespace tcl.lang
20 {
21  
22 /*
23 * This class implements the built-in "lindex" command in Tcl.
24 */
25  
26 class LindexCmd : Command
27 {
28  
29 public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
30 {
31 if ( argv.Length < 3 )
32 {
33 throw new TclNumArgsException( interp, 1, argv, "list index" );
34 }
35  
36 int size = TclList.getLength( interp, argv[1] );
37 int index = Util.getIntForIndex( interp, argv[2], size - 1 );
38 TclObject element = TclList.index( interp, argv[1], index );
39  
40 if ( element != null )
41 {
42 interp.setResult( element );
43 }
44 else
45 {
46 interp.resetResult();
47 }
48 return TCL.CompletionCode.RETURN;
49 }
50 } // end
51 }