wasCSharpSQLite – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /*
2 * UpdateCmd.java --
3 *
4 * Implements the "update" command.
5 *
6 * Copyright (c) 1997 Sun Microsystems, Inc.
7 *
8 * See the file "license.terms" for information on usage and
9 * redistribution of this file, and for a DISCLAIMER OF ALL
10 * WARRANTIES.
11 *
12 * Included in SQLite3 port to C# for use in testharness only; 2008 Noah B Hart
13 *
14 * RCS @(#) $Id: UpdateCmd.java,v 1.1.1.1 1998/10/14 21:09:19 cvsadmin Exp $
15 *
16 */
17 using System;
18 namespace tcl.lang
19 {
20  
21 /*
22 * This class implements the built-in "update" command in Tcl.
23 */
24  
25 class UpdateCmd : Command
26 {
27  
28 /*
29 * Valid command options.
30 */
31  
32 private static readonly string[] validOpts = new string[] { "idletasks" };
33  
34 internal const int OPT_IDLETASKS = 0;
35  
36 public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
37 {
38 int flags;
39  
40 if ( argv.Length == 1 )
41 {
42 flags = TCL.ALL_EVENTS | TCL.DONT_WAIT;
43 }
44 else if ( argv.Length == 2 )
45 {
46 TclIndex.get( interp, argv[1], validOpts, "option", 0 );
47  
48 /*
49 * Since we just have one valid option, if the above call returns
50 * without an exception, we've got "idletasks" (or abreviations).
51 */
52  
53 flags = TCL.IDLE_EVENTS | TCL.DONT_WAIT;
54 }
55 else
56 {
57 throw new TclNumArgsException( interp, 1, argv, "?idletasks?" );
58 }
59  
60 while ( interp.getNotifier().doOneEvent( flags ) != 0 )
61 {
62 /* Empty loop body */
63 }
64  
65 /*
66 * Must clear the interpreter's result because event handlers could
67 * have executed commands.
68 */
69  
70 interp.resetResult();
71 return TCL.CompletionCode.RETURN;
72 }
73 } // end UpdateCmd
74 }