2 #pragma ident "%Z%%M% %I% %E% SMI"
6 # This script is used to generate the array of strings and the enum
7 # that appear at the beginning of the C code implementation of a
8 # a TCL command and that define the available subcommands for that
12 while {![eof stdin
]} {
14 if {$line==""} continue
15 regsub -all "\[ \t\n,\]+" [string trim
$line] { } line
16 foreach token
[split $line { }] {
17 if {![regexp {(([a-zA-Z
]+)_
)?
([_a-zA-Z
]+)} $token all px p2 name
]} continue
18 lappend namelist
[string tolower
$name]
19 if {$px!=""} {set prefix
$p2}
23 puts " static const char *${prefix}_strs\[\] = \173"
27 if {$col==0} {puts -nonewline " "}
29 puts -nonewline [format " %-21s" $x]
42 foreach name
[lsort $namelist] {
48 puts " enum ${prefix}_enum \173"
49 foreach name
[lsort $namelist] {
50 regsub -all {@} $name {} name
51 put_item
${prefix
}_
[string toupper
$name],