From cba565f4ccd4a667cc3b51108fae55cc735b36aa Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Wed, 3 Nov 2010 16:27:40 +1000 Subject: Autogenerate the command index in the documentation This was lost in the merge of the WorkWare fork Signed-off-by: Steve Bennett --- Makefile.in | 2 +- Tcl_shipped.html | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- jim_tcl.txt | 2 +- make-index | 60 ++++++++++++++++++++ 4 files changed, 222 insertions(+), 5 deletions(-) create mode 100755 make-index diff --git a/Makefile.in b/Makefile.in index 7d20574..43af85e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -90,7 +90,7 @@ endif $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ $*.o $(SH_LIBJIM) $(LDLIBS) Tcl.html: jim_tcl.txt - asciidoc -o $@ -d manpage $^ || cp @SRCDIR@/Tcl_shipped.html Tcl.html + tclsh @SRCDIR@/make-index $^ | asciidoc -o $@ -d manpage - || cp @SRCDIR@/Tcl_shipped.html Tcl.html clean: rm -f *.o *.so lib*.a $(JIMSH) Tcl.html diff --git a/Tcl_shipped.html b/Tcl_shipped.html index 05dcc0f..0584083 100644 --- a/Tcl_shipped.html +++ b/Tcl_shipped.html @@ -2512,6 +2512,163 @@ arguments or groups of arguments may appear, in the same format as the preceding argument(s).

alarm

@@ -5795,7 +5952,7 @@ descriptors.

-

posix: os.fork, os.wait, os.gethostname, os.getids, os.uptime

+

posix: os.fork, os.wait, os.gethostname, os.getids, os.uptime

os.fork @@ -5991,7 +6148,7 @@ uid 1000 euid 1000 gid 100 egid 100
-

eventloop: after, vwait, update

+

eventloop: after, vwait, update

The following commands allow a script to be invoked when the given condition occurs. If no script is given, returns the current script. If the given script is the empty, the handler is removed.

@@ -6458,7 +6615,7 @@ official policies, either expressed or implied, of the Jim Tcl Project.
diff --git a/jim_tcl.txt b/jim_tcl.txt index dfe6b4c..cea5bf8 100644 --- a/jim_tcl.txt +++ b/jim_tcl.txt @@ -1347,7 +1347,7 @@ as the preceding argument(s). [[CommandIndex]] Command Index ~~~~~~~~~~~~~ -// @INSERTINDEX@ +@INSERTINDEX@ alarm ~~~~~ diff --git a/make-index b/make-index new file mode 100755 index 0000000..944d94e --- /dev/null +++ b/make-index @@ -0,0 +1,60 @@ +#!/usr/bin/env tclsh +# vim:se syn=tcl: + +lassign $argv filename +set f [open $filename] + +while {[gets $f buf] >= 0} { + if {$buf eq "@INSERTINDEX@"} { + break + } + puts $buf +} + +# Collect lines and commands +set lines {} +set commands {} +set c 0 + +while {[gets $f buf] >= 0} { + if {[string match "~~*" $buf]} { + if {[string match "*:*" $prev]} { + incr c + set target cmd_$c + set lines [linsert $lines end-1 "\[\[$target\]\]"] + } else { + set target _$prev + } + foreach cmd [split $prev ":,"] { + set cmd [string trim $cmd] + if {$cmd ne ""} { + lappend commands [list $cmd $target] + } + } + } + lappend lines $buf + set prev $buf +} +close $f + +# Output the index +puts {[frame="none",grid="none"]} +puts {|=========================} +set i 0 +foreach command [lsort $commands] { + foreach {cmd target} $command break + + puts -nonewline "|<<$target,$cmd>> " + incr i + if {$i % 8 == 0} { + puts "" + } +} +while {$i % 8 != 0} { + incr i + puts -nonewline "| " +} +puts "" +puts {|=========================} + +puts [join $lines \n] -- cgit v1.1