aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/sqlite/unix/sqlite-3.5.1/tool/mkopts.tcl
diff options
context:
space:
mode:
authordan miller2007-10-20 02:49:29 +0000
committerdan miller2007-10-20 02:49:29 +0000
commite36d23a85ebff914d74bb541558c2b6082b78edb (patch)
tree54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/tool/mkopts.tcl
parent* Fixed an issue whereby avatar chat distances were being calculated against ... (diff)
downloadopensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.zip
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.gz
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.bz2
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.xz
sqlite source (unix build) added to libraries
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/tool/mkopts.tcl')
-rwxr-xr-xlibraries/sqlite/unix/sqlite-3.5.1/tool/mkopts.tcl51
1 files changed, 51 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/tool/mkopts.tcl b/libraries/sqlite/unix/sqlite-3.5.1/tool/mkopts.tcl
new file mode 100755
index 0000000..e3ddcb9
--- /dev/null
+++ b/libraries/sqlite/unix/sqlite-3.5.1/tool/mkopts.tcl
@@ -0,0 +1,51 @@
1#!/usr/bin/tclsh
2#
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
6# TCL command.
7
8set prefix {}
9while {![eof stdin]} {
10 set line [gets stdin]
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}
17 }
18}
19
20puts " static const char *${prefix}_strs\[\] = \173"
21set col 0
22proc put_item x {
23 global col
24 if {$col==0} {puts -nonewline " "}
25 if {$col<2} {
26 puts -nonewline [format " %-21s" $x]
27 incr col
28 } else {
29 puts $x
30 set col 0
31 }
32}
33proc finalize {} {
34 global col
35 if {$col>0} {puts {}}
36 set col 0
37}
38
39foreach name [lsort $namelist] {
40 put_item \"$name\",
41}
42put_item 0
43finalize
44puts " \175;"
45puts " enum ${prefix}_enum \173"
46foreach name [lsort $namelist] {
47 regsub -all {@} $name {} name
48 put_item ${prefix}_[string toupper $name],
49}
50finalize
51puts " \175;"