sd: remove 'ssd' driver support
[unleashed/tickless.git] / usr / src / lib / libsqlite / tool / mkopts.tcl
blobfb906f5df76d4301f5496eb3119e29d628daa8d2
2 #pragma ident "%Z%%M% %I% %E% SMI"
4 #!/usr/bin/tclsh
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
9 # TCL command.
11 set prefix {}
12 while {![eof stdin]} {
13 set line [gets 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"
24 set col 0
25 proc put_item x {
26 global col
27 if {$col==0} {puts -nonewline " "}
28 if {$col<2} {
29 puts -nonewline [format " %-21s" $x]
30 incr col
31 } else {
32 puts $x
33 set col 0
36 proc finalize {} {
37 global col
38 if {$col>0} {puts {}}
39 set col 0
42 foreach name [lsort $namelist] {
43 put_item \"$name\",
45 put_item 0
46 finalize
47 puts " \175;"
48 puts " enum ${prefix}_enum \173"
49 foreach name [lsort $namelist] {
50 regsub -all {@} $name {} name
51 put_item ${prefix}_[string toupper $name],
53 finalize
54 puts " \175;"