home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-05 | 1.7 KB | 56 lines | [TEXT/$Tcl] |
-
- foreach name [espace This is a test] { print "$name\n" }
- foreach name {This is a test} { print "$name\n" }
-
- print [length {This is a test} chars]
- print [range abcdefghijklmnopqrstuvwxyz 10 15 chars]
- print [time {print "time run\n"} 100]
-
- foreach cmd [info commands] { print "$cmd\n" }
- foreach cmd [info globals] { print "$cmd\n" }
- foreach cmd [info locals] { print "$cmd\n" }
- foreach cmd [info procs] { print "$cmd\n" }
- foreach cmd [info tclversion] { print "$cmd\n" }
- foreach cmd [info vars] { print "$cmd\n" }
- foreach cmd [info tclversion] { print "$cmd\n" }
-
- print [history info]
- 1 print "[espace This is a test]\n"
- 2 foreach name [espace This is a test] { print "$name\n" }
- 3 foreach name {This is a test} { print "$name\n" }
- 4 history info 1
- 5 history info 2
- 6 print history info 2
- 7 print [history info 2]
- 8 print [history info]
-
- ###
- ### This will generate MPW style output to open and locate
- ### lines containing a regular expression we specify.
- ###
- proc cool_search { globexp regexp open_cmd line_cmd } {
- foreach file [glob $globexp] {
- set SC [scancontext create]
- scanmatch $SC $regexp {
- puts stdout "$open_cmd $file; $line_cmd $matchInfo(linenum); # $matchInfo(line)"
- }
-
- set FD [open $file r]
-
- scanfile $SC $FD
-
- close $FD
- scancontext delete $SC
- }
- }
-
- ### Tickle Version
- cool_search "Fire:MPW:src:tickle:tcl:*.h" {^#.*include} "open_text" "Line"
-
- ### MPW Version
- cool_search "Fire:MPW:src:tickle:tcl:*.h" {^#.*include} "File" "Line"
-
- File Fire:MPW:src:tickle:tcl:tcl.h; Line 34; # #include <stdio.h>
- File Fire:MPW:src:tickle:tcl:tclExtend.h; Line 22; # #include <stdio.h>
- File Fire:MPW:src:tickle:tcl:tclExtend.h; Line 23; # #include "tcl.h"
-