xvi
Created: September 9, 1994 —bookLOX.doc—Copyright Prentice Hall—DRAFT: 1/13/95
4.9 A while loop to read standard input..........................................46
4.10 A for loop.................................................................................46
4.11 A standard catch phrase...........................................................47
4.12 A longer catch phrase. ..............................................................47
4.13 The results of error with no info argument. ..............................48
4.14 Preserving errorInfo when calling error...................................48
4.15 Specifying errorinfo with return..............................................49
50Procedures and Scope................................................................................................................................. 51
5.1 Default parameter values..........................................................52
5.2 Variable number of arguments..................................................52
5.3 Variable scope and Tcl procedures............................................53
5.4 A random number generator.....................................................54
5.5 Using arrays for global state. ....................................................55
5.6 Print by name...........................................................................56
5.7 Improved incr procedure. .........................................................56
5.8 Using an array to implement a stack.........................................56
60Eval............................................................................................................................................................ 59
6.1 Using list to construct commands...........................................60
6.2 Using eval with $args...............................................................61
70Working with UNIX..................................................................................................................................... 65
7.1 Using exec on a process pipeline...............................................66
7.2 A procedure to compare file modify times..................................68
7.3 Creating a directory recusively..................................................69
7.4 Determining if pathnames reference the same file. ....................69
7.5 Opening a file for writing...........................................................70
7.6 Opening a file using the POSIX access flags................................71
7.7 A more careful use of open. .......................................................71
7.8 Opening a process pipeline. ......................................................72
7.9 Prompting for input. .................................................................72
7.10 A read loop using gets. .............................................................73
7.11 A read loop using read and split..............................................73
7.12 Finding a file by name...............................................................74
80Reflection and Debugging ........................................................................................................................... 77
8.1 Printing a procedure definition..................................................79
8.2 Getting a trace of the Tcl call stack. ..........................................80
8.3 Interactive history usage..........................................................82
8.4 Implementing special history syntax. ........................................83
8.5 A Debug procedure. ..................................................................83
90Script Libraries........................................................................................................................................... 89
9.1 Maintaining a tclIndex file. ......................................................90
9.2 Loading a tclIndex file..............................................................91
100Tk Fundamentals...................................................................................................................................... 95
10.1 “Hello, World!” Tk program........................................................96
110Tk by Example........................................................................................................................................ 103
11.1 Logging the output of a UNIX program. ....................................104
11.2 A browser for the code examples in the book...........................109
11.3 A Tcl shell in a text widget. .....................................................113
120The Pack Geometry Manager................................................................................................................... 115