4 set filename [lindex $argv 0]
7 # Read the file looking for command definitions
13 while {[gets $f buf] >= 0} {
14 if {[string match "~~*" $buf]} {
15 if {[string match "*: *" $prev]} {
18 set lines [linsert $lines end-1 "\[\[$target\]\]"]
19 set prevlist [split $prev ":, "]
21 set target _[string map {:: _} $prev]
22 set prevlist [list $prev]
24 foreach cmd $prevlist {
25 set cmd [string trim $cmd]
26 if {[regexp {^[a-z.:]+$} $cmd]} {
27 lappend commands [list $cmd $target]
28 set cdict($cmd) $target
37 # Build the command index in the list: $index
38 lappend index {[frame="none",grid="none"]}
39 lappend index {|=========================}
42 foreach command [lsort $commands] {
43 lassign $command cmd target
45 append row "|<<$target,*`$cmd`*>> "
57 lappend index {|=========================}
59 # Map all `cmd` to <<$target,`cmd`>>
61 foreach c [array names cdict] {
62 lappend mapping `$c` <<$cdict($c),*`$c`*>>
63 lappend mapping "`$c " "<<$cdict($c),*`$c`*>> `"
66 # And the command index
67 lappend mapping @INSERTINDEX@ [join $index \n]
71 if {[string first ` $line] >= 0 || [string first @ $line] >= 0} {
72 puts [string map $mapping $line]