3 # This script is used to generate the array of strings and the enum
4 # that appear at the beginning of the C code implementation of a
5 # a TCL command and that define the available subcommands for that
11 if {$line==""} continue
12 regsub -all "\[ \t\n,\]+" [string trim
$line] { } line
13 foreach token
[split $line { }] {
14 if {![regexp {(([a-zA-Z
]+)_
)?
([_a-zA-Z
]+)} $token all px p2 name
]} continue
15 lappend namelist
[string tolower
$name]
16 if {$px!=""} {set prefix
$p2}
20 puts " static const char *${prefix}_strs\[\] = \173"
24 if {$col==0} {puts -nonewline " "}
26 puts -nonewline [format " %-21s" $x]
39 foreach name
[lsort $namelist] {
45 puts " enum ${prefix}_enum \173"
46 foreach name
[lsort $namelist] {
47 regsub -all {@} $name {} name
48 put_item
${prefix
}_
[string toupper
$name],