From e36d23a85ebff914d74bb541558c2b6082b78edb Mon Sep 17 00:00:00 2001
From: dan miller
Date: Sat, 20 Oct 2007 02:49:29 +0000
Subject: sqlite source (unix build) added to libraries
---
.../sqlite/unix/sqlite-3.5.1/www/mkapidoc.tcl | 176 +++++++++++++++++++++
1 file changed, 176 insertions(+)
create mode 100644 libraries/sqlite/unix/sqlite-3.5.1/www/mkapidoc.tcl
(limited to 'libraries/sqlite/unix/sqlite-3.5.1/www/mkapidoc.tcl')
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/www/mkapidoc.tcl b/libraries/sqlite/unix/sqlite-3.5.1/www/mkapidoc.tcl
new file mode 100644
index 0000000..723f84a
--- /dev/null
+++ b/libraries/sqlite/unix/sqlite-3.5.1/www/mkapidoc.tcl
@@ -0,0 +1,176 @@
+#!/usr/bin/tclsh
+#
+# Run this script redirecting the sqlite3.h file as standard
+# inputs and this script will generate API documentation.
+#
+set rcsid {$Id: mkapidoc.tcl,v 1.2 2007/06/20 09:09:48 danielk1977 Exp $}
+source common.tcl
+header {C/C++ Interface For SQLite Version 3}
+puts {
+
C/C++ Interface For SQLite Version 3
+}
+
+# Scan standard input to extract the information we need
+# to build the documentation.
+#
+set title {}
+set type {}
+set body {}
+set code {}
+set phase 0
+set content {}
+while {![eof stdin]} {
+ set line [gets stdin]
+ if {$phase==0} {
+ # Looking for the CAPI3REF: keyword
+ if {[regexp {^\*\* CAPI3REF: +(.*)} $line all tx]} {
+ set title $tx
+ set phase 1
+ }
+ } elseif {$phase==1} {
+ if {[string range $line 0 1]=="**"} {
+ set lx [string trim [string range $line 3 end]]
+ if {[regexp {^CATEGORY: +([a-z]*)} $lx all cx]} {
+ set type $cx
+ } elseif {[regexp {^KEYWORDS: +(.*)} $lx all kx]} {
+ foreach k $kx {
+ set keyword($k) 1
+ }
+ } else {
+ append body $lx\n
+ }
+ } elseif {[string range $line 0 1]=="*/"} {
+ set phase 2
+ }
+ } elseif {$phase==2} {
+ if {$line==""} {
+ set kwlist [lsort [array names keyword]]
+ unset -nocomplain keyword
+ set key $type:$kwlist
+ lappend content [list $key $title $type $kwlist $body $code]
+ set title {}
+ set keywords {}
+ set type {}
+ set body {}
+ set code {}
+ set phase 0
+ } else {
+ if {[regexp {^#define (SQLITE_[A-Z0-9_]+)} $line all kx]} {
+ set type constant
+ set keyword($kx) 1
+ } elseif {[regexp {^typedef .* (sqlite[0-9a-z_]+);} $line all kx]} {
+ set type datatype
+ set keyword($kx) 1
+ } elseif {[regexp {^[a-z].*[ *](sqlite3_[a-z0-9_]+)\(} $line all kx]} {
+ set type function
+ set keyword($kx) 1
+ }
+ append code $line\n
+ }
+ }
+}
+
+# Output HTML that displays the given list in N columns
+#
+proc output_list {N lx} {
+ puts {}
+ set len [llength $lx]
+ set n [expr {($len + $N - 1)/$N}]
+ for {set i 0} {$i<$N} {incr i} {
+ set start [expr {$i*$n}]
+ set end [expr {($i+1)*$n}]
+ puts {}
+ for {set j $start} {$j<$end} {incr j} {
+ set entry [lindex $lx $j]
+ if {$entry!=""} {
+ foreach {link label} $entry break
+ puts "- $label
"
+ }
+ }
+ puts { | }
+ }
+ puts {
}
+}
+
+# Do a table of contents for objects
+#
+set objlist {}
+foreach c $content {
+ foreach {key title type keywords body code} $c break
+ if {$type!="datatype"} continue
+ set keywords [lsort $keywords]
+ set k [lindex $keywords 0]
+ foreach kw $keywords {
+ lappend objlist [list $k $kw]
+ }
+}
+puts {Datatypes:
}
+output_list 3 $objlist
+puts {
}
+
+# Do a table of contents for constants
+#
+set clist {}
+foreach c $content {
+ foreach {key title type keywords body code} $c break
+ if {$type!="constant"} continue
+ set keywords [lsort $keywords]
+ set k [lindex $keywords 0]
+ foreach kw $keywords {
+ lappend clist [list $k $kw]
+ }
+}
+puts {Constants:
}
+set clist [lsort -index 1 $clist]
+output_list 3 $clist
+puts {
}
+
+
+# Do a table of contents for functions
+#
+set funclist {}
+foreach c $content {
+ foreach {key title type keywords body code} $c break
+ if {$type!="function"} continue
+ set keywords [lsort $keywords]
+ set k [lindex $keywords 0]
+ foreach kw $keywords {
+ lappend funclist [list $k $kw]
+ }
+}
+puts {Functions:
}
+set funclist [lsort -index 1 $funclist]
+output_list 3 $funclist
+puts {
}
+
+# Resolve links
+#
+proc resolve_links {args} {
+ set tag [lindex $args 0]
+ regsub -all {[^a-zA-Z0-9_]} $tag {} tag
+ set x ""
+ if {[llength $args]>2} {
+ append x [lrange $args 2 end]
+ } else {
+ append x [lindex $args 0]
+ }
+ return $x
+}
+
+# Output all the records
+#
+foreach c [lsort $content] {
+ foreach {key title type keywords body code} $c break
+ foreach k $keywords {
+ puts ""
+ }
+ puts "$title
"
+ puts ""
+ puts "$code"
+ puts "
"
+ regsub -all "\n\n+" $body {\1} body
+ regsub -all {\[}
$body
{[resolve_links } body
+ set body [subst -novar -noback $body]
+ puts "$body"
+ puts "
"
+}
--
cgit v1.1